/* ============ Tokens ============ */
:root {
  --paper: #f5f1e8;
  --paper-2: #ede7da;
  --card: #fbf9f4;
  --ink: #1d1f1c;
  --ink-2: #3c3e39;
  --muted: #74716a;
  --line: rgba(29, 31, 28, 0.12);
  --line-strong: rgba(29, 31, 28, 0.22);
  --jade: #2c6e5a;
  --jade-ink: #ffffff;
  --jade-soft: #e1ebe5;
  --vermilion: #b8452f;
  --vermilion-soft: #f6e2db;
  --gold: #b78a2c;
  --tile-face: #f7f2e6;
  --tile-hi: #fffdf8;
  --tile-edge: #dcd2bf;
  --tile-back: #2c6e5a;
  --felt: #e9e3d4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 12px 32px -16px rgba(40, 36, 28, 0.28);
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  --tw: 46px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #131513; --paper-2: #1a1d1a; --card: #1b1e1b; --ink: #ece8df; --ink-2: #cfcbc1; --muted: #9a978e;
    --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(255, 255, 255, 0.2);
    --jade: #74bba0; --jade-ink: #0f1a15; --jade-soft: #1e2e27; --vermilion: #e58a6f; --vermilion-soft: #3a231c; --gold: #d8b25a;
    --tile-face: #ebe4d3; --tile-hi: #f6f1e5; --tile-edge: #b9ae97; --tile-back: #2f6b57; --felt: #1d211d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #131513; --paper-2: #1a1d1a; --card: #1b1e1b; --ink: #ece8df; --ink-2: #cfcbc1; --muted: #9a978e;
  --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(255, 255, 255, 0.2);
  --jade: #74bba0; --jade-ink: #0f1a15; --jade-soft: #1e2e27; --vermilion: #e58a6f; --vermilion-soft: #3a231c; --gold: #d8b25a;
  --tile-face: #ebe4d3; --tile-hi: #f6f1e5; --tile-edge: #b9ae97; --tile-back: #2f6b57; --felt: #1d211d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  min-height: 100vh; overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 3px; border-radius: 6px; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 19px; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 38px; border-radius: 6px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile-face));
  box-shadow: 0 2px 0 var(--tile-edge), 0 4px 0 var(--tile-back);
  color: var(--vermilion); font: 700 19px/1 'Noto Serif SC', 'Songti SC', serif;
}
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a, .nav button {
  text-decoration: none; padding: 7px 12px; border-radius: 999px; border: 0; background: none; cursor: pointer;
  color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.nav a:hover, .nav button:hover { background: var(--paper-2); }
.nav a[aria-current='page'] { background: var(--ink); color: var(--paper); }
.toggle { display: inline-flex; align-items: center; gap: 8px; }
.toggle .switch { width: 30px; height: 18px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; }
.toggle .switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle[aria-pressed='true'] .switch { background: var(--jade); }
.toggle[aria-pressed='true'] .switch::after { transform: translateX(12px); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--ink); color: var(--paper); font-weight: 500; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform .15s, background .2s, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .35; cursor: not-allowed; transform: none; }
.btn--jade { background: var(--jade); color: var(--jade-ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--paper-2); }
.btn--sm { padding: 7px 14px; font-size: 14px; }
.btn--red { background: var(--vermilion); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ============ Tiles ============ */
.tile {
  --w: var(--tw);
  position: relative; flex: none; display: block;
  width: var(--w); height: calc(var(--w) * 1.333);
  padding: calc(var(--w) * 0.07);
  border: 0; border-radius: calc(var(--w) * 0.15);
  background: linear-gradient(180deg, var(--tile-hi) 0%, var(--tile-face) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 calc(var(--w) * 0.06) 0 var(--tile-edge),
    0 calc(var(--w) * 0.1) 0 var(--tile-back),
    0 calc(var(--w) * 0.14) calc(var(--w) * 0.22) -4px rgba(30, 26, 18, 0.35);
  margin-bottom: calc(var(--w) * 0.1);
  transition: transform .18s cubic-bezier(.3,.7,.4,1), box-shadow .2s, opacity .2s;
}
.tile svg { width: 100%; height: 100%; display: block; }
.tile--lg { --w: calc(var(--tw) * 1.28); }
.tile--sm { --w: calc(var(--tw) * 0.72); }
.tile--xs { --w: calc(var(--tw) * 0.5); }
.tile--back {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.18), transparent 60%),
    var(--tile-back);
  box-shadow: 0 calc(var(--w) * 0.06) 0 var(--tile-edge), 0 calc(var(--w) * 0.1) calc(var(--w) * .2) -4px rgba(0,0,0,.3);
}
button.tile { cursor: pointer; }
button.tile:hover { transform: translateY(-5px); }
.tile.is-selected { transform: translateY(-12px); }
.tile.is-selected::before, .tile.is-hint::before, .tile.is-good::before, .tile.is-bad::before, .tile.is-last::before {
  content: ''; position: absolute; inset: -4px; border-radius: calc(var(--w) * 0.2);
  border: 2px solid var(--jade); pointer-events: none;
}
.tile.is-hint::before { border-style: dashed; animation: breathe 1.6s ease-in-out infinite; }
.tile.is-good::before { border-color: var(--jade); background: color-mix(in srgb, var(--jade) 12%, transparent); }
.tile.is-bad::before { border-color: var(--vermilion); }
.tile.is-bad { animation: shake .35s; }
.tile.is-last::before { border-color: var(--vermilion); }
.tile.is-dim { opacity: .35; }
.tile.is-new { animation: rise .35s cubic-bezier(.2,.8,.3,1); }
@keyframes breathe { 50% { opacity: .35; } }
@keyframes shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

