/* Layout: header with account bar, tab bar, then one view at a time. The felt
   table holds the cards and the decision; a quiet sidebar keeps score; both
   stack on phones. Colours and type match Coach Texas so the apps read as a pair. */
:root {
  /* light theme (an option from v2.8; dark green is the default, set on <html> by js/theme.js) */
  --bg: #edf1ec; --surface: #ffffff; --surface-2: #f3f6f1; --fg: #15201b; --muted: #5a6862; --line: #d5ddd6;
  --felt: #0f6b3f; --felt-edge: #0a4a2c; --on-felt: #eef5f0; --on-felt-muted: #c6ddd1; --seat: rgba(0,0,0,.18);
  --accent: #b5862a; --accent-ink: #1b1406; --accent-soft: #f3e7cc; --accent-on-felt: #f2d68a;
  --good: #1d7f47; --good-bg: #dff1e5; --bad: #b8262f; --bad-bg: #f6d9db; --okay: #8f6c0c; --okay-bg: #f5ecd2;
  --card: #fbfaf5; --card-line: #d8d4c8; --card-back: #7a2f2f; --card-back-2: #8f3a3a; --red-suit: #c8323a; --black-suit: #1b1f24;
  --c-hit: #f6d9db; --c-stand: #dff1e5; --c-double: #dbe6f2; --c-split: #f3e7cc; --c-surr: #e6def0; --c-ink: #15201b;
  --chart: #12805c;
  /* the casino look (v2.8, agreed 18 Nov 2026): leather rail, chip tray, roulette stripe */
  --leather: #7a1d2b; --leather-edge: #5e1520; --roulette-red: #a3162b; --roulette-black: #0a0a0a; --chip-black: #1b1b1b;
  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 14px;
}
/* dark green: the default */
:root[data-theme="dark"] {
  --bg: #0f2a20; --surface: #153528; --surface-2: #1a3d2f; --fg: #e3ebe7; --muted: #a3bdb0; --line: #285443;
  --seat: rgba(0,0,0,.25);
  --accent: #d6a646; --accent-ink: #1b1406; --accent-soft: #3a2f17;
  --good: #7fdca4; --good-bg: #1f4d33; --bad: #f2707a; --bad-bg: #3d1b20; --okay: #d9b34e; --okay-bg: #322a12;
  --chart: #2fae7a; --c-hit: #4a2a28; --c-stand: #1f4d33; --c-double: #22344b; --c-split: #463a1f; --c-surr: #3a2f47; --c-ink: #e3ebe7;
  color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(40px, env(safe-area-inset-bottom, 0px)); }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.wrap > * { min-width: 0; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: .01em; text-wrap: balance; margin: 0; line-height: 1.1; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }

/* header */
header.top { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand h1 { font-size: clamp(26px, 5vw, 36px); }
.brand .sub { color: var(--muted); font-size: 13px; }
.account { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.account .who { color: var(--muted); }
.pill-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; }
.pill-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill-btn.armed { color: var(--bad); border-color: var(--bad); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.sync-dot.ok { background: var(--good); } .sync-dot.err { background: var(--bad); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; justify-content: space-between; }
label.field { display: grid; gap: 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 14px; max-width: 100%; text-transform: none; letter-spacing: 0; }
.edge { font-size: 13px; color: var(--muted); margin: 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; width: fit-content; max-width: 100%; }
.tab { border: 0; background: none; color: var(--muted); padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); font-weight: 700; }
.seg button[aria-selected="true"] { background: var(--fg); color: var(--bg); }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .main { grid-template-columns: minmax(0, 1fr); } }
.col { display: grid; gap: 12px; min-width: 0; }

/* felt table */
/* v2.8: the felt sits in a padded wine-leather rail (the border) with the chip tray at the dealer's side */
.table { position: relative; color: var(--on-felt); border: 9px solid transparent;
  background: radial-gradient(120% 90% at 50% 35%, var(--felt) 55%, var(--felt-edge) 100%) padding-box,
    linear-gradient(180deg, var(--leather), var(--leather-edge)) border-box;
  border-radius: 34px; padding: 20px clamp(12px, 3vw, 24px); display: grid; gap: 14px; min-width: 0;
  box-shadow: inset 0 0 0 4px var(--felt-edge), inset 0 1px 0 rgba(255,255,255,.08), 0 10px 30px -18px rgba(0,0,0,.6); }
@media (min-width: 861px) {
  .table:not(.count-table) { padding-top: 34px; }
  .table:not(.count-table)::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 132px; height: 24px;
    border-radius: 0 0 12px 12px; pointer-events: none;
    background:
      radial-gradient(circle at 18px 11px, var(--roulette-red) 0 6px, rgba(255,255,255,.85) 6px 7.5px, var(--roulette-red) 7.5px 9px, transparent 9.5px),
      radial-gradient(circle at 42px 11px, var(--chip-black) 0 6px, rgba(255,255,255,.85) 6px 7.5px, var(--chip-black) 7.5px 9px, transparent 9.5px),
      radial-gradient(circle at 66px 11px, var(--felt) 0 6px, rgba(255,255,255,.85) 6px 7.5px, var(--felt) 7.5px 9px, transparent 9.5px),
      radial-gradient(circle at 90px 11px, var(--roulette-red) 0 6px, rgba(255,255,255,.85) 6px 7.5px, var(--roulette-red) 7.5px 9px, transparent 9.5px),
      radial-gradient(circle at 114px 11px, var(--chip-black) 0 6px, rgba(255,255,255,.85) 6px 7.5px, var(--chip-black) 7.5px 9px, transparent 9.5px),
      var(--roulette-black); }
}
/* the roulette stripe under the header: red and black pockets with one green zero */
.roulette-stripe { height: 8px; border-radius: 2px; background:
  linear-gradient(90deg, transparent 0 calc(50% - 9px), var(--felt) calc(50% - 9px) calc(50% + 9px), transparent calc(50% + 9px)),
  repeating-linear-gradient(90deg, var(--roulette-red) 0 18px, var(--roulette-black) 18px 36px); }
.seat { display: grid; gap: 6px; justify-items: center; }
.seat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--on-felt-muted); }
.hand { display: flex; gap: 8px; justify-content: center; min-height: 92px; flex-wrap: wrap; }
.hand-name, .table-note { font-size: 15px; text-align: center; }
.table .hint { color: var(--on-felt-muted); text-align: center; }

.card { --w: clamp(56px, 13vw, 72px); width: var(--w); height: calc(var(--w) * 1.4); border-radius: 8px; background: var(--card);
  border: 1px solid var(--card-line); color: var(--black-suit); display: grid; place-content: center; justify-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.25); font-family: var(--f-display); font-weight: 700; line-height: 1; flex: none; }
