@font-face { font-family: 'IBM Plex Sans'; font-weight: 100 700; font-display: swap; src: url(fonts/plex-sans.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(fonts/plex-mono-500.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600 700; font-display: swap; src: url(fonts/plex-mono-600.woff2) format('woff2'); }

/* Calm study: warm paper, a sage table, ink blue as the one accent, burnt orange for mistakes (tells apart from green for colour-blind players) */
:root {
  color-scheme: light;
  --page: #f4f1ea;
  --surface: #fffdf8;
  --ink: #23262a;
  --ink-2: #4a4e54;
  --muted: #6b6f75;
  --grid: #e3ddd0;
  --baseline: #cfc7b6;
  --border: rgba(60, 45, 20, 0.16);
  --wash: rgba(60, 45, 20, 0.05);
  --series-1: #2f5d8a;
  --series-2: #b07a2a;
  --accent: #2f5d8a; /* ink blue, the one accent: links, focus, the current step, primary buttons */
  --on-accent: #fffdf8;
  --pos: #2e7d4f;
  --neg: #c2410c;
  --warn: #a8650f; /* "works, but…" */
  --star: #0f7c86; /* brilliant and great plays */
  /* glossary terms by kind; kept clear of the grade colours */
  --t-action: #6b4fb5;
  --t-seat: #b03a7a;
  --t-cards: #8a5a2b;
  --t-numbers: #2f6fb0;
  --felt: #3f6f62;
  --felt-edge: #35604f;
  --rail: #b9ab92;
  --seat: rgba(255, 253, 248, 0.95);
  --seat-ink: #23262a;
  --heart: #b42318;
  --diamond: #1f5fae;
  --club: #2e7d4f;
  --spade: #23262a;
  /* push/fold chart: one blue ramp, darker = bigger edge for going all-in */
  --pf-1: #b7d3f6;
  --pf-1-ink: #0b0b0b;
  --pf-2: #6da7ec;
  --pf-2-ink: #0b0b0b;
  --pf-3: #256abf;
  --pf-3-ink: #ffffff;
  --band: #e6dfd0; /* usual range behind a stat */
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #15171a;
    --surface: #1e2125;
    --ink: #ece8df;
    --ink-2: #c4c0b6;
    --muted: #9a9da3;
    --grid: #2c3035;
    --baseline: #4a4e54;
    --border: rgba(255, 255, 255, 0.1);
    --wash: rgba(255, 255, 255, 0.05);
    --series-1: #8fb3d9;
    --series-2: #d9a95a;
    --accent: #8fb3d9;
    --on-accent: #15171a;
    --pos: #5fbf88;
    --neg: #f08a4b;
    --warn: #e0a845;
    --star: #4fc3c9;
    --t-action: #b6a2f2;
    --t-seat: #f08cc0;
    --t-cards: #d6ad80;
    --t-numbers: #8db8ea;
    --felt: #2f5249;
    --felt-edge: #26443c;
    --rail: #4a443a;
    --seat: rgba(21, 23, 26, 0.92);
    --seat-ink: #ece8df;
    --pf-1: #184f95;
    --pf-1-ink: #ffffff;
    --pf-2: #2a78d6;
    --pf-2-ink: #ffffff;
    --pf-3: #86b6ef;
    --pf-3-ink: #0b0b0b;
    --band: #3a3d40;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #15171a;
  --surface: #1e2125;
  --ink: #ece8df;
  --ink-2: #c4c0b6;
  --muted: #9a9da3;
  --grid: #2c3035;
  --baseline: #4a4e54;
  --border: rgba(255, 255, 255, 0.1);
  --wash: rgba(255, 255, 255, 0.05);
  --series-1: #8fb3d9;
  --series-2: #d9a95a;
  --accent: #8fb3d9;
  --on-accent: #15171a;
  --pos: #5fbf88;
  --neg: #f08a4b;
  --warn: #e0a845;
  --star: #4fc3c9;
  --t-action: #b6a2f2;
  --t-seat: #f08cc0;
  --t-cards: #d6ad80;
  --t-numbers: #8db8ea;
  --felt: #2f5249;
  --felt-edge: #26443c;
  --rail: #4a443a;
  --seat: rgba(21, 23, 26, 0.92);
  --seat-ink: #ece8df;
  --pf-1: #184f95;
  --pf-1-ink: #ffffff;
  --pf-2: #2a78d6;
  --pf-2-ink: #ffffff;
  --pf-3: #86b6ef;
  --pf-3-ink: #0b0b0b;
  --band: #3a3d40;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
main { min-height: 100vh; }
.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 16px 0 6px; color: var(--ink-2); font-weight: 600; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.foot { margin-top: 24px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* App bar: on every page, sticks to the top */
.appbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 10px max(16px, calc((100% - 1100px) / 2 + 16px));
  background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--grid);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-size: 19px; line-height: 1;
}
.wordmark { font-size: 19px; font-weight: 600; }
.crumb { font-size: 14px; color: var(--muted); }
.crumb a { color: inherit; }
.crumb strong { color: var(--ink); font-weight: 500; }
.spacer { flex: 1; }
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.segmented { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented .chip { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 5px 14px; }
.segmented .chip.on { background: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 600; }
.segmented .chip:not(.on):hover { background: var(--wash); }

/* Home: the last session up top, then one card per section */
.hero-card { border-left: 4px solid var(--accent); }
.hero-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hero-head a { text-decoration: none; font-size: 14px; }
.hero-line { margin: 4px 0 0; font-size: 15px; }
.nav-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.nav-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink); text-decoration: none;
}
a.nav-card:hover { border-color: var(--accent); background: var(--wash); }
.card-title { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.card-go { color: var(--accent); font-size: 18px; line-height: 1; }
.card-big { font-size: 22px; font-weight: 700; }
.card-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.card-line .muted { margin: 0; white-space: nowrap; }
.card-line > :last-child { text-align: right; }
.card-link { font-size: 14px; text-decoration: none; }

/* Filters: one row above everything they scope */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
select, .chip, .more, .ctrl {
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; cursor: pointer;
}
select { border-radius: 8px; }
.chip:hover, .more:hover, .ctrl:hover { background: var(--wash); }
.chip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip:not(.on) { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 24px; font-weight: 600; }
.tile.hero .tile-value { font-size: 40px; line-height: 1.15; }
.tile-note { font-size: 13px; color: var(--muted); }
.tile.open { font: inherit; color: inherit; text-align: left; cursor: pointer; position: relative; }
.tile.open::after { content: '›'; position: absolute; top: 8px; right: 12px; color: var(--muted); font-size: 18px; }
.tile.open:hover { border-color: var(--accent); }
.tile.open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Session dashboard: two columns of panels, one on narrow screens */
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.dash > .panel { margin-bottom: 0; }
.session-tiles .tiles { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.session-tiles .tile-value, .session-tiles .tile.hero .tile-value { font-size: 21px; line-height: 1.3; }
.session-tiles .tile-value { white-space: nowrap; }
.session-head h2 { margin-bottom: 4px; }
.session-head details { margin: 0 0 12px; }
.session-head summary { cursor: pointer; }
.small { font-size: 13px; margin: 10px 0 0; }
dialog.modal .panel { border: 0; padding: 0; }
.ok { color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.game-block h3:first-child { margin-top: 8px; }

table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.data th, .data td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.data th:first-child, .data td.games { text-align: left; }
.data td.games { white-space: normal; color: var(--ink-2); }
.data thead th { color: var(--muted); font-weight: 500; font-size: 13px; text-align: right; }
.data thead th:first-child, .data thead th.left { text-align: left; }
.tile-value .hint { font-size: 14px; font-weight: 400; color: var(--muted); }
.data tbody th { font-weight: 500; }
.data tr.total th, .data tr.total td { font-weight: 600; border-bottom: 0; }
.clickable tbody tr { cursor: pointer; }
.clickable tbody tr:hover { background: var(--wash); }
.clickable tbody tr.selected { background: var(--wash); box-shadow: inset 3px 0 0 var(--accent); }
.more { display: block; margin: 12px auto 0; }

/* Chart */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--baseline); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .end-dot { stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--ink); font-size: 13px; font-weight: 600; }
.chart .crosshair { stroke: var(--baseline); stroke-width: 1; }
.tooltip {
  position: absolute; top: 8px; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); white-space: nowrap;
}
.tip-head { color: var(--muted); margin-bottom: 2px; }
.key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 6px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }

