/* CSA Chess Tutor design system (docs/design.md): theme "Ivory Board".
   Warm ivory paper, deep emerald accent and app bar, brass details, a walnut-framed
   board. Headings in Fraunces (serif), text in Inter. Status colors
   (blunder / mistake / inaccuracy / good) always come with a symbol or label.
   Radius: controls 8px, containers 12px, chips and tabs fully rounded. */
:root {
  --bg: #f7f4ec;
  --surface: #ffffff;
  --surface-2: #f0ebdf;
  --ink: #1b1b18;
  --ink-2: #4a473f;
  --ink-3: #5e5a50;
  --line: #e4ddcc;
  --line-2: #efe9db;
  --accent: #1e5c45;
  --accent-hover: #123b2c;
  --accent-ink: #ffffff;
  --accent-soft: #e3eee8;
  --nav: #173a2e;
  --nav-2: #21503f;
  --nav-ink: #f3efe4;
  --nav-ink-2: #bccfc3;
  --partly: #a35a00;
  --error: #b42318;
  --error-soft: #fdecea;
  --error-ink: #ffffff;
  --ok: #157f3b;
  --st-critical: #d03b3b;
  --st-serious: #ec835a;
  --st-warning: #fab219;
  --st-good: #0ca30c;
  --sq-light: #f1e7cc;
  --sq-dark: #5d8b68;
  --sq-last: rgba(240, 200, 80, 0.55);
  --sq-sel: rgba(30, 92, 69, 0.45);
  --sq-mark: rgba(214, 128, 20, 0.55);
  --sq-bad: rgba(208, 59, 59, 0.5);
  --sq-good: rgba(12, 163, 12, 0.42);
  --frame: #5a3920;
  --brass: #c9a24b;
  --shadow-sm: 0 1px 2px rgba(40, 32, 16, 0.06);
  --shadow: 0 1px 2px rgba(40, 32, 16, 0.06), 0 10px 28px rgba(40, 32, 16, 0.08);
  --shadow-lg: 0 12px 40px rgba(40, 32, 16, 0.18);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12110f; --surface: #1b1a17; --surface-2: #24221e; --ink: #eeeae0; --ink-2: #b3ad9f; --ink-3: #948e80;
    --line: #34312b; --line-2: #2a2824; --accent: #7cc3a1; --accent-hover: #9ad3b7; --accent-ink: #0f1f18; --accent-soft: #1c3229;
    --nav: #0e1a15; --nav-2: #18291f; --partly: #f0b45c; --error: #ff8a7a; --error-soft: #3a1d1a; --error-ink: #12110f; --ok: #4cc47a;
    --sq-light: #d8d2b8; --sq-dark: #4e7457; --sq-last: rgba(230, 190, 80, 0.45); --sq-sel: rgba(124, 195, 161, 0.5);
    --frame: #3a2616; --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35); --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12110f; --surface: #1b1a17; --surface-2: #24221e; --ink: #eeeae0; --ink-2: #b3ad9f; --ink-3: #948e80;
    --line: #34312b; --line-2: #2a2824; --accent: #7cc3a1; --accent-hover: #9ad3b7; --accent-ink: #0f1f18; --accent-soft: #1c3229;
    --nav: #0e1a15; --nav-2: #18291f; --partly: #f0b45c; --error: #ff8a7a; --error-soft: #3a1d1a; --error-ink: #12110f; --ok: #4cc47a;
    --sq-light: #d8d2b8; --sq-dark: #4e7457; --sq-last: rgba(230, 190, 80, 0.45); --sq-sel: rgba(124, 195, 161, 0.5);
    --frame: #3a2616; --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35); --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-optical-sizing: auto; }
h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.xsmall { font-size: 0.8125rem; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Page titles get focus on navigation (for screen readers); no ring on them. */
h1[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Anything scrolled into view (focus, links, tests) lands below the sticky top bar. */
html { scroll-padding-top: 76px; }

/* ---------- App shell ----------
   Signed out: a navy top bar. Signed in, wide screens: a navy sidebar and a light
   top bar holding the account menu. Signed in, phones: the navy top bar and a
   tab bar at the bottom. Gold is the logo's color, used sparingly. */
:root { --sidebar: 248px; --gold: #c9a24b; --gold-ink: #8a6420; --gold-soft: #f6edd6; --accent-solid: #1e5c45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --gold-ink: #e2c27a; --gold-soft: #2e2716; } }
:root[data-theme="dark"] { --gold-ink: #e2c27a; --gold-soft: #2e2716; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--nav); color: var(--nav-ink); }
.topbar-inner { height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: inherit; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; flex: none; }
.brand-mark img { width: 100%; height: 100%; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25)); }
.brand-text strong { font-family: var(--serif); font-weight: 700; }
.brand-text span { color: var(--gold); }
.brand-lg { gap: 12px; padding: 2px 8px 4px; color: #fff; }
.brand-lg .brand-mark { width: 42px; height: 42px; border-radius: 11px; }

.brand-lg .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-lg strong { font-size: 1.0625rem; }
.brand-lg .brand-text span { font-size: 0.875rem; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30; background: var(--nav); color: var(--nav-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
#sidenav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
#sidenav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--nav-ink-2); text-decoration: none; font-size: 0.9375rem; font-weight: 500; transition: background-color 160ms ease, color 160ms ease; }
#sidenav a:hover { color: var(--nav-ink); background: rgba(255, 255, 255, 0.06); }
#sidenav a[aria-current="page"] { color: #fff; background: #2f7a5c; box-shadow: inset 3px 0 0 var(--brass); font-weight: 600; }
#sidenav .icon { width: 19px; height: 19px; }
.sidenav-gap { flex: 1; min-height: 16px; }
.sidenav-group { margin: 14px 12px 2px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--nav-ink-2); opacity: 0.75; }
body.has-nav .shell { margin-left: var(--sidebar); }
body.has-nav .topbar { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
body.has-nav .topbar .brand { visibility: hidden; } /* the sidebar shows it */
body.has-nav .account-btn { border-color: var(--line); background: var(--surface); color: var(--ink); }
body.has-nav .account-btn:hover, body.has-nav .account-btn[aria-expanded="true"] { background: var(--surface-2); }
.tabbar { display: none; }
.topbar .btn-ghost-nav { color: var(--nav-ink); border: 1px solid rgba(255, 255, 255, 0.25); background: transparent; }
.topbar .btn-ghost-nav:hover { background: rgba(255, 255, 255, 0.08); }

/* Account menu */
.account { position: relative; z-index: 40; } /* the open menu sits above page content at every width (below the tour and dialogs) */
.account-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.04); color: var(--nav-ink); font: inherit; font-size: 0.875rem; cursor: pointer; transition: background-color 160ms ease; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); }
.account-btn .chev { width: 16px; height: 16px; color: var(--nav-ink-2); transition: transform 200ms var(--ease-out); }
.account-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem; flex: none; }
.avatar .icon { width: 15px; height: 15px; }
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; transform-origin: top right; animation: pop 160ms var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: 0.9375rem; }
.menu-head span { display: block; font-size: 0.8125rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 0.9375rem; text-decoration: none; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu .icon { color: var(--ink-2); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 0; }

main { min-height: calc(100vh - 60px); }
.page { padding-top: 36px; padding-bottom: 88px; }
.screen { animation: enter 220ms var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .menu { animation: none; } *, *::before { transition: none !important; } }
.head { display: grid; gap: 8px; margin-bottom: 28px; max-width: 70ch; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.head-row .head { margin-bottom: 0; }

/* ---------- Controls ---------- */
.btn { font: inherit; font-weight: 600; font-size: 0.9375rem; border-radius: 8px; padding: 0 18px; min-height: 44px; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(18, 24, 38, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--error); color: var(--error-ink); }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 1rem; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.875rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon-arrow { transition: transform 200ms var(--ease-out); }
.btn-primary:hover .icon-arrow { transform: translateX(3px); }
.btn-link { font: inherit; font-size: 0.875rem; background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 24px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

label.field, div.field { display: grid; gap: 6px; }
.label { font-weight: 600; font-size: 0.9375rem; }
.hint { font-size: 0.875rem; color: var(--ink-2); }
:where(input:not([type]), input[type="number"], input[type="email"], input[type="tel"], input[type="text"], input[type="search"], input[type="url"], select, textarea) { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 46px; transition: border-color 160ms ease, box-shadow 160ms ease; }
:where(input:not([type]), input[type="number"], input[type="email"], input[type="tel"], input[type="text"], input[type="search"], input[type="url"], select) { height: 46px; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.field.has-error input, .field.has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: 0.875rem; display: none; }
.field.has-error .field-error { display: block; }
.error-box { display: grid; gap: 12px; justify-items: start; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--error) 35%, var(--line)); border-radius: 12px; background: var(--error-soft); color: var(--ink); margin: 0 0 12px; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); padding: 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 1.0625rem; }
.panel-head a, .panel-head .btn-link { font-size: 0.875rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.win { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.chip.loss { background: var(--error-soft); color: var(--error); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px var(--surface); }
.dot.blunder { background: var(--st-critical); } .dot.mistake { background: var(--st-serious); } .dot.inaccuracy { background: var(--st-warning); } .dot.good { background: var(--st-good); }
.skeleton { display: grid; gap: 14px; }
.skeleton div { height: 72px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; display: flex; gap: 8px; align-items: center; animation: enter 200ms var(--ease-out); }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 24px; max-width: 440px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(40, 32, 16, 0.45); }
dialog h2 { margin-bottom: 8px; }

/* ---------- Landing ---------- */
/* Landing: the cream king behind the hero, copy on a light card */
.hero-wrap { position: relative; overflow: hidden; background: var(--bg); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left center; opacity: 0.9; }
.hero-wrap .hero { position: relative; padding-bottom: 96px; }
.hero-copy { background: rgba(255, 255, 255, 0.84); border-radius: 18px; padding: 28px; color: var(--ink); }
.hero-copy .lead { color: var(--ink-2); }
.hero-tag { justify-self: start; padding: 5px 12px; border-radius: 999px; background: var(--nav); color: var(--gold); font-size: 0.8125rem; font-weight: 700; }
.features { position: relative; margin-top: -40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.feature-tile { display: grid; gap: 8px; align-content: start; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(40, 32, 16, 0.08); }
.feature-tile h3 { font-size: 1.0625rem; }
.feature-tile p { font-size: 0.875rem; color: var(--ink-2); line-height: 1.5; }
.step-cards { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.step-cards li { display: grid; gap: 8px; align-content: start; padding: 22px; border-radius: 14px; background: var(--surface-2); }
.step-cards .n { width: 34px; height: 34px; border-radius: 50%; background: var(--nav); color: var(--gold); display: grid; place-items: center; font-weight: 700; }
.step-cards h3 { font-size: 1.125rem; }
.step-cards p { color: var(--ink-2); font-size: 0.9375rem; }
.games-band { position: relative; overflow: hidden; background: var(--nav); color: #fff; padding: 80px 0; }
.games-band > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.4; }
.games-band .wrap { position: relative; display: grid; gap: 16px; justify-items: start; }
.games-band h2 { font-size: 2rem; letter-spacing: -0.025em; max-width: 24ch; }
.games-band p { color: #e3e7ee; max-width: 56ch; font-size: 1.0625rem; }
.btn-gold { background: var(--gold); color: var(--nav); border: 1px solid var(--gold); font-weight: 700; }
.btn-gold:hover { background: #d8b45f; color: var(--nav); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 72px; align-items: center; padding-top: 56px; padding-bottom: 72px; }
.hero-copy { display: grid; gap: 22px; }
.hero h1 { font-size: 3.25rem; font-weight: 700; letter-spacing: -0.035em; line-height: 1.04; max-width: 13ch; }
.lead { font-size: 1.1875rem; color: var(--ink-2); max-width: 40ch; line-height: 1.5; }
.hero .actions { margin-top: 8px; }
.demo { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 16px; align-items: start; }
.demo-board { display: grid; gap: 12px; }
/* 3D hero: the board leans back and turns a little toward the pointer (--tx, --ty in -1..1). */
.hero-stage { --tx: 0; --ty: 0; perspective: 1100px; padding: 6px 4px 18px; }
.hero-tilt { position: relative; transform-style: preserve-3d; transform: rotateX(calc(16deg - var(--ty) * 5deg)) rotateY(calc(var(--tx) * 8deg)) rotateZ(-1.5deg); transition: transform 500ms var(--ease-out); animation: hero-in 900ms var(--ease-out) both; }
.hero-tilt::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: -26px; height: 40px; border-radius: 50%; background: radial-gradient(closest-side, rgba(40, 32, 16, 0.35), transparent); transform: translateZ(-60px); filter: blur(6px); pointer-events: none; }
.hero-tilt .board { border-radius: 8px; box-shadow: 0 2px 0 color-mix(in srgb, var(--sq-dark) 70%, #000), 0 24px 50px rgba(40, 32, 16, 0.28); }
@keyframes hero-in { from { opacity: 0; transform: rotateX(38deg) rotateZ(-6deg) translateY(30px); } }
@media (prefers-reduced-motion: reduce) { .hero-tilt { transform: none; animation: none; transition: none; } }
.caption { min-height: 3.1em; font-weight: 500; font-size: 0.9375rem; transition: opacity 180ms var(--ease-out); }
.caption.fade { opacity: 0; }
.sheet { font-family: var(--mono); font-size: 0.875rem; border-top: 2px solid var(--ink); }
.sheet-head, .sheet-row { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.sheet-head { font-family: "Inter", sans-serif; font-size: 0.75rem; font-weight: 600; color: var(--ink-2); }
.sheet-row span:first-child { color: var(--ink-2); }
.sheet .ply { opacity: 0; transition: opacity 200ms var(--ease-out); }
.sheet .ply.on { opacity: 1; }
.sheet .ply.now { color: var(--accent); font-weight: 500; }
.section { padding: 80px 0; border-top: 1px solid var(--line); }
.section h2, .band h2, .closing h2 { font-size: 2rem; letter-spacing: -0.025em; max-width: 22ch; }
.band { background: var(--nav); color: var(--nav-ink); padding: 88px 0; }
.band-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 64px; align-items: center; }
.band-copy p { color: var(--nav-ink-2); max-width: 46ch; margin-top: 16px; font-size: 1.0625rem; }
.preview { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 4px 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.preview .dim { border-bottom: 0; }
.closing { padding-top: 88px; padding-bottom: 88px; display: grid; gap: 18px; justify-items: start; }
.closing p { color: var(--ink-2); max-width: 52ch; font-size: 1.0625rem; }
.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 0.8125rem; color: var(--ink-2); }
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { color: inherit; }

/* ---------- Sign in ---------- */
.auth { max-width: 420px; margin: 0 auto; display: grid; gap: 14px; }
.auth .head { margin-bottom: 14px; }
.btn-block { width: 100%; min-height: 48px; }
.btn-provider { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-provider:hover:not(:disabled) { background: var(--surface-2); }
.btn-provider[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 0.8125rem; font-weight: 600; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-panel { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.phone-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 8px; }
.code-input { font-family: var(--mono); letter-spacing: 0.3em; font-size: 1.125rem; }
.legal { font-size: 0.8125rem; color: var(--ink-2); text-align: center; margin-top: 10px; }

/* ---------- Dashboard ---------- */
.feature-body { display: grid; gap: 10px; align-content: center; }
.feature-body h2 { font-size: 1.5rem; letter-spacing: -0.01em; }
.board.mini { box-shadow: 0 0 0 1px var(--brass), 0 0 0 5px var(--frame), 0 6px 18px rgba(40, 32, 16, 0.18); border-radius: 2px; }
.board.mini .coord { display: none; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-2); }
.activity li:first-child { border-top: 0; padding-top: 0; }
.activity .a-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; }
.activity .a-icon .icon { width: 16px; height: 16px; }
.activity a { color: inherit; text-decoration: none; }
.activity a:hover strong { text-decoration: underline; }
.activity strong { font-weight: 600; font-size: 0.9375rem; display: block; }
.activity span { font-size: 0.8125rem; color: var(--ink-2); }
/* Dashboard: today, streak, review, skill charts */
:root { --chart-line: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart-line: #5fae89; } }
:root[data-theme="dark"] { --chart-line: #5fae89; } /* the dark accent is too light for a chart mark (dataviz check) */
/* Page sections shared by the dashboard, progress and practice pages */
.screen > * + * { margin-top: 20px; }
.screen > .head + * { margin-top: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; align-items: stretch; }
.stack { display: grid; gap: 20px; }
/* Tinted icon squares: blue lessons, green practice, violet play, gold habits */
.tile-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.tile-icon .icon { width: 22px; height: 22px; }
.t-blue { background: var(--accent-soft); color: var(--accent); }
.t-green { background: var(--t-green-bg); color: var(--ok); }
.t-violet { background: var(--t-violet-bg); color: var(--t-violet); }
.t-gold { background: var(--gold-soft); color: var(--gold-ink); }
:root { --t-green-bg: #e6f4ea; --t-violet-bg: #f1ecfb; --t-violet: #6b46c1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --t-green-bg: #16301f; --t-violet-bg: #251d3a; --t-violet: #b49cf0; } }
:root[data-theme="dark"] { --t-green-bg: #16301f; --t-violet-bg: #251d3a; --t-violet: #b49cf0; }
/* Today: the streak strip */
.today-strip { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; box-shadow: var(--shadow-sm); }
.today-strip .tile-icon { width: 48px; height: 48px; border-radius: 12px; }
.today-strip .tile-icon .icon { width: 26px; height: 26px; }
.today-text { flex: 1 1 220px; display: grid; gap: 2px; }
.today-text strong { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
/* Next lesson: board and text, with the cream king beside them on wide screens */
.next-lesson { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.next-main { padding: 26px; display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 24px; align-items: center; }
.next-board { width: 196px; }
.next-art { width: 100%; height: 100%; min-height: 220px; object-fit: cover; object-position: left center; display: block; }
.next-lesson .chip { justify-self: start; }
@media (max-width: 1100px) { .next-lesson { grid-template-columns: 1fr; } .next-art { display: none; } }
@media (max-width: 560px) { .next-main { grid-template-columns: 1fr; padding: 20px; } .next-board { width: min(100%, 260px); justify-self: center; } }
/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.quick a { display: grid; gap: 6px; align-content: start; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color 160ms ease, transform 160ms var(--ease-out); }
.quick a .tile-icon { margin-bottom: 4px; }
.quick a strong { font-size: 1rem; }
.quick a:hover { border-color: var(--accent); transform: translateY(-1px); }
@media (max-width: 560px) { .quick { grid-template-columns: 1fr 1fr; gap: 12px; } .quick a { padding: 14px; } .quick .small { font-size: 0.8125rem; } }
/* The four skills as levels */
.skill-levels { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.levels-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9375rem; }
.levels-row .muted { font-size: 0.8125rem; }
.lvl { font-weight: 600; }
.lvl.l2 { color: var(--accent); } .lvl.l1 { color: var(--partly); } .lvl.l0 { color: var(--error); }
.segs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.segs i { height: 6px; border-radius: 3px; background: var(--surface-2); }
.segs.l2 i { background: var(--accent); }
.segs.l1 i:first-child { background: var(--partly); }
.skill-time { padding: 12px 0; border-top: 1px solid var(--line-2); }
.skill-time:first-of-type { border-top: 0; padding-top: 0; }
/* Due for review */
.review-list { list-style: none; margin: 0; padding: 0; display: grid; }
.review-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.review-list li:first-child { border-top: 0; padding-top: 0; }
.review-list li > span { display: grid; gap: 2px; }
/* Progress: totals and habits */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 16px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.tile > div { display: grid; gap: 2px; }
.tile strong { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile span:not(.tile-icon) { font-size: 0.875rem; color: var(--ink-2); }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; gap: 12px; } .tile { flex-direction: column; align-items: flex-start; padding: 14px; } }
.habits { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.habits li { display: grid; justify-items: center; align-content: start; text-align: center; gap: 4px; padding: 14px 8px; border-radius: 12px; background: var(--surface-2); opacity: 0.6; }
.habits li.earned { background: var(--gold-soft); opacity: 1; }
.habits strong { font-size: 0.875rem; }
/* Play setup: the board beside the settings */
.play-setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.setup-board { max-width: 520px; width: 100%; }
/* The cards under the setup share its columns, so both rows line up on the left and right */
.play-setup + .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; }
.setup-board .board { margin: 10px; width: calc(100% - 20px); }
@media (max-width: 1000px) { .play-setup, .play-setup + .cols { grid-template-columns: 1fr; } .setup-board { max-width: 360px; } }
.import-card { display: grid; gap: 10px; justify-items: start; }
.import-card h2 { font-size: 1.125rem; }
/* Practice */
.practice-card { display: grid; gap: 12px; justify-items: start; }
.practice-card h2 { font-size: 1.375rem; }
.spark { position: relative; height: 46px; margin-top: 8px; grid-column: 1 / -1; cursor: crosshair; }
.spark svg { width: 100%; height: 46px; display: block; overflow: visible; }
.spark .grid { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; }
.spark-dots i { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--chart-line); box-shadow: 0 0 0 2px var(--surface); opacity: 0; transition: opacity 120ms ease; }
.spark-dots i.last, .spark-dots i.on { opacity: 1; }
.spark .chart-tip { position: absolute; top: -34px; transform: translateX(-50%); background: var(--ink); color: var(--surface); border-radius: 8px; padding: 4px 8px; font-size: 0.75rem; white-space: nowrap; pointer-events: none; display: flex; gap: 8px; z-index: 2; }
.table-view { margin-top: 10px; font-size: 0.875rem; }
.table-view summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.table-view table { margin-top: 8px; width: 100%; }
/* Hover lift on interactive cards (subtle; off with reduced motion via the global rule). */
.topic-list li, .activity li { transition: background-color 160ms ease; }
.topic-list li:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

/* Think first (games) */
.think { display: grid; gap: 10px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); animation: enter 220ms var(--ease-out); }
.think h2 { display: flex; align-items: center; gap: 8px; }
.think h2 .icon { color: var(--accent); }
.think.found { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.think-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.think-list li strong { display: block; font-size: 0.9375rem; }
.think > .btn { justify-self: start; }

/* Puzzle sprint */
.sprint { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
.sprint-start { display: grid; gap: 14px; justify-items: start; }
.sprint-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sprint-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width 200ms linear; }
.sprint-score { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sprint-score strong { display: block; font-size: 1.75rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sprint-end { display: grid; gap: 8px; margin-top: 16px; animation: enter 220ms var(--ease-out); }
@media (max-width: 1000px) { .sprint { grid-template-columns: 1fr; } }

.to-reach { margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--partly); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.to-reach b { color: var(--partly); }
.also-note { margin-top: 8px; font-size: .94em; color: var(--ink-2); }
.also-note b { color: var(--ink); font-weight: 600; }
.draft-note { min-height: 1.4em; margin-top: -4px; }

/* Lessons catalog */
.cols.topics-top { align-items: stretch; }
.topics-family .topic-list li:first-child { border-top: 0; }
.topics-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; height: 100%; }
.topics-next > div { display: grid; gap: 6px; justify-items: start; }
.topics-next h2 { font-size: 1.25rem; }
/* The sprint banner: navy with the sunset king behind it */
.sprint-banner { position: relative; overflow: hidden; border-radius: 12px; padding: 22px; background: var(--nav); color: #fff; }
.sprint-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.4; }
.sprint-banner > :not(img) { position: relative; }
.sprint-banner .chip { background: rgba(255, 255, 255, 0.18); color: #fff; }
.sprint-banner p { color: #e3e7ee; }
.btn-light { background: #fff; color: var(--nav); border: 1px solid #fff; }
.btn-light:hover { background: #f3efe4; color: var(--nav); }
/* Filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.filter:hover { border-color: var(--ink-3); }
.filter[aria-pressed="true"] { background: var(--nav); border-color: var(--nav); color: #fff; }
.chip.due { background: var(--gold-soft); color: var(--gold-ink); }
/* A family: image, name, progress; opens to its topics */
.topics-family { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.topics-family + .topics-family { margin-top: 14px; }
.topics-family > summary { list-style: none; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 18px 14px 14px; cursor: pointer; }
.topics-family > summary::-webkit-details-marker { display: none; }
.topics-family > summary:hover .fam-chevron { border-color: var(--ink-3); }
.fam-art { width: 132px; height: 76px; border-radius: 10px; object-fit: cover; flex: none; }
.fam-art.fam-1 { object-position: left center; }
.fam-text { flex: 1 1 240px; display: grid; gap: 4px; }
.fam-text h2 { font-size: 1.125rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fam-progress { flex: 0 1 260px; min-width: 200px; display: grid; gap: 6px; }
.fam-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: block; }
.fam-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.fam-chevron { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.fam-chevron .icon { transition: transform 160ms var(--ease-out); }
.topics-family[open] .fam-chevron .icon { transform: rotate(180deg); }
.topics-family > .topic-list, .topics-family > div[id^="err-"]:not(:empty) { margin: 0 18px; }
.topics-family > .topic-list { padding-bottom: 6px; border-top: 1px solid var(--line-2); }
@media (max-width: 560px) {
  .topics-family > summary { gap: 12px; padding: 12px; }
  .fam-art { width: 72px; height: 56px; }
  .fam-text { flex-basis: calc(100% - 140px); }
  .fam-progress { flex: 1 1 100%; min-width: 0; order: 3; }
  .fam-chevron { width: 32px; height: 32px; }
}
.topic-list { list-style: none; margin: 0; padding: 0; display: grid; }
.topic-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.topic-list li > div { display: grid; gap: 4px; min-width: 0; }
.topic-list strong { font-weight: 600; font-size: 0.9375rem; }
.topic-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.topic-tags:empty { display: none; }
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-2); font-size: 0.9375rem; }

/* ---------- Profile & account ---------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 84px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.settings-nav a:hover { background: var(--surface-2); color: var(--ink); }
.settings-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.settings-body { display: grid; gap: 20px; }
.legal-see { margin-top: 20px; }
.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 16px; }
.kv dt { color: var(--ink-2); font-size: 0.9375rem; }
.kv dd { margin: 0; font-weight: 500; }
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 0.9375rem; }
.note .icon { color: var(--accent); margin-top: 2px; }
.legal-doc { display: grid; gap: 12px; max-width: 820px; }
.legal-doc h2 { font-size: 1.125rem; margin-top: 14px; }
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc p, .legal-doc li { color: var(--ink-2); max-width: 72ch; }
.legal-doc ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.legal-doc strong { color: var(--ink); }
.danger { border-color: color-mix(in srgb, var(--error) 35%, var(--line)); }
.danger h2 { color: var(--error); }

/* ---------- Intake ---------- */
.intake { display: grid; gap: 32px; max-width: 820px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }
legend { font-weight: 600; font-size: 1.0625rem; margin-bottom: 10px; padding: 0; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.choices.chess-levels { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .choices.chess-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.choice > span { display: grid; gap: 4px; height: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color 160ms ease, background-color 160ms ease; }
.choice > span em { font-style: normal; font-size: 0.875rem; color: var(--ink-2); }
.choice input:hover + span { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 16px; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented .choice > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding: 9px 14px; border-radius: 999px; }

/* ---------- Lesson stepper ---------- */
.lesson-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.lesson-bar .wrap { display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.875rem; color: var(--ink-3); min-width: 0; }
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; flex-wrap: wrap; }
.stepper a { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.stepper a .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.stepper a.done .num { background: var(--accent-soft); color: var(--accent); }
.stepper a[aria-current="step"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.stepper a[aria-current="step"] .num { background: var(--accent); color: var(--accent-ink); }
.stepper a[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.stepper a:not([aria-current]):not([aria-disabled]):hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Board ---------- */
.work { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 48px; align-items: start; }
.work > * { min-width: 0; }  /* a long move line wraps instead of widening the column */
.board-col { position: sticky; top: 84px; display: grid; gap: 12px; }
.board-col > .actions { margin-top: 0; }
/* The wooden frame is drawn 10px outside the board (box-shadow), so the layout must leave room for it:
   boards in a board column sit inside it, lined up with the text edge and clear of what follows. */
.board-col .board { margin: 10px; width: calc(100% - 20px); }
/* Placeholders filled only after a move take no space (each grid gap added 12px of nothing) */
.board-col > div:empty { display: none; }
.rating-panel > .btn { justify-self: start; margin-top: 4px; }
.to-move { display: flex; align-items: center; gap: 12px; }
.to-move .disc { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.to-move .disc.w { background: #fff; }
.to-move .disc.b { background: #1b1b18; }
.to-move strong { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; }
.board-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 0.875rem; color: var(--ink-2); }
.board-meta strong { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.board-wrap { position: relative; }
.board:not(.mini) { margin-block: 10px; } /* room for the walnut frame */
.board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1; width: 100%; border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 2px var(--brass), 0 0 0 10px var(--frame), 0 16px 34px rgba(40, 24, 10, 0.28); user-select: none; -webkit-user-select: none; }
.sq { position: relative; border: 0; padding: 0; margin: 0; min-width: 0; min-height: 0; background: var(--sq-light); display: grid; place-items: center; font: inherit; }
.sq.dark { background: var(--sq-dark); }
.sq.last::before, .sq.sel::before, .sq.mark::before, .sq.bad::before, .sq.good::before { content: ""; position: absolute; inset: 0; }
.sq.last::before { background: var(--sq-last); }
.sq.mark::before { background: var(--sq-mark); }
.sq.bad::before { background: var(--sq-bad); }
.sq.good::before { background: var(--sq-good); }
.sq.sel::before { background: var(--sq-sel); }
.sq.target::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(18, 24, 38, 0.28); pointer-events: none; }
.sq.target.capture::after { width: 86%; height: 86%; background: none; box-shadow: inset 0 0 0 5px rgba(18, 24, 38, 0.28); }
.sq.check { background: radial-gradient(circle, rgba(208, 59, 59, 0.85) 0%, rgba(208, 59, 59, 0.35) 45%, transparent 72%), var(--sq-light); }
.sq.dark.check { background: radial-gradient(circle, rgba(208, 59, 59, 0.85) 0%, rgba(208, 59, 59, 0.35) 45%, transparent 72%), var(--sq-dark); }
.sq img { width: 90%; height: 90%; position: relative; pointer-events: none; will-change: transform; filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.3)); }
.sq .coord { position: absolute; font-family: var(--mono); font-size: 0.6875rem; font-weight: 600; line-height: 1; pointer-events: none; }
.sq .coord.file { right: 3px; bottom: 3px; }
.sq .coord.rank { left: 3px; top: 3px; }
.sq.dark .coord { color: var(--sq-light); }
.sq:not(.dark) .coord { color: var(--sq-dark); }
.board.interactive .sq { cursor: pointer; }
/* Board themes and coordinates (Settings > Board and sound). No green: see docs/design.md. */
:root[data-board="walnut"] { --sq-light: #ead9bb; --sq-dark: #b08562; }
:root[data-board="ocean"] { --sq-light: #dfe6ec; --sq-dark: #7f99ae; }
:root[data-board="marble"] { --sq-light: #ececec; --sq-dark: #a3a7ad; }
:root[data-coords="off"] .sq .coord { display: none; }
/* Drag and drop: the board keeps the touch, so dragging a piece doesn't scroll the page. */
.board.interactive { touch-action: none; }
.sq.dragging img { opacity: 0.3; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); }
/* Feedback on a move: a short tint on the square, a small shake for a miss. */
.sq.flash-good { animation: flash-good 900ms var(--ease-out); }
.sq.flash-bad { animation: flash-bad 900ms var(--ease-out); }
@keyframes flash-good { from { box-shadow: inset 0 0 0 100vmax var(--sq-good); } to { box-shadow: inset 0 0 0 100vmax transparent; } }
@keyframes flash-bad { from { box-shadow: inset 0 0 0 100vmax var(--sq-bad); } to { box-shadow: inset 0 0 0 100vmax transparent; } }
.board.shake { animation: shake 360ms var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } 100% { transform: none; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1000; }
/* Theme swatches in settings */
.swatch { display: grid; grid-template-columns: repeat(4, 1fr); width: 64px; aspect-ratio: 1; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-sm); }
.swatch i { background: var(--sw-l); }
.swatch i:nth-child(8n + 2), .swatch i:nth-child(8n + 4), .swatch i:nth-child(8n + 5), .swatch i:nth-child(8n + 7) { background: var(--sw-d); }
.theme-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.theme-choices .choice > span { justify-items: center; text-align: center; }
.board.interactive .sq:hover::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--sq-sel); }
.board.interactive .sq.target:hover::after { width: 100%; height: 100%; border-radius: 0; background: none; box-shadow: inset 0 0 0 3px var(--sq-sel); }
.lock p { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; font-size: 0.875rem; color: var(--ink-2); }
.lock.open { display: none; }
.status { min-height: 1.5em; font-weight: 500; }
.status.ok { color: var(--accent); }
.status.bad { color: var(--error); }
.why { margin-top: -4px; }
.skeleton-board { aspect-ratio: 1; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; box-shadow: none; }
.questions { display: grid; gap: 14px; }
/* Each question as a numbered card: number, skill, question, then the answer box */
.q-card { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.q-card .q-num { grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.q-card .q-dim { font-size: 0.8125rem; }
.q-card .label { font-weight: 600; }
.q-card textarea, .q-card .field-error { grid-column: 1 / -1; }
.q-card textarea { margin-top: 8px; }
.q-dim { font-size: 0.875rem; font-weight: 600; color: var(--accent); }
.consent { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.consent > span { display: grid; gap: 4px; }
.consent:has(input:checked) { border-color: var(--accent); }
.consent:has(input:disabled) { cursor: default; opacity: 0.75; }
.no-ai { display: grid; gap: 14px; max-width: 62ch; }

/* ---------- Feedback ---------- */
.dims { display: grid; border-top: 1px solid var(--line); }
.dim { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.dim-name { display: grid; gap: 8px; align-content: start; }
.dim-name small { color: var(--ink-2); font-size: 0.875rem; }
.meter { display: flex; gap: 4px; align-items: center; }
.meter i { width: 28px; height: 6px; border-radius: 3px; background: var(--line); }
.meter.l2 i { background: var(--accent); }
.meter.l1 i:first-child { background: var(--partly); }
.meter b { margin-left: 8px; font-size: 0.875rem; font-weight: 600; }
.meter.l2 b { color: var(--accent); }
.meter.l1 b { color: var(--partly); }
.dim-body { display: grid; gap: 10px; max-width: 68ch; }
.dim.focus .dim-body > p:first-child { font-weight: 500; }
blockquote { margin: 0; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; font-size: 0.9375rem; color: var(--ink-2); }
blockquote b { color: var(--ink); font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; align-items: start; }
.aside dl { margin: 0; display: grid; gap: 6px; }
.aside dt { font-size: 0.8125rem; color: var(--ink-2); margin-top: 8px; }
.aside dt:first-child { margin-top: 0; }
.aside dd { margin: 0; font-weight: 500; }
.caveat { font-size: 0.8125rem; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.routine { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.routine li { counter-increment: step; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
.routine li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.875rem; }
.routine li div { display: grid; gap: 2px; }
.reveal { display: grid; gap: 8px; padding: 16px; border-radius: 12px; background: var(--accent-soft); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); border-bottom-color: var(--ink); }
tbody th { font-weight: 600; }
.up { color: var(--accent); font-weight: 600; }

/* ---------- Play ---------- */
.levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.levels .choice > span { text-align: center; padding: 14px 10px; }
.levels .choice strong { font-size: 0.9375rem; }
.levels .choice > span .chip { justify-self: center; margin-top: 2px; }
.contact-card h2 { margin: 0 0 10px; }
.contact-card p { margin: 0 0 10px; }
.play { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 32px; align-items: start; }
.player-tag { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 0.9375rem; }
.player-tag .who { display: flex; align-items: center; gap: 10px; }
.player-tag .disc { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.player-tag .disc.w { background: #fff; } .player-tag .disc.b { background: #1b1b18; }
.thinking { font-size: 0.8125rem; color: var(--ink-2); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.thinking::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.movelist { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 0.875rem; }
.movelist table { font-size: inherit; }
.movelist td { padding: 6px 10px; border-bottom: 1px solid var(--line-2); }
.movelist td:first-child { color: var(--ink-3); width: 42px; }
.movelist button { font: inherit; background: none; border: 0; padding: 2px 6px; border-radius: 6px; color: var(--ink); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.movelist button:hover { background: var(--surface-2); }
.movelist button[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sym { font-weight: 700; }
.sym.blunder { color: var(--st-critical); } .sym.mistake { color: var(--st-serious); } .sym.inaccuracy { color: #b07b00; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width 200ms linear; }
.promo { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.promo button { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.promo button:hover { border-color: var(--accent); }
.promo img { width: 48px; height: 48px; }

/* ---------- Review ---------- */
.review { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 32px; align-items: start; }
.review-board { position: sticky; top: 84px; display: grid; gap: 12px; }
.nav-btns { display: flex; gap: 8px; justify-content: center; }
.stat-line { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chart { position: relative; }
.chart svg { width: 100%; height: 160px; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--accent); opacity: 0.08; }
.chart .cursor { stroke: var(--ink-2); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 0.8125rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); }
.moments { display: grid; gap: 12px; }
.moment { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color 160ms ease, box-shadow 160ms ease; width: 100%; }
.moment:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.moment[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.moment-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.moment-head strong { font-size: 1rem; }
.moment p { color: var(--ink-2); font-size: 0.9375rem; }
.moment p b { color: var(--ink); }
.coach { display: grid; gap: 16px; }
.coach ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Phones and small tablets: tab bar instead of the sidebar. */
  .sidebar { display: none; }
  body.has-nav .shell { margin-left: 0; }
  body.has-nav .topbar { background: var(--nav); color: var(--nav-ink); border-bottom: 0; }
  body.has-nav .topbar .brand { visibility: visible; }
  body.has-nav .account-btn { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.04); color: var(--nav-ink); }
  /* on the dark bar, open/hover must stay dark too, or the light name disappears */
  body.has-nav .account-btn:hover, body.has-nav .account-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); }
  body.has-nav .tabbar:not([hidden]) { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; color: var(--ink-3); text-decoration: none; font-size: 0.75rem; font-weight: 500; }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .tabbar .icon { width: 22px; height: 22px; }
  body.has-nav main { padding-bottom: 72px; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 32px; padding-bottom: 56px; }
  .band-grid, .work, .split, .play, .review, .settings { grid-template-columns: 1fr; gap: 24px; }
  .board-col, .review-board, .settings-nav { position: static; }
  .settings-nav { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .settings-nav a { justify-content: center; text-align: center; gap: 6px; padding: 8px 6px; line-height: 1.25; }
  .choices, .choices.chess-levels, .row { grid-template-columns: 1fr; }
  .dim { grid-template-columns: 1fr; gap: 12px; }
  .topbar { position: static; }
  .stepper { margin-left: 0; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .hero h1 { font-size: 2.25rem; }
  .section h2, .band h2, .closing h2 { font-size: 1.625rem; }
  .demo { grid-template-columns: 1fr; }
  .sheet { display: none; }
  .page { padding-top: 24px; }
  .account-name { display: none; }
  .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper a { padding-right: 8px; }
  .stepper .label-text { display: none; }
  .stepper a[aria-current="step"] .label-text { display: inline; }
}
/* Landing on small phones: one sign-in button in the bar (the hero has Get started),
   and a backing for the board caption over the photo. */
.hero-wrap .caption { background: rgba(255, 255, 255, 0.8); color: var(--ink); border-radius: 8px; padding: 6px 10px; justify-self: start; }
@media (max-width: 480px) { .topbar .btn-gold { display: none; } }

/* ---------- Coach Leo (speech bubbles) ----------
   Gradients and a soft glow are allowed on coach elements only (docs/design.md). */
:root { --coach-glow: rgba(30, 92, 69, 0.22); --bubble-edge: linear-gradient(135deg, #c9a24b, #1e5c45); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --coach-glow: rgba(142, 164, 255, 0.25); } }
:root[data-theme="dark"] { --coach-glow: rgba(142, 164, 255, 0.25); }
.coach-say { display: flex; gap: 12px; align-items: flex-start; }
/* A coach bubble never touches what follows it */
.coach-say:not(:last-child) { margin-bottom: 16px; }
.coach-face { width: 64px; height: 64px; border-radius: 50%; flex: none; object-fit: cover; object-position: top;
  background: radial-gradient(circle at 50% 35%, var(--gold-soft), var(--surface-2)); box-shadow: 0 0 0 3px var(--surface), 0 6px 20px var(--coach-glow); }
.bubble { position: relative; flex: 1; min-width: 0; padding: 12px 16px; border-radius: 16px; background: var(--surface);
  border: 1.5px solid transparent; background-image: linear-gradient(var(--surface), var(--surface)), var(--bubble-edge);
  background-origin: border-box; background-clip: padding-box, border-box; box-shadow: 0 8px 24px var(--coach-glow); }
.bubble::before { content: ""; position: absolute; left: -7px; top: 22px; width: 12px; height: 12px; background: var(--surface);
  border-left: 1.5px solid #8a7a8f; border-bottom: 1.5px solid #8a7a8f; transform: rotate(45deg); }
.coach-name { display: block; font-size: 0.75rem; letter-spacing: 0.02em; color: var(--gold-ink); margin-bottom: 2px; }
.bubble p { font-size: 0.9375rem; line-height: 1.5; }
.bubble p strong { color: var(--ink); }
.explain.loading .bubble p { color: var(--ink-2); }
.explain.loading .coach-face { animation: coach-breathe 1.6s ease-in-out infinite; }
@keyframes coach-breathe { 50% { box-shadow: 0 0 0 3px var(--surface), 0 6px 28px var(--coach-glow), 0 0 0 8px var(--coach-glow); } }
/* The explained line under the board */
.explain { margin-top: 16px; display: grid; gap: 14px; padding: 16px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.explain.loading { background: transparent; border: 0; box-shadow: none; padding: 0; }
.explain h3 { font-size: 0.9375rem; }
.line-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.line-moves { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.line-moves button { font: inherit; font-family: var(--mono); font-size: 0.875rem; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.line-moves button.next { border-style: dashed; }
.line-moves button[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 3px var(--coach-glow); }
.line-moves .then { font-family: var(--font, inherit); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.line-moves button[aria-current] .then { color: #fff; }
.line-result { font-weight: 600; }
.eng-num { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-2); font-weight: 500; }
.defences summary { cursor: pointer; font-weight: 600; font-size: 0.9375rem; }
.defences ul, .your-lines ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.defences li, .your-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line-2); }
.defences li > button, .your-lines li > button { grid-row: 1 / span 3; grid-column: 2; }
.d-move { display: flex; gap: 8px; align-items: center; }
.d-line { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
.d-res { font-size: 0.875rem; }
.d-res .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; color: var(--ok); }
li.best .d-res { color: var(--ok); font-weight: 600; }
.your-lines h3 { margin-bottom: 0; }

/* ---------- Lessons by phase ---------- */
.view-switch { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.view-switch button { font: inherit; font-size: 0.875rem; font-weight: 600; padding: 8px 14px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.view-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
#by-phase { display: grid; gap: 16px; }
#by-phase[hidden], #by-idea[hidden] { display: none; }
.phase-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.phase-head { display: flex; gap: 18px; align-items: center; padding: 16px 20px; background: linear-gradient(120deg, var(--gold-soft), transparent 70%); }
.phase-head img { width: 120px; height: 80px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 14px rgba(40, 32, 16, 0.18)); }
.phase-head h2 { font-size: 1.25rem; }
.phase-head > div { display: grid; gap: 2px; }
.phase-card > div[id^="err-"]:not(:empty) { margin: 0 20px; }
.phase-subs { list-style: none; margin: 0; padding: 0 20px 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); column-gap: 24px; }
.phase-subs > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main actions" "guide guide"; column-gap: 14px; row-gap: 4px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line-2); }
.phase-subs .phase-sub-main { grid-area: main; display: grid; gap: 3px; min-width: 0; }
.phase-subs .phase-sub-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.phase-subs .phase-actions { grid-area: actions; }
.phase-subs .guide { grid-area: guide; margin-top: 4px; }
/* Middlegame and endgame types: one per row, so an opened guide never reflows the others */
.phase-types { grid-template-columns: minmax(0, 1fr); }
/* Openings: the two buttons always go under the description, so the text has the full card width at
   every screen size (beside the text they squeezed it to one or two words a line at tablet widths) */
.phase-subs:not(.phase-types) > li { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "actions"; row-gap: 10px; }
.phase-subs:not(.phase-types) .phase-actions { justify-content: flex-start; }
.phase-intro { margin: 0; padding: 12px 20px 4px; }
.phase-subs strong { font-weight: 600; font-size: 0.9375rem; }
@media (max-width: 560px) { .phase-head { padding: 14px; gap: 12px; } .phase-head img { width: 72px; height: 56px; } .phase-subs { padding: 0 18px 6px; }
  .phase-subs > li { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "actions" "guide"; row-gap: 10px; }
  .phase-subs .phase-actions { justify-content: flex-start; }
  .phase-intro { padding: 12px 18px 4px; } }
.fam-art { object-fit: contain; background: var(--surface-2); }

/* ---------- Coach Leo across the site (Stage 3) ---------- */
#leo-dash .coach-say, .coach-say.intro { margin-bottom: 4px; }
.coach-say.reading .coach-face { animation: coach-breathe 1.6s ease-in-out infinite; }
.coach-say.hint { margin-top: 10px; }
.bubble p.typing::after { content: "▍"; color: var(--accent); margin-left: 1px; animation: caret 0.9s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
/* Feedback rows arrive one by one */
.stagger > * { animation: rise-in 420ms var(--ease-out) both; }
.stagger > *:nth-child(2) { animation-delay: 120ms; } .stagger > *:nth-child(3) { animation-delay: 240ms; } .stagger > *:nth-child(4) { animation-delay: 360ms; }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
/* Pages fade in */
#app > .screen, #app > section > .screen { animation: page-in 260ms var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
/* Badges and scenes */
.habit-badge { width: 72px; height: 72px; object-fit: contain; filter: grayscale(1) opacity(0.55); }
.habits li.earned .habit-badge { filter: drop-shadow(0 6px 12px rgba(201, 154, 46, 0.35)); }
.empty-scene { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 8px 0; }
.empty-scene img { width: min(100%, 320px); border-radius: 14px; }
/* First-visit tour: a spotlight and Leo's card. The page stays usable behind it. */
.tour { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(40, 32, 16, 0.45), 0 0 0 3px var(--gold), 0 0 24px 6px var(--coach-glow);
  transition: all 320ms var(--ease-out); }
.tour-card { position: fixed; width: min(360px, calc(100vw - 24px)); pointer-events: auto; display: grid; gap: 8px; }
.tour-card .bubble { box-shadow: 0 18px 48px rgba(40, 32, 16, 0.35); }
.tour-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-left: 76px; padding: 6px 6px 6px 14px;
  border-radius: 12px; background: var(--surface); box-shadow: 0 10px 30px rgba(40, 32, 16, 0.3); }
.tour-actions .xsmall { margin-right: auto; }
@media (prefers-reduced-motion: reduce) { .stagger > *, #app > .screen, .tour-spot { animation: none; transition: none; } }

/* ---------- Play it out (Stage 4) ---------- */
.playout-panel { padding: 0; overflow: hidden; }
.playout-panel .phase-head { border-bottom: 0; }
.playout-list { list-style: none; margin: 0; padding: 4px 20px 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); column-gap: 24px; }
.playout-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.playout-list li > div { display: grid; gap: 2px; min-width: 0; }
.playout-list strong { font-weight: 600; font-size: 0.9375rem; }
.playout-side { display: grid; gap: 16px; align-content: start; }
.playout-facts { grid-template-columns: 120px 1fr; }

/* ---------- Stage 5: ask, weekly plan, mistakes ---------- */
.ask { border-top: 1px solid var(--line-2); padding-top: 12px; display: grid; gap: 8px; }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.ask-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ask-log { display: grid; gap: 12px; }
.ask-item { display: grid; gap: 8px; animation: rise-in 300ms var(--ease-out) both; }
.ask-q { font-size: 0.9375rem; color: var(--ink-2); }
.week-plan ol { list-style: none; margin: 0; padding: 0; display: grid; }
.week-plan li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.week-plan li:first-child { border-top: 0; padding-top: 0; }
.week-plan li > div { display: grid; gap: 2px; min-width: 0; }
.week-plan li.done strong { color: var(--ink-2); text-decoration: line-through; }
.plan-err { grid-column: 1 / -1; }
.plan-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; }
.week-plan li.done .plan-check { background: var(--ok); border-color: var(--ok); }
.plan-check .icon { width: 14px; height: 14px; }
.plan-bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.plan-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5fae89); border-radius: 3px; }

/* ---------- Stage 6: calculation and evaluation ---------- */
.calc-timer { margin-left: auto; font-family: var(--mono); font-size: 0.875rem; color: var(--ink-2); padding: 2px 8px; border-radius: 8px; background: var(--surface-2); }
.calc-line { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.calc-line li { line-height: 1.4; }
.calc-line .chip { padding: 1px 8px; font-size: 0.75rem; vertical-align: 1px; }
.calc-h { margin: 4px 0 0; font-size: 0.9375rem; }
.ev-nums { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-num { display: grid; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); min-width: 92px; }
.ev-num strong { font-size: 1.125rem; }
.cand-note { margin: 0; }
.cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cand { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; background: var(--surface); }
.cand.best { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.cand-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.cand-eval { margin-left: auto; }
.cand-line { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.cand details summary { cursor: pointer; color: var(--ink-2); }
.cand .btn { justify-self: start; }
.ev-scale { flex-wrap: wrap; }
.ev-results { display: grid; gap: 8px; }
.ev-results .choice > span { display: grid; gap: 2px; text-align: left; }
.ev-results .choice em { font-style: normal; font-size: 0.8125rem; color: var(--ink-2); }
.playout-side fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.playout-side legend { font-weight: 600; margin-bottom: 8px; }
.playout-side .field input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.q-card .q-look { grid-column: 2; font-size: 0.8125rem; color: var(--ink-2); line-height: 1.45; margin-top: 2px; }
.q-card .q-look b { color: var(--gold-ink); font-weight: 600; }
.q-card .q-plain { grid-column: 2; font-size: 0.875rem; line-height: 1.45; margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--accent-soft); }
.q-card .q-plain b { font-weight: 600; }

/* ---------- Phase 1: rating ---------- */
.connect-cols { margin-top: 4px; }
.link-form, .linked-card { display: grid; gap: 10px; align-content: start; }
.link-form input, .linked-card select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.linked-card .chip .icon { width: 14px; height: 14px; }
.rating-panel { display: grid; gap: 10px; }
.rating-panel .panel-head { margin-bottom: 0; }
.rating-hero { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rating-hero strong { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.rating-change { font-weight: 700; color: var(--ink); }
.rating-chart { position: relative; }
.rating-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.rating-chart .grid { stroke: var(--line-2); stroke-width: 1; }
.rating-chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--mono); }
.rating-chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rating-chart .last, .rating-chart .hover circle { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.rating-chart .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.rating-chart .started { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; }
.rating-chart .started-label { fill: var(--gold-ink); font-family: inherit; font-weight: 600; }
.rating-chart .chart-tip { position: absolute; top: -8px; transform: translate(-50%, -100%); background: var(--ink); color: var(--surface); border-radius: 8px; padding: 4px 8px; font-size: 0.75rem; white-space: nowrap; pointer-events: none; display: flex; gap: 8px; }
.dash-rating { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- Phase 2: diagnosis and plan ---------- */
.diag-intro { display: grid; gap: 14px; }
.diag-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.diag-points li { display: flex; gap: 10px; align-items: flex-start; }
.diag-points .icon { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 2px; }
.diag-progress { display: flex; gap: 6px; margin-top: 4px; }
.diag-progress i { flex: 1; max-width: 56px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.diag-progress i.done { background: var(--accent); }
.diag-progress i.now { background: var(--gold); }
.skill-levels li.focus .levels-row strong:first-child { color: var(--gold-ink); }
.diag-level, .plan-focus, .diag-cta { display: grid; gap: 10px; align-content: start; }
.plan-focus .chip { justify-self: start; }
.plan-focus h2 { font-size: 1.375rem; }
.plan-train { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line-2); }

/* ---------- Phase 3: game insights ---------- */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: 120px minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 0.9375rem; }
.hbars li.top span:first-child { font-weight: 700; }
.hbar { height: 10px; border-radius: 0 5px 5px 0; background: var(--surface-2); overflow: hidden; display: block; }
.hbar i { display: block; height: 100%; background: var(--chart-line); border-radius: 0 5px 5px 0; min-width: 2px; }
.hbars strong { text-align: right; font-variant-numeric: tabular-nums; }
.skill-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 600; margin-left: 4px; }
@media (max-width: 560px) { .hbars li { grid-template-columns: 96px minmax(0, 1fr) 28px; } }

/* ---------- Phase 4: public pages ---------- */
.public-nav { display: flex; gap: 18px; margin-right: 8px; }
.public-nav a { color: var(--nav-ink-2, #c9d1e3); text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.public-nav a:hover { color: #fff; }
@media (max-width: 760px) { .public-nav { display: none; } }
.public-page .lead { max-width: 60ch; }
.prose { max-width: 70ch; display: grid; gap: 12px; margin: 8px 0 24px; }
.prose h2 { font-size: 1.25rem; margin-top: 12px; }
.prose p, .prose li { color: var(--ink-2); line-height: 1.65; }
.skill-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.skill-list strong { color: var(--ink); }
.method-example { display: grid; gap: 10px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.method-example .dim-name { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.faq { display: grid; gap: 10px; max-width: 760px; margin-bottom: 16px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }
.faq p { color: var(--ink-2); line-height: 1.6; }
.not-found { display: grid; gap: 18px; max-width: 640px; padding-top: 48px; }
.stuck-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.stuck-grid p { color: var(--ink-2); line-height: 1.65; margin-top: 12px; max-width: 58ch; }
.stuck-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stuck-list li { display: grid; gap: 2px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold); }
.stuck-list span { font-size: 0.875rem; color: var(--ink-2); }
.hero-copy .btn-link { justify-self: start; }
@media (max-width: 900px) { .stuck-grid { grid-template-columns: 1fr; gap: 24px; } }
/* ---------- Phase 5: achievements, monthly report, report a problem ---------- */
.ach-group { margin-top: 16px; }
.ach-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ach-list li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ach-list li > div { display: grid; gap: 4px; min-width: 0; }
.ach-list .habit-badge { width: 64px; height: 64px; }
.ach-list li.earned { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.ach-list li.earned .habit-badge { filter: drop-shadow(0 6px 12px rgba(201, 154, 46, 0.35)); }
.medal { width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.ach-list li.earned .medal { background: var(--gold); color: #fff; }
.ach-bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ach-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.report-btn { margin-top: 12px; color: var(--ink-2); }
.report-dialog fieldset { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.report-dialog legend { font-weight: 600; margin-bottom: 8px; }
.report-dialog .choice > span { padding: 10px 12px; }
.report-dialog textarea { width: 100%; }
/* ---------- Theme "Ivory Board": home, sign-in, Position of the week ---------- */
.eyebrow { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-ink); }
.lp-center { text-align: center; margin-inline: auto; }
.lp-hero { padding: 80px 0 40px; }
.lp-hero-inner { display: grid; justify-items: center; text-align: center; gap: 20px; max-width: 900px; }
.lp-hero h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.04; letter-spacing: -0.02em; font-weight: 600; }
.lp-hero h1 em { color: var(--accent); }
.lp-hero .lead { max-width: 640px; font-size: 1.25rem; }
.lp-hero .actions { justify-content: center; }
.lp-demo { padding-bottom: 88px; }
.lp-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px rgba(60, 48, 20, 0.08); }
.lp-questions { display: grid; gap: 14px; }
.lp-questions h2 { font-size: 1.875rem; }
.q-list { list-style: none; margin: 0; padding: 0; }
.q-list li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.q-list li:last-child { border-bottom: 0; }
.q-list .n { font-family: var(--serif); font-size: 1.5rem; color: var(--gold-ink); width: 28px; flex: none; line-height: 1.2; }
.q-list li div { display: grid; }
.q-list li span:not(.n) { color: var(--ink-2); }
.lp-band { background: var(--accent-solid); color: #f7f4ec; padding: 76px 0; }
.lp-band-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 48px; }
.lp-band h2 { font-size: 2.5rem; line-height: 1.1; margin-bottom: 20px; }
.lp-reasons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; }
@media (max-width: 560px) { .lp-reasons { grid-template-columns: 1fr; } }
.lp-reasons li { display: grid; gap: 6px; }
.lp-reasons strong { font-size: 1.125rem; }
.lp-reasons span { color: #d6e3dc; }
.btn-ghost-light { color: #f7f4ec; border: 1px solid rgba(247, 244, 236, 0.45); background: transparent; }
.btn-ghost-light:hover { background: rgba(247, 244, 236, 0.1); color: #fff; }
.lp-steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.lp-steps li { display: grid; gap: 10px; align-content: start; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.lp-steps h3 { font-family: var(--serif); font-size: 1.4375rem; font-weight: 600; }
.lp-steps p { color: var(--ink-2); }
.lp-potw { padding: 0 0 88px; }
.potw { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 40px; align-items: center;
  padding: 36px; border-radius: 20px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); }
.potw-copy { display: grid; gap: 12px; }
.potw-copy h2 { font-size: 2.125rem; }
.potw-copy p { color: var(--ink-2); max-width: 52ch; }
.potw-board { padding: 6px; }
.potw-result { margin-top: 12px; display: grid; gap: 12px; }
.potw-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.potw-checks li { display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.potw-checks li.ok { color: var(--ok); }
.lp-closing { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; padding: 48px 16px; margin-bottom: 40px;
  border-top: 1px solid var(--line); }
.lp-closing h2 { font-size: 2.125rem; margin: 0 0 8px; }
.lp-closing p { margin: 0; }
/* The two band buttons: one row, equal widths, on phones too */
@media (max-width: 560px) { .lp-band-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .lp-band-actions .btn { white-space: normal; text-align: center; padding: 8px 10px; } }
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: 940px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 24px 60px rgba(60, 48, 20, 0.08); }
.auth-brand { background: var(--accent-solid); color: #f7f4ec; padding: 44px 40px; display: grid; gap: 24px; align-content: space-between; }
.auth-brand .board { max-width: 280px; margin: 6px; }
.auth-quote { font-family: var(--serif); font-size: 1.625rem; font-style: italic; line-height: 1.25; }
.auth-brand > span { font-size: 0.875rem; color: #d6e3dc; }
.auth-split .auth { padding: 40px; margin: 0; max-width: none; }
@media (max-width: 860px) {
  .lp-card, .lp-band-grid, .potw, .auth-split { grid-template-columns: 1fr; }
  .lp-card, .potw { padding: 20px; gap: 24px; }
  .lp-band h2 { font-size: 2rem; }
  .auth-brand { display: none; }
  .auth-split .auth { padding: 28px 20px; }
  .potw-board { max-width: 320px; }
}
/* Home: "Proof, not promises" */
.lp-proof-wrap { padding-bottom: 88px; }
.lp-proof { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 36px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.lp-proof-copy { display: grid; gap: 12px; justify-items: start; }
.lp-proof-copy h2 { font-size: 2.125rem; }
.lp-proof-copy p { color: var(--ink-2); max-width: 48ch; }
.lp-proof-demo { margin: 0; display: grid; gap: 14px; padding: 20px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.lp-proof-head { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--ink-3); }
.lp-proof-demo svg { width: 100%; height: 120px; }
.lp-proof-demo svg line { stroke: var(--line); }
.lp-proof-demo svg path { fill: none; stroke: var(--chart-line, var(--accent)); stroke-width: 2.5; stroke-linejoin: round; }
.lp-proof-skills { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lp-proof-skills li { display: grid; gap: 2px; padding: 10px; border-radius: 10px; background: var(--surface); font-size: 0.8125rem; }
.lp-proof-skills span { color: var(--ink-3); }
.lp-proof-demo figcaption { font-size: 0.75rem; color: var(--ink-3); }
@media (max-width: 860px) {
  .lp-proof { grid-template-columns: 1fr; padding: 20px; gap: 24px; }
  .lp-proof-skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Analytics consent banner (js/analytics.js): equal-weight choices, never blocks the page */
.consent-banner { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 70; max-width: 720px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 14px 18px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 0.875rem; }
.consent-banner p { flex: 1 1 320px; color: var(--ink-2); }
.consent-banner .actions { margin: 0; gap: 8px; }
@media (max-width: 1000px) { body:has(#tabbar:not([hidden])) .consent-banner { bottom: calc(84px + env(safe-area-inset-bottom)); } }
/* ---------- Opening trainer (js/openings.js) ---------- */
.op-search { max-width: 520px; margin: 8px 0 12px; }
.op-h2 { margin: 28px 0 12px; }
.op-families { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.op-families a { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.op-families a:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.op-families strong { font-family: var(--serif); font-size: 1.0625rem; }
.op-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.op-lines a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none; }
.op-lines a:hover { border-color: var(--accent); }
.op-family-tools { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.op-tree { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.op-tree li { padding-left: calc(var(--d, 0) * 18px); }
.op-tree a { display: grid; gap: 2px; padding: 8px 12px; border-left: 2px solid var(--line); color: var(--ink); text-decoration: none; }
.op-tree a:hover { border-left-color: var(--accent); background: var(--accent-soft); }
.op-cta { margin: 4px 0 12px; }
.op-work { align-items: start; }
.op-side { display: grid; gap: 16px; }
.op-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.op-movelist { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 4px; font-family: var(--mono); font-size: 0.875rem; }
.op-movelist li { display: inline-flex; align-items: center; gap: 2px; }
.op-movelist .n { color: var(--ink-3); }
.op-movelist button { font: inherit; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; min-height: 32px; }
.op-movelist button:hover { background: var(--surface-2); }
.op-movelist button[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
.op-score { display: flex; align-items: baseline; gap: 12px; }
.op-score strong { font-family: var(--mono); font-size: 1.5rem; }
.op-bar { height: 10px; border-radius: 5px; background: #2b2b28; overflow: hidden; margin: 10px 0; border: 1px solid var(--line); }
.op-bar i { display: block; height: 100%; background: #f5f1e6; transition: width 300ms var(--ease-out); }
.op-named { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--gold-soft); }
@media (prefers-reduced-motion: reduce) { .op-bar i { transition: none; } }
/* Opening trainer, stage 2: quiz, repertoire, review */
.rep-lines li { display: grid; gap: 8px; }
.rep-lines .ach-bar { margin-top: 4px; }
.rep-gaps-h { margin: 18px 0 8px; font-size: 1rem; }
.op-train { margin-bottom: 8px; }
.rep-due { margin-bottom: 16px; }
/* Opening trainer, stage 3: Why this move? (by CSA skill) */
.why-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.why-grid h3 { font-size: 0.9375rem; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.why-grid p + p { margin-top: 6px; }
.why-facts { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.875rem; }
.why-note { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
@media (max-width: 560px) { .why-grid { grid-template-columns: 1fr; } }
/* Opening trainer, stage 4: masters table, results bar, game viewer */
.op-mtable { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.op-mtable th { text-align: left; font-size: 0.75rem; color: var(--ink-3); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.op-mtable td { padding: 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.op-mtable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wdb { display: flex; height: 10px; border-radius: 3px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 2px; min-width: 90px; }
.wdb i { display: block; height: 100%; }
.wdb .w { background: #f5f1e6; } .wdb .d { background: #a8a296; } .wdb .b { background: #2b2b28; }
.op-differ { padding: 8px 10px; border-radius: 8px; background: var(--gold-soft); }
.op-credit { margin-top: 10px; }
.op-puzzle { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; }

/* Voice input under answer boxes */
.voice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.voice-btn .icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.voice-btn.listening { color: var(--error); background: var(--error-soft); }
.voice-btn.listening .icon { animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 50% { opacity: 0.35; } }
textarea:disabled + .voice { display: none; }
@media (prefers-reduced-motion: reduce) { .voice-btn.listening .icon { animation: none; } }

/* Evaluate: the student's assessment and the board's facts */
.ev-notes { display: grid; gap: 10px; }
.as-panel { display: grid; gap: 8px; }
.as-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .as-cols { grid-template-columns: 1fr; } }
.as-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.as-list li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; line-height: 1.4; }
.as-mark { font-weight: 700; text-align: center; }
.as-list li.noted .as-mark { color: var(--ok); }
.as-ok { color: var(--ok); font-weight: 600; }
.as-no { color: var(--error); font-weight: 600; }
.as-list li.contradicted .as-mark { color: var(--error); }
/* What you wrote, checked (statementsPanel) */
.as-part { color: var(--partly); font-weight: 600; }
.said-list q { font-style: italic; }
.said-list q::before, .said-list q::after { content: '“'; }
.said-list q::after { content: '”'; }
.said-why { display: block; color: var(--ink-2); }
.said-list li.said-right .as-mark { color: var(--ok); }
.said-list li.said-partly .as-mark { color: var(--partly); }
.said-list li.said-wrong .as-mark { color: var(--error); }
.said-list li.said-unclear .as-mark { color: var(--ink-3); }

/* Dashboard: the level's training list */
.focus-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.focus-list li { display: grid; grid-template-columns: 24px 40px 1fr auto; align-items: center; gap: 12px; }
.focus-list li div { display: grid; gap: 2px; }
.focus-n { font-weight: 700; color: var(--ink-2); text-align: center; }
@media (max-width: 640px) { .focus-list li { grid-template-columns: 20px 1fr auto; } .focus-list .tile-icon { display: none; } }

/* Chess basics */
.basics-units { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.basics-units li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.basics-units li div { display: grid; gap: 2px; }
.basics-units li.done .focus-n { color: var(--ok); }
.basics-units .focus-n .icon { width: 18px; height: 18px; }
.basics-teach { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }
.sq-score { display: flex; align-items: baseline; gap: 10px; }
.sq-score strong { font-size: 2rem; }
.sq-score .calc-timer { margin-left: auto; }

/* Piece pictures in moves (♘f3): a touch larger so the shape reads at text size */
.fig { width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-right: 1px; }

/* Mistakes: think first */
.think-first .q-card textarea { min-height: 3.2em; }
.diag-panel p { margin: 0 0 6px; }

/* Is it getting rarer? (trend sparklines) */
.trend { position: relative; }
.tr-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tr-rows li { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(130px, auto); align-items: center; gap: 14px; }
.tr-name { display: grid; gap: 2px; }
.tr-spark { overflow: visible; }
.tr-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tr-base { stroke: var(--line); stroke-width: 1; }
.tr-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.tr-hit { fill: transparent; cursor: default; }
.tr-hit:hover + .tr-dot { r: 5; }
.tr-word { font-weight: 600; font-size: 0.875rem; white-space: nowrap; }
.tr-word.ok { color: var(--ok); }
.tr-word.warn { color: var(--partly); }
.tr-word.same { color: var(--ink-2); }
.tr-tip { position: absolute; width: 180px; text-align: center; padding: 6px 8px; border-radius: 8px; font-size: 0.8125rem;
  background: var(--ink); color: var(--surface); pointer-events: none; z-index: 2; }
@media (max-width: 640px) { .tr-rows li { grid-template-columns: 1fr auto; } .tr-rows .tr-spark { grid-column: 1 / -1; justify-self: start; } }
/* Visually hidden, still read by screen readers (data tables behind charts) */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.moment-wrap { display: grid; gap: 6px; }
.moment-wrap .think-it { justify-self: start; }

/* By idea (profile per tactical concept) */
.idea-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.idea { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.idea-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.idea-skills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.idea p { margin: 0; }
.idea .btn { justify-self: start; }
.lvl-word { font-weight: 600; font-size: 0.875rem; }
.lvl-word.ok { color: var(--ok); }
.lvl-word.part { color: var(--partly); }
.lvl-word.no { color: var(--ink-2); }
.voice-note { max-width: min(460px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--surface); color: var(--ink); }
.voice-note::backdrop { background: rgba(20, 18, 14, 0.45); }
.voice-note h2 { margin-top: 0; }

/* Opening lessons */
.ol-work { align-items: start; }
.ol-board { position: sticky; top: 76px; }
.ol-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.ol-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }
.ol-plans { display: grid; grid-template-columns: 1fr; gap: 14px; }
#ol-level-note { margin: 0 0 14px; }
.ai-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ol-plans h3 { margin: 0 0 6px; }
.ol-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ol-line { display: grid; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ol-line:last-child { border-bottom: 0; }
.ol-line-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ol-line p { margin: 0; }
.ol-line .btn { justify-self: start; }
.ol-moves { color: var(--ink-2); overflow-wrap: anywhere; }
.ol-why { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.5; }
.op-learn { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.op-learn div { display: grid; gap: 2px; }
@media (max-width: 960px) { .ol-board { position: static; } .ol-plans { grid-template-columns: 1fr; } }
.op-learn-all { display: grid; gap: 10px; }
.op-families a > :last-child { margin-top: auto; }
@media (max-width: 560px) { .op-tree li { padding-left: calc(min(var(--d, 0), 3) * 12px); } }
/* The long "Written with AI…" label may wrap on phones instead of widening the panel */
.op-learn-all .panel-head { flex-wrap: wrap; gap: 6px 12px; }
.op-learn-all .panel-head .chip, .ol-body ~ * .chip, .head .chip.accent { white-space: normal; }
.as-minor-h { margin: 10px 0 4px; }
.as-minor li { opacity: 0.85; }
.phase-subs .phase-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-term { margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.auth .age-check { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.auth .age-check legend { margin-bottom: 6px; }
.auth .age-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.auth .age-row select { width: 100%; }
.auth .age-check .hint { display: block; margin-top: 6px; }
/* Speak button inside the one-line Ask Coach Leo form: button in the row, its message on a line below */
.ask-form { flex-wrap: wrap; }
.ask-form .voice { display: contents; }
.ask-form .voice-msg:not(:empty) { flex-basis: 100%; order: 5; }

/* How to play each middlegame and endgame type, by level (guides.js) */
.guide > summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--accent); width: fit-content; }
.guide > summary .small { font-weight: 500; }
.guide[open] > summary { margin-bottom: 10px; }
.guide-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.guide-levels .xsmall { opacity: 0.8; }
.guide-list { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: 0.875rem; line-height: 1.5; list-style: disc; }
.guide-list li { padding: 0; border: 0; }
.guide-levels .filter { padding: 4px 10px; font-size: 0.8125rem; }

/* Study with Coach Leo (study.js) */
.study-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.study-moves { margin: 10px 0 0; line-height: 1.8; }
.study-moves .cur { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; }
.study-setup { margin-top: 10px; }
.study-setup > summary { cursor: pointer; font-weight: 600; }
.study-ask { display: grid; gap: 10px; margin-top: 16px; }
.study-suggest .filter { padding: 4px 10px; font-size: 0.8125rem; }
.study-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.study-meta details { flex-basis: 100%; }

.coach-pick { margin: 0 0 14px; }
.coach-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.coach-opt { position: relative; display: grid; justify-items: center; align-content: start; gap: 2px; padding: 10px 4px 8px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); cursor: pointer; text-align: center; transition: border-color 160ms ease, background-color 160ms ease; }
.coach-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.coach-opt .coach-face { width: 48px; height: 48px; margin-bottom: 4px; font-size: 1.25rem; }
.coach-opt-name { font-weight: 600; font-size: 0.875rem; line-height: 1.2; }
.coach-opt-style { font-size: 0.75rem; color: var(--ink-2); line-height: 1.2; }
.coach-opt:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.coach-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.coach-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.coach-about { margin: 10px 0 4px; font-size: 0.875rem; }
.study-moves-empty { font: 400 0.875rem/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
@media (max-width: 560px) { .coach-row { gap: 4px; } .coach-opt { padding: 8px 2px 6px; } .coach-opt .coach-face { width: 40px; height: 40px; } .coach-opt-style { font-size: 0.6875rem; } }

.ask-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ask-coach { display: inline-flex; align-items: center; gap: 6px; }
.ask-coach select { font: inherit; font-size: 0.875rem; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }

/* No single word left alone on the last line of a heading or short intro */
h1, h2, h3, .head p, .hint, .muted, .bubble p { text-wrap: pretty; }

/* Privacy: the processors table stacks as one card per service on phones (3 columns wrapped to 10+ lines) */
@media (max-width: 560px) {
  .legal-doc table, .legal-doc tbody, .legal-doc tr, .legal-doc td { display: block; width: 100%; }
  .legal-doc thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .legal-doc tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .legal-doc td { border: 0; padding: 2px 0; }
  .legal-doc td:nth-child(1) { font-weight: 600; }
  .legal-doc td:nth-child(2)::before { content: "What it does: "; color: var(--ink-2); }
  .legal-doc td:nth-child(3)::before { content: "Data involved: "; color: var(--ink-2); }
}
.settings-h { font-family: inherit; font-size: 1.0625rem; font-weight: 600; margin: 0; }
/* A card title never squeezed to one word a line by the note beside it: the note wraps below instead */
.panel-head > h2, .panel-head > h3 { flex: none; max-width: 100%; }
.panel-head { flex-wrap: wrap; row-gap: 4px; }
@media (max-width: 560px) { .choices.theme-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Breathing room the reviews found missing */
#op-x-help { margin: 0 0 12px; }
#op-x-help + .consent { margin-bottom: 12px; }
.panel .review-list { margin-top: 12px; }
.plan-form > .small { margin: 0 0 14px; }
#q-bar { margin-bottom: 10px; }
.board-col > .status:empty { min-height: 0; }
/* Recent activity on phones: the time goes under the line, so the line isn't squeezed to one word */
.activity li > div > span { text-wrap: pretty; }
@media (max-width: 560px) { .activity li { grid-template-columns: 32px minmax(0, 1fr); } .activity li > .xsmall { grid-column: 2; margin-top: -8px; } }
.op-more { margin: 2px 0 4px 14px; font-size: 0.8125rem; }
.op-more::before { content: '▸ '; }
.op-more[aria-expanded="true"]::before { content: '▾ '; }
.if-taken { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
