:root {
  --paper: #eef1f5; --surface: #ffffff; --ink: #131c2b; --muted: #5b6678; --line: #d5dbe5;
  --navy: #131c2b; --navy-2: #1e2a3f; --accent: #e9a21a; --accent-ink: #4d3200; --accent-soft: #fdf1d6;
  --raise: #e0564a; --call: #35a56a; --fold: #9db3c9; --allin: #8e1f2f; --cell-empty: #e4e9f0;
  --good: #1f8a54; --good-bg: #e3f4ea; --bad: #c23b30; --bad-bg: #fbe7e4;
  --felt: #1d5560; --felt-2: #17434c;
  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--body); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 2.6vw + 1rem, 2.6rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 0.9em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 99; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.topbar { display: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--navy); color: #c9d2e0; padding: 22px 14px; overflow-y: auto; }
.sidebar .brand, .topbar .brand { font: 700 1.45rem var(--display); color: #fff; text-decoration: none; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.sidebar .brand { display: block; padding: 0 10px 18px; }
.nav-group { margin-top: 18px; font-size: 0.78rem; color: #8493ab; padding: 0 10px 4px; font-weight: 600; }
.sidebar a.nav { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: #d4dbe7; font-weight: 500; font-size: 0.95rem; }
.sidebar a.nav:hover { background: var(--navy-2); color: #fff; }
.sidebar a.nav.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.sidebar a.nav small { font-size: 0.72rem; background: var(--navy-2); color: #c9d2e0; padding: 1px 7px; border-radius: 99px; }
.sidebar a.nav.on small { background: rgba(0,0,0,.15); color: var(--accent-ink); }
.side-meter { margin: 22px 10px 0; padding-top: 16px; border-top: 1px solid #2a3750; font-size: 0.85rem; }
.side-meter .bar { height: 6px; background: #2a3750; border-radius: 9px; margin: 6px 0 4px; overflow: hidden; }
.side-meter .bar i { display: block; height: 100%; background: var(--accent); }
main { margin-left: 232px; padding: 34px clamp(18px, 4vw, 48px) 80px; max-width: 1280px; outline: none; }
.page-head { margin-bottom: 22px; max-width: 70ch; }
.page-head p { color: var(--muted); margin: 8px 0 0; }
.crumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

@media (max-width: 880px) {
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: var(--navy); padding: 10px 14px; }
  .menu-btn { background: none; border: 0; color: #fff; font-size: 1.4rem; padding: 2px 8px; cursor: pointer; }
  .top-streak { margin-left: auto; color: #c9d2e0; font-size: 0.85rem; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 40; top: 50px; width: 260px; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .sidebar .brand { display: none; }
  main { margin-left: 0; padding: 20px 16px 70px; }
}

/* ---------- Building blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel > h2, .panel > h3 { margin-bottom: 10px; }
.cols { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.cols.side { grid-template-columns: 280px minmax(0, 1fr); }
@media (max-width: 1020px) { .cols, .cols.wide-left, .cols.side { grid-template-columns: minmax(0, 1fr); } }
.muted { color: var(--muted); } .small { font-size: 0.88rem; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: #26344d; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 5px 10px; font-size: 0.86rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
kbd { font: 600 0.72rem var(--body); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; opacity: .6; }
.seg { display: inline-flex; background: #dfe5ee; border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(19,28,43,.18); }
label.field { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 12px; }
label.field span.hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=number], textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; margin-top: 4px; }
textarea { min-height: 64px; resize: vertical; font-size: 0.9rem; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 9px; z-index: 100; font-weight: 600; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.data td { padding: 6px 8px; border-bottom: 1px solid #edf0f5; }
table.data td.num, table.data th.num { text-align: right; }
.scroll { max-height: 420px; overflow: auto; }

/* ---------- Cards ---------- */
.card { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 62px; background: #fff; border: 1px solid #c3cbd8; border-radius: 7px; font-family: var(--display); line-height: 1; box-shadow: 0 1px 2px rgba(19,28,43,.18); vertical-align: middle; }
.card b { font-size: 1.45rem; font-weight: 700; } .card i { font-style: normal; font-size: 1.15rem; margin-top: 2px; }
.card.sm { width: 26px; height: 34px; border-radius: 5px; margin: 0 1px; } .card.sm b { font-size: 0.86rem; } .card.sm i { font-size: 0.72rem; margin-top: 0; }
.card.back { background: repeating-linear-gradient(45deg, #2a3a57 0 5px, #34476b 5px 10px); border-color: #1e2a3f; }
.cards { display: inline-flex; gap: 5px; } .cards.big .card { width: 60px; height: 82px; } .cards.big .card b { font-size: 1.9rem; } .cards.big .card i { font-size: 1.4rem; }
.cards.mini .card { width: 30px; height: 40px; border-radius: 5px; } .cards.mini .card b { font-size: 1rem; } .cards.mini .card i { font-size: 0.8rem; margin: 0; }
.suit-s { color: #1b2433; } .suit-h { color: #d43d3d; } .suit-d { color: #2a6fdb; } .suit-c { color: #1f9153; }

/* ---------- Range grid ---------- */
.rgrid { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px; width: 100%; max-width: 640px; user-select: none; }
.rcell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 3px; font-size: clamp(0.5rem, 1.25vw, 0.78rem); font-weight: 600; color: #101826; position: relative; overflow: hidden; }
.rcell span { position: relative; text-shadow: 0 0 3px rgba(255,255,255,.55); }
.rcell.empty { color: #8b96a8; }
.rcell.dim { opacity: .28; }
.rcell.mark { outline: 3px solid var(--ink); outline-offset: -1px; z-index: 2; }
.rgrid.small { max-width: 330px; gap: 1px; } .rgrid.small .rcell { font-size: 0.5rem; border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.88rem; margin: 12px 0 0; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; } .legend b { font-weight: 700; }
.freqbar { display: flex; height: 30px; border-radius: 7px; overflow: hidden; font-size: 0.8rem; font-weight: 700; color: #fff; }
.freqbar div { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; min-width: 3px; }
.hoverbox { min-height: 74px; }

/* ---------- Quiz ---------- */
.quiz { max-width: 760px; }
.qhead { display: flex; justify-content: space-between; font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.progress { height: 5px; background: #dfe5ee; border-radius: 9px; margin: 8px 0 20px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.qbody { font-size: 1.08rem; margin-bottom: 16px; } .qbody .cards { margin: 6px 6px 6px 0; }
.qbody .qlabel { display: block; font-size: 0.84rem; color: var(--muted); font-weight: 600; margin-top: 8px; }
.choices { display: grid; gap: 8px; } .choices.row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 9px; padding: 12px 14px; cursor: pointer; font-weight: 600; display: flex; gap: 12px; align-items: center; }
.choice:hover:not(:disabled) { border-color: var(--ink); }
.choice.right { border-color: var(--good); background: var(--good-bg); } .choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice:disabled { cursor: default; color: var(--ink); }
.feedback { margin-top: 14px; padding: 0; } .feedback.good, .feedback.bad { padding: 12px 14px; border-radius: 9px; }
.feedback.good { background: var(--good-bg); } .feedback.bad { background: var(--bad-bg); }
.feedback.mixed { background: var(--accent-soft); padding: 12px 14px; border-radius: 9px; }
.qnext { margin-top: 14px; }
.result { text-align: center; padding: 30px 10px; } .result .score { font: 700 4rem var(--display); } .result .score small { font-size: 1.6rem; color: var(--muted); } .result .btnrow { justify-content: center; }

/* ---------- Poker table ---------- */
.ptable { position: relative; width: 100%; max-width: 760px; aspect-ratio: 16 / 9.4; margin: 28px auto 34px; }
.ptable .felt { position: absolute; inset: 9% 6%; border-radius: 999px; background: radial-gradient(ellipse at 50% 40%, var(--felt), var(--felt-2)); border: 10px solid #101a29; box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.ptable .center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); text-align: center; color: #fff; width: 70%; }
.ptable .pot { font-weight: 700; font-size: 0.95rem; margin-top: 6px; } .ptable .center .cards { min-height: 62px; }
.seat { position: absolute; transform: translate(-50%, -50%); text-align: center; width: 112px; }
.seat .plate { background: var(--navy); color: #fff; border-radius: 9px; padding: 4px 6px; font-size: 0.8rem; line-height: 1.25; border: 2px solid transparent; }
.seat .plate b { display: block; font-size: 0.86rem; } .seat .plate small { color: #b6c1d3; }
.seat.hero .plate { background: #fff; color: var(--ink); border-color: var(--ink); } .seat.hero .plate small { color: var(--muted); }
.seat.active .plate { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,162,26,.35); }
.seat.folded { opacity: .42; }
.seat .hole { display: flex; justify-content: center; gap: 3px; margin-bottom: -8px; min-height: 40px; }
.seat .tag { position: absolute; top: -6px; right: -4px; background: var(--accent); color: var(--accent-ink); border-radius: 99px; font-size: 0.66rem; font-weight: 700; padding: 1px 6px; z-index: 3; }
.betchip { position: absolute; transform: translate(-50%, -50%); background: rgba(8,16,26,.72); color: #fff; font-size: 0.78rem; font-weight: 700; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.betchip.act { background: var(--accent); color: var(--accent-ink); }
.dealer { position: absolute; transform: translate(-50%, -50%); background: #fff; color: #111; border-radius: 50%; width: 20px; height: 20px; font-size: 0.68rem; font-weight: 700; display: grid; place-items: center; border: 1px solid #999; }
@media (max-width: 640px) {
  .ptable { aspect-ratio: 1 / 1.02; } .seat { width: 84px; } .seat .plate { font-size: 0.7rem; }
  .ptable .center .card { width: 34px; height: 46px; } .ptable .center .card b { font-size: 1.05rem; } .ptable .center .card i { font-size: .85rem; } .ptable .center .cards { min-height: 46px; gap: 3px; }
}
.actionbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.act { border: 0; border-radius: 9px; padding: 12px 22px; font-weight: 700; color: #fff; cursor: pointer; min-width: 110px; font-size: 1rem; }
.act small { display: block; font-weight: 500; font-size: 0.74rem; opacity: .85; }
.act.fold { background: #6f8fb0; } .act.call, .act.check { background: var(--call); } .act.raise, .act.bet { background: var(--raise); } .act.allin { background: var(--allin); }
.act:hover:not(:disabled) { filter: brightness(1.08); } .act:disabled { opacity: .4; cursor: not-allowed; }
.act.picked { outline: 3px solid var(--ink); outline-offset: 2px; }
.sizer { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; } .sizer input[type=range] { width: 200px; } .sizer input[type=number] { width: 84px; margin: 0; }
.log { font-size: 0.86rem; color: var(--muted); max-height: 190px; overflow: auto; } .log div { padding: 2px 0; border-bottom: 1px dashed #e6eaf0; } .log b { color: var(--ink); }

/* ---------- Picker ---------- */
.picker { display: grid; gap: 3px; } .prow { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; }
.pc { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 5px 0; font-weight: 700; font-size: clamp(0.62rem, 1.5vw, 0.86rem); cursor: pointer; }
.pc.on { background: var(--ink); color: #fff !important; border-color: var(--ink); } .pc:disabled { opacity: .22; cursor: not-allowed; }

/* ---------- Home ---------- */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: center; background: var(--navy); color: #fff; border-radius: 16px; padding: clamp(22px, 4vw, 44px); margin-bottom: 22px; }
.home-hero h1 { font-size: clamp(1.9rem, 3vw + 1rem, 3.2rem); }
.home-hero p { color: #c0cadb; max-width: 46ch; margin-top: 14px; }
.home-hero .spot { background: #fff; color: var(--ink); border-radius: 12px; padding: 18px; }
.home-hero .spot .cards { margin: 10px 0; }
@media (max-width: 880px) { .home-hero { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile .v { font: 700 1.7rem var(--display); } .tile .k { font-size: 0.84rem; color: var(--muted); }
.path { list-style: none; margin: 0; padding: 0; }
.path li a { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 11px 6px; border-bottom: 1px solid #edf0f5; text-decoration: none; }
.path li a:hover { background: #f6f8fb; }
.path .n { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 0.82rem; color: var(--muted); }
.path .done .n { background: var(--good); border-color: var(--good); color: #fff; }
.path .t { font-weight: 600; } .path .d { font-size: 0.85rem; color: var(--muted); display: block; font-weight: 400; }
.path .go { font-size: 0.82rem; color: var(--muted); }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.tool { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.tool:hover { border-color: var(--ink); } .tool h3 { margin-bottom: 4px; } .tool p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.days { display: flex; gap: 3px; align-items: flex-end; height: 70px; } .days i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; } .days i.zero { background: #dfe5ee; }

/* ---------- Lessons ---------- */
.prose { max-width: 68ch; font-size: 1.04rem; line-height: 1.65; }
.prose h2 { margin: 1.5em 0 0.5em; } .prose h3 { margin: 1.3em 0 0.4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; } .prose li { margin-bottom: 0.35em; }
.prose table { border-collapse: collapse; margin: 0 0 1em; font-size: 0.95rem; } .prose th, .prose td { border: 1px solid var(--line); padding: 5px 12px; text-align: left; } .prose th { background: #f3f6fa; }
.prose .key { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 0 0 1em; }
.prose code { background: #e6ebf2; padding: 1px 6px; border-radius: 4px; font-size: 0.92em; font-family: inherit; font-weight: 600; }
.lesson-list a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 4px; border-bottom: 1px solid #edf0f5; text-decoration: none; }
.lesson-list a:hover { background: #f6f8fb; } .lesson-list .ok { color: var(--good); font-weight: 700; }
.scn-list button { display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-weight: 500; }
.scn-list button:hover { background: #f1f4f8; } .scn-list button.on { background: var(--ink); color: #fff; }
.scn-list h3 { font-size: 0.82rem; color: var(--muted); margin: 14px 10px 4px; font-family: var(--body); }
.tree-path { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; } .tree-path .sep { color: var(--muted); }
.spin { display: inline-block; width: 16px; height: 16px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.eqrow { display: grid; grid-template-columns: 90px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 8px; } .eqrow .barwrap { background: #dfe5ee; border-radius: 6px; height: 22px; overflow: hidden; } .eqrow .barwrap i { display: block; height: 100%; background: var(--call); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
.cols.solver { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
@media (max-width: 1020px) { .cols.solver { grid-template-columns: minmax(0, 1fr); } }
.hist { margin: 0 0 12px; padding-left: 1.2em; } .hist li { margin-bottom: 2px; }
.herohand { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.riverboard { background: radial-gradient(ellipse at 50% 30%, var(--felt), var(--felt-2)); border-radius: 14px; padding: 18px; color: #fff; text-align: center; margin: 12px 0; }
.review { border-left: 4px solid var(--line); padding: 6px 12px; margin: 8px 0; font-size: 0.92rem; } .review.good { border-color: var(--good); } .review.bad { border-color: var(--bad); background: var(--bad-bg); } .review.mixed { border-color: var(--accent); }