/* Cards */
.cards { display: inline-flex; gap: 3px; }
.card {
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  width: 26px; height: 34px; border-radius: 4px; background: #fffdf8; border: 1px solid #d9d2c3;
  font-weight: 700; font-size: 13px; line-height: 1; color: var(--spade);
}
.card .suit { font-size: 12px; }
.card.lg { width: 40px; height: 54px; font-size: 18px; border-radius: 6px; flex-direction: column; }
.card.lg .suit { font-size: 16px; }
.card.suit-s { color: var(--spade); }
.card.suit-h { color: var(--heart); }
.card.suit-d { color: var(--diamond); }
.card.suit-c { color: var(--club); }
.card.back { background: repeating-linear-gradient(45deg, #2f5d8a 0 4px, #29527a 4px 8px); border-color: rgba(255, 255, 255, 0.5); }
.card.slot { background: transparent; border: 1px dashed rgba(255, 255, 255, 0.25); }

/* Replayer */
.replay-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-bottom: 12px; }
.replay-title { flex: 1; min-width: 200px; }
.hand-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.back, .hand-nav a { text-decoration: none; }
button.back { all: unset; cursor: pointer; color: var(--accent); }
button.back:hover { text-decoration: underline; }
button.back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.walk-start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.walk-start .more { margin: 0; }
.walk-start .muted { margin: 0; }
.more.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.more.primary:hover { filter: brightness(1.08); background: var(--accent); }
.walk-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; margin-bottom: 12px; }
.walk-bar a { text-decoration: none; }
.walk-hands { position: relative; display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 8px; scrollbar-width: thin; }
.walk-hands a { flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; }
.walk-hands a:hover { border-color: var(--accent); }
.walk-hands a[aria-current] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.replay-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.replay-summary .big { font-size: 28px; font-weight: 600; }
.stage { margin-bottom: 12px; }
.felt {
  position: relative; aspect-ratio: 16 / 9; min-height: 300px; border-radius: 999px;
  background: radial-gradient(ellipse at center, var(--felt) 60%, var(--felt-edge) 100%);
  border: 10px solid var(--rail); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.18); margin: 28px auto;
  /* As wide as fits, but short enough that the verdict under it stays above the bottom bar */
  width: min(calc(100% - 80px), calc((100vh - 330px) * 16 / 9));
}
.center { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; }
.board { display: flex; gap: 4px; }
.pot { color: #fffdf8; font-weight: 600; margin-top: 6px; min-height: 1.5em; }
.seat {
  position: absolute; transform: translate(-50%, -50%); min-width: 96px; text-align: center;
  background: var(--seat); color: var(--seat-ink); border-radius: 10px; padding: 4px 8px 6px; font-size: 13px;
  border: 2px solid transparent; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.seat.hero { box-shadow: 0 0 0 2px var(--accent), 0 1px 3px rgba(0, 0, 0, 0.18); }
.seat.acting { border-color: var(--accent); }
.seat.folded { opacity: 0.45; }
.seat-cards { display: flex; justify-content: center; gap: 2px; margin-top: -22px; margin-bottom: 2px; }
.seat-name { font-weight: 600; }
.seat-stack { font-variant-numeric: tabular-nums; }
.seat-action { color: var(--accent); font-size: 12px; font-weight: 600; }
.bet {
  position: absolute; transform: translate(-50%, -50%); background: #fffdf8; color: #23262a;
  border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.dealer {
  position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%;
  background: #fff; color: #0b0b0b; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
/* The replayer's buttons: a bar fixed to the bottom of the window, like a video player's */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px 12px;
  padding: 10px max(16px, calc((100% - 1100px) / 2 + 16px)); background: var(--surface); border-top: 1px solid var(--grid);
  box-shadow: 0 -4px 16px rgba(60, 40, 10, 0.06);
}
.dock-side.end { justify-self: end; }
a.ctrl { color: var(--ink); text-decoration: none; line-height: 30px; }
.ctrl:disabled { opacity: 0.45; cursor: default; background: var(--surface); }
body:has(.dock) main { padding-bottom: 72px; }
.ctrl { border-radius: 8px; min-width: 44px; height: 40px; font-size: 16px; display: inline-grid; place-items: center; }
.more .icon, .import-link .icon { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.narration { text-align: center; font-weight: 600; min-height: 1.5em; margin: 8px 0; }
.ctrl.text { display: inline-block; font-size: 14px; }
.review-summary { margin: 0 0 4px; max-width: 72ch; }
.fold-panel > summary { list-style: none; color: var(--ink); }
.fold-panel > summary::-webkit-details-marker { display: none; }
.fold-panel > summary h2 { display: inline; margin: 0; }
.fold-panel > summary h2::before { content: '▸ '; color: var(--accent); }
.fold-panel[open] > summary h2::before { content: '▾ '; }
.fold-panel[open] > summary { margin-bottom: 8px; }

/* Timeline: a dot per step, your decisions bigger and coloured by verdict */
.steps { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 0; margin: 0 auto 12px; max-width: 760px; }
.steps .street { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 2px 0 8px; }
.dot { all: unset; cursor: pointer; display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.dot.decision { width: 16px; height: 16px; background: var(--muted); }
.dot.good { background: var(--pos); }
.dot.bad { background: var(--neg); }
.dot.warn { background: var(--warn); }
.dot.star { background: var(--star); }
.dot:hover { transform: scale(1.25); }
.dot[aria-current] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.replay-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }

/* The verdict on the current step: a speech bubble pointing up at your seat, which is always bottom centre */
.callout { display: flex; justify-content: center; margin: -30px 16px 4px; position: relative; z-index: 1; }
.callout:empty { display: none; }
.bubble {
  --tone: var(--pos); /* the grade's colour */
  scroll-margin: 72px 0 84px; /* clear of the app bar and the bottom bar when scrolled into view */
  position: relative; max-width: 560px; background: var(--surface); border: 2px solid var(--tone); border-radius: 12px;
  padding: 8px 14px; font-size: 14px; box-shadow: 0 6px 18px rgba(60, 40, 10, 0.14);
}
.bubble.bad { --tone: var(--neg); }
.bubble.warn { --tone: var(--warn); }
.bubble.star { --tone: var(--star); }
.bubble::before, .bubble::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); border: solid transparent;
}
.bubble::before { top: -14px; border-width: 0 12px 14px; border-bottom-color: var(--tone); }
.bubble::after { top: -10px; border-width: 0 10px 11px; border-bottom-color: var(--surface); }
.bubble > summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--tone); text-align: center; }
.bubble > summary::-webkit-details-marker { display: none; }
.bubble > summary::after { content: ' Why?'; color: var(--accent); font-weight: 400; font-size: 13px; }
.bubble[open] > summary::after { content: ''; }
.bubble-body > :first-child { margin-top: 6px; }
.bubble-body > :last-child { margin-bottom: 0; }

