/* play.rafas.net — Белот. Вид по belot.bg: тъмно синьо, злато, синя маса. */

:root {
  --navy: #15171a;
  --navy-2: #1c2622;
  --navy-3: #0b0d0e;
  --gold: #d4af37;
  --gold-2: #f0cf6a;
  --felt: #1f6a44;
  --felt-2: #134a2f;
  --text: #f4f6fb;
  --muted: rgba(244, 246, 251, .62);
  --line: rgba(255, 255, 255, .12);
  --red: #d33b3b;
  --green: #35a35f;
  --card-w: clamp(52px, 13.5vw, 78px);
  --card-h: calc(var(--card-w) * 1.42);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 0%, #2a2620 0%, #17161a 50%, var(--navy-3) 100%);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .45; cursor: default; }
input, select { font: inherit; }
[hidden] { display: none !important; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ── Лоби ─────────────────────────────────────────────────────────────── */
#lobby { align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.logo {
  font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 850; letter-spacing: .02em;
  color: var(--gold);
  text-shadow: 0 2px 0 #7a5a10, 0 6px 18px rgba(212, 175, 55, .35); font-family: Georgia, 'Times New Roman', serif;
}
.logo small { display: block; font-size: .95rem; font-weight: 500; letter-spacing: .18em; color: var(--muted); text-shadow: none; margin-top: 2px; }
.panel {
  width: min(420px, 100%); margin-top: 26px; padding: 22px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.field input {
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .25); color: var(--text); outline: none; font-size: 1.05rem;
}
.field input:focus { border-color: var(--gold); }
.avatars { display: flex; flex-wrap: wrap; gap: 8px; }
.avatars button {
  width: 44px; height: 44px; border-radius: 12px; font-size: 1.5rem;
  background: rgba(0, 0, 0, .25); border: 2px solid transparent;
}
.avatars button.on { border-color: var(--gold); background: rgba(212, 175, 55, .15); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 14px; font-weight: 700; font-size: 1rem;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line); transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1a02; border-color: #a8862a; box-shadow: 0 6px 16px rgba(212, 175, 55, .3); }
.btn.gold:hover { filter: brightness(1.05); }
.btn.green { background: linear-gradient(180deg, #46b86f, var(--green)); color: #fff; border-color: #237a45; }
.btn.red { background: rgba(211, 59, 59, .18); border-color: rgba(211, 59, 59, .5); }
.btn.wide { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: .88rem; border-radius: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.or { text-align: center; color: var(--muted); font-size: .8rem; margin: 14px 0; letter-spacing: .1em; }
.code-input { text-transform: uppercase; letter-spacing: .35em; text-align: center; font-weight: 800; font-size: 1.3rem !important; }
.lobby-foot { margin-top: 18px; color: var(--muted); font-size: .8rem; text-align: center; line-height: 1.5; }

/* ── Масата ──────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; background: rgba(0, 0, 0, .28); border-bottom: 1px solid var(--line);
  min-height: 48px;
}
.score { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.score .lbl { font-size: .66rem; letter-spacing: .12em; color: var(--muted); }
.score b { font-size: 1.35rem; font-weight: 850; }
.score .us b { color: var(--gold-2); }
.score .sep { color: var(--muted); }
.score .hang { font-size: .7rem; color: var(--gold); margin-left: 4px; }
.contract {
  flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; overflow: hidden;
}
.contract .pill { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.contract .pill {
  padding: 4px 10px; border-radius: 999px; background: rgba(212, 175, 55, .16); border: 1px solid rgba(212, 175, 55, .5); color: var(--gold-2);
}
.contract .pill.red { color: #ff8a8a; }
.tools { display: flex; gap: 4px; }
.tools button { width: 36px; height: 36px; border-radius: 10px; font-size: 1.05rem; background: rgba(255, 255, 255, .06); }
.tools button.code { width: auto; padding: 0 10px; font-weight: 800; letter-spacing: .15em; font-size: .85rem; }

.felt {
  position: relative; flex: 1; margin: 10px;
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, .08), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><g fill='%23ffffff' fill-opacity='.035'><text x='6' y='22' font-size='16'>♠</text><text x='34' y='22' font-size='16'>♥</text><text x='6' y='52' font-size='16'>♦</text><text x='34' y='52' font-size='16'>♣</text></g></svg>"),
    radial-gradient(ellipse at 50% 50%, var(--felt) 0%, var(--felt-2) 70%, #0c3521 100%);
  box-shadow: inset 0 0 0 7px #3a2a1c, inset 0 0 0 9px #8a6a3a, inset 0 0 0 10px #2a1d12, inset 0 0 70px rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .55);
  overflow: hidden;
}

/* места */
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; z-index: 3; }
.seat.pos0 { left: 12px; bottom: 10px; align-items: flex-start; }
.seat.pos1 { right: 8px; top: 50%; transform: translateY(-50%); }
.seat.pos2 { left: 50%; top: 8px; transform: translateX(-50%); }
.seat.pos3 { left: 8px; top: 50%; transform: translateY(-50%); }
.avatar {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem;
  background: linear-gradient(180deg, #2a2f2c, #151917); border: 3px solid var(--gold); box-shadow: 0 6px 14px rgba(0, 0, 0, .5), inset 0 0 0 2px #0b0d0e;
  position: relative; transition: border-color .2s, box-shadow .2s;
}
.seat.turn .avatar { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 55, .25), 0 0 22px rgba(212, 175, 55, .55); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(212, 175, 55, .12), 0 0 28px rgba(212, 175, 55, .75); } }
.seat.off .avatar { filter: grayscale(1) brightness(.7); }
.avatar .dealer { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #2a1a02; font-size: .7rem; font-weight: 900; display: grid; place-items: center; border: 2px solid var(--felt-2); }
.avatar .bot { position: absolute; left: -6px; bottom: -6px; font-size: .8rem; background: #0c1428; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid var(--felt-2); }
.seat .name { font-size: .76rem; font-weight: 700; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 9px; border-radius: 999px; background: rgba(8, 10, 9, .8); border: 1px solid rgba(212, 175, 55, .55); }
.seat .name small { color: var(--gold-2); font-weight: 600; }
.seat .team { font-size: .62rem; color: var(--muted); letter-spacing: .08em; }
.seat .backs { display: flex; gap: 1px; height: 22px; }
.seat .backs i { display: block; width: 9px; height: 22px; border-radius: 2px; background: linear-gradient(135deg, #3c5a99, #23386a); border: 1px solid rgba(255, 255, 255, .55); margin-left: -3px; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.seat .sit {
  padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px dashed rgba(255, 255, 255, .45); font-size: .8rem; font-weight: 700;
}
.seat .sit:hover { border-color: var(--gold); color: var(--gold-2); }

/* балончета */
.bubble {
  position: absolute; z-index: 6; max-width: 190px; padding: 8px 12px; border-radius: 14px;
  background: #fff; color: #1a2340; font-weight: 700; font-size: .9rem; line-height: 1.25;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35); opacity: 0; transform: translateY(6px) scale(.9);
  transition: opacity .18s, transform .18s; pointer-events: none;
}
.bubble.show { opacity: 1; transform: none; }
.bubble.bid { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1a02; font-size: 1rem; }
.bubble.bid.red { color: #a11a1a; }
.bubble.decl { background: #e9f7ee; color: #14532d; }
.bubble::after { content: ""; position: absolute; width: 12px; height: 12px; background: inherit; transform: rotate(45deg); }
.pos0 .bubble { left: 70px; bottom: 30px; } .pos0 .bubble::after { left: -4px; bottom: 14px; }
.pos1 .bubble { right: 100px; top: 8px; } .pos1 .bubble::after { right: -4px; top: 14px; }
.pos2 .bubble { left: 96px; top: 6px; } .pos2 .bubble::after { left: -4px; top: 14px; }
.pos3 .bubble { left: 100px; top: 8px; } .pos3 .bubble::after { left: -4px; top: 14px; }

/* взятката в центъра */
.trick { position: absolute; inset: 0; pointer-events: none; }
.tcard {
  position: absolute; left: 50%; top: 50%; width: var(--card-w); height: var(--card-h);
  transform: translate(-50%, -50%); opacity: 0; transition: transform .28s cubic-bezier(.2, .8, .3, 1), opacity .2s;
}
.tcard.pos0 { transform: translate(-50%, -50%) translate(-8%, 58%) rotate(-3deg); }
.tcard.pos1 { transform: translate(-50%, -50%) translate(78%, -4%) rotate(8deg); }
.tcard.pos2 { transform: translate(-50%, -50%) translate(8%, -62%) rotate(2deg); }
.tcard.pos3 { transform: translate(-50%, -50%) translate(-80%, 4%) rotate(-9deg); }
.tcard.show { opacity: 1; }
.tcard.pos0.show { animation: tin0 .32s cubic-bezier(.2, .8, .3, 1); }
.tcard.pos1.show { animation: tin1 .32s cubic-bezier(.2, .8, .3, 1); }
.tcard.pos2.show { animation: tin2 .32s cubic-bezier(.2, .8, .3, 1); }
.tcard.pos3.show { animation: tin3 .32s cubic-bezier(.2, .8, .3, 1); }
@keyframes tin0 { from { opacity: 0; transform: translate(-50%, -50%) translate(-8%, 260%) scale(1.1); } }
@keyframes tin1 { from { opacity: 0; transform: translate(-50%, -50%) translate(320%, -4%) rotate(30deg); } }
@keyframes tin2 { from { opacity: 0; transform: translate(-50%, -50%) translate(8%, -260%) rotate(10deg); } }
@keyframes tin3 { from { opacity: 0; transform: translate(-50%, -50%) translate(-320%, 4%) rotate(-30deg); } }
.tcard.show.collect0 { animation: tout0 .45s ease-in forwards; }
.tcard.show.collect1 { animation: tout1 .45s ease-in forwards; }
.tcard.show.collect2 { animation: tout2 .45s ease-in forwards; }
.tcard.show.collect3 { animation: tout3 .45s ease-in forwards; }
@keyframes tout0 { to { opacity: 0; transform: translate(-50%, -50%) translate(-8%, 300%) scale(.5); } }
@keyframes tout1 { to { opacity: 0; transform: translate(-50%, -50%) translate(360%, -4%) scale(.5); } }
@keyframes tout2 { to { opacity: 0; transform: translate(-50%, -50%) translate(8%, -300%) scale(.5); } }
@keyframes tout3 { to { opacity: 0; transform: translate(-50%, -50%) translate(-360%, 4%) scale(.5); } }

/* голям надпис в центъра: Белот!, Каре, Контра, Валат */
.flash {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 8; pointer-events: none;
  font-size: clamp(1.6rem, 7vw, 3rem); font-weight: 900; letter-spacing: .04em; color: var(--gold-2);
  text-shadow: 0 2px 0 #7a5a10, 0 0 24px rgba(212, 175, 55, .6), 0 6px 20px rgba(0, 0, 0, .6);
  animation: flash 1.4s cubic-bezier(.2, .8, .3, 1) forwards; white-space: nowrap;
}
.flash.red { color: #ff7a7a; text-shadow: 0 2px 0 #6a1010, 0 0 24px rgba(255, 90, 90, .6); }
@keyframes flash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 30% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* конфети при победа */
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; border-radius: 2px; z-index: 50; pointer-events: none; animation: confetti linear forwards; }
@keyframes confetti { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }
.tcard.win .card { box-shadow: 0 0 0 3px var(--gold), 0 10px 24px rgba(0, 0, 0, .5); }
.center-msg {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; color: rgba(255, 255, 255, .8); font-weight: 700; font-size: .95rem; z-index: 2; pointer-events: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .6); max-width: 70%;
}
.center-msg .big { font-size: 1.5rem; color: var(--gold-2); display: block; }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.fly { position: absolute; font-size: 2.2rem; animation: fly 1.6s ease-out forwards; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
@keyframes fly { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); } 100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); } }

/* карти */
.card {
  width: var(--card-w); height: var(--card-h); border-radius: 8px; position: relative;
  background: linear-gradient(180deg, #fffdf7, #f3efe3); color: #1a1a1a;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .08);
  font-weight: 800; overflow: hidden; flex: none;
}
.card.red { color: #c22b2b; }
.card .c1, .card .c2 { position: absolute; font-size: calc(var(--card-w) * .26); line-height: 1; text-align: center; }
.card .c1 { left: 5px; top: 5px; }
.card .c2 { right: 5px; bottom: 5px; transform: rotate(180deg); }
.card .c1 span, .card .c2 span { display: block; font-size: .8em; }
.card .pip { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: calc(var(--card-w) * .62); opacity: .95; }
.card .pip.face { font-size: calc(var(--card-w) * .5); font-weight: 900; font-family: Georgia, "Times New Roman", serif; }

/* ръката */
.hand {
  height: calc(var(--card-h) + 34px + var(--safe-b)); padding: 0 10px calc(12px + var(--safe-b));
  display: flex; align-items: flex-end; justify-content: center; position: relative; z-index: 4;
}
.hand .card {
  margin-left: calc(var(--card-w) * -.36); transform-origin: 50% 130%; cursor: pointer;
  transform: rotate(calc(var(--rot, 0) * 1deg)) translateY(calc(var(--lift, 0) * 1px + var(--hov, 0px)));
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), filter .15s, margin .15s;
}
.hand .card:first-child { margin-left: 0; }
.hand .card.legal { cursor: pointer; }
.hand .card.legal:hover, .hand .card.legal:active { --hov: -16px; z-index: 2; }
.hand.fresh .card { animation: dealin .38s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes dealin { from { opacity: 0; transform: translate(40vw, -60vh) rotate(25deg) scale(.6); } }
.hand .card.dim { filter: brightness(.55) saturate(.6); cursor: not-allowed; }
.hand.my-turn .card.legal { box-shadow: 0 -2px 0 2px rgba(212, 175, 55, .9), 0 6px 14px rgba(0, 0, 0, .5); }

/* анонси */
.bidbar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 8px 10px 2px; z-index: 4; }
.bidbar button {
  padding: 10px 12px; border-radius: 12px; font-weight: 800; font-size: .95rem; min-width: 56px;
  background: rgba(255, 255, 255, .95); color: #1a2340; box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.bidbar button.red { color: var(--red); }
.bidbar button.pass { background: #1e2422; color: var(--text); border: 1px solid rgba(255,255,255,.2); }
.bidbar button.x { background: #1a1a14; color: var(--gold-2); border: 2px solid var(--gold); }
.bidbar button.nt { background: linear-gradient(180deg, #e9ecf5, #cfd5e6); }
.bidbar button.at { background: linear-gradient(180deg, #2e8b57, #1f6a44); color: #fff; }

/* преди старт */
.pregame { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px; z-index: 4; }
.pregame .hint { width: 100%; text-align: center; color: var(--muted); font-size: .85rem; }
.pregame select { padding: 9px 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); color: var(--text); border: 1px solid var(--line); }
.pregame label.chk { display: inline-flex; gap: 6px; align-items: center; font-size: .88rem; color: var(--muted); }

/* чат */
.fab {
  position: fixed; right: 14px; bottom: calc(var(--card-h) + 42px + var(--safe-b)); width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1a02; font-size: 1.4rem; z-index: 8;
  box-shadow: 0 8px 20px rgba(212, 175, 55, .4); display: grid; place-items: center;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 70vh; display: flex; flex-direction: column;
  background: var(--navy-2); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  padding-bottom: var(--safe-b); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 800; }
.sheet-hd button { font-size: 1.2rem; width: 36px; height: 36px; }
.emoji-row { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.emoji-row button { font-size: 1.7rem; width: 46px; height: 46px; border-radius: 12px; background: rgba(255, 255, 255, .06); flex: none; }
.emoji-row button:active { transform: scale(1.2); }
.phrases { overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.phrase { display: flex; align-items: center; gap: 6px; }
.phrase .say { flex: 1; text-align: left; padding: 11px 14px; border-radius: 12px; background: rgba(255, 255, 255, .07); font-weight: 600; }
.phrase .say:active { background: rgba(212, 175, 55, .25); }
.phrase .del { width: 34px; height: 34px; border-radius: 10px; color: var(--muted); font-size: 1rem; }
.phrase .del:hover { color: #ff8a8a; background: rgba(211, 59, 59, .15); }
.add-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.add-row input { flex: 1; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: var(--text); outline: none; }
.add-row input:focus { border-color: var(--gold); }

/* overlay: табло след раздаване, край, история */
.overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(6, 10, 22, .72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(460px, 100%); max-height: 88vh; overflow-y: auto; background: var(--navy-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal h2 { font-size: 1.25rem; margin-bottom: 4px; }
.modal h2.gold { color: var(--gold-2); }
.modal .sub { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.tbl th, .tbl td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; color: var(--muted); font-weight: 500; }
.tbl th { color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.tbl tr.total td { font-weight: 850; font-size: 1.05rem; border-bottom: 0; }
.tbl td.us { color: var(--gold-2); }
.note { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-size: .88rem; }
.note.bad { background: rgba(211, 59, 59, .18); }
.note.good { background: rgba(53, 163, 95, .18); }
.modal .actions { display: flex; gap: 8px; margin-top: 14px; }
.modal .actions .btn { flex: 1; }
.winner { text-align: center; padding: 10px 0 6px; }
.winner .cup { font-size: 3.4rem; }
.winner .who { font-size: 1.4rem; font-weight: 850; color: var(--gold-2); }
.winner .sc { font-size: 2rem; font-weight: 900; margin-top: 4px; }

.toasts { position: fixed; top: 60px; left: 14px; z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; max-width: 60vw; }
.toast { padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, .7); font-size: .85rem; font-weight: 600; animation: fade .2s; border: 1px solid var(--line); }
.toast.err { background: rgba(211, 59, 59, .85); }

.watching { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: .75rem; color: var(--muted); z-index: 3; }

@media (min-width: 700px) {
  :root { --card-w: 84px; }
  .felt { margin: 12px 16px; }
  .seat { width: 110px; }
  .avatar { width: 62px; height: 62px; font-size: 2rem; }
  .seat.pos0 { left: 18px; bottom: 16px; }
}
@media (max-width: 430px) {
  .topbar { padding: 6px 8px; gap: 6px; }
  .score b { font-size: 1.15rem; }
  .score .lbl { font-size: .58rem; }
  .contract { font-size: .8rem; }
  .contract .pill { padding: 3px 8px; }
  .tools button { width: 32px; height: 32px; font-size: .95rem; }
  .tools button.code { padding: 0 7px; font-size: .75rem; letter-spacing: .08em; }
}
@media (max-height: 640px) {
  :root { --card-w: 50px; }
  .avatar { width: 46px; height: 46px; font-size: 1.4rem; }
}
/* телефон, обърнат настрани: всичко по-ниско, местата по-компактни */
@media (max-height: 470px) {
  :root { --card-w: 44px; }
  .topbar { min-height: 38px; padding-top: 4px; padding-bottom: 4px; }
  .score b { font-size: 1.05rem; }
  .felt { margin: 6px 10px; border-radius: 18px; }
  .avatar { width: 36px; height: 36px; font-size: 1.1rem; border-width: 2px; }
  .seat .backs { display: none; }
  .seat .team { display: none; }
  .seat .name { font-size: .66rem; padding: 2px 7px; }
  .hand { height: calc(var(--card-h) + 18px + var(--safe-b)); padding-bottom: calc(4px + var(--safe-b)); }
  .bidbar { padding: 4px 8px 0; }
  .bidbar button { padding: 6px 9px; font-size: .82rem; min-width: 48px; }
  .fab { width: 40px; height: 40px; font-size: 1.1rem; bottom: calc(var(--card-h) + 26px + var(--safe-b)); }
  .center-msg { font-size: .8rem; } .center-msg .big { font-size: 1.1rem; }
}
/* тесен портрет (телефон): страничните места по-нагоре, взятката по-надолу — да не се застъпват */
@media (max-aspect-ratio: 3/4) {
  .seat.pos1, .seat.pos3 { top: 36%; }
  .tcard, .center-msg { top: 56%; }
  .flash { top: 46%; }
}
/* квадратни екрани (сгъваеми, отворени): по-големи карти, повече въздух */
@media (min-width: 640px) and (min-height: 700px) and (max-aspect-ratio: 5/4) {
  :root { --card-w: 84px; }
  .avatar { width: 66px; height: 66px; font-size: 2.1rem; }
  .seat { width: 130px; }
  .seat .name { font-size: .88rem; max-width: 130px; }
  .seat .backs { height: 26px; } .seat .backs i { width: 11px; height: 24px; }
}