.labels-on .tile[data-label]::after {
  content: attr(data-label); position: absolute; left: 50%; top: 100%;
  transform: translate(-50%, calc(var(--w) * 0.14 + 3px));
  font: 500 10px/1 var(--sans); color: var(--muted); white-space: nowrap; letter-spacing: .01em;
}
.labels-on .tile-row:not(.no-label-space) { padding-bottom: 14px; }
.no-labels .tile::after, .labels-on .tile--xs::after, .labels-on .tile--sm::after { display: none !important; }
.labels-on .no-labels .tile-row { padding-bottom: 0; }

.tile-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: flex-end; }
.tile-row.tight { gap: 2px; }
.sets { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.set { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.set .tile-row { gap: 2px; }
.set-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ============ Home ============ */
.home { max-width: 1080px; margin: 0 auto; padding: clamp(40px, 9vw, 110px) clamp(16px, 4vw, 40px) 80px; }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--jade); margin-bottom: 18px; }
.hero h1 { font-size: clamp(44px, 7vw, 82px); font-weight: 300; }
.hero h1 em { font-style: italic; color: var(--jade); }
.hero .lede { font-size: 19px; color: var(--ink-2); max-width: 30em; margin: 24px 0 32px; }
.hero-art { position: relative; height: 340px; }
.hero-art .tile { position: absolute; --w: 64px; }
.hero-art .tile:nth-child(odd) { animation: float 7s ease-in-out infinite; }
.hero-art .tile:nth-child(even) { animation: float 8s ease-in-out -3s infinite; }
@keyframes float { 50% { translate: 0 -8px; } }
.chapters { margin-top: clamp(64px, 10vw, 120px); display: grid; grid-template-columns: 1fr 2fr; gap: 48px; }
.chapters h2 { font-size: 34px; }
.chapter-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.chapter-list a { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: baseline; padding: 18px 4px; border-bottom: 1px solid var(--line); text-decoration: none; transition: padding .2s; }
.chapter-list a:hover { padding-left: 12px; }
.chapter-list .num { font-family: var(--serif); color: var(--muted); font-size: 15px; }
.chapter-list .ttl { font-family: var(--serif); font-size: 21px; }
.chapter-list .sub { display: block; font-family: var(--sans); font-size: 14px; color: var(--muted); margin-top: 2px; }
.chapter-list .state { font-size: 12px; color: var(--jade); font-weight: 600; }
.variant-note { margin-top: 64px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-size: 15px; display: flex; gap: 16px; }

