:root {
  --bg: #0d1210;
  --bg-2: #121916;
  --panel: #17201c;
  --panel-2: #1d2823;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef1ea;
  --muted: #98a59d;
  --felt-1: #217457;
  --felt-2: #0f3d2d;
  --wood-1: #5b3a22;
  --wood-2: #2e1d11;
  --brass: #d9b36a;
  --brass-2: #f3d9a0;
  --card: #fbf8f1;
  --card-ink: #1c1c1f;
  --card-red: #c4372f;
  --danger: #e2675d;
  --up: #6fd49a;
  --down: #ef8a80;
  --radius: 14px;
  --display: 'Fraunces', Georgia, serif;
  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--brass-2); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #24312b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brass); color: #1d160b; border-color: transparent; }
.btn.primary:hover { background: var(--brass-2); }
.btn.big { min-height: 50px; font-size: 16px; padding: 0 22px; }
.btn.icon { width: 38px; padding: 0; font-size: 18px; position: relative; }
.btn:focus-visible, .seat.open:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--brass-2); outline-offset: 2px;
}
kbd {
  font: 600 10px/1 var(--ui); padding: 3px 5px; border-radius: 4px;
  background: rgba(0, 0, 0, .25); opacity: .7;
}

.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 20px/1 var(--display); color: var(--text); text-decoration: none; letter-spacing: -.01em;
}
.logo-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--brass); color: #1d160b; font-size: 18px;
}
.logo-mark svg { width: 20px; height: 20px; display: block; }

/* ---------- landing ---------- */

body.home {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(33, 116, 87, .35), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(217, 179, 106, .08), transparent 60%),
    var(--bg);
}
.site-header { padding: 22px clamp(16px, 5vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.account-chip { gap: 8px; padding-left: 6px; text-decoration: none; color: var(--text); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero {
  flex: 1; width: 100%; max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 6vw, 80px); align-items: center;
  padding: 24px clamp(16px, 5vw, 56px) 48px;
}
.eyebrow { color: var(--brass); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12.5px; margin: 0 0 14px; }
h1 { font: 700 clamp(44px, 7vw, 76px)/1 var(--display); letter-spacing: -.025em; margin: 0 0 20px; }
h1 em { font-style: italic; color: var(--brass-2); }
.lede { font-size: 18px; color: #c8d1cb; max-width: 30em; margin: 0 0 30px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; counter-increment: s; }
.steps li::before {
  content: counter(s); grid-row: span 2; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(217, 179, 106, .5); color: var(--brass-2); font-weight: 800;
}
.steps b { font-weight: 700; }
.steps span { color: var(--muted); font-size: 14px; }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 20px; padding: 26px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7);
}
.panel h2 { font: 700 24px/1.2 var(--display); margin: 0 0 18px; }
.field { display: grid; gap: 6px; margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; text-align: center; padding: 8px 0; border-radius: 7px; font-weight: 700; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.segmented input:focus-visible + span { outline: 2px solid var(--brass-2); }
.check { display: flex; gap: 10px; align-items: center; margin: 4px 0 14px; color: #c8d1cb; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brass); }
.summary { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.create .btn.big { width: 100%; }
.form-error { color: var(--danger); min-height: 1.5em; margin: 10px 0 0; font-size: 14px; }
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 16px 28px; }

@media (max-width: 860px) {
  /* On phones the form comes right after the headline, before the how-it-works steps. */
  .hero { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-top: 4px; }
  .pitch { display: contents; }
  .lede { margin-bottom: 22px; }
  .create { order: 1; margin-bottom: 32px; }
  .steps { order: 2; }
  .lede { font-size: 16px; }
  .panel { padding: 20px; }
}

/* ---------- table page ---------- */

body.play {
  height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
  background: radial-gradient(1000px 520px at 50% 40%, #16231d, var(--bg) 70%);
}
.topbar {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 10px clamp(12px, 2vw, 20px); border-bottom: 1px solid var(--line);
  background: rgba(13, 18, 16, .85); backdrop-filter: blur(8px);
}
.table-info { display: flex; align-items: center; gap: 10px; font-size: 13.5px; min-width: 0; }
.table-info .code { font-weight: 800; letter-spacing: .12em; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn.invite { border-color: rgba(217, 179, 106, .45); color: var(--brass-2); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .7);
}
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 600; }
.menu button:hover { background: rgba(255, 255, 255, .06); }
.side-toggle { display: none; }
.side-toggle .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.banner { flex: none; text-align: center; padding: 8px; background: #4b2b16; color: var(--brass-2); font-weight: 700; font-size: 14px; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 330px; }
.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.table-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 30px 40px 10px; container-type: size; }

.table {
  --ratio: 1.9;
  position: relative;
  /* Fallbacks first for browsers without container units (iOS 15 and older). */
  width: min(100%, 1000px);
  width: min(100cqw, 100cqh * var(--ratio));
  aspect-ratio: var(--ratio);
  --cw: clamp(34px, 3.6cqw, 54px);
}
.rail {
  position: absolute; inset: 6% 5%; border-radius: 999px; padding: clamp(10px, 1.6cqw, 18px);
  background: linear-gradient(160deg, var(--wood-1), var(--wood-2));
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9), inset 0 2px 0 rgba(255, 255, 255, .08), inset 0 -3px 8px rgba(0, 0, 0, .5);
}
.rail::after { content: ''; position: absolute; inset: 5px; border-radius: inherit; border: 1px solid rgba(243, 217, 160, .18); pointer-events: none; }
.felt {
  width: 100%; height: 100%; border-radius: 999px;
  background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 75%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25), inset 0 10px 40px rgba(0, 0, 0, .45);
}

.center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px; width: 62%;
}
.pot {
  min-height: 26px; padding: 3px 14px; border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .3); color: var(--brass-2);
}
.pot:empty { visibility: hidden; }
.pot span { font-weight: 600; color: var(--muted); margin-right: 4px; }
.board { display: flex; gap: 6px; }
.status { text-align: center; font-weight: 600; color: #d6dfd9; min-height: 24px; font-size: 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.status .result { font-size: 15px; }
.status .result b { color: var(--brass-2); }

/* While you wait for friends, the invite card sits above the empty seats. */
.table.inviting .center { z-index: 3; }
.invite-card {
  background: rgba(8, 14, 11, .72); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-align: center;
  width: min(420px, 100%); text-shadow: none;
}
.invite-card p { margin: 0 0 8px; }
.invite-row { display: flex; gap: 6px; margin-bottom: 8px; }
.invite-row input { flex: 1; min-width: 0; min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-2); font-size: 13px; }

