/* Poker Coach — "Blue Felt" premium theme.
   Cardroom blue felt, clay-chip red and ivory, one champagne-gold hairline for luxury, Archivo at three widths.
   Motion tokens (every animation below uses one of these, and all of it turns off under Reduce Motion):
     deal    520ms cubic-bezier(.2,.9,.25,1.08)   cards landing, slight overshoot
     rise    440ms cubic-bezier(.16,1,.3,1)       sheets and panels arriving
     wipe    450ms cubic-bezier(.16,1,.3,1)       TV name plates sliding in from the left
     fill    900ms cubic-bezier(.65,0,.35,1)      bars and meters
     pop     320ms cubic-bezier(.2,.9,.25,1.2)    chips and action bubbles
     breathe 2400ms ease-in-out                   gold ring on the seat to act, only while acting
     press   120ms ease-out, scale .97            every button */
:root {
  --night: #071428;
  --navy: #0d2547;
  --panel: #0c2140;
  --panel-2: #112a50;
  --panel-3: #18355f;
  --line: rgba(243, 239, 228, 0.10);
  --line-2: rgba(243, 239, 228, 0.18);
  --gold: #d8c08a;
  --gold-hi: #f1e2b8;
  --gold-lo: #a88c52;
  --gold-line: rgba(216, 192, 138, 0.45);
  --foil: linear-gradient(180deg, #f1e2b8 0%, #d8c08a 50%, #a88c52 100%);
  --text: #f3efe4;
  --muted: #a9b6c9;
  --dim: #7f90a8;
  --accent: #d8c08a;
  --accent-ink: #1a1408;
  --ivory: #f3efe4;
  --chip: #c8283b;
  --good: #5be0a5;
  --ok: #f0b860;
  --bad: #f2737a;
  --bad-mark: #e5484d;
  --blunder: #ff5468;
  --info: #7fb2f0;
  --felt-hi: #3672bc;
  --felt: #23599e;
  --felt-lo: #123766;
  --spade: #121821;
  --heart: #c8283b;
  --diamond: #2f6fd0;
  --club: #2a9d6a;
  --radius: 14px;
  --shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.7);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  font-family: Archivo, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
/* The page is already dark. Samsung Internet's own dark mode re-darkens any page that does not
   say so in a way it reads (this media query, or the color-scheme meta in index.html): it turned
   the ivory "Deal me in" chip olive and flipped its ink to white. */
@media (prefers-color-scheme: dark) { :root { color-scheme: dark; } }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text); font-size: 14px; line-height: 1.45;
  background: radial-gradient(1200px 800px at 38% 30%, #133158 0%, var(--navy) 45%, var(--night) 100%) fixed, var(--night);
}
button { font: inherit; color: inherit; cursor: pointer; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.92em; background: rgba(243,239,228,0.07); padding: 1px 5px; border-radius: 5px; }
b { font-weight: 700; }
.num, .tab-num { font-variant-numeric: tabular-nums; }
.wide { font-stretch: 125%; letter-spacing: -0.02em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 12px 22px; position: sticky; top: 0; z-index: 20;
  background: rgba(7, 20, 40, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 -1px 0 var(--line);
}
.brand { font-weight: 750; font-size: 18px; font-stretch: 125%; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-chip { width: 30px; height: 30px; flex: none; display: block; }
.brand-sub { color: var(--muted); font-weight: 500; font-size: 12.5px; font-stretch: 100%; letter-spacing: 0; }
.tabs { display: flex; gap: 2px; }
.tabs a { position: relative; color: var(--muted); text-decoration: none; padding: 9px 14px; border-radius: 10px; font-weight: 600; transition: color 180ms ease-out, background-color 180ms ease-out; }
.tabs a:hover { color: var(--text); background: rgba(243,239,228,0.05); }
.tabs a.active { color: var(--text); }
.tabs a.active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px; border-radius: 1px; background: var(--foil); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.session-chip { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; white-space: nowrap; padding: 6px 12px; border-radius: 999px; background: rgba(243,239,228,0.05); box-shadow: inset 0 0 0 1px var(--line); }
.session-chip b.pos { color: var(--good); }
.session-chip b.neg { color: var(--bad); }
/* The AI coach status dot is also the shortcut to the AI coach dialog: a 28px target around a 9px dot. */
.ai-dot { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; transition: background-color 180ms ease-out; }
.ai-dot::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.ai-dot:hover { background: rgba(243,239,228,0.07); }
.ai-dot.on::before { background: var(--good); box-shadow: 0 0 0 3px rgba(91,224,165,0.18); }
.icon-btn { display: grid; place-items: center; background: rgba(243,239,228,0.05); border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 10px; width: 38px; height: 38px; color: var(--muted); transition: color 180ms ease-out, background-color 180ms ease-out, transform 120ms ease-out; }
.icon-btn:hover { background: rgba(243,239,228,0.09); color: var(--text); }
.icon-btn:active { transform: scale(.97); }

main { padding: 18px 22px 48px; max-width: 1560px; margin: 0 auto; }

/* ---------- generic ---------- */
.btn {
  position: relative; background: rgba(243,239,228,0.06); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 999px; padding: 10px 18px; font-weight: 650;
  transition: background-color 180ms ease-out, box-shadow 180ms ease-out, transform 120ms ease-out, opacity 180ms ease-out;
}
.btn:hover:not(:disabled) { background: rgba(243,239,228,0.11); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
/* Primary = the ivory chip: inlay ivory with the dashed red edge of a clay chip. */
.btn.primary { background: var(--ivory); color: var(--night); box-shadow: 0 10px 24px -12px rgba(0,0,0,0.7); font-weight: 750; }
.btn.primary::after, .act-call::after, .act-raise::after { content: ''; position: absolute; inset: 4px; border-radius: inherit; border: 1.5px dashed rgba(200,40,59,0.7); pointer-events: none; }
.btn.primary:hover:not(:disabled) { background: #ffffff; }
.btn.danger { background: rgba(200,40,59,0.18); box-shadow: inset 0 0 0 1px rgba(242,115,122,0.4); }
.btn.danger:hover:not(:disabled) { background: rgba(200,40,59,0.28); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.small.primary::after { inset: 3px; border-width: 1px; }
.btn.ghost { background: transparent; }
.kbd { display: inline-block; min-width: 18px; text-align: center; font-size: 10.5px; font-weight: 600; color: currentColor; opacity: 0.55; border: 1px solid currentColor; border-radius: 5px; padding: 0 4px; margin-left: 8px; font-family: ui-monospace, monospace; line-height: 15px; vertical-align: 1px; }
.card-box { background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line), var(--shadow); border-radius: 18px; }
.muted { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.good { background: rgba(91,224,165,0.14); color: var(--good); }
.pill.ok { background: rgba(240,184,96,0.14); color: var(--ok); }
.pill.mistake { background: rgba(242,115,122,0.15); color: var(--bad); }
.pill.blunder { background: rgba(255,84,104,0.22); color: #ff9aa6; }
.pill.info { background: rgba(127,178,240,0.15); color: var(--info); }
h2 { font-size: 22px; margin: 0 0 6px; font-stretch: 125%; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 700; }

/* ---------- playing cards ---------- */
.card {
  --w: 46px; width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * 0.13);
  background: #ffffff; color: var(--spade); position: relative; display: inline-block; flex: none; user-select: none;
  box-shadow: inset 0 0 0 1px rgba(7,20,40,0.06), 0 calc(var(--w) * 0.12) calc(var(--w) * 0.24) calc(var(--w) * -0.1) rgba(0,0,0,0.65);
}
.card .r { position: absolute; top: calc(var(--w) * 0.08); left: calc(var(--w) * 0.12); font-weight: 800; font-size: calc(var(--w) * 0.38); line-height: 1; letter-spacing: -0.04em; }
.card .s { position: absolute; bottom: calc(var(--w) * 0.08); right: calc(var(--w) * 0.11); font-size: calc(var(--w) * 0.46); line-height: 1; }
.card.s-h { color: var(--heart); }
.card.s-d { color: var(--diamond); }
.card.s-c { color: var(--club); }
.card.back {
  background: repeating-linear-gradient(45deg, rgba(216,192,138,0.32) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(216,192,138,0.32) 0 1px, transparent 1px 5px), #13305a;
  box-shadow: inset 0 0 0 calc(var(--w) * 0.07) #f3efe4, inset 0 0 0 calc(var(--w) * 0.07 + 1px) rgba(216,192,138,0.7), 0 6px 12px -6px rgba(0,0,0,0.7);
}
.card.ghost { background: rgba(243,239,228,0.05); box-shadow: inset 0 0 0 1px rgba(243,239,228,0.12); }
.card.sm { --w: 32px; }
.card.xs { --w: 24px; }
.card.lg { --w: 58px; }
.card.deal { animation: deal 520ms cubic-bezier(.2,.9,.25,1.08) both; }
@keyframes deal { from { transform: translateY(-14px) rotate(-6deg) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.cards { display: inline-flex; gap: 4px; }

/* ---------- play layout ---------- */
.play { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.play > * { min-width: 0; }
@media (max-width: 1180px) { .play { grid-template-columns: 1fr; } }
.table-wrap { display: flex; flex-direction: column; gap: 14px; }
.table { position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 460px; }

/* The table: padded navy rail with a gold hairline on both edges, blue felt lit by one lamp overhead. */
.rail {
  position: absolute; inset: 8% 6% 11%; border-radius: 999px;
  background: linear-gradient(180deg, #1c3f6e 0%, #102a4f 45%, #0a1b36 100%);
  box-shadow: 0 0 0 1px var(--gold-line), inset 0 2px 0 rgba(255,255,255,0.10), inset 0 -3px 6px rgba(0,0,0,0.35), 0 50px 70px -30px rgba(0,0,0,0.85);
}
.felt {
  position: absolute; inset: 20px; border-radius: 999px; overflow: hidden;
  background: radial-gradient(ellipse 55% 60% at 50% 42%, var(--felt-hi) 0%, var(--felt) 45%, #17437c 75%, var(--felt-lo) 100%);
  box-shadow: 0 0 0 1.5px rgba(216,192,138,0.6), inset 0 6px 30px rgba(0,0,0,0.45), inset 0 0 90px rgba(0,0,0,0.3);
}
.felt::before { content: ''; position: absolute; inset: 13% 9%; border-radius: 999px; border: 1px solid rgba(243,239,228,0.10); }
.felt::after {
  content: 'POKER COACH'; position: absolute; left: 50%; top: 70%; transform: translateX(-50%);
  font-size: 13px; font-stretch: 125%; font-weight: 800; letter-spacing: 0.32em; color: rgba(243,239,228,0.09); white-space: nowrap;
}
.center { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 1; }
.board { display: flex; gap: 7px; }
.board .card { --w: 58px; }
.pot { background: rgba(7,20,40,0.55); box-shadow: inset 0 0 0 1px rgba(216,192,138,0.35); padding: 5px 16px; border-radius: 999px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pot small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.banner {
  background: linear-gradient(180deg, rgba(10,27,54,0.96), rgba(7,20,40,0.96)); box-shadow: inset 0 1px 0 var(--gold-line), 0 14px 28px -12px rgba(0,0,0,0.8);
  padding: 10px 16px; border-radius: 12px; text-align: center; max-width: 380px; font-size: 13.5px; animation: rise 440ms var(--ease-out) both;
}
.banner .delta { font-weight: 850; font-stretch: 125%; font-variant-numeric: tabular-nums; }
.banner .delta.pos { color: var(--good); }
.banner .delta.neg { color: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; width: 156px; z-index: 2; }
.seat .seat-cards { display: flex; gap: 3px; height: 52px; align-items: flex-end; }
.seat .seat-cards .card { --w: 36px; }
.seat.hero .seat-cards { height: 80px; }
.seat.hero .seat-cards .card { --w: 56px; }
.seat.hero .seat-cards .card:first-child { rotate: -4deg; }
.seat.hero .seat-cards .card:last-child { rotate: 4deg; }
/* Seat plates are TV lower-thirds: dark glass, gold top hairline. */
.seat-plate {
  display: flex; align-items: center; gap: 9px; padding: 5px 13px 5px 5px; min-width: 132px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, rgba(14,36,68,0.96), rgba(7,20,40,0.96));
  box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px rgba(243,239,228,0.06), 0 12px 22px -10px rgba(0,0,0,0.8);
  transition: box-shadow 180ms ease-out, transform 120ms ease-out;
}
.seat-plate:hover { box-shadow: inset 0 1px 0 var(--gold), inset 0 0 0 1px rgba(243,239,228,0.14), 0 12px 22px -10px rgba(0,0,0,0.8); }
.seat-plate:active { transform: scale(.97); }
.seat.toact .seat-plate { animation: breathe 2400ms ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: inset 0 1px 0 var(--gold), 0 0 0 1.5px var(--gold), 0 0 0 6px rgba(216,192,138,0.14), 0 12px 22px -10px rgba(0,0,0,0.8); }
  50% { box-shadow: inset 0 1px 0 var(--gold), 0 0 0 1.5px var(--gold), 0 0 0 10px rgba(216,192,138,0.04), 0 12px 22px -10px rgba(0,0,0,0.8); }
}
.seat.folded { opacity: 0.42; }
.seat.winner .seat-plate { box-shadow: inset 0 1px 0 var(--gold), 0 0 0 1.5px var(--good), 0 0 0 6px rgba(91,224,165,0.18), 0 12px 22px -10px rgba(0,0,0,0.8); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: var(--night); background: var(--c, #a9b6c9); flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25); }
.avatar.unknown { background: #1d3a64; color: var(--muted); box-shadow: inset 0 0 0 1px rgba(243,239,228,0.18); }
.seat.hero .avatar { background: var(--foil); color: var(--accent-ink); }
.seat-info { line-height: 1.15; min-width: 0; }
.seat-name { font-weight: 700; font-size: 12px; font-stretch: 85%; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92px; }
.seat-name .pos { color: var(--gold); font-weight: 650; font-size: 10.5px; margin-left: 5px; letter-spacing: 0.04em; }
.seat-stack { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text); font-weight: 700; }
.seat-tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(7,20,40,0.7); color: var(--c, var(--muted)); box-shadow: inset 0 0 0 1px rgba(243,239,228,0.08); white-space: nowrap; }
.seat-hud { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; background: rgba(7,20,40,0.55); padding: 1px 7px; border-radius: 6px; }
.bubble {
  position: absolute; top: -12px; z-index: 3; background: var(--ivory); color: var(--night); font-weight: 750; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 6px 12px -4px rgba(0,0,0,0.6); animation: pop 320ms cubic-bezier(.2,.9,.25,1.2) both;
}
.bubble.fold { background: #34465f; color: #d5dde8; }
.bubble.raise, .bubble.bet { background: var(--chip); color: var(--ivory); }
.bubble.allin { background: var(--foil); color: var(--accent-ink); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
/* Bets: a clay chip with its dashed edge, sitting in front of the seat. */
.chips {
  position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; z-index: 1;
  font-size: 12.5px; font-weight: 750; font-variant-numeric: tabular-nums; padding: 2px 9px 2px 3px; border-radius: 999px; background: rgba(7,20,40,0.45);
  animation: pop 320ms cubic-bezier(.2,.9,.25,1.2) both;
}
.chips::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2.5px dashed var(--ivory);
  background: radial-gradient(circle at 40% 35%, #e04456 0%, var(--chip) 60%, #951b2b 100%);
  box-shadow: 0 2px 0 #7e1424, 0 0 0 1px rgba(0,0,0,0.25);
}
.dealer {
  position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; z-index: 1;
  background: var(--ivory); color: var(--night); font-weight: 850; font-size: 11px; display: grid; place-items: center;
  box-shadow: 0 0 0 1.5px var(--gold), 0 3px 0 rgba(0,0,0,0.35);
}

/* ---------- action bar ---------- */
.actionbar {
  border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line), var(--shadow);
}
.actionbar .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actionbar .status { color: var(--muted); font-size: 14px; min-height: 20px; }
.actionbar .status b { color: var(--text); }
.act-btn { min-width: 132px; min-height: 54px; padding: 0 24px; font-size: 16px; font-weight: 750; border-radius: 999px; }
.act-fold { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(243,239,228,0.4); }
.act-fold:hover:not(:disabled) { background: rgba(243,239,228,0.07); }
.act-call { background: var(--ivory); color: var(--night); box-shadow: 0 10px 22px -12px rgba(0,0,0,0.8); }
.act-call:hover:not(:disabled) { background: #ffffff; }
.act-raise { background: radial-gradient(circle at 40% 30%, #dc3a4d 0%, var(--chip) 70%); color: var(--ivory); box-shadow: 0 10px 22px -12px rgba(0,0,0,0.8); }
.act-raise::after { border-color: rgba(243,239,228,0.6); }
.act-raise:hover:not(:disabled) { background: radial-gradient(circle at 40% 30%, #e64a5c 0%, #d0303f 70%) !important; }
.sizer { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 260px; }
.sizer input[type=range] { flex: 1; accent-color: var(--gold); }
.amount-input { width: 92px; background: rgba(7,20,40,0.6); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); border-radius: 10px; padding: 9px 10px; font: inherit; font-variant-numeric: tabular-nums; font-weight: 750; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets .btn { padding: 6px 12px; font-size: 12.5px; }

/* ---------- coach panel ---------- */
.coach { position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 98px); overflow: hidden; }
.coach-tabs { display: flex; padding: 0 6px; box-shadow: inset 0 -1px 0 var(--line); }
.coach-tabs button { position: relative; flex: 1; background: none; border: 0; padding: 13px 0; color: var(--muted); font-weight: 650; transition: color 180ms ease-out; }
.coach-tabs button:hover { color: var(--text); }
.coach-tabs button.active { color: var(--text); }
.coach-tabs button.active::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: 0; height: 2px; border-radius: 1px; background: var(--foil); }
.coach-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13.5px; }
.fb { background: rgba(7,20,40,0.45); box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; padding: 11px 13px; border-left: 3px solid transparent; }
.fb.mistake { border-left-color: var(--bad-mark); }
.fb.blunder { border-left-color: var(--blunder); }
.fb.ok { border-left-color: var(--ok); }
.fb.good { border-left-color: var(--good); }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.fb-title { font-weight: 700; }
.fb-meta { margin-left: auto; color: var(--dim); font-size: 11.5px; }
.fb-line { color: var(--muted); font-size: 13px; margin-top: 5px; }
.fb-steps { margin-top: 10px; display: flex; flex-direction: column; gap: 11px; }
.step h4 { margin: 0 0 3px; font-size: 12.5px; font-weight: 750; color: var(--gold); }
.step p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.rule { background: rgba(216,192,138,0.08); box-shadow: inset 2px 0 0 var(--gold); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; font-weight: 600; }
.rule::before { content: 'Table rule. '; font-weight: 800; color: var(--gold); }
.evtable { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.evtable td { padding: 5px 6px; border-top: 1px solid var(--line); }
.evtable td:last-child { text-align: right; font-weight: 700; }
.evtable tr.best td { color: var(--good); }
.evtable tr.yours td:first-child::after { content: '  (you)'; color: var(--muted); font-weight: 500; }
.comp { display: flex; gap: 2px; height: 10px; margin: 6px 0 4px; }
.comp span { display: block; height: 100%; min-width: 2px; border-radius: 2px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--muted); }
.comp-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.math-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: rgba(7,20,40,0.45); box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; padding: 9px 11px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11.5px; color: var(--muted); }
.meter { position: relative; height: 10px; background: rgba(243,239,228,0.08); border-radius: 5px; overflow: hidden; margin: 7px 0; }
.meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--info); border-radius: 5px; transform-origin: left; animation: fill 900ms cubic-bezier(.65,0,.35,1) both; }
.meter .need { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--gold); }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.math-note { font-size: 13px; color: var(--muted); }
.math-note b { color: var(--text); }
.log-line { font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; color: var(--muted); padding: 1px 0; }
.log-line.street { color: var(--gold); margin-top: 6px; }
.log-line.hero { color: var(--text); }

/* ---------- range grids ---------- */
.rgrid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; font-size: 9.5px; max-width: 380px; }
.rgrid div { background: rgba(243,239,228,0.05); color: var(--dim); text-align: center; padding: 3px 0; font-weight: 650; border-radius: 3px; }
.rgrid div.in { background: rgba(216,192,138,0.85); color: var(--accent-ink); }
.rgrid div.me { outline: 2px solid var(--ivory); outline-offset: -2px; color: var(--ivory); background: var(--chip); }
.rgrid div.me.in { background: var(--chip); color: var(--ivory); }
/* Opponent's range vs. your hand: red = ahead of you, green = behind; brighter = more of their range. */
.vgrid { display: grid; grid-template-columns: 12px repeat(13, minmax(0, 1fr)); gap: 2px; width: 100%; max-width: 340px; }
.vgrid .ax { display: grid; place-items: center; font-size: 9.5px; font-weight: 700; font-stretch: 80%; color: var(--dim); }
.vgrid .c { aspect-ratio: 1; border-radius: 3px; background: rgba(243,239,228,0.05); animation: cell 260ms cubic-bezier(.2,.9,.25,1.1) both; }
@keyframes cell { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
.vlegend { display: flex; flex-direction: column; gap: 12px; font-size: 12px; color: var(--muted); min-width: 0; }
.vlegend .item { display: flex; flex-direction: column; gap: 3px; }
.vlegend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.vlegend .big { font-size: 18px; font-weight: 850; font-stretch: 125%; color: var(--text); letter-spacing: -0.02em; }
.vlegend .note { font-size: 11px; color: var(--dim); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(3,9,20,0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade 200ms ease-out both; }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: linear-gradient(180deg, #102a50 0%, #0a1d3a 100%); border-radius: 22px; width: min(760px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto;
  box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line), 0 40px 80px -30px rgba(0,0,0,0.9);
  animation: rise 440ms var(--ease-out) both;
}
.modal-head { padding: 18px 22px 12px; box-shadow: inset 0 -1px 0 var(--line); display: flex; gap: 12px; align-items: flex-start; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { position: sticky; bottom: 0; z-index: 2; background: #0a1d3a; padding: 14px 22px 18px; box-shadow: inset 0 1px 0 var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-radius: 0 0 22px 22px; }
.modal-foot .btn { min-height: 48px; padding: 0 22px; }
.mistake-hand { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.mistake-hand .label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.settings-grid { display: grid; grid-template-columns: 1fr auto; gap: 14px 18px; align-items: center; }
.settings-grid label { font-weight: 650; }
.settings-grid .hint { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.settings-grid > .btn { justify-self: start; }
select, .input { background: rgba(7,20,40,0.6); color: var(--text); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 10px; padding: 8px 11px; font: inherit; }
.switch { position: relative; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: rgba(243,239,228,0.1); border-radius: 13px; box-shadow: inset 0 0 0 1px var(--line-2); transition: background-color 180ms ease-out; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: transform 180ms var(--ease-out), background-color 180ms ease-out; }
.switch input:checked + span { background: var(--gold-lo); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--ivory); }

/* ---------- coach replay (the mistake moment, broadcast style) ---------- */
.replay .modal-head { flex-direction: column; gap: 10px; }
.replay-top { display: flex; align-items: center; gap: 10px; width: 100%; }
.replay-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px 6px 10px; border-radius: 999px; background: rgba(7,20,40,0.7); box-shadow: inset 0 0 0 1px rgba(216,192,138,0.35); font-size: 13px; font-weight: 650; }
.replay-tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--bad-mark); box-shadow: 0 0 0 3px rgba(229,72,77,0.25); }
.replay-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; width: 100%; }
.replay-title h2 { font-size: 30px; margin: 0; }
.replay-title .headline { color: var(--muted); font-size: 14.5px; margin-top: 6px; max-width: 46em; }
.cost { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.cost .v { font-size: 30px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.03em; color: var(--bad); line-height: 1; }
.cost .k { font-size: 12px; color: var(--muted); margin-top: 4px; }
.replay-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.replay-left, .replay-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.felt-strip {
  position: relative; border-radius: 18px; padding: 16px 14px 34px; display: flex; justify-content: center; gap: 6px;
  background: radial-gradient(ellipse at 50% 40%, var(--felt-hi) 0%, var(--felt) 50%, var(--felt-lo) 100%);
  box-shadow: 0 0 0 1.5px rgba(216,192,138,0.55), 0 0 0 8px #0a1b36, inset 0 0 40px rgba(0,0,0,0.3);
}
.felt-strip .card { --w: 50px; }
.felt-strip .empty-board { color: rgba(243,239,228,0.6); font-weight: 650; padding: 18px 0 4px; }
.plates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: -30px; padding: 0 8px; position: relative; }
.plate {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 9px; height: 56px; padding: 0 12px 0 8px; border-radius: 11px;
  background: linear-gradient(90deg, rgba(7,20,40,0.97) 0%, rgba(13,37,71,0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(216,192,138,0.6), 0 12px 24px -10px rgba(0,0,0,0.8);
  animation: wipe 450ms var(--ease-out) both;
}
.plate:nth-child(2) { animation-delay: 120ms; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.plate .card { --w: 24px; }
.plate .who { display: flex; flex-direction: column; min-width: 0; }
.plate .name { font-weight: 750; font-size: 14px; font-stretch: 80%; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .pctv { margin-left: auto; font-size: 26px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.plate .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(243,239,228,0.08); }
.plate .bar span { display: block; height: 100%; transform-origin: left; animation: fill 900ms cubic-bezier(.65,0,.35,1) 400ms both; }
.price { display: grid; grid-template-columns: 1fr 1fr; border-radius: 13px; background: rgba(243,239,228,0.05); box-shadow: inset 0 0 0 1px rgba(216,192,138,0.25); }
.price > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; }
.price > div + div { box-shadow: inset 1px 0 0 rgba(216,192,138,0.2); }
.price .k { font-size: 12px; color: var(--muted); }
.price .v { font-size: 19px; font-weight: 800; font-stretch: 125%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.price .v small { font-size: 12px; font-weight: 600; font-stretch: 100%; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.price .bad { color: var(--bad); }
.price .good { color: var(--good); }
.range-block { display: flex; flex-direction: column; gap: 8px; }
.range-block .cap { font-size: 13.5px; color: var(--muted); }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 14px; align-items: start; }

/* ---------- AI ---------- */
.ai-box { box-shadow: inset 0 0 0 1px rgba(127,178,240,0.3); background: rgba(127,178,240,0.07); border-radius: 12px; padding: 11px 13px; font-size: 13.5px; }
.ai-box .ai-label { font-size: 12px; font-weight: 750; color: var(--info); margin-bottom: 4px; }
.ai-box p { margin: 0 0 8px; }
.ai-box ul { margin: 0 0 8px; padding-left: 18px; }
.ai-box .table-rule { background: rgba(216,192,138,0.12); border-radius: 6px; padding: 5px 8px; font-weight: 650; }
.ai-ask { display: flex; gap: 6px; margin-top: 6px; }
.ai-ask input { flex: 1; }
.typing::after { content: '▍'; animation: blink 1s steps(2) infinite; color: var(--info); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- popover ---------- */
.profile { width: min(460px, 100%); }
.profile .types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.profile ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.sd-row { display: flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 5px 0; border-top: 1px solid var(--line); }

/* ---------- drills / lessons / progress ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile {
  background: linear-gradient(180deg, rgba(17,42,80,0.9), rgba(12,33,64,0.9)); border: 0; box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line);
  border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left;
  transition: box-shadow 180ms ease-out, transform 180ms ease-out;
}
.tile:hover { box-shadow: inset 0 1px 0 var(--gold), inset 0 0 0 1px var(--line-2), 0 18px 30px -18px rgba(0,0,0,0.8); transform: translateY(-2px); }
.tile .t { font-weight: 800; font-size: 16px; font-stretch: 112%; }
.tile .d { color: var(--muted); font-size: 13px; flex: 1; }
.tile .foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); }
.drill { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.drill-top { display: flex; align-items: center; gap: 12px; }
.drill-score { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.question { background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.question .prompt { font-size: 17px; font-weight: 600; line-height: 1.45; }
.q-visual { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; }
.q-visual .label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.options .btn { min-height: 56px; border-radius: 14px; font-size: 16px; font-weight: 800; font-stretch: 112%; }
.options .btn.right { background: rgba(91,224,165,0.12); box-shadow: inset 0 0 0 1.5px var(--good); opacity: 1; }
.options .btn.wrong:disabled, .options .btn.right:disabled { opacity: 1; }
.options .btn.wrong { background: rgba(242,115,122,0.12); box-shadow: inset 0 0 0 1.5px var(--bad); }
.answer { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; animation: rise 440ms var(--ease-out) both; }
.lessons { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .lessons { grid-template-columns: 1fr; } }
.lesson-list { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 78px; }
.lesson-list button { text-align: left; background: none; border: 0; border-radius: 10px; padding: 10px 12px; color: var(--muted); transition: background-color 180ms ease-out, color 180ms ease-out; }
.lesson-list button:hover { background: rgba(243,239,228,0.05); color: var(--text); }
.lesson-list button.active { background: rgba(243,239,228,0.08); box-shadow: inset 2px 0 0 var(--gold); color: var(--text); }
.lesson-list .n { color: var(--gold); font-weight: 800; margin-right: 8px; }
.lesson { background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line); border-radius: 18px; padding: 26px 30px; max-width: 860px; font-size: 15.5px; line-height: 1.65; }
.lesson h2 { font-size: 28px; margin-bottom: 10px; }
.lesson h3 { margin-top: 20px; font-size: 16.5px; color: var(--gold); }
.lesson table { border-collapse: collapse; margin: 8px 0; font-variant-numeric: tabular-nums; font-size: 14px; }
.lesson td, .lesson th { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; }
.lesson th { background: rgba(243,239,228,0.05); }
.lesson .callout { background: rgba(216,192,138,0.08); box-shadow: inset 3px 0 0 var(--gold); padding: 11px 15px; border-radius: 8px; margin: 12px 0; }
.lesson-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line); border-radius: 16px; padding: 14px 16px; }
.kpi .k { color: var(--muted); font-size: 12.5px; }
.kpi .v { font-size: 28px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi .v.pos { color: var(--good); }
.kpi .v.neg { color: var(--bad); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.panel { background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line); border-radius: 18px; padding: 16px 18px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) 2fr 70px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.bar-track { background: rgba(243,239,228,0.07); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--gold); border-radius: 0 4px 4px 0; transform-origin: left; animation: fill 900ms cubic-bezier(.65,0,.35,1) both; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.list-row { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; border-radius: 6px; }
.list-row:hover { background: rgba(243,239,228,0.05); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 11px 18px; border-radius: 999px; font-weight: 650;
  background: linear-gradient(180deg, #14325c, #0c2140); box-shadow: inset 0 1px 0 var(--gold-line), 0 20px 40px -16px rgba(0,0,0,0.9);
  animation: toastIn 320ms var(--ease-out) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.seat.hero .bubble { top: 30px; right: 100%; margin-right: -8px; }
.welcome ol { margin: 6px 0 0; padding-left: 20px; }
.welcome li { margin-bottom: 6px; }
a { color: var(--gold); }
a:hover { color: var(--gold-hi); }

/* ---------- coach panel: collapsible ---------- */
.coach-tabs .coach-hide { flex: none; width: 40px; padding: 0; display: grid; place-items: center; background: none; border: 0; color: var(--muted); border-radius: 10px; margin: 6px 0; transition: color 180ms ease-out, background-color 180ms ease-out; }
.coach-tabs .coach-hide:hover { color: var(--text); background: rgba(243,239,228,0.06); }
.coach-hide .ico, .coach-open .ico { display: grid; place-items: center; }
.coach-hide svg, .coach-open svg { width: 18px; height: 18px; display: block; }
.coach-open { display: none; }
.play.coach-collapsed .coach-tabs, .play.coach-collapsed .coach-body { display: none; }
.play.coach-collapsed .coach-open {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 14px; background: none; border: 0; color: var(--text); font-weight: 700; border-radius: 18px;
  transition: background-color 180ms ease-out;
}
.play.coach-collapsed .coach-open:hover { background: rgba(243,239,228,0.05); }
.coach-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(243,239,228,0.14); color: var(--text); animation: pop 320ms cubic-bezier(.2,.9,.25,1.2) both; }
.coach-badge.bad { background: var(--bad-mark); color: #fff; }

/* ---------- desktop: the play screen fits the window ----------
   Everything (table, seats, action bar, coach) fits in one screen with no page scroll. The table takes whatever
   room is left and keeps a stadium shape between 1.6:1 and 1.75:1; the coach panel scrolls inside itself. */
@media (min-width: 1181px) and (min-height: 600px) {
  main:has(> #view-play:not([hidden])) { max-width: none; padding: 14px 22px 18px; }
  .play { height: calc(100dvh - 63px - 32px); grid-template-columns: minmax(0, 1fr) 380px; align-items: stretch; }
  .play.coach-collapsed { grid-template-columns: minmax(0, 1fr) 132px; }
  .table-wrap { min-height: 0; height: 100%; }
  .table-box { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; padding: 34px 56px 8px; }
  .table { width: min(100cqw, 175cqh); height: min(100cqh, 62.5cqw); aspect-ratio: auto; min-height: 0; }
  .coach { position: static; top: auto; height: 100%; max-height: none; }
  .play.coach-collapsed .coach { height: auto; align-self: start; }
  /* One compact action bar: status on top, buttons and bet sizing side by side. */
  .actionbar { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; row-gap: 10px; padding: 12px 16px; }
  .actionbar .status { grid-column: 1 / -1; }
  .actionbar > .row:nth-child(3) { flex-wrap: nowrap; justify-content: flex-end; min-width: 0; }
  .actionbar > .row:nth-child(3) .sizer { min-width: 140px; }
  .actionbar > .row:nth-child(3) .presets { flex-wrap: nowrap; }
  .act-btn { min-width: 118px; min-height: 50px; }
}
@media (min-width: 1181px) and (max-height: 760px) {
  .seat-hud { display: none; }
  .seat .seat-cards { height: 44px; }
  .seat .seat-cards .card { --w: 30px; }
  .seat.hero .seat-cards { height: 66px; }
  .seat.hero .seat-cards .card { --w: 46px; }
  .board .card { --w: 50px; }
}

/* ---------- phone ---------- */
@media (max-width: 900px) {
  .replay-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .topbar { flex-wrap: wrap; gap: 6px 10px; padding: 10px 16px 0; }
  .top-right { gap: 8px; }
  .session-chip .sc-label, .session-chip .sc-mistakes { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .brand { font-size: 16px; }
  .brand-sub { display: none; }
  .session-chip { font-size: 12px; padding: 5px 10px; }
  .tabs { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 8px; overflow-x: auto; }
  .tabs a { padding: 11px 12px; }
  main { padding: 10px 12px 24px; }
  .play { gap: 12px; }
  /* The whole table fits between the header and the thumb-zone action bar, so your seat is never hidden. */
  .table { min-height: 400px; aspect-ratio: auto; height: calc(100svh - 300px); margin: 4px 0 0; }
  .rail { inset: 7% 12% 9%; }
  .felt { inset: 12px; }
  .felt::after { top: 74%; font-size: 10px; }
  .center { top: 46%; gap: 8px; }
  .board { gap: 4px; }
  .board .card { --w: 40px; }
  .seat { width: 92px; gap: 2px; }
  .seat-hud, .seat-tag { display: none; }
  .seat-plate { min-width: 0; padding: 3px 8px 3px 3px; gap: 6px; border-radius: 10px; }
  .avatar { width: 26px; height: 26px; font-size: 10px; }
  .seat-name { font-size: 10.5px; max-width: 52px; }
  .seat-name .pos { display: none; }
  .seat-stack { font-size: 11.5px; }
  .seat .seat-cards { height: 34px; }
  .seat .seat-cards .card { --w: 24px; }
  .seat.hero .seat-cards { height: 68px; }
  .seat.hero .seat-cards .card { --w: 48px; }
  .chips { font-size: 11px; }
  .bubble { font-size: 10.5px; padding: 2px 7px; }
  /* Thumb zone: the action bar sticks to the bottom of the screen. */
  .actionbar { position: sticky; bottom: 0; z-index: 10; margin: 0 -12px; border-radius: 22px 22px 0 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .actionbar { gap: 10px; }
  .actionbar .status { font-size: 13.5px; }
  .actionbar .row { flex-wrap: nowrap; }
  .actionbar .row + .row { flex-wrap: wrap; gap: 8px; }
  .sizer { width: 100%; flex: none; }
  .act-btn { min-width: 0; flex: 1; padding: 0 10px; font-size: 15px; }
  .act-btn .kbd { display: none; }
  .sizer { min-width: 0; }
  .presets { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .math-grid { grid-template-columns: 1fr 1fr; }
  .coach { position: static; max-height: none; }
  /* Sheets come up from the bottom on a phone. */
  .modal-back { place-items: end stretch; padding: 0; }
  /* dvh, not vh: on Samsung Internet and Chrome for Android vh includes the area behind the
     address and tool bars, so a 92vh sheet slid its title under the address bar. */
  .modal { width: 100% !important; max-height: 92vh; max-height: 92dvh; border-radius: 24px 24px 0 0; animation: sheet 440ms var(--ease-out) both; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .modal-foot { position: sticky; bottom: 0; background: #0a1d3a; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .modal-foot .kbd { display: none; }
  .replay-title h2 { font-size: 26px; }
  .cost .v { font-size: 24px; }
  .plates { grid-template-columns: 1fr 1fr; }
  .plate { height: 50px; gap: 6px; padding: 0 9px 0 6px; }
  .plate .sub { display: none; }
  .plate .pctv { font-size: 21px; }
  .lesson { padding: 20px 18px; }
  .panels { grid-template-columns: 1fr; }
}
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- account and sync (web sign-in) ---------- */
.settings-section { font-size: 15px; color: var(--gold, #d8c08a); margin: 2px 0 10px; }
.account-box { display: grid; gap: 10px; padding: 14px; margin-bottom: 18px; border-radius: 14px; background: rgba(243, 239, 228, 0.04); border: 1px solid rgba(243, 239, 228, 0.1); }
.account-box > .btn { justify-self: start; }
.account-who { display: grid; gap: 2px; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.account-note { color: var(--bad, #f2737a); margin: 0; font-size: 13px; }
.account-note:empty { display: none; }
.sync-line { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 13px; color: var(--muted, #a9b6c9); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good, #5be0a5); }
.sync-line.offline .sync-dot { background: #f0b860; }

/* ---------- sessions: New session sheet, session panel, summary ---------- */
button.session-chip { border: 0; font: inherit; font-size: 13px; cursor: pointer; transition: box-shadow .15s, background .15s; }
button.session-chip:hover { background: rgba(243,239,228,0.09); box-shadow: inset 0 0 0 1px var(--line-2); }
.new-session-btn { white-space: nowrap; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.settings-note { margin: 10px 0 18px; }

.ns-body { display: grid; gap: 18px; }
.ns-sec { display: grid; gap: 10px; align-content: start; }
.ns-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ns-sec-head h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--gold); }
.ns-sec-head .hint { font-size: 12.5px; }
.ns-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.ns-inline { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(3,9,20,0.45); box-shadow: inset 0 0 0 1px var(--line); justify-self: start; }
.seg button { border: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; padding: 8px 12px; border-radius: 9px; cursor: pointer; min-height: 36px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--ivory); color: var(--night); box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 4px 12px -6px rgba(0,0,0,.6); }
.seg button:focus-visible, .ns-card:focus-visible, .stepper button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: rgba(243,239,228,0.05); color: var(--text); font-size: 20px; cursor: pointer; }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper-v { min-width: 38px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 16px; }

.ns-buyin { display: grid; gap: 6px; }
.ns-buyin input[type=range] { width: 100%; accent-color: var(--gold); }
.ns-buyin output { font-weight: 700; font-variant-numeric: tabular-nums; }
.ns-custom { display: flex; gap: 12px; flex-wrap: wrap; }
.ns-custom label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.ns-custom input { width: 110px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(3,9,20,.45); color: var(--text); font: inherit; }

.ns-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ns-card { text-align: left; display: grid; gap: 3px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: rgba(243,239,228,0.03); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, background .15s, transform .15s var(--ease-out); }
.ns-card b { font-size: 14px; }
.ns-card span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.ns-card:hover { border-color: var(--line-2); }
.ns-card.on { border-color: var(--gold-line); background: linear-gradient(180deg, rgba(216,192,138,0.12), rgba(216,192,138,0.04)); box-shadow: inset 0 0 0 1px var(--gold-line); }
.ns-mix-custom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; align-items: center; }
.ns-type { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.ns-mix-custom .hint { grid-column: 1 / -1; margin: 0; }

.ns-foot { align-items: center; }
.ns-summary { flex: 1; margin: 0; font-size: 13.5px; color: var(--text); min-width: 0; }

.sum-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sum-stat { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: rgba(243,239,228,0.04); box-shadow: inset 0 0 0 1px var(--line); }
.sum-stat .k { font-size: 12px; color: var(--muted); }
.sum-stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sum-stat .v.pos, .sum-big.pos { color: var(--good); }
.sum-stat .v.neg, .sum-big.neg { color: var(--bad); }
.sum-stat .sub { font-size: 11.5px; color: var(--dim); }
.sum-big { font-size: clamp(40px, 7vw, 64px); font-weight: 900; font-stretch: 125%; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.sum-verdict { margin: 10px 0 18px; font-size: 15px; max-width: 60ch; }

@media (max-width: 700px) {
  .ns-two { grid-template-columns: 1fr; }
  .ns-cards, .ns-mix-custom, .sum-grid { grid-template-columns: 1fr 1fr; }
  .new-session-btn { display: none; }
  .ns-foot { flex-wrap: wrap; }
  .ns-summary { flex-basis: 100%; }
}

/* ---------- AI coach dialog (ui/aiKeyDialog.js) ---------- */
.ai-dialog { width: min(720px, 100%); }
.ai-dialog .settings-section { margin: 4px 0 -4px; }
.ai-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.ai-intro { margin: 0; color: var(--text); max-width: 62ch; }
.ai-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ai-hint a, .ai-privacy a { color: var(--gold); }
.ai-provs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ai-prov { display: grid; grid-template-rows: 1fr auto; border-radius: 12px; border: 1px solid var(--line); background: rgba(243,239,228,0.03); transition: border-color .15s, background .15s; }
.ai-prov:hover { border-color: var(--line-2); }
.ai-prov.on { border-color: var(--gold-line); background: linear-gradient(180deg, rgba(216,192,138,0.12), rgba(216,192,138,0.04)); box-shadow: inset 0 0 0 1px var(--gold-line); }
.ai-prov-pick { display: grid; gap: 4px; align-content: start; text-align: left; padding: 12px 13px 6px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; border-radius: 12px 12px 0 0; }
.ai-prov-pick:active { transform: scale(.985); }
.ai-prov-pick:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.ai-prov-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-prov-name b { font-size: 14px; }
.ai-prov-saved { font-size: 11px; font-weight: 700; color: var(--good); padding: 1px 7px; border-radius: 999px; background: rgba(91,224,165,0.12); }
.ai-prov-blurb { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ai-prov-link { justify-self: start; margin: 0 13px 11px; font-size: 12.5px; font-weight: 650; color: var(--gold); text-decoration: none; padding: 2px 0; }
.ai-prov-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ai-pick-first { margin-top: -4px; }
.ai-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.ai-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.ai-field > label { font-weight: 650; font-size: 13px; }
.ai-field select, .ai-field .input { width: 100%; min-height: 40px; }
.ai-warn { margin: 0; font-size: 12.5px; color: var(--ok); }
.ai-warn:empty { display: none; }
.ai-privacy { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(91,224,165,0.06); box-shadow: inset 0 0 0 1px rgba(91,224,165,0.22); }
.ai-privacy p { margin: 0; font-size: 13px; line-height: 1.5; }
.ai-lock { color: var(--good); flex: none; margin-top: 1px; display: grid; }
.ai-usage { display: grid; gap: 10px; }
.ai-usage-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ai-usage-table th, .ai-usage-table td { padding: 7px 8px; text-align: right; box-shadow: inset 0 -1px 0 var(--line); white-space: nowrap; }
.ai-usage-table th:first-child { text-align: left; white-space: normal; }
.ai-usage-table thead th { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.ai-usage-table thead th:first-child { color: var(--gold); }
.ai-usage-table tbody th { font-weight: 700; }
.ai-usage-table tfoot th, .ai-usage-table tfoot td { font-weight: 800; box-shadow: none; }
.ai-usage-models { display: block; font-size: 11px; font-weight: 500; color: var(--dim); overflow-wrap: anywhere; }
.ai-usage-table .dim { color: var(--dim); }
.ai-usage-foot { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.ai-usage-foot .btn { flex: none; }
.ai-off { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.ai-again { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

@media (max-width: 700px) {
  .ai-provs, .ai-fields { grid-template-columns: 1fr; }
  .ai-usage-table th, .ai-usage-table td { padding: 7px 5px; }
  .ai-usage-table thead th { font-size: 11px; white-space: normal; }
}

/* Terms of Use notice (ui/terms.js): under the buttons it names, readable, links plainly links. */
.terms-notice { margin: 12px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); text-align: center; }
.terms-notice a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.modal .terms-notice { text-align: left; margin-top: 14px; }