/* Quiz: the question hangs from your seat like a verdict; what would give the answer away stays hidden until you pick */
.quiz-locked .spoiler { display: none; }
.bubble.ask { --tone: var(--accent); text-align: center; }
.ask-moves { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.ask-moves .more { margin: 0; min-width: 88px; }
.quiz-bar { text-align: center; max-width: 640px; margin: 0 auto 16px; }
.quiz-bar:empty { display: none; }
.quiz-score { list-style: none; padding: 0; line-height: 1.8; }
.quiz-bar .more { display: inline-block; margin: 8px 0 0; text-decoration: none; }

/* Push/fold verdict and chart */
.verdict { border: 1px solid var(--border); border-left: 4px solid var(--pos); border-radius: 8px; padding: 8px 12px; background: var(--surface); font-size: 14px; }
.verdict.bad { border-left-color: var(--neg); }
.verdict.good > strong { color: var(--pos); }
.verdict.bad > strong { color: var(--neg); }
.range { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; margin-top: 12px; max-width: 560px; font-size: 11px; font-variant-numeric: tabular-nums; }
.range .cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 3px; color: var(--muted); background: var(--wash); }
.range .pf-1, .swatch.pf-1 { background: var(--pf-1); color: var(--pf-1-ink); }
.range .pf-2, .swatch.pf-2 { background: var(--pf-2); color: var(--pf-2-ink); }
.range .pf-3, .swatch.pf-3 { background: var(--pf-3); color: var(--pf-3-ink); }
.range .you { outline: 3px solid var(--ink); outline-offset: -1px; font-weight: 700; position: relative; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; background: var(--wash); }
.legend { flex-wrap: wrap; }
.chart-help { max-width: 560px; margin: 6px 0 0; }
pre { font-size: 12px; overflow-x: auto; background: var(--page); padding: 10px; border-radius: 6px; margin: 8px 0 0; }

