/* ===== Покер-клуб: «ночной салон» — чернильно-синий зал, бордовое сукно, латунь ===== */
@font-face { font-family: 'Lora'; src: url('/fonts/lora.woff') format('woff'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-semibold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-extrabold.woff') format('woff'); font-weight: 800; font-display: swap; }

:root {
  --room: #151a2c;
  --room-2: #1c2238;
  --panel: #222a44;
  --line: #313a5c;
  --ink: #eee6d6;
  --ink-2: #a9adc2;
  --ink-3: #6f7593;
  --felt: #6d1a2a;
  --felt-deep: #3f0c18;
  --brass: #c9a65a;
  --brass-2: #e7cf8f;
  --ivory: #f4ecdc;
  --teal: #2f8f83;
  --teal-2: #3fb3a4;
  --danger: #d0574d;
  --s-spade: #1b1d24;
  --s-heart: #c4262e;
  --s-diamond: #1f63c6;
  --s-club: #20844a;
  --serif: 'Lora', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--room); color: var(--ink); }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  background:
    radial-gradient(120% 60% at 50% -10%, #26304f 0%, transparent 60%),
    var(--room);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass-2); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: 0.005em; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.hidden { display: none !important; }

#app { min-height: 100%; max-width: 560px; margin: 0 auto; position: relative; }

/* ---------- загрузка ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--ink-2); }
.boot-mark {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 38px; color: var(--ivory);
  background: radial-gradient(circle at 50% 40%, var(--felt), var(--felt-deep));
  box-shadow: 0 0 0 3px var(--brass), 0 0 0 7px var(--room), 0 0 0 8px #3a4365;
  animation: breathe 1.8s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(0.94); } }

/* ---------- общая раскладка вкладок ---------- */
.screen { padding: 14px 16px calc(92px + var(--safe-b)); }
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 10px calc(8px + var(--safe-b));
  background: rgba(21, 26, 44, 0.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); z-index: 20;
}
.tab { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.tab .ico { font-size: 20px; line-height: 1; filter: grayscale(1) opacity(0.7); }
.tab.on { color: var(--brass-2); }
.tab.on .ico { filter: none; }

/* ---------- шапка лобби ---------- */
.club-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.club-head .who { flex: 1; min-width: 0; }
.club-head .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xpbar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), var(--brass-2)); border-radius: 3px; }
.lvl-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--brass-2);
}