/* cards */
.card {
  --w: var(--cw);
  position: relative; flex: none; width: var(--w); height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * .12); background: var(--card); color: var(--card-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: flex-start; gap: calc(var(--w) * .02);
  padding: calc(var(--w) * .08) calc(var(--w) * .1);
  font-weight: 800; line-height: 1; overflow: hidden;
}
.card.deal { animation: deal .25s ease-out; }
.card.red { color: var(--card-red); }
/* Rank and suit both sit in the top-left corner so they stay readable when cards overlap. */
.card .r { font-size: calc(var(--w) * .42); letter-spacing: -.04em; }
.card .s { font-size: calc(var(--w) * .34); }
.card[data-suit]::after {
  content: attr(data-suit); position: absolute; right: calc(var(--w) * .06); bottom: calc(var(--w) * -.04);
  font-size: calc(var(--w) * .72); opacity: .9;
}
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(243, 217, 160, .18) 0 3px, transparent 3px 7px),
    linear-gradient(160deg, #8c2a24, #5a1714);
  border: 2px solid var(--card);
}
.card.slot { background: rgba(0, 0, 0, .14); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .1); }
.card.hi { box-shadow: 0 0 0 2px var(--brass-2), 0 6px 14px rgba(0, 0, 0, .5); transform: translateY(-4px); }
.card.dim { filter: brightness(.6); }
/* Motion only, no fade: if a background tab pauses the animation, cards are still visible. */
@keyframes deal { from { translate: 0 -10px; scale: .94; } }
@media (prefers-reduced-motion: reduce) {
  .card.deal, .seat.winner .plate { animation: none; }
}