section[id] { scroll-margin-top: 72px; }

/* Numbers on the table in a monospace, so stacks line up; big numbers keep the sans with even-width digits */
.seat-stack, .bet { font-family: var(--mono); }
.tile-value, .card-big, .replay-summary .big { font-variant-numeric: tabular-nums; }

/* Terms: hover, focus or tap for the explanation */
.term { color: var(--term, inherit); font-weight: 600; cursor: help; }
.term[data-kind='action'] { --term: var(--t-action); }
.term[data-kind='seat'] { --term: var(--t-seat); }
.term[data-kind='cards'] { --term: var(--t-cards); }
.term[data-kind='numbers'] { --term: var(--t-numbers); }
[data-terms='off'] .term { color: inherit; font-weight: inherit; cursor: inherit; }

/* Settings: a menu under the sliders icon in the app bar */
.menu { position: relative; }
.menu > summary { list-style: none; display: inline-flex; align-items: center; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary .icon { margin: 0; }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; display: grid; gap: 14px; min-width: 290px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(60, 40, 10, 0.16); font-size: 14px;
}
.menu-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; cursor: pointer; }
.menu-row small { font-size: 12px; }
.menu-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.term-tip {
  position: fixed; z-index: 20; max-width: 300px; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.term-tip[hidden] { display: none; }
.glossary { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 16px; margin: 0; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; color: var(--ink-2); }

/* Your game */
.coach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 0 32px; }
.coach-grid > div { min-width: 0; }
.coach h3 { margin-top: 12px; }
.coach p { font-size: 14px; margin: 0 0 8px; }
.coach p.muted { font-size: 13px; }
.style strong { font-size: 18px; }
.stats { display: grid; grid-template-columns: max-content minmax(80px, 1fr) 3em max-content; gap: 8px 12px; align-items: center; font-size: 14px; margin-bottom: 8px; }
.stat { display: contents; }
.stat.few > * { opacity: 0.45; }
.stat-bar { position: relative; height: 8px; border-radius: 4px; background: var(--wash); }
.stat-bar .band { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--band); }
.stat-bar .mark { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.stat-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-verdict { color: var(--muted); font-size: 13px; }
.stat.out .stat-verdict { color: var(--ink); font-weight: 600; }
.focus ul { margin: 0 0 8px; padding-left: 20px; font-size: 14px; }
.focus li { margin-bottom: 6px; }
.leaks { margin: 0; padding-left: 20px; font-size: 14px; }
.leaks > li { margin-bottom: 2px; }
.leak-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
details.leak > summary.leak-head { color: var(--ink); font-size: 14px; list-style: none; padding: 4px 0; }
details.leak > summary.leak-head::-webkit-details-marker { display: none; }
details.leak > summary.leak-head strong::before { content: '▸ '; color: var(--accent); }
details.leak[open] > summary.leak-head strong::before { content: '▾ '; }
details.leak[open] { padding-bottom: 8px; }

/* (i): an explanation tucked away until asked for */
details.help { display: inline; margin-left: 6px; font-weight: 400; }
details.help > summary {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; list-style: none;
  border: 1px solid var(--border); color: var(--muted); font: italic 600 12px/1 Georgia, serif; vertical-align: 2px;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help[open] > summary { background: var(--accent); color: var(--surface); border-color: var(--accent); }
details.help > p { display: block; margin: 6px 0 10px; font-size: 13px; color: var(--ink-2); font-weight: 400; text-transform: none; letter-spacing: 0; }
.leak-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.coach .leak-rule { color: var(--ink-2); margin: 2px 0 4px; }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.leak-hands { list-style: none; margin: 6px 0 0; padding: 0; }
.leak-hands button {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 10px; padding: 6px 8px; border-radius: 6px; font-size: 13px; color: var(--ink-2);
}
.leak-hands button:hover { background: var(--wash); }
.leak-hands button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.leak-hands .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.leak-hands .leak-count { flex: none; min-width: 2.2em; }
.leak-hands .leak-count + span { flex: 1 1 0; min-width: 0; }

/* Equity needed against equity had, under a review note */
.odds { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.odds-bar { position: relative; flex: 0 0 160px; height: 8px; border-radius: 4px; background: var(--wash); }
.odds-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--series-1); }
.odds-need { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); }