.card .r { font-size: calc(var(--w) * .5); }
.card .s { font-size: calc(var(--w) * .34); margin-top: -2px; }
.card .s .pip { width: 1em; height: 1em; display: block; }
.card.red { color: var(--red-suit); }
.card.back { background: repeating-linear-gradient(45deg, var(--card-back) 0 6px, var(--card-back-2) 6px 12px); border: 3px solid var(--card); }
.card.small { --w: clamp(42px, 10vw, 54px); }
.card.deal { animation: deal .26s ease-out both; }
.card.deal:nth-child(2) { animation-delay: .05s; }
@keyframes deal { from { transform: translateY(-8px) scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .card.deal { animation: none; } }

.actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 480px) { .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.act { background: var(--card); color: #1a1a1a; border: 0; border-radius: 12px; padding: 11px 6px 9px; font-weight: 700; font-size: 15px;
  display: grid; gap: 1px; justify-items: center; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.act kbd { font-family: var(--f-mono); font-size: 11px; color: #6c6c6c; font-weight: 400; }
.act:disabled { opacity: .28; cursor: not-allowed; }
.act.picked-good { outline: 3px solid var(--good); }
.act.picked-bad { outline: 3px solid var(--bad); }
.act.is-best { box-shadow: 0 0 0 3px var(--accent); }
.bar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.bar-row p { margin: 0; }
.btn-felt { background: var(--card); color: #1a1a1a; border: 0; border-radius: 10px; padding: 9px 18px; font-weight: 700; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn-dark { background: var(--fg); color: var(--bg); border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 700; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.25); color: var(--on-felt); font-size: 20px; line-height: 1; }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 5.5em; text-align: center; font-family: var(--f-mono); }
.felt-chip { background: rgba(0,0,0,.25); color: var(--on-felt); border: 0; border-radius: 999px; padding: 5px 12px; font-family: var(--f-mono); font-size: 13px; }
.felt-input { width: 6.5em; font-family: var(--f-mono); font-size: 18px; padding: 7px 10px; border-radius: 10px; border: 0; background: var(--card); color: #1a1a1a; text-align: center; }

.feedback { background: var(--surface); color: var(--fg); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.verdict { font-family: var(--f-display); font-size: 22px; line-height: 1.15; margin: 0; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }
.why { margin: 0; }
.note { margin: 0; font-size: 14px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; }
.evs { display: grid; gap: 4px; }
.ev-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 70px; gap: 8px; align-items: center; font-size: 14px; }
.ev-row .name { color: var(--muted); }
.ev-row.best .name { color: var(--fg); font-weight: 700; }
.ev-row .val { text-align: right; font-family: var(--f-mono); }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; position: relative; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.next-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seq { display: flex; flex-wrap: wrap; gap: 4px; font-family: var(--f-mono); font-size: 12px; }
.seq span { padding: 2px 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.seq .p { color: var(--good); } .seq .m { color: var(--bad); }
.pm-note { margin: 0; border-radius: 10px; padding: 9px 12px; font-size: 14px; background: var(--surface); color: var(--fg); border-left: 4px solid var(--good); }
.pm-note.bad { border-left-color: var(--bad); }

.pm-info { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--on-felt-muted); }
.pm-info b { color: var(--on-felt); font-family: var(--f-mono); font-weight: 500; }
.shoebar { flex: 1 1 160px; min-width: 120px; display: grid; gap: 3px; }
.shoebar .track { height: 6px; border-radius: 3px; background: rgba(0,0,0,.25); position: relative; }
.shoebar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--on-felt-muted); }
.shoebar .cutmark { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; background: var(--accent); }
.pm-hands { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.pm-hand { display: grid; gap: 6px; justify-items: center; padding: 8px; border-radius: 12px; border: 2px solid transparent; }
.pm-hand.active { border-color: var(--accent); }
.pm-hand .hand { min-height: 0; flex-wrap: nowrap; }
.pm-hand .card + .card { margin-left: -26px; }
.pm-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 13px; color: var(--on-felt-muted); }
.res.win { color: #8fe0ad; font-weight: 700; } .res.lose { color: #f2a3a8; font-weight: 700; } .res.push { color: var(--on-felt); font-weight: 700; }

/* sidebar */
aside { display: grid; gap: 14px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; min-width: 0; }
.panel h2 { font-size: 12px; font-family: var(--f-body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.stat b { display: block; font-family: var(--f-mono); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.cat-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 70px; gap: 8px; align-items: center; font-size: 13px; }
.cat-row .bar i { background: var(--good); left: 0; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.list li { display: flex; justify-content: space-between; gap: 8px; }
.list button { background: none; border: 0; padding: 0; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.empty { color: var(--muted); font-size: 14px; margin: 0; }
.reset { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--muted); justify-self: start; }
.reset.armed { border-color: var(--bad); color: var(--bad); }

/* chart */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr)); gap: 18px; align-items: start; }
.chart-grid > div { min-width: 0; }
.chart-grid h3 { font-size: 20px; margin-bottom: 6px; }
.scroll-x { overflow-x: auto; }
table.chart { border-collapse: separate; border-spacing: 2px; font-family: var(--f-mono); font-size: 13px; }
table.chart th { font-weight: 500; color: var(--muted); padding: 3px 6px; text-align: center; }
table.chart th.rowh { text-align: left; color: var(--fg); min-width: 44px; }
table.chart td { padding: 0; }
table.chart td button { width: 40px; height: 30px; border: 0; border-radius: 4px; color: var(--c-ink); font-family: var(--f-mono); font-size: 12px; position: relative; }
.k-H { background: var(--c-hit); } .k-S { background: var(--c-stand); } .k-D { background: var(--c-double); }
.k-P { background: var(--c-split); } .k-R { background: var(--c-surr); }
.miss { position: absolute; top: 2px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.exc { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }

/* counting */
.count-wrap { display: grid; gap: 14px; max-width: 760px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); margin: 0; }
.tags b { font-family: var(--f-mono); font-weight: 500; color: var(--fg); }
.count-table { justify-items: center; text-align: center; }
.count-table label.field { color: var(--on-felt-muted); }
.count-table select { background: rgba(0,0,0,.25); color: var(--on-felt); border-color: transparent; }
.count-table .feedback { width: 100%; text-align: left; }
.slot { min-height: 150px; display: grid; place-items: center; }
.slot .card { --w: 96px; }
#bet-panel { grid-template-columns: minmax(0, 1fr); }
#bet-panel > * { min-width: 0; }
#bet-panel .bar-row { flex-wrap: wrap; justify-content: center; }
.bet-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); width: 100%; max-width: 520px; justify-self: center; }
@media (max-width: 480px) { .bet-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); } }
.bet-ask { margin: 0; font-weight: 700; }
.tc-board { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; align-items: center; }
.big { font-family: var(--f-display); font-size: 40px; line-height: 1; }
.big small { display: block; font-family: var(--f-body); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--on-felt-muted); margin-bottom: 6px; }
.tray-box { width: 64px; height: 156px; border: 2px solid var(--on-felt-muted); border-top: 0; border-radius: 0 0 6px 6px; position: relative; overflow: hidden; }
.tray-fill { position: absolute; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(0deg, var(--card) 0 3px, #cfd3cc 3px 4px); }
.tray-ticks { position: absolute; inset: 0; display: grid; }
.tray-ticks i { border-top: 1px dashed rgba(255,255,255,.25); }
.tray-ticks i:first-child { border-top: 0; }
.tc-badge { display: inline-flex; align-items: baseline; gap: 8px; background: rgba(0,0,0,.25); border-radius: 999px; padding: 6px 14px; font-size: 14px; color: var(--on-felt-muted); }
.tc-badge b { font-family: var(--f-mono); font-size: 20px; color: var(--accent); font-weight: 500; }

/* review */
.rv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rv-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
table.ramp { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.ramp th, table.ramp td { padding: 4px 10px; text-align: right; border-bottom: 1px solid var(--line); }
table.ramp th:first-child, table.ramp td:first-child { text-align: left; }
table.ramp th { color: var(--muted); font-weight: 500; }

/* sign-in sheet */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(8,14,12,.55); display: grid; place-items: start center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { background: var(--surface); border-radius: 18px; width: min(420px, 100%); padding: 18px; display: grid; gap: 12px; margin-top: 8vh; box-shadow: 0 20px 50px -20px rgba(0,0,0,.6); }
.sheet h3 { font-size: 24px; }
.sheet form { display: grid; gap: 10px; }
.sheet input:not([type="checkbox"]) { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font-size: 16px; }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.sheet .err { color: var(--bad); font-size: 14px; margin: 0; }
.sheet p { margin: 0; }
.sheet .ok-msg { color: var(--good); font-size: 14px; margin: 0; }
.sheet .toggle { align-items: flex-start; }
.sheet .toggle input { margin-top: 3px; flex: none; }
.sheet .stack { display: grid; gap: 8px; }
.big-btn { padding: 11px 16px; font-size: 15px; text-align: center; }
.link-btn { border-color: transparent; background: none; text-decoration: underline; color: var(--muted); }
.sheet .linkish { background: none; border: 0; padding: 0; color: var(--fg); text-decoration: underline; font: inherit; cursor: pointer; }
.sheet details.danger { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.sheet details.danger[open] { display: grid; }
.sheet details.danger summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.sheet details.danger > * + * { margin-top: 8px; }
.danger-btn { color: var(--bad); border-color: var(--bad); }
.sync-dot.busy { background: var(--accent); }
footer.foot { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer.foot a { color: var(--fg); }

/* learn */
.learn { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .learn { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.toc { display: grid; gap: 4px; position: sticky; top: max(12px, env(safe-area-inset-top, 0px)); }
@media (max-width: 860px) { .toc { position: static; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; } }
.toc-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; align-items: center; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.toc-item .no { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--f-display); font-weight: 700; font-size: 13px; }
.toc-item[aria-current="page"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.toc-item[aria-current="page"] .no { background: var(--accent); color: var(--accent-ink); }
.toc-item .no.done { background: var(--good-bg); color: var(--good); }
.toc-item[aria-current="page"] .no.done { background: var(--good); color: var(--bg); }
.toc-item { position: relative; }
.toc-score { grid-column: 2; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .toc-score { grid-column: auto; } }
.quiz { display: grid; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.quiz h3 { font-size: 22px; }
.quiz .small { margin: 0; }
.qz { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; min-width: 0; background: var(--surface); }
.qz.ok { border-color: var(--good); }
.qz.no { border-color: var(--bad); }
.qz legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 700; }
.qz legend .no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-family: var(--f-display); font-size: 13px; margin-right: 4px; }
.qz-opts { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.qz-opt { border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 10px; padding: 8px 12px; font-size: 14px; text-align: left; min-height: 40px; max-width: 100%; }
.qz-opt:not([disabled]):hover { border-color: var(--fg); }
.qz-opt[disabled] { cursor: default; color: var(--muted); }
.qz-opt.is-right { color: var(--fg); background: var(--good-bg); border-color: var(--good); }
.qz-opt.is-wrong { color: var(--fg); background: var(--bad-bg); border-color: var(--bad); }
.qz-opt.is-right::before { content: "✓ "; font-weight: 700; }
.qz-opt.is-wrong::before { content: "✗ "; font-weight: 700; }
.qz-why { clear: both; margin: 10px 0 0; }
.qz-done { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.qz-done p { margin: 0; }
@media (max-width: 860px) { .toc-item { flex: none; white-space: nowrap; border: 1px solid var(--line); } }
.guide { display: grid; gap: 14px; max-width: 70ch; min-width: 0; }
.guide h2 { font-size: clamp(28px, 4vw, 36px); }
.guide h3 { font-size: 21px; margin-top: 6px; }
.guide p, .guide li { font-size: 16px; line-height: 1.6; margin: 0; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.bul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.formula { font-family: var(--f-mono); font-size: 15px !important; background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; width: fit-content; max-width: 100%; overflow-wrap: anywhere; }
.small { font-size: 13px !important; color: var(--muted); }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num { font-family: var(--f-mono); white-space: nowrap; }
.learn-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }

/* feedback */
.topbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.sheet.wide { width: min(640px, 100%); }
.sheet textarea { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px; resize: vertical; text-transform: none; letter-spacing: 0; color: var(--fg); font-family: var(--f-body); }
.fb-ctx { margin: 0; white-space: pre-wrap; font-family: var(--f-mono); font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; max-height: 9em; overflow: auto; }
.fb-status { margin: 0; font-size: 14px; }
.fb-status.ok { color: var(--good); } .fb-status.bad { color: var(--bad); }
.inbox { display: grid; gap: 10px; max-height: 65vh; overflow: auto; }
.fb-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.fb-item p { margin: 0; white-space: pre-wrap; }
.fb-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; justify-content: space-between; }
.toolbar label.field { flex: 1 1 240px; max-width: 380px; min-width: 0; }
.toolbar label.field select { width: 100%; text-overflow: ellipsis; }

/* review */
.review-tag { margin: 0; justify-self: center; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 700; }
.review-line { margin: 0; font-size: 14px; }

/* progress */
.pr-body { display: grid; gap: 14px; }
.pr-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .pr-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pr-tiles .stat b { font-size: 28px; }
.pr-shoes { display: grid; gap: 6px; }
.pr-shoe { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pr-shoe > summary { cursor: pointer; padding: 9px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; list-style: none; }
.pr-shoe > summary::-webkit-details-marker { display: none; }
.pr-shoe > summary .when { font-weight: 700; }
.pr-shoe > summary .what { grid-column: 1; font-size: 13px; color: var(--muted); }
.pr-shoe > summary .res { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-variant-numeric: tabular-nums; }
.pr-shoe > summary .res b { display: block; }
.pr-shoe .tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--fg); margin-left: 6px; vertical-align: 1px; }
.pr-shoe .body { padding: 0 12px 12px; display: grid; gap: 8px; }
.pr-shoe .body ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.pr-lessons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
@media (max-width: 720px) { .pr-lessons { grid-template-columns: minmax(0, 1fr); } }
.pr-lessons li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pr-lessons .st { font-size: 13px; color: var(--muted); }
.pr-lessons .st.ok { color: var(--good); font-weight: 700; }
.pr-charts, .pr-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 860px) { .pr-charts, .pr-two { grid-template-columns: minmax(0, 1fr); } }
.chart-box { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { stroke: var(--muted); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; font-family: var(--f-mono); }
.chart-svg .dlabel { fill: var(--fg); font-size: 12px; font-family: var(--f-mono); font-weight: 500; }
.chart-svg .bar { fill: var(--chart); }
.chart-svg .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart-svg .dot.on { r: 6; }
.chart-svg .hit { fill: transparent; }
.chart-tip { position: absolute; top: -30px; transform: translateX(-50%); z-index: 2; background: var(--fg); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.chart-empty { margin: 0; padding: 30px 0; text-align: center; font-size: 14px; }
details.panel summary { cursor: pointer; font-size: 14px; color: var(--muted); }

/* privacy page */
.privacy-wrap { max-width: 860px; }
.privacy { display: grid; gap: 10px; }
.privacy h3 { margin-top: 10px; font-size: 22px; }
.privacy p, .privacy ul { margin: 0; }
.privacy a { color: inherit; }
a.pill-btn { text-decoration: none; color: var(--fg); display: inline-flex; align-items: center; }

/* ================= phones and touch (v1.5) ================= */
.tab .ic, .tab .sh { display: none; }
.opts-btn { display: none; }
button, a, select, label, .act, .chip, .tab { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.install-tip { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.install-tip p { margin: 0; flex: 1 1 220px; }
.ios-share { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.ios-share::before { content: ""; width: 12px; height: 15px; display: inline-block; vertical-align: -2px;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 15'%3E%3Cpath d='M6 0 2.5 3.5l1 1L5.3 2.7V9h1.4V2.7l1.8 1.8 1-1zM1 6h2v1.3H1.3v6.4h9.4V7.3H9V6h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 15'%3E%3Cpath d='M6 0 2.5 3.5l1 1L5.3 2.7V9h1.4V2.7l1.8 1.8 1-1zM1 6h2v1.3H1.3v6.4h9.4V7.3H9V6h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z'/%3E%3C/svg%3E") center / contain no-repeat; }
.swipe-hint { font-size: 12px; color: var(--on-felt-muted); text-align: center; margin: 0; }

/* Touch screens: no keyboard hints. */
@media (pointer: coarse) {
  .act kbd, #d-keys, .key-hint { display: none; }
}
@media (pointer: fine) { .swipe-hint { display: none; } }

/* Phones held upright (and small windows) */
@media (max-width: 720px) {
  :root { --tabbar: calc(62px + env(safe-area-inset-bottom, 0px)); }
  body { padding-top: max(10px, env(safe-area-inset-top, 0px)); padding-bottom: calc(var(--tabbar) + 18px); }
  .wrap { gap: 12px; }

  /* compact header */
  header.top { gap: 8px 10px; }
  .brand { gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .brand h1 { font-size: 22px; }
  .brand .sub { display: none; }
  .account { gap: 6px; font-size: 13px; }
  .pill-btn { padding: 7px 12px; }

  /* the rule picker and edge line take less room */
  .toolbar label.field { flex: 1 1 100%; max-width: none; font-size: 0; gap: 0; }
  .toolbar label.field select { font-size: 14px; }
  .edge { display: none; }

  /* tabs become a bar along the bottom, within thumb reach */
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; width: auto; max-width: none; margin: 0;
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; border-radius: 0; border: 0; border-top: 1px solid var(--line);
    background: var(--surface); box-shadow: 0 -8px 24px -18px rgba(0,0,0,.55);
    padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .tab { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 54px; padding: 4px 2px; border-radius: 12px; font-size: 11px; line-height: 1.1; }
  .tab .ic { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab .lg { display: none; }
  .tab .sh { display: block; white-space: nowrap; }
  .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--fg); box-shadow: none; }
  .tab[aria-selected="true"] .ic { stroke-width: 2.2; }

  /* drill and play options fold away behind an Options button */
  .opts-btn { display: inline-flex; }
  #filters .opt, #pm-chiprow .opt, #bt-chiprow .opt { display: none; }
  #filters.show-opts .opt, #pm-chiprow.show-opts .opt, #bt-chiprow.show-opts .opt { display: inline-flex; }
  .opts-btn[aria-expanded="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
  #view-play > .col > .hint.countonly { display: none; }

  /* a tighter table, so cards and buttons fit on one screen */
  .table { border-radius: 22px; padding: 14px 12px; gap: 10px; }
  .card { --w: clamp(46px, 13vw, 60px); border-radius: 7px; }
  .card.small { --w: clamp(40px, 11vw, 50px); }
  .hand { min-height: 0; gap: 6px; }
  .pm-hand { padding: 4px 6px; }
  .pm-hand .card + .card { margin-left: -20px; }
  .pm-info { gap: 4px 12px; font-size: 12px; }

  /* big answer buttons */
  .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .act { min-height: 54px; font-size: 17px; border-radius: 14px; align-content: center; }
  .btn-felt, .btn-dark, #d-next, #pm-next, #pm-deal { min-height: 48px; padding-inline: 20px; font-size: 16px; }

  /* after a drill answer the feedback takes the buttons' place, with Next in reach */
  .table:has(#d-feedback:not([hidden])) #d-actions { display: none; }
  #d-feedback .next-row { position: sticky; bottom: calc(var(--tabbar) + 8px); background: var(--surface); padding-top: 8px; margin-top: -4px;
    box-shadow: 0 -10px 10px -6px var(--surface); }
  #d-feedback .next-row .hint { flex: 1 1 100%; order: 2; }
  #d-next { flex: 1 1 100%; }

  /* pop-ups slide up from the bottom */
  .sheet-back { place-items: end center; padding: 0; }
  .sheet { width: 100%; max-width: 560px; margin: 0; border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}

/* Small and short phones (e.g. 320 x 568): one-line header, smaller cards */
@media (max-width: 720px) and (max-height: 700px), (max-width: 360px) {
  .brand img { width: 28px; height: 28px; }
  .brand h1 { font-size: 19px; }
  .topbtns .pill-btn { padding: 6px 10px; }
  .card { --w: clamp(40px, 7.4vh, 54px); }
  .table { gap: 8px; padding: 12px 10px; }
  .hand-name { font-size: 14px; }
  .act { min-height: 48px; font-size: 16px; }
}
@media (max-width: 360px) { .act { font-size: 15px; padding-inline: 4px; letter-spacing: -0.01em; } }

/* Phones held sideways: tabs down the left, table in two columns */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --rail: calc(74px + env(safe-area-inset-left, 0px)); --tabbar: 0px; }
  body { padding-left: calc(var(--rail) + 12px); padding-top: max(8px, env(safe-area-inset-top, 0px)); padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .wrap { gap: 10px; }
  header.top { flex-wrap: nowrap; }
  .brand img { width: 28px; height: 28px; }
  .brand h1 { font-size: 20px; }
  .brand .sub { display: none; }
  .edge { display: none; }
  .toolbar label.field { flex: 1 1 auto; max-width: 420px; font-size: 0; gap: 0; }
  .toolbar label.field select { font-size: 14px; }
  /* title and rule picker share one line */
  .wrap { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .wrap > * { grid-column: 1 / -1; }
  .wrap > header.top { grid-column: 1; }
  .wrap > .toolbar { grid-column: 2; justify-content: flex-end; }
  header.top .topbtns { margin-left: 8px; }

  nav.tabs { position: fixed; top: 0; bottom: 0; left: 0; right: auto; z-index: 40; width: var(--rail); max-width: none; margin: 0;
    display: grid; grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); gap: 2px; border-radius: 0; border: 0; border-right: 1px solid var(--line);
    background: var(--surface); padding: max(4px, env(safe-area-inset-top, 0px)) 4px max(4px, env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .tab { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 0; padding: 2px; border-radius: 12px; font-size: 10.5px; line-height: 1.1; }
  .tab .ic { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab .lg { display: none; }
  .tab .sh { display: block; white-space: nowrap; }
  .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--fg); box-shadow: none; }

  .opts-btn { display: inline-flex; }
  #filters .opt, #pm-chiprow .opt, #bt-chiprow .opt { display: none; }
  #filters.show-opts .opt, #pm-chiprow.show-opts .opt, #bt-chiprow.show-opts .opt { display: inline-flex; }
  .opts-btn[aria-expanded="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
  #view-play > .col > .hint.countonly { display: none; }

  /* cards on the left, buttons and feedback on the right */
  #view-drill .table { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; column-gap: 16px; padding: 12px 14px; gap: 8px 16px; border-radius: 20px; }
  #view-drill .table > .seat, #view-drill .table > .review-tag { grid-column: 1; }
  #view-drill .table > :not(.seat):not(.review-tag) { grid-column: 2; grid-row: 1 / span 3; }
  /* the felt on the left, its rail of buttons on the right (v2.5) */
  .tablebox { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 10px; }
  .table { padding: 12px 14px; border-radius: 20px; }
  .table .seat-label { display: none; }
  .card { --w: clamp(38px, 10.5vh, 54px); border-radius: 6px; }
  .hand { min-height: 0; gap: 5px; }
  .pm-hand .card + .card { margin-left: -18px; }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .act { min-height: 46px; font-size: 16px; align-content: center; }
  .table:has(#d-feedback:not([hidden])) #d-actions { display: none; }
  #d-feedback { max-height: 74vh; overflow-y: auto; }
  #d-feedback .next-row { position: static; box-shadow: none; margin-top: 0; }
  #d-feedback .next-row, #d-feedback .swipe-hint { order: 1; }
  #d-feedback .evs { order: 2; }

  .sheet-back { place-items: center; }
  .sheet { margin-top: 0; max-height: 94vh; overflow-y: auto; }
}

/* ================= today: goal, level, next up (v1.6) ================= */
.today { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px 14px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.goal-ring { position: relative; width: 52px; height: 52px; border: 0; background: none; padding: 0; color: var(--fg); cursor: pointer; display: grid; place-items: center; }
.goal-ring svg, .goal-big svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring .track, .goal-big .track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.goal-ring .fill, .goal-big .fill { fill: none; stroke: var(--chart); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.goal-ring .goal-num { position: relative; font-family: var(--f-display); font-weight: 700; font-size: 17px; line-height: 1; text-align: center; }
.goal-ring .goal-num small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.goal-ring.met .fill { stroke: var(--accent); }
.goal-ring.met::after { content: "✓"; position: absolute; right: -2px; top: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.level-chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 7px 12px; display: grid; gap: 5px; text-align: left; color: var(--fg); cursor: pointer; min-width: 128px; }
.level-chip b { font-family: var(--f-display); font-size: 17px; }
.lvl-title { color: var(--muted); font-size: 13px; }
.lvl-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.lvl-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.lvl-bar.big { height: 10px; border-radius: 5px; }
.next-up { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.next-up p { margin: 0; flex: 1 1 220px; min-width: 0; }
.next-up .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--accent); margin-right: 4px; }
.next-btns { display: flex; gap: 6px; }
.today[hidden] { display: none; }

.toasts { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px;
  width: min(92vw, 440px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--fg); color: var(--bg); border-radius: 14px; padding: 11px 16px; font-size: 15px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(-10px); transition: opacity .25s ease, transform .25s ease; cursor: pointer; }
.toast.in { opacity: 1; transform: none; }
.toast .pts, .milestones .pts { font-family: var(--f-mono); font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.toast.goal { border-left: 6px solid var(--chart); }
.toast.level, .toast.ms { border-left: 6px solid var(--accent); }
@media (prefers-reduced-motion: reduce) { .toast, .goal-ring .fill, .lvl-bar i { transition: none; } }

/* Progress: level, goal, milestones */
.lvl-big { display: flex; align-items: center; gap: 14px; }
.lvl-big > b { font-family: var(--f-display); font-size: 52px; line-height: 1; min-width: 56px; text-align: center; background: var(--accent-soft); border-radius: 14px; padding: 6px 10px; }
.lvl-big > span > span:first-child { font-family: var(--f-display); font-size: 22px; font-weight: 700; }
.pr-level, .pr-goal { display: grid; gap: 12px; align-content: start; }
.tbl.pts td.num { text-align: right; }
.goal-big { position: relative; display: flex; align-items: center; gap: 14px; }
.goal-big svg { position: relative; inset: auto; width: 72px; height: 72px; flex: none; }
.goal-big b { font-family: var(--f-display); font-size: 26px; }
.milestones { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.milestones li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; align-items: start; padding: 9px 10px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); }
.milestones li.got { border-style: solid; background: var(--accent-soft); color: var(--fg); }
.milestones .ms-ic { font-size: 20px; line-height: 1.1; text-align: center; color: var(--muted); }
.milestones li.got .ms-ic { color: var(--accent); }
.milestones .hint { text-align: left; }

@media (max-width: 720px) {
  .today { grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; padding: 8px 10px; }
  .goal-ring { width: 46px; height: 46px; }
  .level-chip { display: none; }
  .next-up { flex-wrap: nowrap; gap: 8px; }
  .next-up p { flex: 1 1 auto; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .next-up .lbl { display: none; }
  #next-more { display: none; }
  .next-btns .pill-btn { padding: 8px 14px; }
  .toasts { top: max(8px, env(safe-area-inset-top, 0px)); }
  .toast { font-size: 14px; padding: 9px 14px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .today { grid-template-columns: auto auto minmax(0, 1fr); padding: 6px 10px; }
  .goal-ring { width: 40px; height: 40px; }
  .level-chip { display: grid; min-width: 110px; padding: 4px 10px; }
  .next-up p { font-size: 13px; }
}

/* How we calculate */
.method .tbl td { vertical-align: top; }
.method .tbl .small { color: var(--muted); }
footer.foot span a { color: var(--fg); }

/* ---- v1.8: step-by-step walk-throughs (Explain this hand, worked examples, guided shoe) ---- */
.walk { display: grid; gap: 12px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.walk-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.walk-count { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.walk-dots { display: inline-flex; gap: 4px; flex: 1; min-width: 0; flex-wrap: wrap; }
.walk-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.walk-dots i.done { background: var(--muted); } .walk-dots i.on { background: var(--accent); }
.walk-all { margin-left: auto; border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 13px; padding: 4px; }
.walk-step { display: grid; gap: 10px; min-width: 0; }
.walk-step + .walk-step { border-top: 1px solid var(--line); padding-top: 12px; }
.walk-step h4 { font-family: var(--f-display); font-size: 21px; margin: 0; line-height: 1.15; }
.walk-step p { margin: 0; font-size: 15px; line-height: 1.55; }
.walk-step .small { font-size: 13px; color: var(--muted); }
.walk-no { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.walk-nav { display: flex; justify-content: space-between; gap: 10px; }
.walk-nav .chip:disabled { opacity: .4; cursor: default; }
.walk-felt { background: var(--felt); color: var(--on-felt); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.walk-seat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 54px; }
.walk-seat .seat-label { width: 52px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--on-felt-muted); }
.walk-seat .hand { display: flex; }
.walk-seat .hand .card + .card { margin-left: -14px; }
.walk-hands { display: flex; gap: 14px; flex-wrap: wrap; }
.walk-tot { font-size: 13px; color: var(--on-felt-muted); }
.walk-cap { font-size: 14px !important; color: var(--on-felt); }
.walk .card.small { --w: clamp(36px, 9vw, 46px); }
.walk-tbl tr.best td { font-weight: 700; }
.cb { display: grid; gap: 4px; }
.cb-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 44px; gap: 8px; align-items: center; font-size: 14px; }
.cb-name { color: var(--muted); }
.cb-bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.cb-bar i { display: block; height: 100%; background: var(--muted); border-radius: 5px; }
.cb-row.good .cb-bar i { background: var(--good); } .cb-row.bad .cb-bar i { background: var(--bad); }
.cb-val { text-align: right; }
.explain-btn { font-weight: 700; }
#d-explain { margin-top: 2px; }
.walk-seat .hand { min-height: 0; gap: 0; justify-content: flex-start; flex-wrap: nowrap; }
.example { display: grid; gap: 10px; }
.ex-chart td, .ex-chart th { text-align: center; padding-right: 6px; }
.ex-chart td.hl { background: var(--accent-soft); font-weight: 700; outline: 2px solid var(--accent); outline-offset: -2px; }
.walk-seat .hand .card + .card { margin-left: 4px; }
.learn > .path { grid-column: 1 / -1; display: grid; gap: 10px; }
.path-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.path-head h2 { font-size: 22px; }
.path-bar { flex: 1 1 120px; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; align-self: center; min-width: 80px; }
.path-bar i { display: block; height: 100%; background: var(--good); }
.path-now { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; }
.path-now h3 { font-size: 20px; }
.path-now .hint { color: var(--fg); opacity: .8; }
.path-toggle { justify-self: start; }
.path-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.path-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.path-list li.done b { color: var(--good); }
.path-list li.locked { opacity: .7; }
.path-list li.next b { color: var(--fg); }
.path-ic { text-align: center; }
.pm-coach { background: var(--surface); color: var(--fg); border-radius: 12px; padding: 10px 14px; display: grid; gap: 8px; border-left: 4px solid var(--accent); }
.pm-coach p { margin: 0; font-size: 15px; }
.pm-coach-h { font-size: 12px !important; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pm-coach .chip { justify-self: start; }
.rv-guided { display: grid; gap: 10px; background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.rv-guided p { margin: 0; }

/* ---- v1.9: challenges and the leaderboard ---- */
.ch-modes { margin-bottom: 2px; }
.ch-panel { display: grid; gap: 12px; }
.ch-panel h2 { font-size: clamp(26px, 5vw, 34px); font-family: var(--f-display); text-transform: none; letter-spacing: .01em; color: var(--fg); }
.ch-panel h3 { font-size: 20px; margin-top: 4px; font-family: var(--f-display); }
.ch-panel p { margin: 0; }
.ch-panel h2:focus { outline: none; }
.ch-best { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; width: fit-content; max-width: 100%; }
.ch-new { color: var(--good); }
.ch-status { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; justify-content: center; font-size: 16px; color: var(--on-felt); }
.ch-status .muted { color: var(--on-felt-muted); }
.ch-status .chip { background: transparent; color: var(--on-felt); border-color: var(--on-felt-muted); }
.ch-status .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; background: rgba(0,0,0,.25); padding: 2px 8px; border-radius: 999px; }
.ch-clock b { font-size: 22px; }
.ch-clock.low b { color: #ffb4b4; }
.ch-miss { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ch-miss li { display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 6px 0; }
.feedback.compact .why, .feedback.compact .note, .feedback.compact .evs, .feedback.compact .next-row, .feedback.compact + #d-explain { display: none !important; }
.feedback.compact { padding: 10px 14px; }
.lb { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.lb h3 .hint { font-family: var(--f-body); font-weight: 400; font-size: 13px; }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lb-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 64px; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.lb-list li:nth-child(odd) { background: var(--surface-2); }
.lb-list li.mine { background: var(--accent-soft); font-weight: 700; }
.lb-list .num.muted { text-align: right; }
.lb-place { font-weight: 700; text-align: center; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-post { display: grid; gap: 6px; }
.lb-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-row input { flex: 1 1 160px; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.lb-post .err { color: var(--bad); font-size: 14px; }
.ch-modes { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.ch-modes button { white-space: nowrap; flex: none; }
@media (max-width: 520px) { .ch-modes button { padding: 6px 9px; font-size: 12.5px; } }
.tbl-felt { display: grid; gap: 14px; min-height: 220px; align-content: start; }
.tbl-dealer { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tbl-seats { display: flex; justify-content: center; gap: 14px 18px; flex-wrap: wrap; }
.tbl-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 70px; }
.tbl-felt .hand { min-height: 62px; gap: 0; flex-wrap: nowrap; }
.tbl-felt .hand .card + .card { margin-left: 3px; }
.tbl-felt .card.small { --w: clamp(30px, 7.6vw, 40px); }
.tbl-felt > .hint { color: var(--on-felt-muted); text-align: left; }
.tbl-sum { display: grid; gap: 4px; }
/* v1.9: cards appearing in the table must not make the browser shift the page (scroll anchoring) */
#view-play, #view-drill { overflow-anchor: none; }

/* ---- v2.0: currency switch beside the rules ---- */
.top-picks { display: flex; gap: 8px; align-items: end; flex: 1 1 320px; max-width: 470px; min-width: 0; }
.top-picks label.field { flex: 1 1 auto; min-width: 0; max-width: none; }
.cur-seg { flex: none; padding: 2px; }
.cur-seg button { padding: 5px 9px; font-size: 15px; font-family: var(--f-mono); min-width: 32px; }
.cur-seg button[aria-checked="true"] { background: var(--fg); color: var(--bg); }
@media (max-width: 720px) {
  .top-picks { flex: 1 1 100%; max-width: none; }
  .toolbar .top-picks label.field { flex: 1 1 auto; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .toolbar .top-picks label.field { flex: 1 1 auto; }
}

/* ---- v2.1: leaderboards and friends ---- */
.lb-tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.lb-tabs .seg { flex: none; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; }
.has-dot { position: relative; }
.has-dot::after { content: ''; position: absolute; top: 3px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.lb-me { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; font-size: 14px; }
.lb-name { display: grid; gap: 8px; background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; }
.lb-name p { margin: 0; font-size: 14px; }
.lb-note { background: var(--good-bg); color: var(--fg); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 0; }
.linklike { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; font-size: inherit; cursor: pointer; }
.fr { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.fr h4 { margin: 4px 0 0; font-size: 16px; font-family: var(--f-display); }
.fr p { margin: 0; }
.fr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fr-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fr-list li > span:last-child { margin-left: auto; display: flex; gap: 6px; }
.fr-link { font-family: var(--f-mono); font-size: 12px !important; }
#friend-sheet .stack input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
#friend-sheet .err { color: var(--bad); font-size: 14px; margin: 0; }

/* ---- Play: just you or the busy table (v2.2) ---- */
#view-play:not([data-where="solo"]) .solo-only, #view-play:not([data-where="busy"]) .bt-only, #view-play:not([data-where="friends"]) .lt-only { display: none !important; }
.seg.where { justify-self: start; }
.tseats { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 6px; }
.tseat { background: var(--seat); border-radius: 12px; padding: 8px 6px; display: grid; gap: 4px; justify-items: center; align-content: start; min-width: 0; border: 2px solid transparent; }
.tseat.mine { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tseat.turn { border-color: var(--accent); }
.tseat.empty { opacity: .6; }
.tseat-name { font-size: 13px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.tseat-name .you { font-weight: 400; color: var(--on-felt-muted); }
.tseat-name .tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; background: rgba(0,0,0,.25); color: var(--on-felt-muted); border-radius: 6px; padding: 1px 5px; vertical-align: 1px; }
.tseat-sub, .tseat-empty, .tseat-bet { font-size: 12px; color: var(--on-felt-muted); text-align: center; }
.tseat-hands { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tseat-hand { display: grid; gap: 3px; justify-items: center; padding: 3px; border-radius: 10px; border: 2px solid transparent; }
.tseat-hand.active { border-color: var(--accent); }
.tseat-hand .hand { min-height: 0; flex-wrap: nowrap; gap: 0; }
.tseat-hand .card { --w: clamp(32px, 4.6vw, 42px); place-content: start; justify-items: start; padding: 3px 0 0 3px; width: var(--w); }
.tseat-hand .card .r { font-size: calc(var(--w) * .42); line-height: 1; }
.tseat-hand .card .s { font-size: calc(var(--w) * .3); margin-top: 1px; }
.tseat-hand .card + .card { margin-left: calc(var(--w) * -1 * clamp(.5, (var(--k, 2) - 2) * .08 + .5, .72)); }
.tseat-hand .hand { flex-wrap: nowrap; }
.tseat .pm-meta { font-size: 11.5px; gap: 2px 6px; }
.tseat-ctl { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tseat-ctl button { font-size: 11.5px; padding: 3px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: var(--on-felt); cursor: pointer; }
@media (max-width: 720px) { #bt-hint { display: none; } #bt-table > .seat .card { --w: 48px; } #bt-table > .seat .hand { min-height: 0; } .tseats { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 4px; } .tseat { padding: 5px 2px; gap: 2px; } .tseat-hand .card { --w: 30px; } .tseat-sub { display: none; } .tseat-name { font-size: 12px; } .tseat-name .tag { font-size: 9px; padding: 0 3px; } .tseat .pm-meta { font-size: 11px; } }
#bt-table > .bar-row, #bt-actbar { scroll-margin-bottom: 90px; }

/* ---- With friends (v2.2) ---- */
#lt { display: grid; gap: 12px; min-width: 0; }
.lt-form { display: grid; gap: 10px; max-width: 460px; }
.lt-form label:not(.toggle) { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.lt-form input:not([type="checkbox"]), .lt-form select { font: inherit; font-size: 16px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.lt-form button[type="submit"] { justify-self: start; }
#lt-lobby { display: grid; gap: 18px; }
#lt-code { text-transform: uppercase; letter-spacing: .2em; font-family: var(--f-mono); max-width: 180px; }
.lt-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lt-invite { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.lt-invite p { margin: 0; }
.lt-head { display: grid; gap: 8px; }
.lt-title { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.lt-title b { font-size: 20px; }
.lt-status { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--accent); }
.lt-status.ended { border-left-color: var(--bad); }
.lt-clock { font-family: var(--f-mono); font-size: 13px; color: var(--on-felt-muted); }
.lt-clock:empty { display: none; }
.lt-turnclock { margin: 0; text-align: center; }
.tseat-ctl .lt-clock { color: var(--accent); font-weight: 600; }
.chip.on-felt { background: transparent; color: var(--on-felt); border-color: rgba(255,255,255,.35); }
.chip.danger { color: var(--bad); border-color: var(--bad); }
.tseat.away { opacity: .7; }

/* ± for negative counts (v2.3): iPhone number pads have no minus key */
.sign-btn { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.18); color: var(--on-felt); font: 600 20px/1 var(--f-mono); cursor: pointer; }
.sign-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent, #111); border-color: var(--accent); }

/* Today's practice (v2.3) */
.tp-cards { display: grid; gap: 10px; }
.tp-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.tp-card h3 { margin: 0 0 2px; font-size: 18px; }
.tp-card p { margin: 0; }
.tp-card.done { border-color: color-mix(in srgb, var(--good, #2e7d4f) 45%, var(--line)); }
.tp-tick { color: var(--good, #2e7d4f); }
.tp-card > button { flex: none; }
.tp-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); border-left: 4px solid var(--accent); }
.tp-bar > span { flex: 1 1 240px; }
@media (max-width: 520px) { .tp-card { flex-direction: column; align-items: stretch; } .tp-card > button { align-self: flex-start; } }
#ch-modes .sh { display: none; }
@media (max-width: 560px) { #ch-modes .lg { display: none; } #ch-modes .sh { display: inline; } #ch-modes button { padding-left: 10px; padding-right: 10px; } }
@media (max-width: 360px) { #ch-modes button { padding-left: 6px; padding-right: 6px; font-size: 13px; } }
@media (max-width: 340px) { #ch-modes { gap: 0; } #ch-modes button { padding-left: 5px; padding-right: 5px; font-size: 12.5px; } }

/* Phones: a long hand overlaps its cards instead of wrapping onto a second row (v2.4), so the
   table keeps its size while cards are dealt. */
@media (max-width: 720px) {
  #pm-dealer, #bt-dealer, #lt-dealer, .pm-hands .hand { flex-wrap: nowrap; }
  :is(#pm-dealer, #bt-dealer, #lt-dealer, .pm-hands .hand):has(> .card:nth-child(5)) { gap: 0; }
  :is(#pm-dealer, #bt-dealer, #lt-dealer, .pm-hands .hand):has(> .card:nth-child(5)) > .card + .card { margin-left: calc(var(--w) * -.38); }
  :is(#pm-dealer, #bt-dealer, #lt-dealer, .pm-hands .hand):has(> .card:nth-child(7)) > .card + .card { margin-left: calc(var(--w) * -.52); }
}
.hint-inline { color: var(--on-felt-muted); font-size: 13px; font-weight: 400; }

/* ---- Go over the cards after a count check (v2.4) ---- */
.count-replay { background: rgba(0,0,0,.22); border-radius: 14px; padding: 12px; display: grid; gap: 10px; color: var(--on-felt); }
.cr-top { display: grid; gap: 2px; }
.cr-top .hint { color: var(--on-felt-muted); text-align: left; font-size: 13px; }
.cr-hand { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.14); }
.cr-head { margin: 0; display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.cr-head span, .cr-name { color: var(--on-felt-muted); font-size: 12.5px; }
.cr-group { display: grid; grid-template-columns: minmax(64px, 7em) 1fr; align-items: center; gap: 8px; }
.cr-name { overflow-wrap: anywhere; }
.cr-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-card { display: grid; justify-items: center; gap: 2px; }
.cr-card .card { --w: 38px; }
.cr-tag { font-family: var(--f-mono); font-size: 12px; font-weight: 600; }
.cr-tag.p, .cr-sum .p { color: #8fe3a8; } .cr-tag.m, .cr-sum .m { color: #ffb3a8; } .cr-tag.z { color: var(--on-felt-muted); }
.cr-sum { margin: 0; font-size: 14px; }
.cr-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cr-nav .chip { background: transparent; color: var(--on-felt); border-color: rgba(255,255,255,.35); }
.cr-nav .num { color: var(--on-felt-muted); font-size: 13px; }

/* ---- Coach me (v2.4) ---- */
.coach-seg button { white-space: nowrap; }
.coach-box { margin: 0; padding: 9px 12px; border-radius: 12px; background: rgba(0,0,0,.24); color: var(--on-felt); border-left: 4px solid #e9c46a; font-size: 14.5px; line-height: 1.4; }
.coach-box .tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-felt); margin-right: 6px; }
.act.coach-pick, .btn-felt.coach-pick { outline: 3px solid #e9c46a; outline-offset: 2px; }
.coach-note { color: var(--on-felt-muted); font-size: 13px; }

/* ---- v2.5: the buttons and coach sit on a rail under the felt (tester feedback #75, #76, #79) ----
   The felt shows only the cards and the shoe, so it stays a fixed size; everything you press or
   read is on the rail below it, as in Coach Texas. */
.tablebox { display: grid; gap: 8px; min-width: 0; }
.felt-rail { display: grid; gap: 10px; min-width: 0; padding: 12px clamp(10px, 2.4vw, 16px); border-radius: 18px;
  background: var(--felt-edge); color: var(--on-felt); }
.felt-rail:not(:has(> :not([hidden]):not(.lt-clock:empty))) { display: none; }
.felt-rail .hint { color: var(--on-felt-muted); text-align: center; }
.felt-rail[hidden] { display: none; }
#pm-dealer, #bt-dealer, #lt-dealer { min-height: calc(var(--w) * 1.4); }
@media (max-width: 720px) {
  .pm-hands { min-height: calc(var(--w) * 1.4 + 34px); align-items: start; }
  .table { gap: 8px; padding: 12px 12px 14px; }
}
/* no keyboard letters on touch screens */
@media (hover: none) and (pointer: coarse) {
  .act kbd, .key-hint { display: none; }
  .act { padding-block: 8px; }
}
/* Phones (v2.5): less above the table and on it, so the felt and its rail fit on one screen. */
@media (max-width: 720px) {
  /* the mode and Test me | Coach me switches fold into Options; the button says what's chosen */
  #pm-chiprow:not(.show-opts) > .seg, #pm-chiprow:not(.show-opts) > #pm-restart,
  #bt-chiprow:not(.show-opts) > .seg { display: none; }
  #pm-table .seat-label, #bt-table > .seat > .seat-label, #lt-table > .seat > .seat-label { display: none; }
  /* only the plays you can make, on one row when they fit */
  .felt-rail .actions { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }
  .felt-rail .actions .act:disabled { display: none; }
  .felt-rail .coach-box { font-size: 14px; }
}
/* The page never moves by itself while you play (v2.5, #75): no scroll anchoring, which would
   otherwise scroll to follow whatever is below the rail as its buttons change. */
html { overflow-anchor: none; }
/* Friends' table setup on phones (v2.5, #74): the boxes shrink to the panel instead of running off it. */
.lt-form, .lt-form label, .lt-row2 > * { min-width: 0; }
.lt-form input:not([type="checkbox"]), .lt-form select { width: 100%; min-width: 0; box-sizing: border-box; }
.lt-row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#lt-code { max-width: 220px; }
.chip.armed { color: var(--bad); border-color: var(--bad); }
.felt-chip.coach-pick { outline: 3px solid #e9c46a; outline-offset: 2px; }
/* Phones (v2.5): the bankroll, hand and shoe on one thin line, so the felt is shorter. */
@media (max-width: 720px) {
  .pm-info { flex-wrap: nowrap; gap: 10px; font-size: 12px; }
  .pm-info > span { white-space: nowrap; }
  .pm-info .shoebar { flex: 1 1 auto; min-width: 70px; grid-template-columns: minmax(30px, 1fr) auto; align-items: center; gap: 6px; }
  .pm-info .shoebar > span { white-space: nowrap; }
  .pm-info .felt-chip { padding: 3px 8px; font-size: 12px; }
}
@media (max-width: 720px) and (max-height: 700px) {
  .felt-rail { padding: 10px; gap: 8px; }
  .felt-rail .coach-box { font-size: 13.5px; line-height: 1.35; padding: 8px 10px; }
  .felt-rail .act { min-height: 46px; }
}
@media (max-width: 720px) { .pm-info:has(> .felt-chip:not([hidden])) { flex-wrap: wrap; } }
/* Phones held sideways (v2.5): a shorter felt (dealer and you side by side, the shoe on one
   line), and in the drill Next stays at the bottom of the screen after you answer, without
   the page having to scroll. */
@media (orientation: landscape) and (max-height: 520px) {
  #pm-table { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px 12px; }
  #pm-table > .pm-info { grid-column: 1 / -1; flex-wrap: nowrap; gap: 10px; font-size: 12px; }
  #pm-table > .pm-info > span { white-space: nowrap; }
  #pm-table > .pm-info .shoebar { flex: 1 1 auto; min-width: 60px; grid-template-columns: minmax(30px, 1fr) auto; align-items: center; gap: 6px; }
  #pm-table > .pm-info:has(> .felt-chip:not([hidden])) { flex-wrap: wrap; }
  .felt-rail .actions .act:disabled { display: none; }
  .felt-rail .actions { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  #d-feedback { max-height: none; overflow: visible; }
  #d-feedback .next-row { position: sticky; bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 2; background: var(--surface); padding-block: 6px; box-shadow: 0 -8px 10px -6px var(--surface); }
}

/* ---- v2.6: the mode row on the rail, as in Coach Texas ---- */
.rail-modes { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.coach-seg.big { flex: 1 1 260px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.22); border: 0; }
.coach-seg.big button { display: grid; gap: 1px; justify-items: center; padding: 7px 8px; border-radius: 10px; color: var(--on-felt-muted); background: none; border: 0; white-space: normal; text-align: center; }
.coach-seg.big button b { font-size: 15px; color: var(--on-felt); }
.coach-seg.big button span { font-size: 12px; font-weight: 400; }
.coach-seg.big button[aria-selected="true"] { background: var(--card); color: #4a4a4a; }
.coach-seg.big button[aria-selected="true"] b { color: #1a1a1a; }
.count-switch { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 14px; padding: 6px 14px; background: rgba(0,0,0,.22); color: var(--on-felt); font-weight: 700; font-size: 14px; }
.count-switch .sw { width: 34px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.25); position: relative; flex: none; transition: background .15s; }
.count-switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--on-felt); transition: left .15s; }
.count-switch[aria-pressed="true"] .sw { background: #e9c46a; }
.count-switch[aria-pressed="true"] .sw::after { left: 16px; background: #1b1406; }
.count-switch[hidden] { display: none; }

/* ---- v2.6: Your decisions (#83) ---- */
#view-play > aside.play-side { align-self: start; }
@media (min-width: 1000px) {
  #view-play.main { grid-template-columns: minmax(0, 1fr) 360px; }
  #view-play > aside.play-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; overscroll-behavior: contain; }
}
.dl { gap: 8px; }
.dl-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin: 0; }
.dl-past > summary { cursor: pointer; list-style: none; }
.dl-past > summary::-webkit-details-marker { display: none; }
.dl-past > summary::after { content: " ▾"; }
.dl-past:not([open]) > summary::after { content: " ▸"; }
.dl-now { display: grid; gap: 6px; }
.dl-wait { margin: 0; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 14px; }
.dl-row { display: grid; gap: 3px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.dl-now .dl-row:first-of-type { border-top: 0; }
.dl-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-sit { font-weight: 700; }
.dl-coach { color: var(--muted); font-size: 13px; }
.dl-why { margin: 0; font-size: 13px; color: var(--muted); }
.dl-hand { display: grid; gap: 0; padding: 8px 0 4px; border-top: 2px solid var(--line); }
.dl-hhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.dl-hhead .res.win { color: var(--good); font-weight: 700; } .dl-hhead .res.lose { color: var(--bad); font-weight: 700; } .dl-hhead .res.push { color: var(--muted); }
.grade { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px 2px 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.grade::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.grade.good { background: var(--good-bg); color: var(--good); }
.grade.okay { background: var(--okay-bg); color: var(--okay); }
.grade.blunder { background: var(--bad-bg); color: var(--bad); }
.grade.coached { background: var(--surface-2); color: var(--muted); }

/* ---- v2.6: a felt that keeps one size (tester feedback #80, #82, #97), as in Coach Texas ----
   Every row of the felt has a fixed height for its screen size: the dealer's cards, your hands
   (split hands squeeze up instead of wrapping), each seat at a busy or friends' table (name,
   chips, cards, a result line). Empty outlines hold the places of cards not dealt yet. */
#pm-table, #bt-table, #lt-table { --cw: 64px; }
#pm-table .card, #bt-table > .seat .card, #lt-table > .seat .card { --w: var(--cw); }
.card-slot { --w: var(--cw, 64px); width: var(--w); height: calc(var(--w) * 1.4); flex: none; border-radius: 8px; border: 1.5px dashed rgba(255,255,255,.22); }
.pm-hands[data-n="2"] .card-slot { --w: calc(var(--cw) * .82); }
.pm-hand .card + .card-slot { margin-left: -26px; }
.tseat-hands .card-slot { --w: var(--tw, 42px); border-radius: 6px; }
.tseat-hand .card-slot + .card-slot, .tseat-hand .card + .card-slot { margin-left: calc(var(--w) * -.5); }
#pm-table.was .card-slot { opacity: 1; }
#pm-dealer, #bt-dealer, #lt-dealer { height: calc(var(--cw) * 1.4); min-height: 0; flex-wrap: nowrap; align-items: start; }
#pm-dealer:has(> .card:nth-child(4)) > .card + .card,
#bt-dealer:has(> .card:nth-child(4)) > .card + .card,
#lt-dealer:has(> .card:nth-child(4)) > .card + .card { margin-left: calc(var(--cw) * -0.38); }
#pm-dtotal, #bt-dtotal, #lt-dtotal { height: 1.5em; white-space: nowrap; }
#pm-dtotal:empty::before, #bt-dtotal:empty::before, #lt-dtotal:empty::before { content: "\00a0"; }
.pm-hands { height: calc(var(--cw) * 1.4 + 44px); flex-wrap: nowrap; align-items: start; gap: 8px; overflow: hidden; }
.pm-hands > .pm-hand { flex: 0 1 auto; min-width: 0; }
.pm-hands .pm-meta { flex-wrap: nowrap; white-space: nowrap; font-size: 13px; }
.pm-hands[data-n="2"] .card { --w: calc(var(--cw) * .82); }
.pm-hands[data-n="3"] .card { --w: calc(var(--cw) * .66); }
.pm-hands[data-n="4"] .card { --w: calc(var(--cw) * .56); }
.pm-hands[data-n="3"] .pm-meta .num, .pm-hands[data-n="4"] .pm-meta .num { display: none; }
.pm-hands[data-n="4"] .pm-meta { font-size: 11.5px; }
#pm-table.was #pm-dealer, #pm-table.was #pm-hands { opacity: .55; }
/* seats: one line each for name and chips, a fixed space for cards, a reserved result line */
.tseat { grid-template-rows: auto auto 1fr auto; }
.tseat-name, .tseat-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tseat-hands { height: calc(var(--tw, 42px) * 1.4 + 28px); flex-wrap: nowrap; overflow: hidden; align-items: start; }
.tseat-hands .card { --w: var(--tw, 42px); }
.tseat-hands[data-n="2"] .card { --w: calc(var(--tw, 42px) * .78); }
.tseat-hands[data-n="3"] .card, .tseat-hands[data-n="4"] .card { --w: calc(var(--tw, 42px) * .62); }
.tseat-hands[data-n="2"] .tseat-hand, .tseat-hands[data-n="3"] .tseat-hand, .tseat-hands[data-n="4"] .tseat-hand { padding: 1px; }
.tseat-hands .pm-meta { flex-wrap: nowrap; white-space: nowrap; }
.tseat-hands[data-n="3"] .pm-meta .num, .tseat-hands[data-n="4"] .pm-meta .num { display: none; }
.tseat-empty { align-self: center; }
.tseat-say { height: 22px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; font-family: var(--f-mono); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.tseat-say:empty { visibility: hidden; }
.tseat-say.win { background: rgba(92,196,137,.25); color: #c9f2d8; }
.tseat-say.lose { background: rgba(0,0,0,.25); color: var(--on-felt-muted); }
.tseat-say.push { background: rgba(0,0,0,.18); color: var(--on-felt-muted); }
.tseat-ctlbox { min-height: 26px; display: flex; justify-content: center; }
#bt-table, #lt-table { --tw: clamp(34px, 3.4vw, 46px); }
@media (max-width: 720px) {
  #pm-table, #bt-table, #lt-table { --cw: clamp(44px, 13vw, 56px); }
  #bt-table, #lt-table { --tw: 30px; }
  .tseat-say { height: 18px; font-size: 11px; padding: 0 4px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #pm-table, #bt-table, #lt-table { --cw: clamp(38px, 10.5vh, 54px); }
  #bt-table, #lt-table { --tw: 28px; }
}
.dl-strip { display: flex; gap: 18px; flex-wrap: wrap; padding: 2px 0 4px; }
.dl-strip > div { display: grid; gap: 1px; }
.dl-strip span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dl-strip b { font-family: var(--f-mono); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dl-strip b.pos { color: var(--good); } .dl-strip b.neg { color: var(--bad); }
.dl-luck { margin: 0; text-align: left; }
.count-switch .cs-short { display: none; }
@media (max-width: 720px) {
  .rail-modes { flex-wrap: nowrap; }
  .coach-seg.big { flex: 1 1 auto; }
  .coach-seg.big button { padding: 6px 6px; }
  .coach-seg.big button span { display: none; }
  .count-switch { padding: 6px 10px; flex: none; }
  .count-switch .cs-long { display: none; } .count-switch .cs-short { display: inline; }
}
#pm-bank, #bt-bank, #lt-bank { border-radius: 6px; padding: 0 3px; }
#pm-bank.up, #bt-bank.up, #lt-bank.up { animation: bank-up 1.2s ease-out; }
#pm-bank.down, #bt-bank.down, #lt-bank.down { animation: bank-down 1.2s ease-out; }
@keyframes bank-up { 0%, 30% { background: rgba(92,196,137,.55); color: #fff; } 100% { background: transparent; } }
@keyframes bank-down { 0%, 30% { background: rgba(0,0,0,.35); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { #pm-bank.up, #bt-bank.up, #lt-bank.up, #pm-bank.down, #bt-bank.down, #lt-bank.down { animation: none; } }
.act .cost { font-family: var(--f-mono); font-size: 11px; color: #6c6c6c; font-weight: 400; }
.act .cost:empty { display: none; }
/* the count sits in the felt's top corner, over empty felt, so showing or hiding it moves nothing (v2.6) */
#pm-table > .pm-info, #bt-table > .pm-info, #lt-table > .pm-info { position: relative; flex-wrap: nowrap; }
#pm-countbox, #bt-countbox, #lt-countbox { position: absolute; left: 0; top: calc(100% + 8px); z-index: 1; white-space: nowrap; }
@media (max-width: 720px) {
  .pm-info:has(> .felt-chip:not([hidden])) { flex-wrap: nowrap; }
  #pm-countbox, #bt-countbox, #lt-countbox { top: calc(100% + 4px); font-size: 11px; padding: 2px 8px; }
}

/* Phones (v2.6): the buttons come straight after the felt; Coach me | Test me and the count
   switch sit under them. Short phones get smaller cards so the felt and buttons fit together. */
@media (max-width: 720px) {
  .felt-rail > .rail-modes { order: 9; }
  .felt-rail { display: flex; flex-direction: column; }
}
@media (max-width: 720px) and (max-height: 700px) {
  #pm-table, #bt-table, #lt-table { --cw: clamp(36px, 7.4vh, 48px); }
  .pm-hands { height: calc(var(--cw) * 1.4 + 38px); }
}
/* exact line heights for the felt's text rows, so a word appearing never nudges it a pixel */
#pm-dtotal, #bt-dtotal, #lt-dtotal { height: 20px; line-height: 20px; }
.pm-hands .pm-meta, .tseat-hands .pm-meta { height: 20px; line-height: 20px; overflow: hidden; }
#pm-table > .pm-info, #bt-table > .pm-info, #lt-table > .pm-info { height: 36px; align-items: center; }
@media (max-width: 720px) { #pm-table > .pm-info, #bt-table > .pm-info, #lt-table > .pm-info { height: 22px; } }
#pm-table .seat-label, #bt-table > .seat > .seat-label, #lt-table > .seat > .seat-label { height: 16px; line-height: 16px; } /* the font arriving can't nudge the felt */
.cb-sep { display: inline-block; width: .7em; }
@media (max-width: 720px) {
  /* on a phone the count stacks into the felt's top-left corner, clear of the dealer's cards */
  #pm-countbox, #bt-countbox, #lt-countbox { border-radius: 10px; line-height: 1.35; padding: 4px 7px; }
  .cb-sep { display: block; width: auto; height: 0; }
}

/* ---- v2.8: the home screen (Coach Design System: icon tiles on squares of felt) ---- */
.home { display: grid; gap: 10px; }
.home-h { font-family: var(--f-body); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.home-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; color: var(--fg); font: inherit; cursor: pointer; }
.home-tile:hover { border-color: var(--accent); }
.home-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 35%, var(--felt) 55%, var(--felt-edge) 100%); }
.home-ic svg { fill: none; stroke: var(--on-felt); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-txt { display: grid; gap: 1px; min-width: 0; }
.home-lbl { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.home-txt b { font-family: var(--f-display); font-size: 22px; line-height: 1.15; }
.home-txt .hint { font-size: 13px; }
@media (max-width: 860px) {
  .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .home-tile { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; }
  .home-ic { width: 36px; height: 36px; border-radius: 10px; }
  .home-ic svg { width: 20px; height: 20px; }
  .home-txt b { font-size: 18px; }
  .home-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* the header stripe sits right under the header */
.wrap > .roulette-stripe { margin-top: -8px; }
@media (max-width: 860px) {
  /* phones: shorter tiles (icon beside the title, no category label) */
  .home-tile { grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: 9px 10px; gap: 9px; }
  .home-lbl { display: none; }
  .home-txt .hint { font-size: 12px; line-height: 1.3; }
  .home-txt b { font-size: 17px; }
}
@media (max-width: 380px) {
  /* seven places in the phone bar: no gaps, so each stays at least 44px wide down to 320px screens */
  nav.tabs { gap: 0; padding-left: max(2px, env(safe-area-inset-left, 0px)); padding-right: max(2px, env(safe-area-inset-right, 0px)); }
  .tab { padding: 4px 0; font-size: 10px; letter-spacing: -.01em; }
}
@media (orientation: landscape) and (max-height: 500px) {
  /* seven places down the side rail must fit a 320px-high screen */
  nav.tabs { gap: 0; }
  .tab { gap: 1px; padding: 1px; font-size: 10px; }
  .tab .ic { width: 19px; height: 19px; }
}
/* the light/dark button: words on computers, a half-moon icon on phones and sideways screens */
.theme-btn { display: inline-flex; align-items: center; gap: 6px; }
.theme-btn .th-ic { display: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
@media (max-width: 860px), (orientation: landscape) and (max-height: 520px) {
  .theme-btn { padding: 6px 9px; }
  .theme-btn .th-ic { display: block; }
  .theme-btn .th-txt { display: none; }
}
@media (max-width: 860px) {
  /* phones: a slimmer leather rail, so the table and its buttons still fit above the bottom bar */
  .table { border-width: 6px; border-radius: 28px; }
}
