:root {
  --bg: #faf7f0;
  --surface: #ffffff;
  --surface-2: #efe9da;
  --surface-3: #231d18;
  --ink: #1e1915;
  --muted: #5c5349;
  --accent: #15803d;
  --accent-hover: #166534;
  --accent-ink: #ffffff;
  --link: #15803d;
  --maple: #e9c98f;
  --maple-edge: #b98a4b;
  --maple-ink: #3b2a17;
  --top-tint: #e5f3ea;
  --bottom-tint: #f6e7d4;
  --ok-bg: #e3f5ec;
  --ok-ink: #0c4a2a;
  --warn-bg: #fdf1e6;
  --warn-ink: #7c370f;
  --bad-bg: #fbe9e7;
  --bad-ink: #7f1d1d;
  --line: rgba(30, 25, 21, 0.14);
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --step-small: clamp(0.85rem, 0.83rem + 0.1vw, 0.92rem);
  --step-body: clamp(1.02rem, 0.99rem + 0.18vw, 1.1rem);
  --step-lead: clamp(1.14rem, 1.08rem + 0.22vw, 1.24rem);
  --step-h2: clamp(1.5rem, 1.2rem + 1.4vw, 2.15rem);
  --step-head: clamp(2rem, 1.45rem + 2.6vw, 3.4rem);
  --gap: 8px;
  --ad-gap: 32px;
  --max-w: 1320px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.55; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: var(--step-body); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 0.44em; font-family: var(--font-sans); font-weight: 700; color: inherit; }