/* Review notes from /review-hands */
.bubble .pro { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--grid); }
.bubble .pro > strong { color: var(--ink); }
.bubble .note-kind { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* Leak and strength groups: the hands toggle, then a link under it */
.leak-links { margin: 0 0 4px; font-size: 13px; }
.data .hint { color: var(--muted); }

/* Review progress next to the "Your game" heading */
.progress { display: flex; align-items: center; gap: 10px; }
.progress .muted { margin: 0; }
.progress-bar { position: relative; width: 120px; height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; }
.progress-bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 4px; }

/* Session timeline: tables open, with reviewed decisions marked underneath */
.timeline .mark-bad { stroke: var(--neg); stroke-width: 2.5; stroke-linecap: round; }
.timeline .mark-good { fill: var(--pos); stroke: var(--surface); stroke-width: 2; }
.timeline .hit { fill: transparent; cursor: pointer; }
.timeline .mark-many.bad { fill: var(--neg); }
.timeline .mark-many.good { fill: var(--pos); }
.timeline .mark-count { fill: var(--surface); font-size: 11px; font-weight: 700; pointer-events: none; }
.timeline rect.hit { cursor: crosshair; }
.timeline .hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; }
.glyph { display: inline-block; margin-right: 6px; font-size: 12px; }
.glyph.bad { color: var(--neg); }
.glyph.good { color: var(--pos); }
.session-page > .panel h3 { margin-top: 16px; }