.avatar {
  --sz: 42px; width: var(--sz); height: var(--sz); border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  font-weight: 700; font-size: calc(var(--sz) * 0.4); color: #fff;
  background: var(--av, #45507a);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.bot { background: #2a3150; font-size: calc(var(--sz) * 0.5); }

.title-block { margin: 6px 0 14px; }
.title-block h1 { font-size: 30px; line-height: 1.1; }
.title-block p { margin: 6px 0 0; color: var(--ink-2); }

/* выбор игры */
.games { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 18px; padding: 0 16px; scrollbar-width: none; }
.games::-webkit-scrollbar { display: none; }
.game-pill {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.game-pill.on { border-color: var(--brass); color: var(--ivory); background: rgba(201, 166, 90, 0.12); }
.game-pill small { font-weight: 500; color: var(--ink-3); }

/* главные действия */
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.big-act {
  text-align: left; padding: 16px 14px 14px; border-radius: var(--r-md); min-height: 108px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.big-act b { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.15; display: block; }
.big-act span { font-size: 12.5px; color: rgba(244, 236, 220, 0.75); }
.big-act .suit { position: absolute; right: -6px; top: -14px; font-size: 76px; opacity: 0.16; line-height: 1; }
.big-act.claret { background: radial-gradient(140% 120% at 0% 0%, #8a2437, var(--felt) 45%, var(--felt-deep)); box-shadow: inset 0 0 0 1px rgba(231, 207, 143, 0.35); }
.big-act.teal { background: radial-gradient(140% 120% at 0% 0%, #3a9c8f, #24685f 50%, #173f3a); box-shadow: inset 0 0 0 1px rgba(160, 230, 220, 0.25); }
.big-act:active { transform: scale(0.98); }

.code-row { display: flex; gap: 8px; margin-bottom: 26px; }
.code-row input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--room-2);
  border: 1px solid var(--line); letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
}
.code-row input::placeholder { letter-spacing: normal; text-transform: none; font-weight: 400; color: var(--ink-3); }

.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; }
.section-h h2 { font-size: 20px; }
.section-h small { color: var(--ink-3); }

/* список столов */
.rooms { border-top: 1px solid var(--line); }
.room-row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.room-row .seats-mini { flex: none; display: grid; grid-template-columns: repeat(3, 9px); gap: 3px; }
.room-row .seats-mini i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.room-row .seats-mini i.h { background: var(--brass); border-color: var(--brass); }
.room-row .seats-mini i.b { background: var(--teal); border-color: var(--teal); }
.room-row .r-main { flex: 1; min-width: 0; }
.room-row .r-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-row .r-main small { color: var(--ink-2); font-size: 12.5px; }
.room-row .r-go { flex: none; font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 999px; background: var(--panel); color: var(--brass-2); }
.room-row .r-go.watch { color: var(--ink-2); }
.room-row.mine .r-go { background: var(--brass); color: #2a1a05; }
.empty { padding: 28px 8px; text-align: center; color: var(--ink-2); }
.empty b { display: block; font-family: var(--serif); font-size: 18px; color: var(--ink); margin-bottom: 4px; }

.return-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--r-md);
  background: rgba(201, 166, 90, 0.14); border: 1px solid rgba(201, 166, 90, 0.45); width: 100%; text-align: left;
}
.return-banner b { flex: 1; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 12px; font-weight: 700; font-size: 15px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
}
.btn.primary { background: linear-gradient(180deg, var(--brass-2), var(--brass)); color: #2a1a05; border: 0; box-shadow: 0 2px 0 #8a6c2c; }
.btn.teal { background: var(--teal); border: 0; color: #fff; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); font-size: 17px; flex: none; }

/* ---------- нижние шторки ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(6, 8, 16, 0.6); z-index: 50; animation: fade 0.18s ease; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 51;
  background: var(--room-2); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line);
  padding: 10px 18px calc(18px + var(--safe-b)); max-height: 90vh; overflow-y: auto;
  animation: rise 0.22s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { font-size: 23px; margin-bottom: 4px; }
.sheet .lead { color: var(--ink-2); margin: 0 0 16px; }
@keyframes rise { from { transform: translate(-50%, 100%); } }
@keyframes fade { from { opacity: 0; } }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 7px; font-weight: 600; }
.field input[type=text] { width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--room); border: 1px solid var(--line); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-width: 64px; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--room); font-weight: 700; font-size: 14px; color: var(--ink-2); text-align: center;
}
.seg button small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.seg button.on { border-color: var(--brass); color: var(--ivory); background: rgba(201, 166, 90, 0.14); }
.seg button.on small { color: var(--brass-2); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 16px; }
.toggle-row small { display: block; color: var(--ink-3); }
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.switch.on { background: var(--teal); }
.switch.on::after { transform: translateX(20px); }

.style-list { display: grid; gap: 6px; }
.style-opt { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); text-align: left; background: var(--room); }
.style-opt .e { font-size: 22px; width: 28px; text-align: center; }
.style-opt b { display: block; font-size: 14.5px; }
.style-opt small { color: var(--ink-3); font-size: 12.5px; }
.style-opt.on { border-color: var(--brass); background: rgba(201, 166, 90, 0.12); }

/* ---------- комната ожидания ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.topbar .tb-title { flex: 1; min-width: 0; }
.topbar .tb-title b { display: block; font-family: var(--serif); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .tb-title small { color: var(--ink-2); font-size: 12px; }

.wait { padding: 4px 16px calc(24px + var(--safe-b)); }
.ticket {
  position: relative; padding: 18px 18px 16px; border-radius: var(--r-lg); margin-bottom: 18px;
  background: radial-gradient(130% 100% at 50% 0%, #84213a, var(--felt) 45%, var(--felt-deep));
  box-shadow: inset 0 0 0 1px rgba(231, 207, 143, 0.4), inset 0 0 0 6px rgba(0,0,0,0.12);
  text-align: center;
}
.ticket .code { font-family: var(--serif); font-size: 40px; font-weight: 700; letter-spacing: 0.2em; color: var(--ivory); margin: 2px 0 4px; padding-left: 0.2em; }
.ticket .t-sub { font-size: 13px; color: rgba(244, 236, 220, 0.72); }
.ticket .t-row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.terms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 20px; border: 1px solid var(--line); }
.terms div { background: var(--room-2); padding: 10px 12px; }
.terms small { display: block; color: var(--ink-3); font-size: 12px; }
.terms b { font-size: 15px; }

.seatlist { display: grid; gap: 8px; margin-bottom: 18px; }
.seat-slot { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--room-2); border: 1px solid var(--line); min-height: 62px; }
.seat-slot.free { background: transparent; border-style: dashed; color: var(--ink-3); }
.seat-slot .s-main { flex: 1; min-width: 0; }
.seat-slot .s-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-slot .s-main small { color: var(--ink-2); font-size: 12.5px; }
.stars { color: var(--brass-2); letter-spacing: 1px; }
.stars i { font-style: normal; color: var(--line); }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(201, 166, 90, 0.16); color: var(--brass-2); }
.tag.off { background: var(--panel); color: var(--ink-3); }
.host-actions { display: grid; gap: 10px; }
.note { text-align: center; color: var(--ink-2); padding: 10px; font-size: 14px; }

/* ======================= СТОЛ ======================= */
.table-screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.t-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px 4px; flex: none; }
.blind-box { flex: 1; min-width: 0; text-align: center; }
.blind-box b { font-size: 15px; }
.blind-box small { display: block; font-size: 11.5px; color: var(--ink-2); }
.blind-box .up { color: var(--brass-2); }

.table-wrap { flex: 1; position: relative; min-height: 0; display: grid; place-items: center; padding: 26px 6px 0; }
.felt-area { position: relative; width: min(100%, calc((100dvh - 250px) * 0.74)); aspect-ratio: 0.74; max-height: 100%; }
.felt {
  position: absolute; inset: 7% 9% 9%; border-radius: 46% / 32%;
  background:
    radial-gradient(60% 45% at 50% 45%, #8b2438 0%, var(--felt) 55%, var(--felt-deep) 100%);
  box-shadow:
    0 0 0 9px #3a2416, 0 0 0 11px var(--brass), 0 0 0 13px #2b1a10,
    inset 0 0 40px rgba(0,0,0,0.55), 0 18px 40px rgba(0,0,0,0.5);
}
.felt::before { /* латунная гравировка: веер в стиле ар-деко */
  content: ''; position: absolute; inset: 8% 10%; border-radius: inherit;
  border: 1px solid rgba(231, 207, 143, 0.22);
}
.felt .monogram { position: absolute; left: 50%; top: 66%; transform: translate(-50%, -50%); font-family: var(--serif); font-size: 13px; letter-spacing: 0.35em; color: rgba(231, 207, 143, 0.32); white-space: nowrap; padding-left: 0.35em; }
.felt .fan { position: absolute; left: 50%; top: 19%; width: 70px; height: 36px; transform: translateX(-50%); opacity: 0.3; }

.center { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 8px; width: 82%; }
.board { display: flex; gap: 4px; justify-content: center; min-height: 54px; }
.board .slot { width: 38px; height: 54px; border-radius: 6px; border: 1px dashed rgba(231, 207, 143, 0.18); }
.pot { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.32); font-weight: 700; font-size: 14px; color: var(--ivory); }
.pot small { font-weight: 500; color: rgba(244,236,220,0.6); font-size: 11.5px; }
.sidepots { font-size: 11px; color: rgba(244,236,220,0.65); }
.result-banner {
  max-width: 100%; text-align: center; padding: 5px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.35;
  background: rgba(10, 8, 6, 0.55); color: var(--brass-2); animation: fade .3s ease;
}
.result-banner b { color: var(--ivory); }

/* карты */
.card {
  --w: 38px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: calc(var(--w) * 0.13);
  background: linear-gradient(180deg, #fffaf0, var(--ivory)); color: var(--s-spade);
  position: relative; flex: none; box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(0,0,0,0.08);
  font-family: var(--sans); font-weight: 800; user-select: none;
}
.card .r { position: absolute; left: 9%; top: 3%; font-size: calc(var(--w) * 0.44); line-height: 1.05; letter-spacing: -0.04em; }
.card .s { position: absolute; left: 10%; top: 33%; font-size: calc(var(--w) * 0.3); line-height: 1; }
.card .big { position: absolute; right: 7%; bottom: 4%; font-size: calc(var(--w) * 0.62); line-height: 1; }
.card.h { color: var(--s-heart); } .card.d { color: var(--s-diamond); } .card.c { color: var(--s-club); }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(231,207,143,0.22) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(231,207,143,0.22) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #7c1f31, #3f0c18);
  box-shadow: 0 2px 4px rgba(0,0,0,0.45), inset 0 0 0 2px #f4ecdc, inset 0 0 0 3px rgba(0,0,0,0.25);
}
.card.dealt { animation: deal .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes deal { from { transform: translateY(-14px) scale(0.85) rotate(-6deg); opacity: 0; } }
.card.win { box-shadow: 0 0 0 2px var(--brass-2), 0 0 14px rgba(231, 207, 143, 0.7); }
.card.lose { filter: brightness(0.6) saturate(0.6); }

/* места игроков */
.seat { position: absolute; transform: translate(-50%, -50%); width: 86px; display: grid; justify-items: center; z-index: 3; transition: opacity .2s; }
.seat .ava-wrap { position: relative; }
.seat .avatar { --sz: 48px; box-shadow: 0 0 0 2px #0e1220, 0 3px 8px rgba(0,0,0,0.5); }
.seat .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.seat .ring circle { fill: none; stroke: var(--brass-2); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 100; animation: drain var(--dur, 20s) linear var(--delay, 0s) forwards; }
.seat .ring.warn circle { stroke: var(--danger); }
@keyframes drain { 0% { stroke-dashoffset: 0; stroke: var(--brass-2); } 70% { stroke: var(--brass-2); } 100% { stroke-dashoffset: 100; stroke: var(--danger); } }
.seat .plate {
  margin-top: -6px; position: relative; z-index: 2; min-width: 76px; max-width: 92px; padding: 3px 8px 4px; border-radius: 9px; text-align: center;
  background: rgba(14, 18, 32, 0.92); border: 1px solid #39426a;
}
.seat .plate .nm { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.seat .plate .st { display: block; font-size: 13.5px; font-weight: 800; color: var(--ivory); }
.seat.turn .plate { border-color: var(--brass-2); box-shadow: 0 0 0 1px var(--brass-2), 0 0 16px rgba(231, 207, 143, 0.35); }
.seat.folded { opacity: 0.45; }
.seat.busted { opacity: 0.3; }
.seat.winner .plate { border-color: var(--brass-2); background: linear-gradient(180deg, #4a3812, #2a1f0a); }
.seat .hole { position: absolute; top: -6px; display: flex; z-index: 1; }
.seat .hole .card { --w: 26px; }
.seat .hole .card + .card { margin-left: -9px; transform: rotate(7deg) translateY(1px); }
.seat .hole .card:first-child { transform: rotate(-5deg); }
.seat .hole.shown .card { --w: 32px; }
.seat .hole.shown .card + .card { margin-left: -4px; transform: none; }
.seat .hole.shown .card:first-child { transform: none; }
.seat .act {
  position: absolute; top: -20px; z-index: 4; white-space: nowrap; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: var(--ivory); color: #2a1d10; box-shadow: 0 2px 5px rgba(0,0,0,0.4); animation: pop .22s ease;
}
.seat .act.fold { background: #4a5070; color: var(--ink-2); }
.seat .act.allin { background: var(--danger); color: #fff; }
.seat .act.raise, .seat .act.bet { background: var(--brass-2); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.seat .hand-nm { position: absolute; bottom: -18px; white-space: nowrap; font-size: 10.5px; font-weight: 700; color: var(--brass-2); background: rgba(0,0,0,0.55); padding: 1px 7px; border-radius: 6px; z-index: 4; }
.seat .badge-off { position: absolute; right: -2px; top: -2px; font-size: 10px; background: #4a5070; color: var(--ink); border-radius: 6px; padding: 0 4px; z-index: 3; }
.seat .botlvl { font-size: 9px; color: var(--brass-2); letter-spacing: 1px; }
.seat .place { font-size: 11px; color: var(--ink-2); }

.bet-chip { position: absolute; transform: translate(-50%, -50%); z-index: 2; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: var(--ivory); background: rgba(0,0,0,0.38); padding: 2px 8px 2px 3px; border-radius: 999px; animation: pop .2s ease; }
.chip { width: 15px; height: 15px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, var(--c, #2f8f83) 42%, transparent 43%), repeating-conic-gradient(var(--c, #2f8f83) 0 30deg, #f4ecdc 30deg 45deg);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.dealer { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: var(--ivory); color: #2a1d10; font-size: 11px; font-weight: 900; display: grid; place-items: center; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.5); transition: left .4s ease, top .4s ease; }
.float-win { position: absolute; transform: translate(-50%, -50%); z-index: 6; font-weight: 800; color: var(--brass-2); font-size: 15px; text-shadow: 0 2px 6px #000; animation: floatup 1.8s ease forwards; pointer-events: none; }
@keyframes floatup { to { transform: translate(-50%, -160%); opacity: 0; } }
.emote-bubble { position: absolute; transform: translate(-50%, -100%); z-index: 8; background: var(--ivory); color: #222; padding: 4px 10px; border-radius: 14px; font-size: 14px; font-weight: 700; white-space: nowrap; animation: pop .2s ease, fade .4s ease 2.2s reverse forwards; box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.emote-bubble.big { font-size: 26px; padding: 2px 8px; background: transparent; box-shadow: none; }

/* мои карты и панель действий */
.me-zone { flex: none; padding: 0 12px calc(10px + var(--safe-b)); position: relative; z-index: 5; }
.me-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; min-height: 30px; }
.my-hand-name { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.my-hand-name b { color: var(--brass-2); font-weight: 700; }
.act-bar { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 8px; }
.act-bar .btn { padding: 14px 6px; font-size: 15px; border-radius: 12px; }
.act-bar .btn small { display: block; font-size: 12px; font-weight: 600; opacity: 0.85; }
.act-bar .btn { flex-direction: column; gap: 0; line-height: 1.15; }
.btn.fold { background: #3a4060; border: 0; }
.btn.call { background: var(--teal); border: 0; color: #fff; }
.btn.raise { background: linear-gradient(180deg, var(--brass-2), var(--brass)); color: #2a1a05; border: 0; }
.waiting-bar { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 15px 0; border: 1px dashed var(--line); border-radius: 12px; }
.waiting-bar.on { color: var(--ink); border-color: var(--brass); }
.pre-acts { display: flex; gap: 8px; }
.pre-acts button { flex: 1; padding: 11px 6px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.pre-acts button.on { border-color: var(--teal-2); color: var(--ivory); background: rgba(47, 143, 131, 0.22); }

.raise-panel { background: var(--room-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 8px; animation: rise2 .18s ease; }
@keyframes rise2 { from { transform: translateY(10px); opacity: 0; } }
.raise-panel .presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.raise-panel .presets button { padding: 8px 2px; border-radius: 9px; background: var(--panel); font-size: 12.5px; font-weight: 700; }
.raise-panel .presets button.allin { color: var(--danger); }
.raise-panel .amt-row { display: flex; align-items: center; gap: 10px; }
.raise-panel .amt { flex: 1; text-align: center; font-size: 22px; font-weight: 800; }
.raise-panel input[type=range] { width: 100%; margin: 12px 0 4px; accent-color: var(--brass); height: 28px; }

.sitout-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(208, 87, 77, 0.15); border: 1px solid rgba(208, 87, 77, 0.5); margin-bottom: 8px; font-size: 13.5px; }
.sitout-bar span { flex: 1; }
.spectator-bar { text-align: center; color: var(--ink-2); font-size: 13.5px; padding: 12px; }

/* эмоции */
.emote-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.emote-grid button { padding: 10px 4px; border-radius: 12px; background: var(--room); border: 1px solid var(--line); font-size: 22px; }
.emote-grid button.txt { font-size: 12.5px; font-weight: 700; grid-column: span 1; }
.emote-grid.phr { grid-template-columns: repeat(2, 1fr); margin-top: 8px; }
.emote-grid.phr button { font-size: 14px; }

/* итоги */
.podium { display: grid; gap: 6px; margin: 4px 0 18px; }
.podium .pl { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--room); border: 1px solid var(--line); }
.podium .pl.first { border-color: var(--brass); background: rgba(201, 166, 90, 0.12); }
.podium .pl.me { box-shadow: inset 3px 0 0 var(--teal-2); }
.podium .pos { font-family: var(--serif); font-size: 22px; width: 28px; text-align: center; color: var(--brass-2); }
.podium .pl b { flex: 1; }
.podium .xp { font-size: 13px; color: var(--teal-2); font-weight: 700; }

/* ---------- профиль ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; margin: 8px 0 18px; }
.profile-head .avatar { --sz: 72px; box-shadow: 0 0 0 3px var(--brass), 0 0 0 6px var(--room); }
.profile-head h1 { font-size: 24px; }
.level-card { padding: 16px; border-radius: var(--r-md); background: var(--room-2); border: 1px solid var(--line); margin-bottom: 18px; }
.level-card .lv-top { display: flex; align-items: baseline; justify-content: space-between; }
.level-card .lv-top b { font-family: var(--serif); font-size: 20px; }
.level-card .xpbar { height: 8px; margin: 10px 0 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 18px; }
.stat-grid div { background: var(--room); padding: 12px 14px; }
.stat-grid b { display: block; font-size: 20px; font-weight: 800; }
.stat-grid small { color: var(--ink-2); font-size: 12.5px; }
.best-hand { display: flex; gap: 4px; margin: 8px 0 4px; }
.best-hand .card { --w: 34px; }
.ladder { display: grid; gap: 4px; }
.ladder div { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.ladder div.on { color: var(--brass-2); font-weight: 700; }
.link-row { display: flex; gap: 8px; margin-bottom: 18px; }
.link-row .btn { flex: 1; font-size: 14px; padding: 11px; }

/* ---------- рейтинг ---------- */
.lb { border-top: 1px solid var(--line); }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.lb-row .rk { width: 26px; text-align: center; font-family: var(--serif); font-size: 17px; color: var(--ink-2); }
.lb-row.top1 .rk { color: var(--brass-2); font-size: 22px; }
.lb-row.top2 .rk, .lb-row.top3 .rk { color: var(--ink); font-size: 19px; }
.lb-row .avatar { --sz: 36px; }
.lb-row .nm { flex: 1; min-width: 0; }
.lb-row .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.lb-row .nm small { color: var(--ink-3); font-size: 12px; }
.lb-row .val { font-weight: 800; }
.lb-row.me { background: rgba(47, 143, 131, 0.14); border-radius: 10px; }

/* правила */
.combo { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.combo .cards { display: flex; gap: 2px; flex: none; }
.combo .card { --w: 22px; }
.combo b { display: block; font-size: 14px; }
.combo small { color: var(--ink-3); font-size: 12px; }

/* ---------- уведомления ---------- */
#toast-root { position: fixed; left: 0; right: 0; top: 10px; display: grid; justify-items: center; gap: 6px; z-index: 100; pointer-events: none; }
.toast { max-width: 92%; padding: 10px 16px; border-radius: 12px; background: var(--ivory); color: #1d1a14; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: pop .2s ease; }
.toast.err { background: #f6d9d5; color: #6a1a14; }
.conn-banner { position: fixed; left: 50%; transform: translateX(-50%); top: 0; z-index: 90; padding: 6px 14px; border-radius: 0 0 12px 12px; background: var(--danger); color: #fff; font-size: 13px; font-weight: 600; }

.gate { min-height: 100vh; display: grid; place-content: center; padding: 24px; text-align: center; gap: 14px; }
.gate h1 { font-size: 26px; }
.gate p { color: var(--ink-2); margin: 0; }

@media (max-height: 640px) {
  .seat .avatar { --sz: 40px; }
  .board .slot, .board .card { --w: 33px; }
  .act-bar .btn { padding: 11px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .seat .ring circle { animation-duration: var(--dur, 20s) !important; }
}

/* место героя: крупные карты над аватаром, подпись действия сбоку */
.seat.me { width: 120px; }
.seat.me .hole { top: -62px; }
.seat.me .hole .card + .card { margin-left: -12px; transform: rotate(6deg) translateY(2px); }
.seat.me .hole .card:first-child { transform: rotate(-6deg); }
.seat.me .act { top: auto; bottom: 8px; left: calc(50% + 50px); }
.seat.me .avatar { --sz: 40px; }
.seat .dealer-btn { position: absolute; right: -4px; bottom: 26px; width: 22px; height: 22px; border-radius: 50%; background: var(--ivory); color: #2a1d10; font-size: 11px; font-weight: 900; display: grid; place-items: center; z-index: 5; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.seat.me .dealer-btn { right: 6px; }