h1 { font-size: var(--step-head); line-height: 1.02; letter-spacing: -0.035em; }
h2 { font-size: var(--step-h2); line-height: 1.1; letter-spacing: -0.025em; }
h3, h4 { font-size: var(--step-lead); line-height: 1.25; }
p, ul, ol, table { margin: 0 0 0.95rem; }
p, li { max-width: 68ch; overflow-wrap: anywhere; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--surface-3); color: #fff; padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.board-shell { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 14px 20px; }
.top-bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
.brand-tile { background: var(--surface-3); color: #ffffff; padding: 10px 16px; min-height: 46px; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; letter-spacing: -0.02em; }
.brand-tile:hover { background: var(--accent); color: #ffffff; }
.brand-mark { font-family: var(--font-mono); background: var(--maple); color: var(--maple-ink); width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-bottom: 3px solid var(--maple-edge); font-size: 0.9rem; }
.nav-tile { background: var(--surface); padding: 8px 18px; min-height: 46px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.nav-tile a { color: var(--ink); text-decoration: none; font-size: var(--step-small); font-weight: 600; }
.nav-tile a:hover, .nav-tile a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.cta-tile { background: var(--accent); color: #ffffff; padding: 12px 20px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--step-small); text-decoration: none; }
.cta-tile:hover { background: var(--accent-hover); color: #ffffff; }

.board-section { margin-top: clamp(40px, 5vw, 72px); }
.board-section--first { margin-top: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.tile { background: var(--surface); color: var(--ink); padding: 22px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.tile--top { justify-content: flex-start; }
.tile-elev { background: var(--surface-2); }
.tile-photo { padding: 0; position: relative; overflow: hidden; min-height: 220px; }
.tile-photo img { width: 100%; height: 100%; min-height: 220px; max-height: 300px; object-fit: cover; }
.photo-strip { background: var(--surface-3); color: #ffffff; padding: 8px 14px; font-size: var(--step-small); line-height: 1.35; }
.c-12 { grid-column: span 12; } .c-8 { grid-column: span 8; } .c-7 { grid-column: span 7; } .c-6 { grid-column: span 6; }
.c-5 { grid-column: span 5; } .c-4 { grid-column: span 4; } .c-3 { grid-column: span 3; } .c-2 { grid-column: span 2; }

.hero-lead { font-size: var(--step-body); line-height: 1.5; margin: 0.4rem 0 0.6rem; max-width: 64ch; }
.board-section--first h1 { font-size: clamp(1.7rem, 1.3rem + 1.9vw, 2.6rem); margin-bottom: 0.25em; }
.board-section--first .tile { padding: 16px 20px; }
.btn-primary, .btn-ghost { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--step-small); text-decoration: none; cursor: pointer; font-family: var(--font-sans); padding: 10px 18px; border: 0; }
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); color: #ffffff; }
.btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.btn-ghost:hover { background: var(--surface-3); color: #ffffff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost:disabled:hover { background: var(--surface-2); color: var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stat-note { font-size: var(--step-small); color: var(--muted); margin: 0; }

/* ---------- Game zone: keeps >= 24px clearance from any ad slot ---------- */
.game-zone { margin-bottom: var(--ad-gap); padding-bottom: 4px; }
.game { background: var(--surface); border: 1px solid var(--line); padding: 18px; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 18px; }
.game-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.game-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; background: var(--surface-2); padding: 14px; }
.game-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; }
.seg button { font-family: var(--font-sans); font-weight: 700; font-size: var(--step-small); border: 0; background: transparent; color: var(--ink); padding: 8px 14px; min-height: 38px; cursor: pointer; }
.seg button.is-on { background: var(--surface-3); color: #ffffff; }
.pips { display: inline-flex; gap: 5px; align-items: center; }
.pip { width: 12px; height: 12px; background: var(--accent); display: inline-block; }
.pip.is-used { background: var(--surface-2); outline: 1px solid var(--line); }
.pip.is-hit { background: var(--maple-edge); }
.left-note { font-size: var(--step-small); color: var(--muted); }

.bound { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; }
.bound-top { background: var(--top-tint); border-left: 5px solid var(--accent); }
.bound-bottom { background: var(--bottom-tint); border-left: 5px solid var(--maple-edge); }
.bound-label { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-width: 108px; }
.tile-word { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.lt { font-family: var(--font-mono); font-weight: 700; width: 34px; height: 38px; display: inline-flex; align-items: center; justify-content: center; background: var(--maple); color: var(--maple-ink); border-bottom: 4px solid var(--maple-edge); font-size: 1.12rem; }
.lt.is-blank { background: transparent; border: 2px dashed var(--maple-edge); color: var(--maple-edge); }
.lt.is-core { background: var(--surface-3); color: #ffffff; border-bottom-color: var(--accent); }

.squeeze { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
.squeeze.is-hidden .squeeze-track { visibility: hidden; height: 4px; }
.squeeze-track { position: relative; height: 14px; background: var(--surface-2); overflow: hidden; }
.squeeze-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; background: var(--accent); transition: left 260ms ease-out, width 260ms ease-out; }
.squeeze-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: var(--step-small); color: var(--muted); }
.squeeze-meta strong { font-family: var(--font-mono); font-size: 1.15rem; color: var(--ink); }
.squeeze-trail { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }

.guess-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.guess-row input { width: 100%; min-height: 50px; padding: 8px 14px; font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; letter-spacing: 0.12em; text-transform: uppercase; background: #ffffff; color: var(--ink); border: 2px solid var(--surface-3); }
.guess-row input::placeholder { letter-spacing: 0.02em; font-weight: 600; font-size: 0.95rem; text-transform: none; color: #8b8075; }
.guess-row input:disabled { background: var(--surface-2); }
.guess-row button { min-width: 96px; }
.guess-row.is-shake { animation: shake 320ms ease; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.game-msg { min-height: 1.5em; font-size: var(--step-small); font-weight: 600; margin: 0; padding: 8px 10px; background: var(--surface-2); max-width: none; }
.game-msg.is-ok { background: var(--ok-bg); color: var(--ok-ink); }
.game-msg.is-warn { background: var(--warn-bg); color: var(--warn-ink); }
.game-msg.is-bad { background: var(--bad-bg); color: var(--bad-ink); }
.hint-line { font-size: var(--step-small); font-weight: 600; color: var(--accent-hover); margin: 0; min-height: 1.2em; }

.kbd { display: flex; flex-direction: column; gap: 6px; user-select: none; }
.kbd-row { display: flex; gap: 5px; justify-content: center; }
.key { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; min-width: 0; flex: 1 1 0; max-width: 46px; height: 48px; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; border-bottom: 3px solid #d6ccb5; }
.key:hover { background: var(--maple); }
.key:active { transform: translateY(2px); border-bottom-width: 1px; }
.key-wide { max-width: 78px; flex-grow: 1.6; font-family: var(--font-sans); font-size: 0.8rem; }
.game-tools { display: flex; flex-wrap: wrap; gap: 8px; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.history li { display: grid; grid-template-columns: 26px minmax(0, auto) 1fr; gap: 8px; align-items: center; background: #ffffff; padding: 6px 10px; font-size: var(--step-small); max-width: none; }
.history strong { font-family: var(--font-mono); letter-spacing: 0.06em; }
.history .h-note { color: var(--muted); text-align: right; }
.history li.h-hit { background: var(--ok-bg); }
.side-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stat-cell { background: #ffffff; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.stat-cell strong { font-family: var(--font-mono); font-size: 1.2rem; }
.stat-cell span { font-size: 0.74rem; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.dist-row { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: center; font-size: 0.74rem; }
.dist-row i { font-style: normal; background: var(--accent); color: #ffffff; text-align: right; padding: 1px 5px; min-width: 18px; font-family: var(--font-mono); }
.countdown { font-family: var(--font-mono); font-size: 0.84rem; color: var(--muted); margin: 0; }

/* sprint */
.sprint-board { display: flex; flex-direction: column; gap: 12px; }
.sprint-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sprint-kpis div { background: var(--surface-2); padding: 8px 10px; display: flex; flex-direction: column; }
.sprint-kpis span { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.sprint-kpis strong { font-family: var(--font-mono); font-size: 1.35rem; }
.is-low .sprint-time { color: #b91c1c; }
.center-tiles { display: flex; gap: 6px; justify-content: center; padding: 14px 0; }
.center-tiles .lt { width: 48px; height: 54px; font-size: 1.5rem; }
.found-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto; }
.found-list li { font-family: var(--font-mono); font-weight: 700; font-size: 0.86rem; background: #ffffff; padding: 4px 8px; border: 1px solid var(--line); }
.missed { font-size: var(--step-small); color: var(--muted); margin: 0; }

/* helper + tutorial */
.ctrl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ctrl-field { display: flex; flex-direction: column; gap: 5px; }
.ctrl-field label { font-size: var(--step-small); font-weight: 700; }
.ctrl-field input { width: 100%; min-height: 46px; padding: 8px 12px; font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.08em; border: 2px solid var(--surface-3); background: #ffffff; color: var(--ink); }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.kpi { background: #ffffff; padding: 10px 12px; }
.kpi span { display: block; font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.kpi strong { display: block; font-family: var(--font-mono); font-size: 1.15rem; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; background: var(--maple); color: var(--maple-ink); padding: 3px 7px; }
.reveal-list { display: flex; flex-direction: column; gap: 6px; }
.reveal-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; background: #ffffff; padding: 8px 10px; }
.reveal-row output { font-family: var(--font-mono); font-weight: 700; }
.tut-log { margin: 0; padding-left: 1.3em; font-size: var(--step-small); display: flex; flex-direction: column; gap: 4px; }
.tut-bounds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tut-bounds div { padding: 10px 12px; }
.tut-bounds strong { display: block; font-family: var(--font-mono); font-size: 1.1rem; letter-spacing: 0.06em; }

/* content */
.guide h2 { margin-top: 1.4em; font-size: clamp(1.25rem, 1.08rem + 0.7vw, 1.6rem); }
.guide h2:first-child { margin-top: 0; }
.guide ul, .guide ol { padding-left: 1.25em; }
.guide li { margin-bottom: 0.35em; }
.guide-aside h3 { margin-top: 0.6em; }
.guide-aside h3:first-child { margin-top: 0; }
.next-row-title { font-size: var(--step-lead); margin-bottom: 10px; }
.next-card { text-decoration: none; gap: 8px; border: 1px solid var(--line); }
.next-card:hover { border-color: var(--accent); }
.next-q { font-weight: 700; color: var(--ink); }
.next-a { font-size: var(--step-small); color: var(--muted); }
.next-go { font-size: var(--step-small); font-weight: 700; color: var(--accent); margin-top: auto; }
.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--step-small); font-variant-numeric: tabular-nums; margin: 0; }
th, td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }

.faq-layout { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gap); align-items: start; }
.faq-sticky { position: sticky; top: 24px; padding-right: 12px; }
.faq-sticky p { color: var(--muted); margin-top: 8px; font-size: var(--step-small); }
.faq-stack { display: flex; flex-direction: column; gap: var(--gap); }
.faq-tile { background: var(--surface); }
.faq-tile summary { list-style: none; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 700; cursor: pointer; }
.faq-tile summary::-webkit-details-marker { display: none; }
.faq-plus { width: 14px; height: 14px; position: relative; flex-shrink: 0; }
.faq-plus::before, .faq-plus::after { content: ""; position: absolute; background: currentColor; }
.faq-plus::before { top: 6px; left: 0; width: 14px; height: 2px; }
.faq-plus::after { top: 0; left: 6px; width: 2px; height: 14px; }
.faq-tile[open] { background: var(--surface-3); color: #ffffff; }
.faq-tile[open] .faq-plus::after { display: none; }
.faq-ans { padding: 0 20px 18px; font-size: var(--step-small); }

/* ---------- Ads: static slots, always >= 24px from game controls ---------- */
.ad-slot { margin: var(--ad-gap) 0; background: var(--surface); padding: 6px 10px; overflow: hidden; }
.ad-leader, .ad-300 { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 68px; }
.ad-n, .ad-native { display: block; width: 100%; text-align: center; }
.ad-slot-label { display: block; font-size: 0.76rem; color: var(--muted); margin-bottom: 4px; }
.ad-slot-pending { display: none; }

.footer-board { margin-top: clamp(56px, 7vw, 100px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.footer-wordmark { background: var(--surface-3); color: #ffffff; padding: 24px; display: flex; align-items: flex-end; min-height: 168px; }
.footer-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-tiles i { font-style: normal; font-family: var(--font-mono); font-weight: 700; font-size: clamp(1.6rem, 4vw, 3rem); width: 1.5em; height: 1.6em; display: inline-flex; align-items: center; justify-content: center; background: var(--maple); color: var(--maple-ink); border-bottom: 5px solid var(--maple-edge); }
.footer-cta-tile { background: var(--accent); color: #ffffff; padding: 22px; min-height: 168px; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; }
.footer-cta-tile:hover { background: var(--accent-hover); color: #ffffff; }
.footer-cta-tile strong { font-size: var(--step-lead); line-height: 1.2; }
.footer-cta-arrow { align-self: flex-end; }
.footer-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.footer-list a { text-decoration: none; color: var(--ink); font-size: var(--step-small); }
.footer-list a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 980px) {
  .top-bar { grid-template-columns: 1fr auto; }
  .nav-tile { grid-column: 1 / -1; order: 3; }
  .c-3, .c-2 { grid-column: span 6; }
  .game, .faq-layout { grid-template-columns: 1fr; }
  .faq-sticky { position: static; }
}
@media (max-width: 680px) {
  .board-shell { padding: 10px 12px; }
  .tile-grid, .footer-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-12, .c-8, .c-7, .c-6, .c-5, .c-4 { grid-column: span 2; }
  .c-3, .c-2 { grid-column: span 1; }
  .game { padding: 12px; }
  .lt { width: 28px; height: 34px; font-size: 1rem; }
  .bound-label { min-width: 0; width: 100%; }
  .key { height: 44px; font-size: 0.86rem; }
  .ctrl-grid, .kpi-grid { grid-template-columns: 1fr 1fr; }
  .sprint-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-section--first .tile-photo img { max-height: 160px; }
}