/* Published pro hands */
.pro-hand { border-top: 1px solid var(--grid); padding-top: 12px; margin-top: 12px; }
.pro-hand h3 { margin: 0 0 2px; font-size: 15px; }
.pro-hand .glossary { font-size: 14px; }

@media (max-width: 640px) {
  /* Steps on top, hands under them */
  .dock { grid-template-columns: 1fr 1fr; padding: 8px 12px; }
  .dock .controls { grid-column: 1 / -1; grid-row: 1; }
  body:has(.dock) main { padding-bottom: 120px; }
  /* A fixed height instead of 16:9, which would make the table wider than the screen */
  .felt { margin: 24px 4px; width: auto; aspect-ratio: auto; min-height: 0; height: 280px; border-width: 6px; }
  .seat { min-width: 72px; font-size: 11px; padding: 3px 5px 4px; }
  .callout { margin-top: -12px; }
  .card { width: 22px; height: 30px; font-size: 11px; }
  .card.lg { width: 30px; height: 42px; font-size: 14px; }
  .tile.hero .tile-value { font-size: 32px; }
  .range { font-size: 9px; gap: 1px; }
  .glossary { grid-template-columns: 1fr; gap: 2px; }
  .glossary dd { margin-bottom: 10px; }
  /* Each stat on two lines: name and value, then the bar and verdict */
  .stats { display: block; }
  .stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name value' 'bar verdict'; align-items: center; gap: 4px 12px; margin-bottom: 10px; }
  .stat-name { grid-area: name; }
  .stat-value { grid-area: value; }
  .stat-verdict { grid-area: verdict; }
  .stat-bar { grid-area: bar; }
  /* Many tournaments make a tall stack of chips: one row you swipe instead */
  .game-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .game-chips .chip { flex: none; white-space: nowrap; }
}

/* Import: a drop zone that is also the file picker; files dropped anywhere count too */
.import-link { color: var(--ink); text-decoration: none; font-size: 14px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 8px; }
.import-link:hover { background: var(--wash); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; margin: 12px 0;
  border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center;
}
.dropzone .muted { margin: 0; }
.dropzone:hover, .dropzone:focus-within, body.dragging .dropzone { border-color: var(--accent); background: var(--wash); }
body.dragging main { outline: 3px dashed var(--accent); outline-offset: -6px; }
.import-log { padding-left: 18px; }
.import-log + .more { display: inline-block; margin: 0; text-decoration: none; }

/* Pro hands over the replayer: closing returns to the same step */
dialog.modal {
  width: min(720px, calc(100% - 32px)); max-height: 85vh; overflow: auto; padding: 0 24px 20px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog.modal::backdrop { background: rgba(20, 18, 12, 0.45); }
.modal-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0 8px; background: var(--surface); }
.modal-head h2 { margin: 0; }

/* End of the hand: the review, without a tail, under the table */
.bubble.recap { --tone: var(--accent); width: min(560px, 100%); }
.bubble.recap::before, .bubble.recap::after { display: none; }
.recap-head { display: block; text-align: center; font-size: 15px; }
.recap-list { list-style: none; padding: 0; margin: 8px 0; }
.recap-row { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.recap-row:hover { background: var(--wash); }
.recap-row:focus-visible { outline: 2px solid var(--accent); }
.recap-row.good strong { color: var(--pos); }
.recap-row.bad strong { color: var(--neg); }
.recap-row.warn strong { color: var(--warn); }
.recap-row.star strong { color: var(--star); }
.recap-result { margin: 4px 0 0; font-weight: 600; }
.bubble .size { margin: 6px 0 0; }
.bubble.none { --tone: var(--baseline); color: var(--ink-2); text-align: center; }