/* ============ Learn ============ */
.learn { display: grid; grid-template-columns: 270px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; gap: clamp(24px, 4vw, 56px); padding: 36px clamp(16px, 4vw, 40px) 80px; }
.toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; padding-right: 4px; }
.toc-progress { height: 3px; background: var(--line); border-radius: 3px; margin: 4px 0 20px; overflow: hidden; }
.toc-progress span { display: block; height: 100%; background: var(--jade); transition: width .4s; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc > ol > li { margin-bottom: 4px; }
.toc .ch { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-family: var(--serif); font-size: 16px; color: var(--ink-2); text-decoration: none; }
.toc .ch:hover { background: var(--paper-2); }
.toc .ch .n { font-size: 13px; color: var(--muted); width: 16px; flex: none; }
.toc .ch.is-current { color: var(--ink); background: var(--paper-2); }
.toc .ch.is-done .n { color: var(--jade); }
.toc .steps { padding: 2px 0 8px 36px; display: none; }
.toc li.open .steps { display: block; }
.toc .steps a { display: block; font-size: 13.5px; padding: 4px 8px; border-radius: 6px; text-decoration: none; color: var(--muted); position: relative; }
.toc .steps a::before { content: ''; position: absolute; left: -12px; top: 50%; width: 6px; height: 6px; border-radius: 50%; translate: 0 -50%; border: 1.5px solid var(--line-strong); }
.toc .steps a.is-done::before { background: var(--jade); border-color: var(--jade); }
.toc .steps a[aria-current='step'] { color: var(--ink); font-weight: 500; }
.toc .steps a:hover { color: var(--ink); }

.lesson { min-width: 0; max-width: 820px; }
.lesson .kicker { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--jade); margin-bottom: 14px; }
.lesson h2 { font-size: clamp(32px, 4.4vw, 46px); font-weight: 300; margin-bottom: 22px; }
.lesson .prose { font-size: 17px; color: var(--ink-2); max-width: 40em; }
.lesson .prose p:last-child { margin-bottom: 0; }
.lesson .prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.lesson .prose li { margin-bottom: .35em; }
.lesson .prose em { font-family: var(--serif); font-style: italic; color: var(--ink); }
.stage { margin-top: 32px; padding: clamp(20px, 3.5vw, 36px); background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.stage + .stage { margin-top: 16px; }
.stage-title { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; display: flex; justify-content: space-between; gap: 12px; }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 36px; gap: 12px; }
.lesson-nav .count { font-size: 13px; color: var(--muted); }
.toc-toggle { display: none; }

