:root {
  --bg: #f4f2ec; --surface: #ffffff; --surface-2: #ecebe4; --line: #d9d6cc;
  --text: #17201c; --muted: #5d6862; --accent: #12805a; --accent-ink: #ffffff;
  --push: #12a06c; --call: #2f7de1; --fold: #d6453d; --gold: #c8901a;
  --cell: #e3e1d9; --cell-text: #2a332e;
  --s-s: #1b1f1d; --s-h: #d0342c; --s-d: #2364d2; --s-c: #138a4a;
  --card-bg: #ffffff; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1714; --surface: #16211d; --surface-2: #1d2b26; --line: #2a3a34;
    --text: #e8efe9; --muted: #95a49c; --accent: #2fc28a; --accent-ink: #062016;
    --push: #27b37d; --call: #4c94f0; --fold: #ef5a50; --gold: #f2c14e;
    --cell: #22312b; --cell-text: #cfdad3;
    --s-s: #1b1f1d; --s-h: #d0342c; --s-d: #2364d2; --s-c: #138a4a;
    --card-bg: #f7f6f1; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1714; --surface: #16211d; --surface-2: #1d2b26; --line: #2a3a34;
  --text: #e8efe9; --muted: #95a49c; --accent: #2fc28a; --accent-ink: #062016;
  --push: #27b37d; --call: #4c94f0; --fold: #ef5a50; --gold: #f2c14e;
  --cell: #22312b; --cell-text: #cfdad3;
  --card-bg: #f7f6f1; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 640px; margin: 0 auto; padding: 0 16px; }
h2 { font-size: 20px; margin: 18px 0 4px; letter-spacing: -.01em; }
.hint { color: var(--muted); margin: 4px 0 14px; font-size: 14px; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .92em; }

.top { display: flex; align-items: center; justify-content: space-between; max-width: 640px; margin: 0 auto; padding: 14px 16px 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.brand b { color: var(--accent); font-weight: 800; }
.streak { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

.tab { display: none; }
.tab.active { display: block; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; margin: 10px 0 12px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 9px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.card-box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; min-height: 120px; }
.desc { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; margin-bottom: 14px; }
.seat { background: var(--surface-2); border-radius: 10px; padding: 6px 8px; font-size: 13px; border: 2px solid transparent; }
.seat b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.seat .st { font-variant-numeric: tabular-nums; font-weight: 600; }
.seat.hero { border-color: var(--gold); }
.seat.pusher { border-color: var(--fold); }
.seat.pusher::after { content: "ALL-IN"; display: block; color: var(--fold); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.seat.folded { opacity: .45; }

.hand { display: flex; gap: 8px; justify-content: center; margin: 6px 0 10px; }
.pc { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 80px; background: var(--card-bg); border-radius: 9px; border: 1px solid rgba(0,0,0,.12); font-weight: 800; font-size: 26px; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.pc i { font-style: normal; font-size: 24px; margin-top: 2px; }
.pc.sm { width: 34px; height: 46px; font-size: 16px; border-radius: 6px; }
.pc.sm i { font-size: 14px; }
.pc.s-s { color: var(--s-s); } .pc.s-h { color: var(--s-h); } .pc.s-d { color: var(--s-d); } .pc.s-c { color: var(--s-c); }
.question { text-align: center; font-weight: 600; margin: 4px 0 14px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-act { font: inherit; font-weight: 800; letter-spacing: .03em; font-size: 17px; padding: 15px; border-radius: 12px; border: 0; cursor: pointer; color: #fff; }
.btn-act.fold { background: var(--fold); }
.btn-act.push { background: var(--push); }
.btn-act.call { background: var(--call); }
.btn-act:active { transform: translateY(1px); }

.verdict { border-radius: 12px; padding: 12px; margin: 12px 0 10px; font-weight: 600; }
.verdict.ok { background: color-mix(in srgb, var(--push) 16%, transparent); }
.verdict.bad { background: color-mix(in srgb, var(--fold) 16%, transparent); }
.verdict.mid { background: color-mix(in srgb, var(--gold) 18%, transparent); }
.verdict small { display: block; font-weight: 500; color: var(--muted); margin-top: 3px; }

.primary, .ghost { font: inherit; font-weight: 700; border-radius: 12px; padding: 12px 16px; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; width: 100%; margin: 6px 0 14px; }
.primary:disabled { opacity: .55; }
.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }

.form { display: grid; gap: 10px; }
.form.inline { grid-template-columns: 1fr 1fr; margin: 10px 0; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; width: 100%; }
textarea { font-family: "JetBrains Mono", monospace; font-size: 12px; }
details { margin: 4px 0; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 0; }
.each { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 6px; }
.row { display: flex; gap: 10px; align-items: end; margin: 8px 0; }
.grow { flex: 1; }

.grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; margin: 10px 0; user-select: none; }
.grid div { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: clamp(7px, 2.3vw, 11px); font-weight: 600; border-radius: 3px; color: var(--cell-text); background: color-mix(in srgb, var(--hl, var(--push)) calc(var(--f, 0) * 100%), var(--cell)); }
.grid div.on { color: #fff; }
.grid div.me { outline: 2.5px solid var(--gold); outline-offset: -1px; z-index: 1; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

.result-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.range-text { font-family: "JetBrains Mono", monospace; font-size: 12px; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; word-break: break-word; }
.copy { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 4px 9px; cursor: pointer; }

.bars { display: grid; gap: 8px; margin: 12px 0; }
.bar { background: var(--surface-2); border-radius: 10px; overflow: hidden; position: relative; padding: 9px 12px; }
.bar span { position: relative; z-index: 1; display: flex; justify-content: space-between; font-weight: 600; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 30%, transparent); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; font-variant-numeric: tabular-nums; }
table.t th, table.t td { text-align: right; padding: 7px 6px; border-bottom: 1px solid var(--line); }
table.t th:first-child, table.t td:first-child { text-align: left; }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats div { background: var(--surface); border-radius: 12px; padding: 10px; text-align: center; box-shadow: var(--shadow); }
.mini-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-stats span { color: var(--muted); font-size: 12px; }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: var(--surface); color: var(--text); }
.drop input { display: none; }
.drop.over { border-color: var(--accent); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.rv-item { background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.rv-item header { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.rv-item .meta { flex: 1; font-size: 13px; color: var(--muted); }
.rv-item .meta b { color: var(--text); font-size: 14px; }
.cost { font-weight: 800; color: var(--fold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }

.eq-guess { display: grid; gap: 8px; margin: 10px 0; }
.eq-guess output { text-align: center; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
input[type="range"] { padding: 0; accent-color: var(--accent); border: 0; background: transparent; }
.vs { text-align: center; color: var(--muted); font-weight: 700; font-size: 13px; margin: 2px 0; }
.board { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.loading { color: var(--muted); text-align: center; padding: 30px 0; }
.err { color: var(--fold); font-weight: 600; margin: 8px 0; }

.bottom { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.bottom button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; display: grid; justify-items: center; gap: 2px; padding: 4px; cursor: pointer; }
.bottom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.bottom button.on { color: var(--accent); }
.legal { text-align: center; font-size: 11px; color: var(--muted); max-width: 640px; margin: 18px auto 0; padding: 0 16px; }

/* mesa oval */
:root { --felt: #1f7a55; --felt-edge: #5b3b22; }
.ptable { position: relative; width: 100%; aspect-ratio: 1.55; max-height: 320px; margin: 4px auto 12px; }
.felt { position: absolute; inset: 15% 12%; border-radius: 999px; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--felt) 85%, #fff), var(--felt) 70%); border: 7px solid var(--felt-edge); box-shadow: inset 0 0 24px rgba(0,0,0,.35), var(--shadow); display: flex; align-items: center; justify-content: center; }
.pot { color: #fff; font-weight: 700; font-size: 13px; background: rgba(0,0,0,.28); padding: 3px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.pseat { position: absolute; transform: translate(-50%, -50%); min-width: 62px; padding: 4px 7px; border-radius: 10px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); text-align: center; font: inherit; color: var(--text); line-height: 1.15; z-index: 2; }
.pseat b { display: block; font-size: 12px; font-weight: 800; }
.pseat .st { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pseat em { display: block; font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.pseat.hero { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.pseat.hero em { color: var(--gold); }
.pseat.pusher { border-color: var(--fold); }
.pseat.pusher em { color: var(--fold); }
.pseat.folded { opacity: .4; }
.pseat.sel { border-color: var(--push); background: color-mix(in srgb, var(--push) 16%, var(--surface)); }
.pseat.sel em, .pseat.push em { color: var(--push); }
.pseat.call { border-color: var(--call); background: color-mix(in srgb, var(--call) 16%, var(--surface)); }
.pseat.call em, .pseat.callable em { color: var(--call); }
.ptable.click .pseat { cursor: pointer; }
.ptable.click .pseat:disabled { cursor: default; }
.dealer, .bet { position: absolute; transform: translate(-50%, -50%); z-index: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.dealer { width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #111; font-size: 11px; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.bet { font-size: 10px; color: #fff; background: rgba(0,0,0,.35); padding: 1px 6px; border-radius: 99px; white-space: nowrap; }
.bet.allin { background: var(--fold); }
.posnote { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; }
.posnote b { color: var(--text); }
@media (max-width: 380px) { .pseat { min-width: 54px; padding: 3px 5px; } .pseat b { font-size: 11px; } }
.ptable.big { aspect-ratio: 1.2; max-height: 360px; }
