:root {
  --bg: #141414;
  --bg-2: #1a1a1a;
  --panel: #202020;
  --panel-2: #282828;
  --line: #323232;
  --line-2: #3d3d3d;
  --text: #f1f1f1;
  --muted: #9b9b9b;
  --dim: #6b6b6b;
  --gold: #f2c14e;
  --gold-2: #ffd978;
  --red: #c62828;
  --felt-1: #d22a2f;
  --felt-2: #b11a20;
  --felt-3: #7a0e13;
  --win: #f2c14e;
  --danger: #ff5c5f;
  --ok: #4cc38a;
  --card-back: url(/backs/lattice.svg); /* рубашка карт «Ромбы» — одна на всех */
  --radius: 12px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(120% 90% at 50% 40%, #1d1d1d 0%, var(--bg) 60%, #0f0f0f 100%) fixed, var(--bg);
  color: var(--text);
  font: 500 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 700; letter-spacing: .01em; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: #313131; border-color: #4a4a4a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn.light { background: #f1f1f1; border-color: #f1f1f1; color: #141414; }
.btn.light:hover { background: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.big { height: 48px; font-size: 16px; }
.btn.block { width: 100%; }

label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input:not([type]) {
  width: 100%; min-width: 0;
  height: 44px; padding: 0 14px; border-radius: 10px;
  background: #151515; border: 1px solid var(--line-2); color: var(--text);
  font-size: 15px; font-weight: 600; outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--gold); }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input::placeholder { color: var(--dim); font-weight: 500; }

.card-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }

/* ---------- Логотип-фишка ---------- */
.chip-logo { display: block; flex: none; filter: drop-shadow(0 6px 16px rgba(198, 40, 40, .35)); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 18px; text-decoration: none; }

/* ---------- Вход ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 32px 28px 28px; display: grid; gap: 18px; }
.auth-head { display: grid; justify-items: center; gap: 10px; text-align: center; }
.auth-head h1 { margin: 6px 0 0; font: 900 30px/1 var(--display); letter-spacing: -.01em; }
.auth-head p { margin: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: #151515; border: 1px solid var(--line); border-radius: 12px; }
.seg button { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.auth form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.form-err { min-height: 18px; color: var(--danger); font-size: 13px; font-weight: 600; }

/* ---------- Лобби ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: rgba(20,20,20,.8); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.me-btn { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 700; }
.me-btn:hover { background: var(--panel-2); }
.lobby-main { max-width: 1040px; margin: 0 auto; padding: 28px 20px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.lobby-main h2 { margin: 0 0 14px; font: 700 20px var(--display); }
.tables { display: grid; gap: 12px; }
.tcard { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 16px 18px; text-decoration: none; transition: border-color .15s, background .15s; }
.tcard:hover { border-color: var(--line-2); background: #242424; }
.tcard .mini-felt { width: 64px; height: 38px; border-radius: 999px; background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-3)); border: 4px solid #0e0e0e; display: grid; place-items: center; font: 900 13px var(--display); color: rgba(255,255,255,.7); }
.tcard h3 { margin: 0 0 4px; font-size: 17px; }
.tcard .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.badge.live { background: rgba(76,195,138,.12); color: var(--ok); }
.badge.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.empty-note { padding: 28px; text-align: center; color: var(--muted); }
.new-table { padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; position: sticky; top: 84px; }
.new-table h3 { margin: 0; font: 700 17px var(--display); }
.new-table form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Аватары ---------- */
.ava { border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; overflow: hidden; background: #444; user-select: none; }

/* ---------- Модальные окна ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { grid-template-columns: minmax(0, 1fr); width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; display: grid; gap: 20px; position: relative; animation: rise .18s ease; }
.modal .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.modal .x:hover { background: var(--panel-2); color: var(--text); }
.prof-head { display: flex; gap: 16px; align-items: center; }
.ava-edit { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; }
.ava-edit::after { content: 'Сменить'; position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.55); font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.ava-edit:hover::after { opacity: 1; }
.prof-name { display: grid; gap: 4px; min-width: 0; }
.prof-name h2 { margin: 0; font: 700 22px var(--display); overflow-wrap: anywhere; }
.name-row { display: flex; gap: 8px; }
.name-row input { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: #181818; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 2px; }
.stat b { font: 700 20px var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.pos b { color: var(--ok); }
.stat.neg b { color: var(--danger); }
.stat-groups { display: grid; gap: 10px; }
.stat-groups .section-title { margin: 6px 0 0; }
.stat-note { margin: -2px 0 4px; font-size: 12px; color: var(--dim); }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 0 0 -8px; }
details.pw summary { cursor: pointer; color: var(--muted); font-weight: 700; list-style: none; }
details.pw summary::-webkit-details-marker { display: none; }
details.pw[open] summary { margin-bottom: 12px; color: var(--text); }
details.pw form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; }

/* ---------- Законченные столы ---------- */
.done-title { margin: 18px 0 2px !important; font-size: 16px !important; color: var(--muted); }
.tcard.closed { opacity: .6; }
.tcard.closed:hover { opacity: .85; }
.tcard.closed .mini-felt { filter: grayscale(1); }
.closed-main { max-width: 540px; margin: 0 auto; padding: 32px 16px 60px; }
.closed-card { padding: 26px 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.closed-card h2 { margin: 4px 0 0; font: 700 22px var(--display); overflow-wrap: anywhere; }
.closed-note { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Итоги игры ---------- */
.res-head { display: grid; justify-items: center; gap: 4px; text-align: center; }
.res-cup { font-size: 44px; line-height: 1; filter: drop-shadow(0 6px 14px rgba(242,193,78,.35)); }
.res-list { display: grid; gap: 8px; }
.res-row { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #181818; border: 1px solid var(--line); }
.res-row.top { border-color: var(--gold); background: rgba(242,193,78,.07); }
.res-row .place { font: 700 15px var(--display); color: var(--dim); text-align: center; }
.res-row.top .place { color: var(--gold); }
.res-name { display: grid; min-width: 0; }
.res-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-name small { color: var(--muted); font-size: 12px; }
.res-net { font: 700 17px var(--display); font-variant-numeric: tabular-nums; }
.res-net.pos { color: var(--ok); }
.res-net.neg { color: var(--danger); }

/* ---------- Тосты ---------- */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 10px; background: #f1f1f1; color: #111; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: rise .2s ease; }
.toast.err { background: var(--danger); color: #fff; }

/* =========================================================
   СТОЛ
   ========================================================= */
.tpage {
  height: 100vh; height: 100dvh; overflow: hidden;
  display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr auto;
  position: relative;
}
.arena { position: relative; min-height: 0; overflow: hidden; }

/* панель инструментов (сверху слева) */
.tool { position: absolute; z-index: 6; top: 12px; left: 12px; display: flex; gap: 2px; padding: 4px; background: rgba(28,28,28,.92); border: 1px solid var(--line); border-radius: 14px; }
.tool button { width: 68px; padding: 7px 2px 5px; display: grid; justify-items: center; gap: 3px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.tool button:hover { background: var(--panel-2); color: var(--text); }
.tool button.on { color: var(--gold); }
.tool svg { width: 22px; height: 22px; }
.tool .badge-dot { position: relative; }
.tool .unread { position: absolute; top: -4px; right: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; }
.tool .only-mobile { display: none; }

/* информация о столе */
.tinfo { position: absolute; z-index: 6; top: 16px; right: 20px; text-align: right; display: grid; gap: 2px; }
.tinfo .tname { font-weight: 800; font-size: 15px; }
.tinfo .blinds { font: 700 24px var(--display); letter-spacing: -.01em; }
.tinfo .sub { color: var(--muted); font-size: 12px; font-weight: 600; }
.pause-badge { margin-top: 4px; background: var(--gold); color: #1a1405; }
.seat .crown { font-size: .85em; margin-right: 3px; }
.paused-panel { border: 1px solid rgba(242,193,78,.35); }

/* сам стол */
.rim {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 14px; border-radius: 999px;
  background: linear-gradient(180deg, #2c2c2c 0%, #141414 55%, #0b0b0b 100%);
  box-shadow: 0 30px 80px rgba(0,0,0,.65), 0 0 0 1px #000, inset 0 1px 0 rgba(255,255,255,.08);
}
.felt {
  position: relative; width: 100%; height: 100%; border-radius: 999px; overflow: hidden;
  background: radial-gradient(ellipse 70% 75% at 50% 42%, var(--felt-1) 0%, var(--felt-2) 50%, var(--felt-3) 100%);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), inset 0 0 70px rgba(0,0,0,.45);
}
.felt::before { /* линия ставок */
  content: ''; position: absolute; inset: 9% 6%; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.07);
}
.felt::after { /* фактура сукна */
  content: ''; position: absolute; inset: 0; opacity: .5; mix-blend-mode: overlay;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 2px, transparent 2px 4px);
}
.felt-27 {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font: 900 var(--logo, 160px)/1 var(--display); letter-spacing: -.04em;
  color: rgba(0,0,0,.22); text-shadow: 0 2px 0 rgba(255,255,255,.07);
  user-select: none; pointer-events: none;
}

/* центр стола: банк, борд, итог */
.center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; display: grid; justify-items: center; gap: 12px; pointer-events: none; width: var(--fw, 600px); }
.center > * { pointer-events: auto; }
.center.wait { transform: translate(-50%, calc(-50% + var(--fh, 400px) * .26)); }
.pot { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px 0 10px; border-radius: 999px; background: rgba(0,0,0,.4); font: 700 18px var(--display); font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.pot small { font: 600 12px var(--font); color: rgba(255,255,255,.6); }
.board { display: flex; gap: var(--cgap, 8px); min-height: var(--bh, 90px); }
.result { display: grid; gap: 4px; justify-items: center; text-align: center; }
.result div { padding: 6px 14px; border-radius: 999px; background: rgba(0,0,0,.45); font-weight: 700; font-size: 14px; }
.result b { color: var(--gold); }

.waiting { display: grid; justify-items: center; gap: 10px; padding: 20px 26px; border-radius: 22px; background: rgba(12,12,12,.82); box-shadow: 0 20px 50px rgba(0,0,0,.4); text-align: center; max-width: 92%; }
.waiting .w-title { font: 700 20px var(--display); }
.waiting .w-sub { color: var(--muted); font-size: 14px; }
.waiting .w-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* карты */
.pcard {
  position: relative; width: var(--cw, 62px); height: calc(var(--cw, 62px) * 1.4); border-radius: calc(var(--cw, 62px) * .1);
  background: #fbfbf8; color: #161616; box-shadow: 0 4px 10px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.08);
  display: grid; grid-template-rows: auto 1fr; padding: 4% 8%; flex: none; user-select: none;
  transition: transform .2s, opacity .2s;
}
.pcard .r { font: 800 calc(var(--cw, 62px) * .42)/1 var(--font); letter-spacing: -.04em; }
.pcard .s { font-size: calc(var(--cw, 62px) * .5); line-height: 1; align-self: end; justify-self: end; }
.pcard.red { color: #d0202a; }
.pcard.back {
  background: var(--card-back) center / 100% 100% no-repeat;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
  padding: 0;
}
/* «27» на медальоне — тем же шрифтом, что и на столе */
.pcard.back::after {
  content: '27'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%);
  font: 900 calc(var(--cw, 62px) * .27)/1 var(--display); letter-spacing: -.04em; color: #b5121b;
}
.pcard.slot { background: rgba(0,0,0,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.pcard.dim { opacity: .4; }
.pcard.hl { transform: translateY(-8%); box-shadow: 0 0 0 2px var(--gold), 0 8px 18px rgba(0,0,0,.45); }
.pcard.lo { opacity: .45; }
.pcard.deal { animation: deal .35s cubic-bezier(.2,.8,.3,1) both; }

/* места */
.seat {
  position: absolute; z-index: 3; transform: translate(-50%, -50%);
  width: var(--sw, 172px); height: var(--sh, 62px);
}
.seat .box {
  position: relative; height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 9px;
  background: #1d1d1d; border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,.45); transition: box-shadow .2s, border-color .2s, opacity .2s;
  cursor: pointer;
}
.seat .box .ava { width: var(--av, 44px); height: var(--av, 44px); font-size: calc(var(--av, 44px) * .4); }
.seat .who { min-width: 0; display: grid; }
.seat .nm { font-weight: 700; font-size: var(--nmf, 14px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #d9d9d9; }
.seat .st { font: 700 var(--stf, 18px)/1.15 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.seat .st.allin { color: var(--gold); font-size: calc(var(--stf, 18px) * .8); }
.seat.me .box { background: #232323; }
.seat.active .box { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 30px rgba(255,255,255,.18), 0 10px 26px rgba(0,0,0,.45); }
.seat.winner .box { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 34px rgba(242,193,78,.45); }
.seat.folded .box, .seat.away .box { opacity: .5; }
.seat .timer { position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.12); }
.seat .timer i { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.seat .status { position: absolute; top: calc(var(--sh, 62px) * -.32); right: -10px; font-size: calc(var(--sh, 62px) * .42); filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.seat .tag {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px);
  height: 22px; padding: 0 10px; border-radius: 999px; display: grid; place-items: center;
  background: #2d2d2d; color: #ddd; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.seat .tag.a-raise, .seat .tag.a-bet { background: var(--gold); color: #1a1405; }
.seat .tag.a-allin { background: #fff; color: #111; }
.seat .tag.a-fold { background: #2a2a2a; color: #888; }
.seat .tag.win { background: var(--gold); color: #1a1405; font-size: 13px; letter-spacing: 0; }
.seat .hname { position: absolute; left: 50%; bottom: calc(100% + var(--cw-o, 40px) * 1.4 + 4px); transform: translateX(-50%); white-space: nowrap; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.75); font-size: 12px; font-weight: 700; color: var(--gold); }
.seat .hole { position: absolute; left: 50%; bottom: calc(100% - 14px); transform: translateX(-50%); display: flex; gap: 3px; --cw: var(--cw-o, 40px); }
.seat.me .hole { --cw: var(--cw-me, 58px); bottom: calc(100% - 10px); gap: 5px; }
.seat.me .hname { bottom: calc(100% + var(--cw-me, 58px) * 1.4 - 4px); }
.seat .hole .pcard:nth-child(1) { transform: rotate(-4deg); }
.seat .hole .pcard:nth-child(2) { transform: rotate(4deg); }
.seat .hole .pcard.hl:nth-child(1) { transform: rotate(-4deg) translateY(-10%); }
.seat .hole .pcard.hl:nth-child(2) { transform: rotate(4deg) translateY(-10%); }

.seat.up .hole { bottom: auto; top: calc(100% + 4px); }
.seat.up .tag { top: auto; bottom: 100%; transform: translate(-50%, -6px); }
.seat.up .hname { bottom: auto; top: calc(100% + var(--cw-o, 40px) * 1.4 + 10px); }
.seat.up .hole .pcard:nth-child(1) { transform: rotate(4deg); }
.seat.up .hole .pcard:nth-child(2) { transform: rotate(-4deg); }
.seat.up .hole .pcard.hl:nth-child(1) { transform: rotate(4deg) translateY(8%); }
.seat.up .hole .pcard.hl:nth-child(2) { transform: rotate(-4deg) translateY(8%); }

.seat.empty .box { justify-content: center; background: transparent; border: 1.5px dashed rgba(255,255,255,.12); box-shadow: none; cursor: default; }
.seat.empty .seatno { color: rgba(255,255,255,.18); font: 700 18px var(--display); }
.seat.empty.can-sit .box { cursor: pointer; }
.seat.empty.can-sit .box:hover { border-color: var(--gold); background: rgba(242,193,78,.06); }
.seat.empty.can-sit .seatno { display: none; }
.seat.empty .sit { display: none; color: var(--gold); font-weight: 800; font-size: 14px; }
.seat.empty.can-sit .sit { display: block; }

/* фишки ставок, баттон */
.bet { position: absolute; z-index: 2; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: rgba(0,0,0,.42); font: 700 14px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; animation: pop .2s ease; }
.chip { width: 20px; height: 20px; border-radius: 50%; flex: none; background: conic-gradient(#fff 0 12.5%, var(--c, #c62828) 0 25%, #fff 0 37.5%, var(--c, #c62828) 0 50%, #fff 0 62.5%, var(--c, #c62828) 0 75%, #fff 0 87.5%, var(--c, #c62828) 0); box-shadow: inset 0 0 0 4px var(--c, #c62828), 0 1px 2px rgba(0,0,0,.5); }
.chip.gold { --c: #d4a017; }
.chip.dark { --c: #222; }
.dealer { position: absolute; z-index: 2; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font: 900 12px var(--display); box-shadow: 0 3px 8px rgba(0,0,0,.45); transition: left .4s, top .4s; }

/* эмоции */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.fx { position: absolute; left: 0; top: 0; font-size: 44px; line-height: 1; will-change: transform, opacity; }

/* нижняя панель */
.bottom { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 14px; padding: 0 14px 14px; align-items: end; min-height: 0; }
.dock { height: 190px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.dock-tabs { display: flex; gap: 2px; padding: 6px 6px 0; }
.dock-tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.dock-tabs button.on { background: var(--panel-2); color: var(--text); }
.dock-tabs .close-dock { margin-left: auto; display: none; }
.dock-body { overflow-y: auto; padding: 8px 12px; font-size: 13px; display: grid; align-content: start; gap: 3px; overscroll-behavior: contain; }
.dock-body .ln { color: #bdbdbd; }
.dock-body .ln.sep { color: var(--dim); font-weight: 700; margin-top: 6px; }
.dock-body .msg b { color: var(--gold); font-weight: 700; }
.dock-body .msg { overflow-wrap: anywhere; }
.dock-body .empty { color: var(--dim); text-align: center; padding: 30px 0; }
.dock-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); }
.dock-form input { flex: 1; height: 36px; min-width: 0; font-size: 14px; }
.dock-form .btn { height: 36px; padding: 0 12px; }
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger th { text-align: right; color: var(--dim); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 6px; }
.ledger td { text-align: right; padding: 5px 6px; border-top: 1px solid var(--line); font-weight: 600; }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger .pos { color: var(--ok); }
.ledger .neg { color: var(--danger); }

/* действия */
.actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 12px; min-width: 0; }
.emote-btn { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel); font-size: 26px; display: grid; place-items: center; transition: transform .12s, background .15s; }
.emote-btn:hover { background: var(--panel-2); transform: scale(1.05); }
.act-main { display: grid; gap: 10px; justify-items: end; min-width: 0; }
.act-row { display: flex; gap: 10px; }
.act-row .btn { height: 54px; min-width: 128px; font-size: 16px; border-radius: 12px; }
.btn.fold { background: #262626; }
.btn.call { background: #f1f1f1; border-color: #f1f1f1; color: #111; }
.btn.call:hover { background: #fff; }
.btn.raise { background: var(--gold); border-color: var(--gold); color: #1a1405; min-width: 168px !important; }
.btn.raise:hover { background: var(--gold-2); }
.raise-box { display: grid; gap: 8px; padding: 10px; background: rgba(28,28,28,.92); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 470px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { flex: 1; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px; font-weight: 700; color: #ddd; white-space: nowrap; }
.presets button:hover { border-color: var(--gold); color: var(--text); }
.slider { display: flex; gap: 10px; align-items: center; }
.slider input[type=range] { flex: 1; accent-color: var(--gold); height: 28px; }
.slider input[type=number] { width: 110px; height: 36px; text-align: right; }
.hint { color: var(--muted); font-weight: 600; font-size: 14px; padding: 0 6px 16px; text-align: right; }
.hint b { color: var(--text); }
.kbd { display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line-2); font-size: 11px; color: var(--dim); text-align: center; margin-left: 6px; }

/* всплывашки */
.pop { position: fixed; z-index: 40; background: #1e1e1e; border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.55); padding: 12px; width: 300px; display: grid; gap: 12px; animation: rise .15s ease; }
.pop-head { display: flex; gap: 12px; align-items: center; }
.pop-head .nm { font-weight: 800; font-size: 16px; }
.pop .mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pop .mini-stats div { background: #171717; border-radius: 8px; padding: 6px 8px; display: grid; }
.pop .mini-stats b { font: 700 15px var(--display); }
.pop .mini-stats span { font-size: 11px; color: var(--muted); font-weight: 600; }
.pop .lbl { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.emoji-grid button { height: 40px; border: 0; border-radius: 8px; background: transparent; font-size: 24px; transition: background .1s, transform .1s; }
.emoji-grid button:hover { background: var(--panel-2); transform: scale(1.12); }
.emoji-grid button.on { background: rgba(242,193,78,.18); box-shadow: inset 0 0 0 1px var(--gold); }
.pop .seg { margin-bottom: -2px; }

.conn { position: absolute; z-index: 30; top: 14px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: var(--danger); color: #fff; font-weight: 700; font-size: 13px; }

/* анимации */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
@keyframes deal { from { opacity: 0; transform: translateY(-30px) rotate(-8deg) scale(.8); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Телефоны и узкие экраны
   ========================================================= */
@media (max-width: 900px) {
  .lobby-main { grid-template-columns: 1fr; }
  .new-table { position: static; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { padding: 10px 14px; }
  .brand span { display: none; }
  .lobby-main { padding: 18px 14px 40px; }
  .tcard { grid-template-columns: auto 1fr; }
  .tcard .badge { grid-column: 2; justify-self: start; }

  .tpage { grid-template-rows: auto 1fr auto; }
  .tool { position: static; grid-row: 1; display: flex; justify-content: space-between; border-radius: 0; border-width: 0 0 1px; padding: 4px 6px; padding-top: max(4px, env(safe-area-inset-top)); background: rgba(20,20,20,.95); }
  .tool button { width: auto; flex: 1; padding: 6px 2px 4px; font-size: 10px; }
  .tool svg { width: 20px; height: 20px; }
  .tool .only-mobile { display: grid; }
  .arena { grid-row: 2; }
  .tinfo { top: 8px; right: 10px; }
  .tinfo .tname { font-size: 12px; }
  .tinfo .blinds { font-size: 16px; }
  .tinfo .sub { font-size: 11px; }

  .bottom { grid-row: 3; grid-template-columns: 1fr; padding: 0 8px max(8px, env(safe-area-inset-bottom)); gap: 0; }
  .dock { position: fixed; z-index: 45; left: 8px; right: 8px; bottom: 8px; height: min(60vh, 420px); display: none; box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
  .dock.open { display: grid; }
  .dock-tabs .close-dock { display: block; font-size: 18px; }

  .actions { justify-content: stretch; gap: 8px; }
  .act-main { flex: 1; justify-items: stretch; }
  .act-row { gap: 6px; }
  .act-row .btn { flex: 1; min-width: 0 !important; height: 50px; font-size: 15px; padding: 0 8px; }
  .raise-box { max-width: none; padding: 8px; }
  .presets button { font-size: 11px; padding: 0 4px; }
  .slider input[type=number] { width: 92px; }
  .emote-btn { width: 50px; height: 50px; font-size: 24px; align-self: flex-end; }
  .hint { padding: 0 4px 14px; text-align: left; }
  .kbd { display: none; }

  .seat .box { padding: 0 6px 0 5px; gap: 6px; border-radius: 10px; }
  .seat .tag { height: 18px; font-size: 9px; padding: 0 7px; transform: translate(-50%, 3px); }
  .seat .hname { font-size: 10px; padding: 2px 7px; }
  .bet { font-size: 12px; padding: 2px 8px 2px 3px; gap: 4px; }
  .chip { width: 16px; height: 16px; box-shadow: inset 0 0 0 3px var(--c, #c62828); }
  .dealer { width: 20px; height: 20px; font-size: 10px; }
  .pot { height: 30px; font-size: 15px; padding: 0 12px 0 8px; }
  .result div { font-size: 12px; padding: 4px 10px; }
  .waiting { padding: 14px 16px; border-radius: 16px; }
  .waiting .w-title { font-size: 16px; }
  .waiting .w-sub { font-size: 12px; }
  .waiting .btn { height: 38px; padding: 0 12px; font-size: 13px; }
  .fx { font-size: 34px; }
  .pop { width: min(300px, calc(100vw - 16px)); }
  .modal { padding: 20px 16px; gap: 16px; }
  .stats { gap: 6px; }
  .stat { padding: 10px 8px; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 11px; }
}