/* seats */
.seat {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; width: 130px; width: clamp(118px, 14cqw, 156px);
  transition: opacity .2s;
}
.seat .hole { display: flex; justify-content: center; margin-bottom: -12px; min-height: 8px; z-index: 0; }
.seat .hole .card { --w: calc(var(--cw) * .82); margin: 0 -3px; }
.seat .hole .card:first-child { transform: rotate(-5deg); }
.seat .hole .card:last-child { transform: rotate(5deg); }
.seat .hole .card.hi:first-child { transform: rotate(-5deg) translateY(-5px); }
.seat .hole .card.hi:last-child { transform: rotate(5deg) translateY(-5px); }
.seat.me .hole .card { --w: var(--cw); }
.plate {
  position: relative; z-index: 1; width: 100%;
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 999px;
  background: rgba(9, 13, 11, .92); border: 1px solid var(--line);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .7);
}
.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--h) 38% 38%); color: #fff; font-weight: 800; font-size: 14px;
}
.meta { flex: 1; min-width: 0; line-height: 1.15; }
.name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-badge { color: var(--brass); font-size: 11px; }
.stack { font-size: 12.5px; color: var(--brass-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.timer { position: absolute; left: 16px; right: 16px; bottom: -5px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .6); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--brass); transform-origin: left; }
.timer.low i { background: var(--danger); }
.seat.acting .plate { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(217, 179, 106, .25), 0 8px 20px -6px rgba(0, 0, 0, .7); }
.seat.folded .hole, .seat.folded .plate { opacity: .45; }
.seat.away .plate { opacity: .55; }
.seat.winner .plate { border-color: var(--brass-2); animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 0 4px rgba(243, 217, 160, .3), 0 0 30px rgba(243, 217, 160, .35); } }
.seat.me .plate { background: rgba(14, 22, 18, .96); border-color: rgba(217, 179, 106, .35); }

.tag, .handname {
  margin-top: 7px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
  background: rgba(0, 0, 0, .55); color: #d6dfd9; white-space: nowrap; letter-spacing: .02em;
}
.handname { background: rgba(243, 217, 160, .14); color: var(--brass-2); max-width: 180%; overflow: hidden; text-overflow: ellipsis; }
.tag.bet-tag { display: inline-flex; align-items: center; gap: 5px; padding-left: 3px; color: var(--text); font-variant-numeric: tabular-nums; }
.win-badge {
  position: absolute; right: -6px; top: -10px; z-index: 2;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--brass); color: #1d160b; box-shadow: 0 3px 8px rgba(0, 0, 0, .45);
}
.tag.muted { color: var(--muted); }
.tag.act-fold { color: var(--muted); }
.tag.act-bet, .tag.act-raise, .tag.act-allin { color: #ffcf8a; }

.seat.empty {
  width: 64px; height: 64px; border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, .14); background: rgba(0, 0, 0, .12);
}
.seat.open {
  cursor: pointer; display: grid; place-items: center; color: var(--brass-2);
  font-weight: 800; font-size: 11.5px; border-color: rgba(217, 179, 106, .5); background: rgba(0, 0, 0, .3);
}
.seat.open:hover { background: rgba(217, 179, 106, .16); }

