/* poker-table — a card room at night.
   The room is dark walnut and stays quiet; the table under the lamp is the only saturated
   thing on the page. Brass marks what matters right now (the seat to act, the button, the
   active tab). Barlow Condensed carries numbers and names, like broadcast graphics; Barlow
   carries the prose (reasoning, coach notes). */
:root {
  color-scheme: dark;  /* native scrollbars and form controls in the room's colours */
  scrollbar-color: #4a3f35 transparent;
  --room: #1c1713;
  --room-2: #231d18;
  --room-3: #2d261f;
  --room-4: #3a3129;
  --line: #372e27;
  --ivory: #eee5d3;
  --ivory-soft: #a89d8b;
  --ivory-faint: #958c80;  /* the dimmest text that still reads at 4.5:1 on every room surface */
  --brass: #caa24c;
  --brass-hi: #e3c378;
  --up: #86c79f;
  --down: #e5857a;

  --baize: #13663f;
  --baize-deep: #0b442b;
  --baize-edge: #06301e;
  --leather: #2b1812;

  --card: #fbf8f1;
  --card-line: #d6cdbb;
  --suit-red: #c62a2f;
  --suit-black: #16171b;

  --condensed: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --radius-panel: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  display: flex; flex-direction: column;  /* the header takes what it needs, main the rest */
  font: 400 16px/1.5 "Barlow", system-ui, sans-serif;
  color: var(--ivory); background: var(--room);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font: 14px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ivory); background: var(--room-3); padding: 1px 6px; border-radius: 4px; }

button {
  font: inherit; color: var(--ivory); background: var(--room-3);
  border: 1px solid var(--room-4); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
button:hover { background: var(--room-4); }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
.hidden { display: none !important; }

/* ----- the top bar -------------------------------------------------------------------- */
header {
  flex: none; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  min-height: 56px; padding: 0 20px; background: #16120f; border-bottom: 1px solid var(--line);
}
header h1 {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font: 700 23px/1 var(--condensed); letter-spacing: .01em;
}
header h1 .mark { color: var(--brass); font-size: 20px; }
header .file { color: var(--ivory-soft); font-size: 15px; }
header nav { margin-left: auto; display: flex; gap: 2px; align-self: stretch; }
header nav button {
  background: none; border: 0; border-radius: 0; padding: 0 14px;
  font: 600 18px var(--condensed); color: var(--ivory-soft);
  box-shadow: inset 0 -2px 0 transparent;
}
header nav button:hover { background: none; color: var(--ivory); }
header nav button[aria-pressed="true"] { color: var(--ivory); box-shadow: inset 0 -2px 0 var(--brass); }
header nav button.switch { align-self: center; margin-right: 10px; padding: 5px 10px; font: 400 14px "Barlow", sans-serif; box-shadow: none; }
header .live { display: inline-flex; align-items: center; gap: 8px; color: var(--ivory-soft); }
header .live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 10px var(--brass); }
header .live.over::before { background: var(--ivory-faint); box-shadow: none; }
header .live.turn::before { animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }

/* ----- the room ----------------------------------------------------------------------- */
main { flex: 1; min-height: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
main > * { overflow-y: auto; min-height: 0; }

/* hand list: the result first, the board underneath, the pot on the right */
aside { background: var(--room-2); border-right: 1px solid var(--line); overflow-x: hidden; }
aside ol { list-style: none; margin: 0; padding: 0; }
aside li button {
  display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 2px; align-items: baseline;
  width: 100%; text-align: left; border: 0; border-radius: 0; border-bottom: 1px solid var(--line);
  background: none; padding: 9px 14px 10px;
}
aside li button:hover { background: var(--room-3); }
aside li button[aria-current="true"] { background: var(--room-3); box-shadow: inset 3px 0 var(--brass); }
aside .id { font: 500 15px var(--condensed); color: var(--ivory-faint); }
aside .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
aside .who .won { color: var(--up); font-family: var(--condensed); font-weight: 600; }
aside .pot { font: 600 15px var(--condensed); color: var(--ivory-soft); }
aside .mini { grid-column: 2 / -1; display: flex; gap: 6px; align-items: baseline; font: 600 14px var(--condensed); letter-spacing: .02em; }
aside .mini .c { color: #d9d2c4; }
aside .mini .c.r { color: #ef8a80; }
aside .mini .none { color: var(--ivory-faint); font-weight: 500; }
aside .mini .sd { color: var(--ivory-faint); font-weight: 500; }
aside .more { display: block; width: 100%; margin: 8px 0 20px; background: none; border: 0; color: var(--ivory-soft); }
.filters { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; background: var(--room-2); border-bottom: 1px solid var(--line); }
.filters select { flex: 1 1 130px; min-width: 0; padding: 4px 6px; font: 500 14px/1.3 "Barlow", system-ui, sans-serif; color: var(--ivory); background: var(--room-3); border: 1px solid var(--room-4); border-radius: 6px; }
aside .line { grid-column: 2 / -1; font-size: 13px; line-height: 1.3; color: var(--ivory-soft); }
aside .line.out { color: var(--brass-hi); }
aside li.subset .count { flex: 1 1 100%; }
aside li.subset .scanning { display: block; font-size: 13px; font-weight: 400; color: var(--ivory-soft); }
aside li.subset { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--room-3); font-size: 14px; }
aside li.subset button { display: inline-block; width: auto; padding: 2px 10px; font-size: 13px; background: var(--room-3); border: 1px solid var(--room-4); border-radius: 6px; }

/* ----- the stage: the table under a lamp, the log beside it ----------------------------- */
section.hand { padding: 0; }
#replay { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: 100%; }
.stage {
  container-type: inline-size; overflow-y: auto; overflow-x: hidden; min-height: 0; padding: 18px 28px 28px;
  isolation: isolate;  /* so the rail, drawn behind the table, still paints over the lamp */
  background: radial-gradient(ellipse 75% 60% at 50% 40%, #33291f 0%, #231c16 45%, var(--room) 80%);
}
.side { display: flex; flex-direction: column; min-height: 0; background: var(--room-2); border-left: 1px solid var(--line); }
@media (max-width: 1180px) {
  section.hand { overflow-y: auto; }
  #replay { display: block; height: auto; }
  .stage { overflow: visible; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .side .log { max-height: 60vh; }
}
/* A phone scrolls the page as one, the way phones do. Boxes that each scroll left the table and
   the action bar fighting over what was left under the list, and gave the leaderboard the list's
   short row. The list keeps a short box of its own, and an empty one takes no room. */
@media (max-width: 860px) {
  html, body { height: auto; overflow: visible; }
  body { min-height: 100%; }
  main { display: block; }
  main > *, section.hand { overflow-y: visible; }
  main > aside { max-height: 30vh; overflow-y: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}

.hand-title { margin: 0; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-weight: 400; }
.hand-title strong { font: 700 26px/1.1 var(--condensed); }
.hand-title span { color: var(--ivory-soft); font-size: 15px; }

/* The table: a stadium of baize, a wooden racetrack, a padded leather rail, and a lamp. */
.table {
  position: relative; width: min(calc(100% - 84px), 1040px); aspect-ratio: 1.95 / 1; margin: 70px auto 78px;
  border-radius: 9999px;
  background:
    radial-gradient(ellipse 55% 60% at 50% 42%, rgba(255, 250, 225, .13), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 70% 75% at 50% 45%, var(--baize) 0%, var(--baize-deep) 72%, var(--baize-edge) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 60px rgba(0, 0, 0, .45);
  /* no transform, perspective or z-index here: any of them makes the table a stacking context,
     and the rail and racetrack behind it would paint over the baize */
}
/* where the seats sit, in % of the table, and how far their bets go toward the pot; read by the script */
.table { --seat-rx: 44; --seat-ry: 50; --bet-reach: .56; }
.table::before {  /* the rail */
  content: ""; position: absolute; inset: -32px; border-radius: 9999px; z-index: -1;
  background: radial-gradient(ellipse 80% 90% at 50% 18%, #5b3526 0%, #3a2019 40%, #1e0f0b 100%);
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .85), inset 0 2px 1px rgba(255, 214, 170, .16), inset 0 -4px 10px rgba(0, 0, 0, .6);
}
.table::after {  /* the racetrack, a thin ring of wood between rail and felt */
  content: ""; position: absolute; inset: -7px; border-radius: 9999px; z-index: -1;
  background: linear-gradient(180deg, #9a7148 0%, #6d4b2e 50%, #4a321f 100%);
}
.table .center { position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.table .board { display: flex; gap: clamp(4px, .7cqi, 8px); justify-content: center; min-height: clamp(48px, 7.6cqi, 82px); perspective: 900px; }
.table .pot { min-height: 30px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.table .pot .pot-label { font: 600 clamp(16px, 2.1cqi, 22px)/1 var(--condensed); color: var(--ivory); letter-spacing: .01em; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

/* ----- seats: broadcast nameplates at the rail ------------------------------------------- */
.seat { position: absolute; width: clamp(150px, 21cqi, 204px); transform: translate(-50%, -50%); z-index: 2; }
.seat .plate {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "av name stack" "av pos pos";
  column-gap: 9px; row-gap: 1px; align-items: center;
  padding: 7px 11px 7px 8px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(38, 31, 25, .96), rgba(24, 19, 15, .96));
  border: 1px solid #4a3e33; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .9);
}
.seat .plate .id { display: contents; }
.seat .plate .avatar { grid-area: av; }
.seat .plate .name { grid-area: name; min-width: 0; }
.seat .plate .pos { grid-area: pos; min-width: 0; }
.seat .plate .stack { grid-area: stack; }
.seat .name { font: 600 clamp(15px, 1.9cqi, 18px)/1.1 var(--condensed); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .pos { font-size: 12px; line-height: 1.3; color: var(--ivory-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .pos b { font: 600 13px var(--condensed); color: var(--ivory); margin-right: 4px; }
.seat .stack { font: 600 clamp(15px, 1.9cqi, 18px)/1 var(--condensed); color: var(--ivory); text-align: right; }
.seat .stack.allin { color: var(--brass-hi); }
.seat .plate .won { grid-column: 1 / -1; margin-top: 4px; font: 700 15px var(--condensed); color: var(--brass-hi); }

/* win chances, the broadcast strip under the plate */
.seat .equity { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 6px; }
.seat .equity .bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.seat .equity .bar i { display: block; height: 100%; width: var(--p); background: var(--brass); border-radius: 3px; }
.seat .equity b { font: 700 15px/1 var(--condensed); min-width: 3ch; text-align: right; }
.seat .equity.lead .bar i { background: var(--brass-hi); }
.seat .equity.nil { opacity: .45; }
@media (prefers-reduced-motion: no-preference) { .seat .equity .bar i { transition: width .45s cubic-bezier(.2, .8, .2, 1); } }

.seat.acting .plate { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass), 0 0 26px -4px rgba(202, 162, 76, .55), 0 10px 22px -10px rgba(0, 0, 0, .9); }
.seat.winner .plate { border-color: var(--brass-hi); background: linear-gradient(180deg, #3a2f1f, #241c12); }
.seat.folded .plate { opacity: .5; }
.seat.folded .cards { opacity: .35; filter: saturate(.3); }

/* hole cards sit on the felt, on the table side of the plate */
.seat .cards { position: absolute; left: 50%; display: flex; gap: 3px; transform: translateX(-50%); }
.seat.bottom .cards { bottom: calc(100% - 6px); }
.seat.top .cards { top: calc(100% - 6px); }
.seat.bottom .plate, .seat.top .plate { z-index: 1; }
.seat.bottom .button { bottom: calc(100% + 8px); }
.seat.top .button { top: calc(100% + 8px); }

/* a bet sits halfway from its seat to the pot (the script measures the way, --bx/--by) */
.seat .bet {
  position: absolute; left: 50%; top: 50%; z-index: 0;
  transform: translate(calc(-50% + var(--bx, 0px)), calc(-50% + var(--by, 0px)));
}
.seat .button {
  position: absolute; z-index: 3; width: 24px; height: 24px; border-radius: 50%; left: calc(50% + clamp(40px, 6.4cqi, 58px));
  display: grid; place-items: center; font: 700 12px var(--condensed); color: #1b1814;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #ebe6da 60%, #cfc7b6 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .55), inset 0 -1px 0 rgba(0, 0, 0, .15);
}

/* avatars: initials on a disc in the seat's colour; model seats wear a ring */
.avatar {
  position: relative; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c); color: #fff; font: 700 13px var(--condensed); letter-spacing: .03em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25);
}
.avatar.llm { box-shadow: 0 0 0 2px #1d1712, 0 0 0 3.5px var(--brass), inset 0 -2px 0 rgba(0, 0, 0, .25); }
.avatar.model { box-shadow: 0 0 0 2px #1d1712, 0 0 0 3.5px #7fb4c9, inset 0 -2px 0 rgba(0, 0, 0, .25); }
.avatar.human { color: #1d1712; }
.avatar .glyph {
  position: absolute; right: -5px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: #1d1712; color: var(--c); font-size: 10px; line-height: 16px; text-align: center; border: 1px solid #4a3e33;
}

/* thinking, the ticker for model seats, and table talk as a note beside the plate */
.thinking { display: inline-flex; gap: 4px; height: 8px; grid-column: 1 / -1; justify-self: center; margin-top: 5px; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--brass); animation: blink 1.1s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; }
.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.ticker { grid-column: 1 / -1; font: 500 13px var(--condensed); color: var(--ivory-soft); text-align: center; margin-top: 2px; }
.ticker.settled { color: var(--up); }
.bubble {
  position: absolute; top: 50%; z-index: 6; width: max-content; max-width: 220px;
  padding: 7px 11px; border-radius: 10px; background: var(--card); color: #2a241d;
  font-style: italic; font-size: 14px; line-height: 1.35; box-shadow: 0 8px 18px -6px rgba(0, 0, 0, .7);
  animation: pop .18s ease-out;
}
.seat.left .bubble { left: calc(100% + 12px); transform: translateY(-50%); }
.seat.right .bubble { right: calc(100% + 12px); transform: translateY(-50%); }
.bubble::after { content: ""; position: absolute; top: 50%; width: 10px; height: 10px; background: var(--card); transform: translateY(-50%) rotate(45deg); }
.seat.left .bubble::after { left: -4px; }
.seat.right .bubble::after { right: -4px; }
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .thinking i, .bubble, header .live.turn::before { animation: none; } }

/* ----- cards ---------------------------------------------------------------------------- */
.card {
  --w: clamp(36px, 5.6cqi, 60px);
  position: relative; display: inline-block; width: var(--w); aspect-ratio: 5 / 7; border-radius: calc(var(--w) * .1);
  background: linear-gradient(170deg, #fffdf8, var(--card) 60%, #efe8da);
  color: var(--suit-black); box-shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 4px 10px -4px rgba(0, 0, 0, .6), inset 0 0 0 1px var(--card-line);
  font-family: var(--condensed); font-weight: 700; line-height: 1; overflow: hidden;
}
.card.red { color: var(--suit-red); }
.card .rank { position: absolute; left: 10%; top: 6%; font-size: calc(var(--w) * .42); letter-spacing: -.02em; }
.card .suit { position: absolute; left: 11%; top: 44%; font-size: calc(var(--w) * .28); font-family: system-ui, sans-serif; }
.card .pip { position: absolute; right: 7%; bottom: 3%; font-size: calc(var(--w) * .62); font-family: system-ui, sans-serif; opacity: .95; }
.card.small { --w: clamp(30px, 4.8cqi, 46px); }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 230, 220, .16) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-45deg, rgba(255, 230, 220, .16) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 50% 50%, #8e2a30, #641a1f);
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .6), inset 0 0 0 2px #f4efe4, inset 0 0 0 3px #4c1216;
}
/* cards in the log are text-sized: an index and a suit, no pip */
.log .card { --w: 25px; border-radius: 3px; }
.log .card .pip { display: none; }
.log .card .rank { left: 0; right: 0; top: 3px; text-align: center; font-size: 15px; }
.log .card .suit { left: 0; right: 0; top: auto; bottom: 3px; text-align: center; font-size: 12px; }

/* ----- chips: clay, with edge spots --------------------------------------------------- */
.chipstack { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding-left: 28px; }
.chipstack .chip {
  position: absolute; left: 0; width: 24px; height: 24px; border-radius: 50%;
  background:
    radial-gradient(circle, var(--ch) 0 36%, rgba(255, 255, 255, .8) 37% 41%, var(--ch) 42% 63%, transparent 64%),
    repeating-conic-gradient(var(--ch) 0deg 30deg, var(--spot) 30deg 45deg);
  box-shadow: 0 1.5px 0 rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .22);
}
.chip.white { --ch: #ebe5d6; --spot: #3169a8; }
.chip.red { --ch: #b8322a; --spot: #f4efe4; }
.chip.green { --ch: #1f7a4a; --spot: #f4efe4; }
.chip.black { --ch: #24211e; --spot: #d9c28a; }
.chipstack b {
  font: 600 14px/20px var(--condensed); color: var(--ivory); padding: 0 8px; border-radius: 10px;
  background: rgba(10, 8, 6, .62);
}
.ghost { position: absolute; pointer-events: none; z-index: 5; }

/* ----- transport ------------------------------------------------------------------------ */
.your-odds { flex: 1 1 100%; margin: 0; color: var(--ivory-soft); }
.your-odds strong { color: var(--ivory); }
.your-odds .good { color: var(--up); font-weight: 600; }
.your-odds .bad { color: var(--down); font-weight: 600; }

/* The commentary, under the table like a broadcast caption. The height is held so that the
   controls below stay put when a line comes and goes. */
.call {
  max-width: 1040px; min-height: 1.3em; margin: 12px auto;
  font: 500 clamp(17px, 2.1cqi, 21px)/1.3 var(--condensed); color: var(--ivory); text-align: center;
}
@container (max-width: 700px) { .call { min-height: 2.6em; } }
.controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  max-width: 1040px; margin: 0 auto; padding: 8px 10px; border-radius: var(--radius-panel);
  background: rgba(35, 29, 24, .92); border: 1px solid var(--line);
}
.transport { display: flex; align-items: center; gap: 2px; }
.controls button.icon, .controls button.play {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 36px; padding: 0 8px; background: none; border: 0; border-radius: 8px; color: var(--ivory);
}
.controls button.icon:hover, .controls button.play:hover { background: var(--room-3); }
.controls svg { width: 16px; height: 16px; fill: currentColor; }
.controls button.play { padding: 0 14px 0 10px; background: var(--room-3); font: 600 16px var(--condensed); }
.controls button.play[aria-pressed="true"] { background: var(--brass); color: #1d1712; }
.controls button.play .when-on, .controls button.play[aria-pressed="true"] .when-off { display: none; }
.controls button.play[aria-pressed="true"] .when-on { display: inline; }
.controls .street { font: 600 16px var(--condensed); color: var(--ivory-soft); min-width: 5.5em; }
.switches { display: flex; gap: 4px; margin-left: auto; }
.switch {
  display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid transparent;
  padding: 5px 10px; border-radius: 999px; font-size: 14px; color: var(--ivory-faint);
}
.switch::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--room-4); box-shadow: inset 0 0 0 1px var(--ivory-faint); }
.switch:hover { background: var(--room-3); color: var(--ivory-soft); }
.switch[aria-pressed="true"] { color: var(--ivory); }
.switch[aria-pressed="true"]::before { background: var(--brass); box-shadow: 0 0 8px rgba(202, 162, 76, .7); }
.controls .pace-wrap { display: inline-flex; align-items: center; gap: 8px; color: var(--ivory-soft); font-size: 14px; }
.controls .pace-wrap input { width: 90px; }

input[type=range] { -webkit-appearance: none; appearance: none; background: none; height: 20px; cursor: pointer; }
#scrub { flex: 1 1 160px; min-width: 120px; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--room-4); }
#scrub::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--brass) var(--pct, 0%), var(--room-4) var(--pct, 0%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--room-4); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--brass); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--brass-hi); border: 0; box-shadow: 0 0 0 3px rgba(202, 162, 76, .25); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--brass-hi); border: 0; }

/* On a phone the table stands up, the way mobile poker clients draw it, and the plates keep
   only what fits: name, stack, win chance, with the seat's colour as an edge. This block must
   come after the seat, card and transport rules it overrides: in a tie, the later rule wins. */
@media (max-width: 640px) {
  .stage { padding: 12px 12px 20px; }
  .hand-title strong { font-size: 22px; }
  /* Bets stop short of the middle, so they sit beside the board rather than on it, and the
     board moves up into the room that leaves. */
  .table { --seat-rx: 38; --seat-ry: 46; --bet-reach: .42; width: calc(100% - 40px); aspect-ratio: .8 / 1; margin: 50px auto 54px; }
  .table::before { inset: -17px; }
  .table::after { inset: -5px; }
  .table .center { top: 47%; }
  .table .board { gap: 3px; }
  .table .board .card { --w: 30px; }
  .seat { width: 108px; }
  .seat .plate { grid-template-columns: 1fr auto; grid-template-areas: "name stack"; padding: 5px 8px; border-left: 3px solid var(--c, #4a3e33); }
  .seat .plate .avatar, .seat .plate .pos { display: none; }
  .seat .name, .seat .stack { font-size: 15px; }
  .seat .equity { margin-top: 4px; gap: 6px; }
  .seat .equity b { font-size: 14px; }
  .seat .bubble { max-width: 150px; font-size: 13px; }
  .card.small { --w: 30px; }
  .controls { gap: 6px 10px; padding: 6px; }
  .controls .street { min-width: 0; }
  .switches { margin-left: 0; }
}

/* ----- the numbers for the seat to act ------------------------------------------------ */
.odds { max-width: 1040px; margin: 10px auto 0; padding: 12px 16px; border-radius: var(--radius-panel); background: rgba(35, 29, 24, .92); border: 1px solid var(--line); font-size: 14px; }
.odds .head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.odds .head strong { font: 600 18px var(--condensed); }
.odds .head .price { color: var(--ivory-soft); margin-left: auto; }
.odds .row { display: grid; grid-template-columns: 8.5em minmax(60px, 12em) 3.2em 1fr; gap: 10px; align-items: center; padding: 3px 0; }
.odds .row .what { color: var(--ivory-soft); }
.odds .bar { background: var(--room-4); border-radius: 3px; height: 8px; overflow: hidden; }
.odds .bar i { display: block; height: 100%; background: var(--baize); background: #2f8a5c; border-radius: 3px; }
.odds .row.exact .bar i { background: var(--brass); }
.odds .row b { text-align: right; font: 700 17px var(--condensed); }
.odds .note { color: var(--ivory-soft); font-size: 13px; }
.odds .foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ivory-soft); }
.odds .foot strong { color: var(--ivory); }
.odds .foot .good { color: var(--up); font-weight: 600; }
.odds .foot .bad { color: var(--down); font-weight: 600; }
@media (max-width: 720px) {
  .odds .row { grid-template-columns: 1fr auto; grid-template-areas: "what pct" "bar bar" "note note"; row-gap: 4px; padding: 6px 0; }
  .odds .row .what { grid-area: what; } .odds .row b { grid-area: pct; } .odds .row .bar { grid-area: bar; } .odds .row .note { grid-area: note; }
  .odds .head .price { margin-left: 0; width: 100%; }
}

/* ----- the log, beside the table -------------------------------------------------------- */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.side-head h3 { margin: 0; font: 600 18px var(--condensed); }
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 16px; }
.log ol { list-style: none; margin: 0; padding: 0; }
.log li { padding: 8px 18px 9px; font-size: 15px; color: var(--ivory-soft); border-left: 3px solid transparent; }
.log li .who { font: 600 16px var(--condensed); color: var(--ivory); margin-right: 2px; }
.log li.future { opacity: .3; }
.log li.current { background: var(--room-3); border-left-color: var(--brass); color: var(--ivory); }
.log li.street {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--line); font: 600 17px var(--condensed); color: var(--ivory);
}
.log li.street .cards { display: inline-flex; gap: 3px; }
.log li .talk { font-style: italic; color: var(--ivory); }
.log li .think { display: block; margin-top: 5px; padding-left: 12px; border-left: 2px solid var(--room-4); color: var(--ivory-soft); font-size: 14px; line-height: 1.45; }
.log li .think .illegal { color: var(--down); }
.log li .think .note { display: block; margin-top: 3px; color: var(--brass-hi); }
.log li .meta { display: inline-block; margin-left: 8px; font: 500 13px var(--condensed); color: var(--ivory-faint); }
.log li.win { color: var(--brass-hi); }
.log li.win .who { color: var(--brass-hi); }
.log.no-think .think { display: none; }

.summary { border-top: 1px solid var(--line); padding: 12px 18px 16px; font-size: 14px; color: var(--ivory-soft); }
.summary:empty, .summary.pending { display: none; }  /* the result waits for the end of the hand */
.summary table { border-collapse: collapse; width: 100%; }
.summary td, .summary th { text-align: left; padding: 3px 8px 3px 0; }
.summary th { font: 600 14px var(--condensed); color: var(--ivory-faint); }
.summary td:first-child { color: var(--ivory); font-weight: 500; }
.summary td.num, .summary th.num { text-align: right; font-family: var(--condensed); font-size: 16px; }
.summary .plus { color: var(--up); font-weight: 600; }
.summary .minus { color: var(--down); }
.summary p { margin: 8px 0 0; }
.summary p.out { color: var(--brass-hi); font-weight: 500; }

/* ----- the empty table, before a hand is picked ---------------------------------------- */
.empty { display: grid; place-items: center; min-height: 100%; padding: 40px 24px;
  background: radial-gradient(ellipse 75% 60% at 50% 45%, #33291f 0%, #231c16 45%, var(--room) 80%); }
.felt-empty {
  max-width: 720px; padding: 64px 72px; border-radius: 9999px; text-align: center; color: var(--ivory);
  background: radial-gradient(ellipse 70% 75% at 50% 45%, var(--baize) 0%, var(--baize-deep) 72%, var(--baize-edge) 100%);
  box-shadow: 0 0 0 7px #6d4b2e, 0 0 0 30px var(--leather), 0 40px 80px -24px rgba(0, 0, 0, .85);
}
.felt-empty p { margin: 0 0 10px; color: #cfe3d5; }
.felt-empty .lead { font: 600 30px/1.15 var(--condensed); color: var(--ivory); margin-bottom: 14px; }
.felt-empty code { display: inline-block; margin: 2px 0 14px; background: rgba(0, 0, 0, .3); color: #eaf3ec; }
.felt-empty p code { margin: 0; }
@media (max-width: 640px) {
  .felt-empty { padding: 40px 26px; border-radius: 48px; box-shadow: 0 0 0 5px #6d4b2e, 0 0 0 16px var(--leather), 0 30px 60px -20px rgba(0, 0, 0, .85); }
  .felt-empty .lead { font-size: 24px; }
  .felt-empty code { font-size: 12px; }
  header { padding: 8px 14px 0; gap: 4px 12px; }
  header nav { width: 100%; margin-left: 0; justify-content: space-between; }
  header nav button { padding: 8px 6px 10px; font-size: 17px; }
}

/* ----- the human seat's action bar ---------------------------------------------------- */
.action-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  max-width: 1040px; margin: 0 auto 16px; padding: 12px 14px; border-radius: var(--radius-panel);
  background: #2a2117; border: 1px solid var(--brass); box-shadow: 0 0 30px -10px rgba(202, 162, 76, .5);
}
.action-bar .lead { width: 100%; font: 600 18px var(--condensed); }
.action-bar .lead span { font: 400 15px "Barlow", sans-serif; color: var(--ivory-soft); margin-left: 6px; }
.action-bar button { font: 600 17px var(--condensed); padding: 7px 18px; }
.action-bar button.primary { background: #1f7a4a; border-color: #2a8f59; color: #f3fbf6; }
.action-bar button.primary:hover { background: #238a54; }
.action-bar #act-raise { background: var(--brass); border-color: var(--brass-hi); color: #1d1712; }
.action-bar .size { display: inline-flex; align-items: center; gap: 6px; }
.action-bar input { font: inherit; color: var(--ivory); background: var(--room-2); border: 1px solid var(--room-4); border-radius: 8px; padding: 6px 10px; }
.action-bar input[type=number] { width: 96px; font: 600 17px var(--condensed); }
.action-bar input[type=text] { flex: 1 1 220px; }
.action-bar .quick { display: inline-flex; gap: 4px; }
.action-bar .quick button { font: 500 14px var(--condensed); padding: 4px 9px; }
.action-bar .talk-list { width: 100%; color: var(--ivory-soft); font-style: italic; }
@media (max-width: 640px) {
  .action-bar { gap: 8px; padding: 10px 12px; }
  .action-bar .size { flex-wrap: wrap; width: 100%; }
  .action-bar #act-raise { white-space: nowrap; }
  .action-bar .quick { flex: 1 1 100%; }
  .action-bar .quick button { flex: 1; }
}

/* ----- leaderboard ---------------------------------------------------------------------- */
section.board-view, section.coach-view { grid-column: 1 / -1; padding: 22px 28px 48px; }
section.board-view h2, section.coach-view h2 { margin: 0 0 16px; font: 700 26px/1.15 var(--condensed); }
/* The verdict, ahead of the numbers it qualifies. */
.board-call { margin: -8px 0 16px; max-width: 70ch; font: 500 19px/1.35 var(--condensed); }
.board-call:empty, .board-note:empty { display: none; }
.board-note { margin: 12px 0 0; max-width: 80ch; color: var(--ivory-soft); font-size: 14px; }
.leaderboard { background: var(--room-2); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow-x: auto; }
.leaderboard table { border-collapse: collapse; width: 100%; min-width: 900px; }
.leaderboard th, .leaderboard td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.leaderboard tr:last-child td { border-bottom: 0; }
.leaderboard th { font: 600 15px var(--condensed); color: var(--ivory-soft); background: var(--room-3); }
.leaderboard th[title] { cursor: help; }
.leaderboard td { font: 500 17px var(--condensed); }
.leaderboard th:first-child, .leaderboard td:first-child { text-align: left; }
.leaderboard td:first-child { font: 600 18px var(--condensed); }
.leaderboard tbody tr:first-child td:first-child::before { content: "♠"; color: var(--brass); margin-right: 8px; }
.leaderboard td.plus { color: var(--up); font-weight: 700; }
.leaderboard td.minus { color: var(--down); }
.leaderboard tbody tr:hover { background: var(--room-3); }
.leaderboard.standings { max-width: 560px; margin-bottom: 18px; }
.leaderboard.standings table { min-width: 0; }
.leaderboard.standings td:first-child, .leaderboard.standings th:first-child { width: 4.5em; }
.leaderboard.standings td:nth-child(2), .leaderboard.standings th:nth-child(2) { text-align: left; }

/* bankroll chart: the reference categorical palette, dark steps, in its fixed order.
   Validated on this surface (#231d18): every slot inside the lightness band and >= 3:1,
   worst adjacent CVD separation 8.4, worst normal-vision separation 19.3. */
.viz-root {
  color-scheme: dark;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --grid: #3a3129; --axis-text: var(--ivory-soft);
  background: var(--room-2); border: 1px solid var(--line); border-radius: var(--radius-panel);
  padding: 14px 18px 10px; margin-bottom: 16px;
}
.viz-root .viz-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.viz-root .viz-head h3 { margin: 0; font: 600 20px var(--condensed); }
.viz-root .viz-head span { color: var(--ivory-soft); }
.viz-root .viz-head button { margin-left: auto; padding: 3px 10px; font-size: 14px; }
.viz-root figure { margin: 0; position: relative; }
.viz-root svg { display: block; width: 100%; height: 280px; }
.viz-root .grid line { stroke: var(--grid); stroke-width: 1; }
.viz-root .zero { stroke: var(--ivory-faint); stroke-width: 1; }
.viz-root .axis text { fill: var(--axis-text); font: 500 13px var(--condensed); }
.viz-root .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-root .end-label { font: 600 14px var(--condensed); fill: var(--ivory); }
.viz-root .crosshair { stroke: var(--ivory-faint); stroke-width: 1; pointer-events: none; }
.viz-root .dot { stroke: var(--room-2); stroke-width: 2; pointer-events: none; }
.viz-root .tip {
  position: absolute; top: 8px; pointer-events: none; background: var(--room); color: var(--ivory);
  border: 1px solid var(--room-4); border-radius: 8px; padding: 7px 11px; font-size: 14px; white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .8);
}
.viz-root .tip b { display: block; margin-bottom: 3px; font-family: var(--condensed); }
.viz-root .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.viz-root .legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 14px; color: var(--ivory-soft); }
.viz-root .legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--c); vertical-align: middle; margin-right: 7px; }
.viz-root .viz-table { max-height: 280px; overflow: auto; }
.viz-root .viz-table table { border-collapse: collapse; width: 100%; }
.viz-root .viz-table th, .viz-root .viz-table td { padding: 4px 10px; text-align: right; border-bottom: 1px solid var(--grid); font-family: var(--condensed); }
.viz-root .viz-table th:first-child, .viz-root .viz-table td:first-child { text-align: left; }

/* ----- coach ---------------------------------------------------------------------------- */
section.coach-view > * { max-width: 960px; }
.seat-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.seat-picker button { font: 600 16px var(--condensed); padding: 5px 14px; border-radius: 999px; }
.seat-picker button[aria-pressed="true"] { background: var(--brass); border-color: var(--brass-hi); color: #1d1712; }
.week-picker button { font-size: 14px; padding: 3px 12px; }
.coach { background: var(--room-2); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 18px 22px; }
.coach .lead { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; padding-bottom: 14px; }
.coach .lead strong { font: 700 26px var(--condensed); }
.coach .lead span { color: var(--ivory-soft); }
.coach .lead .plus { color: var(--up); font: 600 19px var(--condensed); }
.coach .lead .minus { color: var(--down); font: 600 19px var(--condensed); }
.coach .lead button { margin-left: auto; }
.coach ol.leaks { list-style: none; margin: 0; padding: 0; counter-reset: leak; }
.coach ol.leaks > li { padding: 16px 0; border-top: 1px solid var(--line); counter-increment: leak; }
.coach ol.leaks > li > h3 { margin: 0 0 6px; font: 600 20px/1.2 var(--condensed); }
.coach ol.leaks > li > h3::before { content: counter(leak); display: inline-block; min-width: 1.6em; color: var(--brass); }
.coach .rate { color: var(--ivory-soft); font: 400 16px "Barlow", sans-serif; }
.coach .leak-link { font-size: 13px; padding: 2px 10px; margin-left: 8px; vertical-align: 2px; border-radius: 999px; }
.coach .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px 1.6em; }
.coach .chips span { background: var(--room-3); border-radius: 999px; padding: 1px 10px; font: 500 14px var(--condensed); color: var(--ivory-soft); }
.coach .chips span.street-chip { background: none; border: 1px solid var(--room-4); }
.coach ul.examples { margin: 0 0 0 1.6em; padding: 0; list-style: none; }
.coach ul.examples li { padding: 3px 0; color: var(--ivory-soft); }
.coach ul.examples a { color: var(--brass-hi); font: 600 16px var(--condensed); text-decoration: none; margin-right: 8px; }
.coach ul.examples a:hover { text-decoration: underline; }
.coach ul.examples .where { color: var(--ivory-faint); margin-right: 6px; }
.coach .note { margin: 10px 0 0 1.6em; padding: 10px 14px; background: #2b2318; border-left: 3px solid var(--brass); border-radius: 0 8px 8px 0; }
.coach .note .do { font-weight: 600; margin-top: 4px; color: var(--ivory); }
.coach h4 { margin: 20px 0 6px; font: 600 19px var(--condensed); }
.coach ul.plain { margin: 0; padding-left: 20px; color: var(--ivory-soft); }
.coach .focus { margin-top: 16px; padding: 12px 14px; background: #2b2318; border: 1px solid var(--brass); border-radius: 8px; font-weight: 600; }
.coach .empty-note { color: var(--ivory-soft); }

/* ----- drill ---------------------------------------------------------------------------- */
.drill-side { padding: 18px 16px; }
.drill-side h2 { margin: 0 0 12px; font: 700 20px/1.2 var(--condensed); }
.drill-side .seat-picker button { font-size: 15px; padding: 3px 12px; }
.drill-side .progress { font-size: 14px; color: var(--ivory-soft); margin-bottom: 12px; }
.drill-side .progress strong { color: var(--ivory); font-family: var(--condensed); font-size: 17px; }
.drill-side .boxes { display: flex; gap: 3px; margin-top: 8px; height: 8px; }
.drill-side .boxes span { flex: 1; background: var(--room-4); border-radius: 3px; position: relative; overflow: hidden; }
.drill-side .boxes span i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--brass); }
.drill-side .boxes-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--ivory-faint); margin-top: 3px; }
.drill-side .verdict { background: var(--room-3); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; border-left: 3px solid var(--brass); }
.drill-side .verdict.right { border-left-color: var(--up); }
.drill-side .verdict.wrong { border-left-color: var(--down); }
.drill-side .verdict b { display: block; margin-bottom: 4px; font: 600 17px var(--condensed); }
.drill-side .verdict .table-said { color: var(--ivory-soft); font-size: 14px; margin-top: 4px; }
.drill-side .drill-actions { display: flex; gap: 8px; }
.drill-side .drill-actions button { flex: 1; white-space: nowrap; }
.drill-side button.primary { background: var(--brass); border-color: var(--brass-hi); color: #1d1712; font-weight: 600; }
.drill-side .hint { font-size: 13px; color: var(--ivory-faint); margin: 14px 0 0; }
.drill-side .done { background: var(--room-3); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .seat .plate, .log li { transition: background-color .2s, border-color .2s, opacity .2s, box-shadow .25s; }
}