.prompt { font-family: var(--serif); font-size: 22px; margin-bottom: 18px; }
.prompt small { display: block; font-family: var(--sans); font-size: 14px; color: var(--muted); margin-top: 4px; }
.feedback { margin-top: 18px; padding: 12px 16px; border-radius: 12px; font-size: 15px; display: none; }
.feedback.show { display: block; animation: rise .3s; }
.feedback.good { background: var(--jade-soft); color: var(--ink); }
.feedback.bad { background: var(--vermilion-soft); color: var(--ink); }
.feedback.info { background: var(--paper-2); }
.feedback .tile-row, .feedback .sets { margin-top: 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.choice { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; font-weight: 500; transition: background .2s, border-color .2s; }
.choice:hover { background: var(--paper-2); }
.choice.is-right { background: var(--jade); color: var(--jade-ink); border-color: var(--jade); }
.choice.is-wrong { border-color: var(--vermilion); color: var(--vermilion); animation: shake .35s; }
.choice[disabled] { cursor: default; }
.dots { display: flex; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.dots i.on { background: var(--jade); }
.dots i.miss { background: var(--vermilion); }
.info-line { min-height: 1.6em; margin-top: 14px; font-size: 15px; color: var(--muted); }
.info-line strong { color: var(--ink); }
.gallery { display: grid; gap: 22px; }
.gallery h4 { margin: 0 0 10px; font: 600 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.numeral-key { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin-top: 18px; max-width: 460px; }
.numeral-key div { text-align: center; padding: 8px 0; border-radius: 8px; background: var(--paper-2); font-size: 12px; color: var(--muted); }
.numeral-key b { display: block; font: 700 20px/1.2 'Noto Serif SC', 'Songti SC', serif; color: var(--ink); }
.zone-label { font-size: 12px; color: var(--muted); margin: 18px 0 8px; font-weight: 500; }
.pool { min-height: 80px; }
.built { min-height: 40px; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: 14px; }
.built:empty::before { content: 'Your sets will appear here'; color: var(--muted); font-size: 14px; }
.faan-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.faan-table td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.faan-table td:last-child { text-align: right; font-family: var(--serif); font-size: 18px; white-space: nowrap; }
.faan-table tr.total td { border-bottom: 0; font-weight: 600; }
.callout { margin-top: 20px; padding: 14px 18px; border-left: 3px solid var(--gold); background: var(--paper-2); border-radius: 0 10px 10px 0; font-size: 15px; color: var(--ink-2); }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps-list li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; }
.steps-list li::before { content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--jade-soft); color: var(--jade); font: 600 13px/1 var(--sans); }

/* mini table diagram */
.mini-table { position: relative; width: 240px; height: 240px; margin: 0 auto; }
.mini-table .felt { position: absolute; inset: 44px; border-radius: 18px; background: var(--felt); border: 1px solid var(--line); display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted); padding: 10px; }
.mini-table .seat { position: absolute; width: 72px; text-align: center; font-size: 12px; color: var(--muted); transition: color .3s; }
.mini-table .seat b { display: grid; place-items: center; margin: 0 auto 4px; width: 38px; height: 38px; border-radius: 50%; background: var(--card); border: 1px solid var(--line-strong); font: 700 17px/1 'Noto Serif SC', 'Songti SC', serif; color: var(--ink); transition: all .3s; }
.mini-table .seat.on { color: var(--ink); font-weight: 600; }
.mini-table .seat.on b { background: var(--jade); color: var(--jade-ink); border-color: var(--jade); transform: scale(1.12); }
.mini-table .seat.from b { background: var(--vermilion); border-color: var(--vermilion); color: #fff; }
.mini-table .s-bottom { bottom: -14px; left: 50%; translate: -50% 0; }
.mini-table .s-right { right: -18px; top: 50%; translate: 0 -50%; }
.mini-table .s-top { top: -6px; left: 50%; translate: -50% 0; }
.mini-table .s-left { left: -18px; top: 50%; translate: 0 -50%; }
.scenario { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: center; }
.discard-callout { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }

/* wall diagram */
.wall { display: grid; grid-template-columns: repeat(17, 1fr); gap: 2px; max-width: 420px; }
.wall i { aspect-ratio: 3/4; border-radius: 2px; background: var(--tile-back); opacity: .85; }
.wall i.dealt { opacity: .15; }

/* ============ Play ============ */
.play { max-width: 1320px; margin: 0 auto; padding: 20px clamp(12px, 3vw, 32px) 60px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
.board {
  --tw: clamp(26px, calc((100vw - 60px) / 16), 46px);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: 'top top top' 'left center right' 'bottom bottom bottom';
  gap: 14px; background: var(--felt); border-radius: 24px; padding: clamp(12px, 2vw, 22px); border: 1px solid var(--line);
}
.opp { display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; }
.opp-top { grid-area: top; }
.opp-left { grid-area: left; }
.opp-right { grid-area: right; }
.opp .who, .me .who { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.who .wind { font: 700 14px/1 'Noto Serif SC', 'Songti SC', serif; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); }
.who.is-turn { color: var(--ink); font-weight: 600; }
.who.is-turn .wind { background: var(--jade); color: var(--jade-ink); border-color: var(--jade); }
.opp-hand { display: flex; gap: 2px; }
.opp-left .opp-hand, .opp-right .opp-hand { flex-direction: column; }
.opp-left .opp-hand .tile, .opp-right .opp-hand .tile { height: calc(var(--w) * .55); margin-bottom: 0; }
.opp-hand .tile { --w: calc(var(--tw) * 0.5); margin-bottom: 0; }
.melds { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.melds .tile-row { gap: 1px; }
.center { grid-area: center; display: grid; grid-template-columns: 1fr 1.6fr 1fr; grid-template-rows: auto 1fr auto; gap: 10px; background: color-mix(in srgb, var(--paper) 40%, var(--felt)); border-radius: 18px; padding: 12px; min-height: 260px; }
.river { display: flex; flex-wrap: wrap; gap: 2px; align-content: flex-start; }
.river .tile { --w: calc(var(--tw) * 0.62); margin-bottom: 3px; }
.river-top { grid-column: 2; grid-row: 1; justify-content: center; }
.river-left { grid-column: 1; grid-row: 1 / 4; align-content: center; justify-content: flex-end; }
.river-right { grid-column: 3; grid-row: 1 / 4; align-content: center; }
.river-bottom { grid-column: 2; grid-row: 3; justify-content: center; }
.center-info { grid-column: 2; grid-row: 2; display: grid; place-items: center; text-align: center; }
.center-info .wall-count { font-family: var(--serif); font-size: 34px; line-height: 1; }
.center-info small { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.center-info .round { margin-top: 10px; font-size: 12px; color: var(--muted); }
.me { grid-area: bottom; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.my-hand { display: flex; gap: 4px; align-items: flex-end; flex-wrap: nowrap; justify-content: center; padding-top: 14px; }
.my-hand .drawn { margin-left: calc(var(--tw) * 0.35); }
.labels-on .my-hand { padding-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 42px; align-items: center; }
.actions .claim-chow { display: inline-flex; gap: 6px; align-items: center; }
.actions .claim-chow .tile-row { gap: 1px; }
.actions .claim-chow .tile { --w: 20px; margin-bottom: 0; }
.status { font-size: 14px; color: var(--ink-2); text-align: center; min-height: 1.4em; }

.coach { position: sticky; top: 92px; align-self: start; display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.panel h3 { font-size: 20px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coach-msg { font-size: 15px; color: var(--ink-2); }
.coach-msg .tile-row { margin: 10px 0 4px; }
.coach-msg .tile { --w: 26px; }
.coach-log { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); max-height: 240px; overflow: auto; display: flex; flex-direction: column-reverse; }
.coach-log li { padding: 6px 0; border-top: 1px solid var(--line); }
.coach-log li:last-child { border-top: 0; }
.coach-log b { color: var(--ink-2); font-weight: 500; }
.opts { display: grid; gap: 10px; font-size: 14px; }
.opts .toggle { justify-content: space-between; width: 100%; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; padding: 16px; background: rgba(15, 15, 12, .45); backdrop-filter: blur(4px); }
.modal.open { display: grid; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: var(--card); border-radius: 22px; padding: clamp(22px, 4vw, 38px); max-width: 720px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); position: relative; }
.modal-card h2 { font-size: 34px; margin-bottom: 8px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper-2); cursor: pointer; font-size: 20px; line-height: 1; }
.cheat h3 { font-size: 20px; margin: 26px 0 10px; }
.cheat p, .cheat li { font-size: 15px; color: var(--ink-2); }
.cheat ul { padding-left: 1.2em; }
.cheat .sets { margin: 8px 0; }
.cheat .tile { --w: 30px; }
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.result-total { font-family: var(--serif); font-size: 44px; color: var(--jade); }

/* ============ FAQ & footer ============ */
.faq { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 72px; display: grid; grid-template-columns: 1fr 2fr; gap: 48px; }
.faq h2 { font-size: 34px; }
.faq-list { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 32px 18px 4px; font-family: var(--serif); font-size: 19px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 6px; top: 50%; translate: 0 -50%; font-family: var(--sans); font-size: 20px; color: var(--muted); transition: rotate .2s; }
.faq details[open] summary::after { rotate: 45deg; }
.faq details p { margin: 0 4px 20px; color: var(--ink-2); font-size: 15.5px; max-width: 38em; }
.site-footer { border-top: 1px solid var(--line); padding: 24px clamp(16px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--ink-2); }

/* ============ Responsive ============ */
@media (max-width: 1020px) {
  .play { grid-template-columns: 1fr; }
  .coach { position: static; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { height: 220px; order: -1; }
  .hero-art .tile { --w: 46px; }
  .chapters, .faq { grid-template-columns: 1fr; gap: 20px; }
  .learn { grid-template-columns: 1fr; padding-top: 20px; }
  .toc { position: static; max-height: none; display: none; }
  .toc.open { display: block; }
  .toc-toggle { display: inline-flex; margin-bottom: 18px; }
  .split, .scenario { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --tw: 38px; }
  .topbar { gap: 10px; }
  .brand-name { display: none; }
  .nav a, .nav button { padding: 7px 9px; font-size: 13px; }
  .toggle-label { display: none; }
  .board { min-height: 0; padding: 10px; gap: 10px; grid-template-columns: 1fr 1fr 1fr; grid-template-areas: 'left top right' 'center center center' 'bottom bottom bottom'; --tw: clamp(20px, calc((100vw - 44px) / 15), 40px); }
  .opp .opp-hand { display: none; }
  .opp .opp-count { display: block; }
  .opp { justify-content: flex-start; }
  .opp .who { font-size: 11.5px; }
  .center { min-height: 240px; grid-template-columns: 1fr 1.4fr 1fr; padding: 8px; }
  .numeral-key { grid-template-columns: repeat(5, 1fr); }
}
.opp-count { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