.bet {
  position: absolute; transform: translate(-50%, -50%); z-index: 1;
  display: flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px; border-radius: 999px;
  background: rgba(0, 0, 0, .45); font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.chip {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle, var(--brass-2) 0 35%, transparent 36%), repeating-conic-gradient(var(--brass) 0 30deg, #fff 30deg 60deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.dealer {
  position: absolute; transform: translate(-50%, -50%); z-index: 1;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #222; font-weight: 900; font-size: 11px; box-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}

/* action bar */
.actionbar {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  min-height: 74px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.actionbar .hint { margin: 0; color: var(--muted); font-weight: 600; }
.actionbar.my-turn { background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .35)); }
.acts { display: flex; gap: 8px; }
.btn.act { min-height: 50px; min-width: 112px; font-size: 15.5px; border-radius: 12px; }
.btn.fold { color: var(--down); }
.btn.call { background: #2a6b50; border-color: transparent; }
.btn.call:hover { background: #318060; }
.btn.raise { background: var(--brass); color: #1d160b; border-color: transparent; }
.btn.raise:hover { background: var(--brass-2); }
.sizer { display: grid; gap: 6px; min-width: 280px; }
.presets { display: flex; gap: 4px; }
.presets button {
  flex: 1; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 5px 0;
  font-size: 12px; font-weight: 700; cursor: pointer; color: #d6dfd9;
}
.presets button:hover { border-color: rgba(217, 179, 106, .5); }
.slider-row { display: flex; gap: 8px; align-items: center; }
.slider-row input[type=range] { flex: 1; accent-color: var(--brass); }
.slider-row input[type=number] {
  width: 96px; min-height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2);
  font-weight: 700; font-variant-numeric: tabular-nums;
}

/* side panel */
.side { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: rgba(18, 25, 22, .9); }
.tabs { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--brass); }
.close-side { display: none; margin-left: auto; }
.tabpanel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.log .event { color: var(--muted); font-size: 12.5px; }
.log .chat b { color: hsl(var(--h) 60% 72%); margin-right: 4px; }
.log .chat { word-wrap: break-word; }
.log .divider { margin: 8px 0 2px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(217, 179, 106, .6); }
.chatform { flex: none; display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chatform input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.ledger { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ledger th { text-align: right; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 12px 14px 6px; }
.ledger td { text-align: right; padding: 8px 14px; border-top: 1px solid var(--line); }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger td.up { color: var(--up); font-weight: 800; }
.ledger td.down { color: var(--down); font-weight: 800; }
.ledger tr.gone td { opacity: .55; }
.pad { padding: 10px 14px; margin: 0; }

/* name dialog + toast */
.modal {
  border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(380px, calc(100vw - 32px));
  background: var(--panel-2); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
}
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.modal h2 { font: 700 22px/1.2 var(--display); margin: 0 0 4px; }
.modal p { margin: 0 0 14px; }
.modal input:not([type=checkbox]):not([type=radio]) { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal.wide { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); }
.modal h3 { font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 0 6px; }
.modal .field input, .modal .field select { min-height: 42px; }
.modal .row { margin-bottom: 0; }
.field-hint { margin: -8px 0 14px !important; }
.players { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.players li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 12px; }
.players li + li { border-top: 1px solid var(--line); }
.players li.muted { justify-content: flex-start; font-size: 13.5px; }
.btn.small-btn { min-height: 32px; font-size: 12.5px; padding: 0 10px; color: var(--down); }
.btn.small-btn.ok { color: var(--up); }
.status .result.next { margin-top: 6px; font-weight: 600; }

/* pre-actions while waiting for your turn */
.pre { display: flex; gap: 6px; }
.pre-btn {
  min-height: 36px; padding: 0 12px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 13px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.pre-btn::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 3px; border: 1.5px solid currentColor; vertical-align: -1px; }
.pre-btn[aria-pressed="true"] { color: var(--brass-2); border-color: rgba(217, 179, 106, .6); background: rgba(217, 179, 106, .1); }
.pre-btn[aria-pressed="true"]::before { background: var(--brass); border-color: var(--brass); }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  background: #f3efe4; color: #1b1b1b; font-weight: 700; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #f6d5d1; color: #5b1410; }

.notfound { margin: auto; max-width: 440px; text-align: center; grid-column: 1 / -1; }
.notfound h1 { font-size: 34px; }

/* ---------- phones and narrow screens ---------- */

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: auto 0 0 0; height: 70dvh; z-index: 40; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform .25s ease; box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
    background: var(--panel);
  }
  .side.open { transform: none; }
  .side-toggle, .close-side { display: inline-flex; }
  .logo-text { display: none; }
  .btn.invite { padding: 0 10px; }
  .table-wrap { padding: 26px 8px 6px; }
}

@media (max-width: 860px) and (orientation: portrait) {
  .table { --ratio: .66; --cw: clamp(30px, 8.6cqw, 44px); }
  .rail { inset: 7% 9%; }
  .center { width: 72%; }
  .board { gap: 4px; }
  .seat { width: clamp(108px, 31cqw, 128px); }
  .topbar { gap: 8px; }
  .top-actions { gap: 6px; }
  .wide-only { display: none; }
  .avatar { width: 24px; height: 24px; font-size: 12px; }
  .plate { gap: 6px; padding: 4px 8px 4px 4px; }
  .name { font-size: 12px; }
  .stack { font-size: 11.5px; }
  .actionbar { gap: 8px; }
  .sizer { min-width: 0; width: 100%; }
  .acts { width: 100%; }
  .btn.act { flex: 1; min-width: 0; padding: 0 8px; }
  .btn.act kbd { display: none; }
  .table-info .muted { display: none; }
}

@media (max-width: 420px) {
  .table-info { display: none; }
  .btn { padding: 0 11px; }
}

/* Browsers without container units (iOS 15 and older) get fixed card sizes. Kept last so it wins. */
@supports not (width: 1cqw) {
  .table { --cw: 44px; }
  @media (max-width: 860px) and (orientation: portrait) {
    .table { --cw: 38px; width: 100%; }
  }
}

/* ---------- accounts, profile, bots ---------- */

.avatar.mini, .avatar.big { background: var(--brass); color: #1d160b; }
.avatar.mini { width: 24px; height: 24px; font-size: 12px; flex: none; }
.avatar.big { width: 56px; height: 56px; font-size: 26px; flex: none; }
.avatar.bot { background: #2b3530; font-size: 15px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brass-2); font: inherit; text-decoration: underline; cursor: pointer; }
.modal .fine { margin: 14px 0 0; }
.modal .form-error { min-height: 0; margin: 8px 0 0; }
.modal .form-error:empty { display: none; }
.modal input.code-input { font-size: 24px; letter-spacing: .35em; text-align: center; font-weight: 700; }

.profile { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 8px clamp(16px, 5vw, 32px) 32px; }
.page-title { font: 700 clamp(28px, 5vw, 38px)/1.1 var(--display); margin: 0 0 6px; letter-spacing: -.02em; }
.profile .panel h2 { font-size: 18px; margin: 26px 0 12px; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head p { margin: 0; overflow-wrap: anywhere; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: grid; gap: 2px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); min-width: 0; }
.stat b { font: 700 22px/1.2 var(--display); overflow-wrap: anywhere; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 19px; }
}

/* ---------- admin dashboard ---------- */

.admin-pill { font: 800 11px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: 4px 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); color: var(--brass-2); }
.admin-tabs { display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.admin-tabs button { border: 0; background: none; color: var(--muted); font: 700 14px/1 var(--ui); padding: 9px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.admin-tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.admin-main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px) 40px; }
.admin-section { margin: 0 0 34px; }
.admin-section h2 { font: 700 21px/1.2 var(--display); margin: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tiles .stat { background: var(--panel); }
.tiles .stat b small { font: 600 13px var(--ui); color: var(--muted); }
.admin-section > p.small { margin: 10px 0 0; }
.notice-form { display: flex; gap: 8px; }
.notice-form input { flex: 1; min-width: 0; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.segmented.range { display: flex; padding: 3px; }
.segmented.range button { border: 0; background: none; color: var(--muted); font: 700 13px/1 var(--ui); padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.segmented.range button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

.viz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.viz { margin: 0; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.viz figcaption { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .grid { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.viz .grid.base { stroke: rgba(255, 255, 255, .22); }
.viz .axis { fill: var(--muted); font: 600 10.5px var(--ui); }
.viz .hit { fill: transparent; cursor: default; }
.viz .hit:hover { fill: rgba(255, 255, 255, .04); }
.legend { display: flex; gap: 14px; margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.viz-table { margin-top: 8px; font-size: 12.5px; }
.viz-table summary { color: var(--muted); cursor: pointer; }
.viz-table table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.viz-table th, .viz-table td { text-align: right; padding: 3px 6px; border-bottom: 1px solid var(--line); }
.viz-table th:first-child, .viz-table td:first-child { text-align: left; }
.barlist { display: grid; gap: 10px; margin-top: 6px; }
.barrow { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.barlabel { color: #c8d1cb; }
.bartrack { height: 12px; border-radius: 0 4px 4px 0; background: rgba(255, 255, 255, .04); overflow: hidden; }
.bartrack i { display: block; height: 100%; min-width: 2px; background: #3987e5; border-radius: 0 4px 4px 0; }
.barvalue { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.viz-tip {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; display: grid; gap: 2px;
  background: #0b100e; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; color: var(--muted);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.viz-tip b { color: var(--text); font-size: 14px; }

.players-bar { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; flex-wrap: wrap; }
.players-bar input { flex: 1; min-width: 220px; max-width: 420px; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table tr.banned td { opacity: .6; }
.admin-table select { min-height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 8px; }
#morePlayers { margin-top: 12px; }
.badge { display: inline-block; font: 800 11px/1 var(--ui); padding: 4px 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.badge.on { color: var(--up); }

.live-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.live-table { padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 12px; }
.live-table header, .live-table footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-table footer { justify-content: space-between; }
.live-table .code { font-weight: 800; letter-spacing: .12em; }
.live-table .actions { display: flex; gap: 6px; }
.seat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-name { padding: 5px 9px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.chip-name small { color: var(--muted); margin-left: 4px; }
.chip-name.away { opacity: .5; }
.admin-gate { max-width: 480px; margin: 40px auto; text-align: center; }
.banner.notice { background: #1d3550; color: #dce9f7; }

@media (max-width: 760px) {
  body.admin .site-header { flex-wrap: wrap; }
  .admin-tabs { width: 100%; overflow-x: auto; }
  .viz-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles .stat b { font-size: 19px; }
  .notice-form { flex-wrap: wrap; }
  .notice-form input { flex-basis: 100%; }
  .live-tables { grid-template-columns: 1fr; }
}

/* ---------- table motion ---------- */

.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.ghost { position: absolute; will-change: left, top, transform; }
.ghost .chip { display: block; width: 16px; height: 16px; }
.card.back.mini { --w: calc(var(--cw) * .62); }
#dealerBtn { z-index: 2; transition: left .6s cubic-bezier(.3, .7, .2, 1), top .6s cubic-bezier(.3, .7, .2, 1); }
#dealerBtn[hidden] { display: none; }

/* Hole cards fly out from the middle, one seat after another. */
.seat .hole .card.deal { animation: deal-in .42s cubic-bezier(.2, .8, .25, 1) var(--dd, 0ms) backwards; }
.seat .hole .card.deal:last-child { animation-delay: calc(var(--dd, 0ms) + 130ms); }
@keyframes deal-in { from { translate: var(--dx, 0) var(--dy, 0); scale: .5; } }
/* Board cards turn over as they land. */
.board .card.deal { animation: flip-in .5s cubic-bezier(.2, .8, .25, 1) var(--bd, 0ms) backwards; }
@keyframes flip-in { from { transform: perspective(500px) rotateY(88deg) translateY(-10px); } }
/* A new bet slides out from the player to the felt. */
.bet.bet-in { animation: bet-in .38s cubic-bezier(.2, .8, .25, 1); }
@keyframes bet-in { from { translate: var(--fx, 0) var(--fy, 0); scale: .6; } }
.tag.bet-in { animation: pop .32s cubic-bezier(.2, 1.5, .4, 1); }
.win-badge.pop { animation: pop .55s cubic-bezier(.2, 1.6, .4, 1) .55s backwards; }
@keyframes pop { from { scale: .3; } 60% { scale: 1.15; } to { scale: 1; } }
/* Whoever is acting breathes a little, so your eye finds them. */
.seat.acting .plate { animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(217, 179, 106, .16), 0 8px 20px -6px rgba(0, 0, 0, .7); } }
.actionbar.enter { animation: bar-in .3s cubic-bezier(.2, .8, .25, 1); }
@keyframes bar-in { from { translate: 0 16px; } }
.btn.act { transition: transform .08s, background .15s; }
.btn.act:active { transform: scale(.96); }

@media (prefers-reduced-motion: reduce) {
  .seat .hole .card.deal, .board .card.deal, .bet.bet-in, .tag.bet-in, .win-badge.pop, .seat.acting .plate, .actionbar.enter { animation: none; }
  #dealerBtn { transition: none; }
}
