/* Gambit — styles for modules under src/. Uses the core design tokens
   (--ink, --surface, --raised, --line, --font-body …) so new UI matches. */

:root, :is(.splash, .home-hero, .gp-on-hero, .gp-pf-banner, .g-bn-classic, .g-adv-art, .atl-drop-hero) {
  /* spacing scale (4px base) for new components; the aliases are declared again on the photo surfaces,
     where a light theme swaps in its dark partner (tools/themes/build.mjs PHOTO, QA63-2) */
  --g-1: 4px; --g-2: 8px; --g-3: 12px; --g-4: 16px; --g-5: 24px; --g-6: 32px;
  --g-radius: 18px;
  --g-accent: var(--accent);
  --g-gold: var(--gold);
  --g-ease: cubic-bezier(.2, .8, .2, 1);
  --g-focus: var(--focus-ring);
}

/* ---------- accessibility baseline ---------- */

/* One visible, consistent focus ring for keyboard users everywhere. */
:where(button, a, [role="button"], [tabindex], input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
  border-radius: var(--rad-2);
}
.mode-btn:focus-visible, .tab:focus-visible, .gp-rail-btn:focus-visible { outline-offset: -2px; }

@media (prefers-contrast: more) {
  :root { --ink-2: var(--ink); --ink-3: var(--ink-2); --line: color-mix(in srgb, var(--ink) 45%, transparent); }
  .muted { color: var(--ink) !important; }
}
@media (forced-colors: active) {
  .g-cta-main, .g-cta-alt, .engine-chip { border: 1px solid ButtonText; }
  :where(button, a, [role="button"]):focus-visible { outline: 2px solid Highlight; }
}

/* Belt and braces: new animations stop for people who asked for less motion. */
@media (prefers-reduced-motion: reduce) {
  [class^="g-"], [class*=" g-"] { animation: none !important; transition: none !important; }
}

/* ---------- navigation ---------- */

.engine-chip[role="button"] { cursor: pointer; }
.engine-chip span { font-variant-numeric: tabular-nums; }
/* While the engine loads or has failed, the chip always says so: full text on
   wider screens (the rail layout otherwise shows a bare dot), a short "12s" on
   phones (where the chip is otherwise hidden). */
html .engine-chip.load > span, html .engine-chip.bad > span { display: inline !important; }
@media (max-width: 599px) {
  html .engine-chip.load, html .engine-chip.bad { display: inline-flex !important; }
  html .engine-chip.load > span, html .engine-chip.bad > span { display: none !important; }
  .engine-chip[data-short]:not([data-short=""])::after { content: attr(data-short); font: 700 12px/1 var(--font-body); font-variant-numeric: tabular-nums; margin-left: 6px; }
}

/* Navigation: phones use the bottom tab bar, everything ≥600px uses the side
   rail (plus/nav.js). The core's top-bar tabs stay hidden there. */
@media (min-width: 600px) and (max-width: 759px) {
  html.gp-rail-on { padding-left: 72px; }
  html.gp-rail-on .gp-rail { width: 72px; }
  html.gp-rail-on .gp-rail-btn { width: 60px; }
  html.gp-rail-on .atl { left: 72px; }
}
@media (max-height: 640px) and (min-width: 600px) {
  .gp-rail-btn { padding: 6px 0 5px; }
  .gp-rail-btn span { font-size: 9.5px; }
}

@keyframes g-fade-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- home: call to action ---------- */

.g-cta { display: flex; flex-wrap: wrap; gap: var(--g-2); margin-top: var(--g-4); position: relative; z-index: 1; }
.g-cta-main, .g-cta-alt {
  min-height: 44px; padding: 0 var(--g-4); border-radius: var(--rad-3); border: 0; cursor: pointer;
  font: 750 15px/1 var(--font-body); letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: var(--g-2);
  transition: transform .18s var(--g-ease), box-shadow .18s var(--g-ease), background .18s;
}
.g-cta-main { background: var(--grad-accent); color: var(--on-accent); box-shadow: 0 6px 18px -8px rgb(var(--shade-rgb)/.6); }
.g-cta-main span { transition: transform .2s var(--g-ease); }
.g-cta-main:hover span { transform: translateX(3px); }
.g-cta-alt { background: rgb(var(--ink-rgb)/.1); color: var(--ink); box-shadow: inset 0 0 0 1px rgb(var(--ink-rgb)/.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.g-cta-alt:hover { background: rgb(var(--ink-rgb)/.16); }
.g-cta-main:active, .g-cta-alt:active { transform: scale(.97); }

/* ---------- footer ---------- */

.g-foot {
  margin: var(--g-6) 0 var(--g-2); padding: var(--g-5) var(--g-1) 0; border-top: 1px solid var(--line-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--g-2) var(--g-4); color: var(--ink-3); font-size: 13px;
}
.g-foot-brand { margin: 0; flex: 1 1 260px; }
.g-foot-brand b { color: var(--ink); font-family: var(--font-display); font-size: 17px; letter-spacing: .01em; }
.g-foot-brand b span { color: var(--g-accent); font-size: .8em; vertical-align: super; margin-left: 1px; }
.g-foot nav { display: flex; flex-wrap: wrap; gap: var(--g-1); }
.g-foot .link { min-height: 44px; padding: 0 var(--g-2); color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; }
.g-foot-ver { margin: 0; }
@media (max-width: 599px) { .g-foot { padding-bottom: 96px; } }

/* ---------- info + engine sheets ---------- */

.g-info p { line-height: 1.55; margin: 0 0 var(--g-3); }
.g-credits { list-style: none; margin: var(--g-3) 0; padding: 0; display: grid; gap: 2px; }
.g-credits li { display: flex; justify-content: space-between; gap: var(--g-3); padding: 10px var(--g-3); border-radius: var(--rad-3); background: var(--surface-2); }
.g-credits a { color: var(--ink); }
.g-credits em { font-style: normal; color: var(--ink-3); white-space: nowrap; font-size: 13px; }

.g-eng-list { list-style: none; padding: 0; margin: var(--g-4) 0; display: grid; gap: var(--g-2); }
.g-eng-row { display: flex; align-items: center; gap: var(--g-3); padding: var(--g-3); border-radius: var(--rad-3); background: var(--surface-2); }
.g-eng-row i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.g-eng-row[data-state="ready"] i { background: var(--ok); box-shadow: 0 0 0 4px rgb(var(--ok-rgb)/.18); }
.g-eng-row[data-state="loading"] i { background: var(--g-gold); animation: g-pulse 1s ease-in-out infinite alternate; }
.g-eng-row[data-state="skipped"] { opacity: .55; }
.g-eng-row span { display: grid; flex: 1; }
.g-eng-row em { font-style: normal; font-size: 13px; color: var(--ink-3); }
.g-eng-row small { color: var(--ink-2); font-weight: 650; }
.g-actions { display: flex; flex-wrap: wrap; gap: var(--g-2); }
.g-actions > * { min-height: 44px; }
@keyframes g-pulse { to { opacity: .35; } }

/* ---------- profile: your data ---------- */

.g-data-facts { list-style: none; margin: var(--g-3) 0; padding: 0; display: grid; gap: 2px; }
.g-data-facts li { display: flex; justify-content: space-between; gap: var(--g-3); padding: 10px var(--g-3); border-radius: var(--rad-3); background: var(--surface-2); font-size: 14px; }
.g-data-facts span { color: var(--ink-3); }
.g-data-facts b { text-align: right; font-weight: 650; }
.g-data-facts b[data-state="persisted"] { color: var(--ok); }
.g-data .row > * { min-height: 44px; }

/* ---------- trainer ---------- */

.g-why { margin: var(--g-3) 0 var(--g-2); padding: var(--g-3) var(--g-4); border-radius: var(--rad-3); background: color-mix(in srgb, var(--g-accent) 9%, var(--surface-2)); box-shadow: inset 3px 0 0 var(--g-accent); }
.g-why b { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--g-accent); margin-bottom: 4px; }
.g-why p { margin: 0 0 4px; line-height: 1.5; }
.g-line { font-family: var(--font-body); font-weight: 650; color: var(--ink-2); }
.g-due-ico { font: 800 18px/1 var(--font-display); color: var(--gold-ink); background: var(--g-gold) !important; display: grid; place-items: center; }
.g-due { display: inline-flex; gap: 5px; align-items: baseline; margin: var(--g-3) 0 0; padding: 6px 12px; border-radius: var(--rad-pill); font: 650 13px/1 var(--font-body); color: var(--cream-2); background: rgb(var(--ink-rgb)/.08); position: relative; z-index: 1; }
.g-due.on { color: var(--gold-ink); background: var(--g-gold); }
.g-due b { font-weight: 800; }

/* ---------- daily loop ---------- */

.g-week { margin-left: auto; display: inline-flex; align-items: center; gap: var(--g-2); min-height: 44px; padding: 2px 10px 2px 2px; border: 0; border-radius: var(--rad-pill); background: transparent; color: var(--ink); cursor: pointer; transition: background .15s; }
.g-week:hover { background: var(--surface-2); }
.g-week .goal-ring { width: 40px; height: 40px; }
.g-week span { display: grid; text-align: left; line-height: 1.1; }
.g-week b { font-size: 15px; }
.g-week em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.week-card .sec-head { align-items: center; gap: var(--g-2); }
.hh-streak > span:not(.g-freeze) { flex: 0 1 auto; }
.g-freeze { display: inline-flex; flex: none; align-items: center; gap: 3px; margin-left: var(--g-2); padding: 3px 8px; border-radius: var(--rad-pill); background: rgb(var(--info-rgb)/.14); color: var(--info); font: 750 12px/1 var(--font-body); }
.g-freeze.pending { background: rgb(var(--info-rgb)/.28); color: var(--info); }
.g-snow { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.g-freeze-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 13px; color: var(--info); }
.g-seg { display: flex; flex-wrap: wrap; }
.g-seg button { min-height: 44px; flex: 1 1 auto; }

/* ---------- onboarding ---------- */

.g-onb-lead { font-size: 16px; line-height: 1.5; margin: 0 0 var(--g-4); color: var(--ink-2); }
.g-onb-choices { display: grid; gap: var(--g-2); }
.g-onb-choice { display: grid; gap: 3px; text-align: left; min-height: 60px; padding: var(--g-3) var(--g-4); border: 0; border-radius: var(--rad-4); background: var(--surface-2); color: var(--ink); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); transition: transform .15s var(--g-ease), background .15s; }
.g-onb-choice:hover { background: var(--surface-3); }
.g-onb-choice:active { transform: scale(.98); }
.g-onb-choice b { font-size: 16px; }
.g-onb-choice span { font-size: 13px; color: var(--ink-2); }
.g-onb-choice.main { background: var(--ink); color: var(--bg); box-shadow: none; }
.g-onb-choice.main span { color: color-mix(in srgb, var(--bg) 88%, var(--ink)); }
.g-onb-score { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin: var(--g-2) 0 var(--g-3); font-family: var(--font-display); }
.g-onb-score b { font-size: 72px; line-height: 1; letter-spacing: -.01em; animation: g-pop .5s var(--g-ease); }
.g-onb-score span { font-size: 36px; color: var(--g-accent); }
.g-onb-dots { display: flex; gap: 6px; margin: var(--g-3) 0 var(--g-1); }
.g-onb-dots i { flex: 1; height: 6px; border-radius: var(--rad-0); background: var(--surface-3); transition: background .2s; }
.g-onb-dots i.cur { background: var(--ink-3); }
.g-onb-dots i.ok { background: var(--ok); }
.g-onb-dots i.no { background: var(--err); }
@keyframes g-pop { from { transform: scale(.7); opacity: 0; } }

/* ---------- update banner ---------- */
.g-update{position:fixed;left:50%;transform:translateX(-50%);width:min(440px,calc(100vw - 24px));box-sizing:border-box;bottom:calc(env(safe-area-inset-bottom,0px) + 76px);z-index:90;display:flex;align-items:center;gap:8px;max-width:calc(100vw - 24px);padding:10px 10px 10px 16px;border-radius:var(--rad-3);background:var(--surface-2);color:var(--ink);box-shadow:0 10px 30px rgb(var(--shade-rgb)/.45);font-size:14px}
.g-update span{flex:1;min-width:0}
@media (min-width:600px){.g-update{bottom:24px}}

/* ---------- #debug ---------- */
.g-debug h3{margin:18px 0 8px;font-size:14px}
.g-debug-funnel,.g-debug-log{list-style:none;margin:0;padding:0;font-size:13px}
.g-debug-funnel li{display:grid;grid-template-columns:1fr auto 9.5em;gap:10px;padding:6px 0;border-bottom:1px solid rgb(var(--glint-rgb)/.06)}
.g-debug-funnel em{font-style:normal;opacity:.7;text-align:right}
.g-debug-log li{padding:4px 0;word-break:break-word}
.g-debug-log small{opacity:.7}

/* ---------- install nudge ---------- */
.g-install { text-align: center; }
.g-install-icon { display: block; margin: 4px auto 12px; border-radius: var(--rad-4); box-shadow: var(--shadow-2); }
.g-install-lead { margin: 0 auto 14px; max-width: 34ch; font-size: 16px; line-height: 1.4; }
.g-install-perks { list-style: none; margin: 0 auto 16px; padding: 0; display: grid; gap: 8px; max-width: 36ch; text-align: left; font-size: 14px; color: var(--ink-2); }
.g-install-perks li { position: relative; padding-left: 24px; }
.g-install-perks li::before { content: "✓"; position: absolute; left: 0; color: var(--c-best); font-weight: 800; }
.g-install .install-steps { text-align: left; }
.g-install .g-actions { justify-content: center; }

/* ---------- Gambit Vault ---------- */
.g-vault-lead, .g-vault-sum { margin: 0 0 14px; color: var(--ink-2); line-height: 1.45; }
.g-vault h3 { margin: 18px 0 8px; font: 800 13px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.g-vault-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-vault-row { display: grid; gap: 4px; width: 100%; min-height: 56px; padding: 10px 14px; border: 0; border-radius: var(--rad-3); background: var(--surface-2); color: var(--ink); text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.g-vault-row:hover { background: var(--surface-3); }
.g-vault-name { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.g-vault-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; font-size: 12.5px; color: var(--ink-2); }
.g-lvl { display: inline-flex; gap: 3px; }
.g-lvl i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.g-lvl i.on { background: var(--c-inaccuracy); }
.g-done { color: var(--c-best); font-weight: 800; }
.g-pro-badge { padding: 2px 7px; border-radius: var(--rad-pill); background: linear-gradient(135deg, var(--gold), var(--gold-lo)); color: var(--gold-ink); font: 800 10.5px/1.4 var(--font-body); letter-spacing: .03em; }
.g-vault-ideas { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; line-height: 1.4; }
.g-vault-moves { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface-2); font: 600 13.5px/1.6 var(--font-body); font-variant-numeric: tabular-nums; word-spacing: 2px; }
.g-vault-score { margin: 4px 0 10px; text-align: center; font: 800 44px/1 var(--font-display); }
.st-glyph { font: 800 24px/1 var(--font-display); font-style: normal; }

/* ---------- language picker ---------- */
.g-lang { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; padding: 6px; border-radius: var(--rad-3); background: var(--surface-2); }
.g-lang-label { flex: 1; padding-left: 8px; font-weight: 700; font-size: 14px; }
.g-lang-opt { min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--rad-2); background: transparent; color: var(--ink-2); font: 700 14px/1 var(--font-body); cursor: pointer; }
.g-lang-opt.is-on { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Gambit Pro ---------- */
.g-pro-lead { margin: 0 0 14px; line-height: 1.45; }
.g-pro-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.g-pro-list li { position: relative; padding-left: 26px; line-height: 1.4; }
.g-pro-list li::before { content: "✦"; position: absolute; left: 2px; color: var(--gold); }
.g-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0 0 12px; }
.g-plan { position: relative; display: grid; gap: 4px; min-height: 72px; padding: 14px; border: 0; border-radius: var(--rad-4); background: var(--surface-2); color: var(--ink); text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.g-plan.best { box-shadow: inset 0 0 0 2px var(--gold); }
.g-plan:disabled { cursor: not-allowed; opacity: .75; }
.g-plan-tag { position: absolute; top: -9px; right: 10px; padding: 2px 8px; border-radius: var(--rad-pill); background: var(--gold); color: var(--gold-ink); font: 800 10.5px/1.4 var(--font-body); }
.g-plan-price { font: 800 22px/1 var(--font-display); }
.g-plan-price small { font: 600 12px/1 var(--font-body); color: var(--ink-2); margin-left: 3px; }
.g-pro-note { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; }
.g-pro-key { margin: 12px 0; }
.g-pro-key summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.g-pro-key-row { display: flex; gap: 8px; margin: 6px 0; }
.g-pro-key-row input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: var(--rad-3); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px/1 ui-monospace, monospace; }
.g-pro h3 { margin: 18px 0 6px; font-size: 14px; }
.g-pro-have { margin: 0 0 8px; }
.g-pro a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.g-pro-key summary { list-style: none; justify-content: space-between; }
.g-pro-key summary::-webkit-details-marker { display: none; }
.g-pro-key summary::after { content: "+"; font-size: 20px; color: var(--ink-2); }
.g-pro-key[open] summary::after { content: "–"; }

/* ---------- keyboard board cursor ---------- */
.g-kcur { position: absolute; width: 12.5%; height: 12.5%; box-sizing: border-box; border: 3px solid var(--glint); border-radius: var(--rad-1); box-shadow: 0 0 0 2px rgb(var(--shade-rgb)/.55); pointer-events: none; z-index: 6; display: none; }
#board:focus-visible { outline: none; }
#board:focus-visible .g-kcur { display: block; }

/* ---------- 44px touch targets ---------- */
/* Top bar: the controls keep their size (the bar is tight on phones); an invisible
   ::after extends each tap area to at least 44×44. */
.topbar .brand, .topbar .gp-search, .topbar .lvl-chip, .topbar .atl-chip, .topbar .gp-me, .topbar .gp-install-btn { position: relative; }
.topbar .brand::after, .topbar .gp-search::after, .topbar .lvl-chip::after, .topbar .atl-chip::after, .topbar .gp-me::after, .topbar .gp-install-btn::after { content: ""; position: absolute; inset: -6px; }
.nav-back { min-width: 44px; min-height: 44px; }
/* Segmented tabs and text buttons. */
.pz-sets button, .learn-tabs button, .seg > button, [role=tablist] > button { min-height: 44px; }
button.link, a.link { min-height: 44px; display: inline-flex; align-items: center; }
.sec-head button.link, .sec-head a.link { margin-block: -13px; }
.g-week { min-height: 44px; }
button.link, a.link { min-width: 44px; justify-content: center; }
/* Very narrow phones: the logo mark alone, so every top-bar control fits. */
@media (max-width: 360px) { .topbar .brand-word, .topbar .brand-nag { display: none; } }

/* ---------- long sheets ---------- */
/* Bottom and centre sheets never grow past the screen: the header (and its close
   button) stays put and the body scrolls. */
.sheet.bottom { max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 16px); }
.sheet.center { max-height: calc(100dvh - 32px); }
.sheet.bottom > .sheet-body, .sheet.center > .sheet-body,
.sheet.bottom > .g-sheet-root > .sheet-body, .sheet.center > .g-sheet-root > .sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet.bottom > .sheet-head, .sheet.center > .sheet-head, .sheet > .g-sheet-root > .sheet-head { flex: none; }
/* One wrapper per opening (src/core/bridge.js openPanel); invisible to layout. */
.g-sheet-root { display: contents; }
/* Icon buttons (40px) get a 44px invisible tap area. */
.icon-btn { position: relative; }
.icon-btn::after { content: ""; position: absolute; inset: -2px; }

/* ---------- audit round 1: layout fixes ---------- */
/* Settings board swatches: long names wrap instead of pushing the 4th column off-screen. */
.swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.swatch { min-width: 0; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
@media (max-width: 359px) { .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Play setup: the dock clears the raised Play button of the tab bar; no eval before a game. */
@media (max-width: 599px) { html.g-setup .start-dock { bottom: calc(58px + 20px); } }
html.g-setup .evalbar { visibility: hidden; }
/* Portrait tablets: setup is about choosing a bot, so the board steps aside. */
@media (min-width: 600px) and (orientation: portrait) { html.g-setup .board-col, html.g-setup .toolbar { display: none; } html.g-setup .side { width: 100%; } }
/* Profile on wide screens: full-width dashboard like Home, no unrelated board. */
@media (min-width: 600px) {
  .app[data-view="games"] { --content-w: min(1120px, calc(var(--vw) - 2 * var(--pad))); }
  .app[data-view="games"] .board-col, .app[data-view="games"] .toolbar { display: none; }
  .app[data-view="games"] .stage { display: block; width: var(--content-w); max-width: 100%; margin-inline: auto; padding-block: 6px 48px; }
  .app[data-view="games"] .side { width: 100%; contain: none; display: block; min-height: 0; }
  .app[data-view="games"] .side > .panel { overflow: visible; margin: 0; padding: 0; }
}
/* Vault quizzes and the placement test: not the rated puzzle screen. */
html.g-quiz-mode #side .pz-head, html.g-quiz-mode #side .rush-entry, html.g-quiz-mode #side .pz-sets,
html.g-quiz-mode #side .pz-card ~ *, html.g-quiz-mode .toolbar [data-act="pz-hint"], html.g-quiz-mode .toolbar [data-act="pz-solution"] { display: none !important; }

/* Side rail: scrolls when the window is short or zoomed to 200%. */
#gp-rail { overflow-y: auto; overscroll-behavior: contain; }
/* Search placeholder text: 4.5:1 contrast in both themes. */
.gp-search > span { color: var(--ink-2); }

/* Medal toasts are announcements, not controls: taps go through to the buttons below. */
.gp-medal-toast { pointer-events: none; }

/* ---------- Settings → Theme: 12 cards, each drawn with its own palette ---------- */
.g-theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
@media (max-width: 359px) { .g-theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 700px) { .g-theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.g-theme-card { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 8px; border: 0; border-radius: var(--rad-3); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease); }
.g-theme-card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-2); }
.g-theme-card:active { transform: scale(.97); }
.g-theme-card.is-on { box-shadow: inset 0 0 0 2px var(--accent-2), var(--shadow-2); }
.g-theme-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.g-theme-prev { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 6px 8px; align-items: center; padding: 8px; border-radius: var(--rad-2); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); }
.g-tp-text { display: grid; gap: 4px; min-width: 0; }
.g-tp-text i { display: block; height: 5px; border-radius: var(--rad-0); background: var(--ink); width: 82%; }
.g-tp-text i + i { background: var(--ink-3); width: 56%; }
.g-tp-board { grid-row: 1 / span 2; grid-column: 2; display: grid; grid-template-columns: repeat(4, 9px); grid-auto-rows: 9px; border-radius: var(--rad-0); overflow: hidden; }
.g-tp-board i { background: var(--board-light); }
.g-tp-board i:nth-child(8n+2), .g-tp-board i:nth-child(8n+4), .g-tp-board i:nth-child(8n+5), .g-tp-board i:nth-child(8n+7) { background: var(--board-dark); }
.g-tp-cta { height: 12px; width: 62%; border-radius: var(--rad-pill); background: var(--grad-accent); }
.g-theme-strip { display: flex; height: 12px; border-radius: var(--rad-1); overflow: hidden; }
.g-theme-strip i { flex: 1; }
.g-theme-name { font: 700 var(--fs-2)/1.15 var(--font-body); padding: 0 2px 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-theme-card.is-on .g-theme-name::after { content: "✓"; margin-left: 5px; color: var(--accent-ink); font-weight: 800; }
.g-theme-tag { display: inline-block; margin-left: 3px; padding: 0 5px; border-radius: var(--rad-pill); font: 650 10px/1.5 var(--font-body); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) { .g-theme-card { transition: none; } .g-theme-card:hover, .g-theme-card:active { transform: none; } }

/* ---------- polish: selection, scrollbars, pressed and selected states ---------- */
::selection { background: rgb(var(--accent-rgb)/.38); color: var(--ink); }
html { scrollbar-color: var(--surface-3) transparent; }
:where(input, select, textarea) { accent-color: var(--accent); }
/* primary actions: a soft lift on hover, a quick press */
.btn-primary, .g-cta-main, .atl-btn:not([disabled]) { transition: transform var(--dur-1) var(--ease), filter var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
@media (hover: hover) {
  .btn-primary:hover, .g-cta-main:hover, .atl-btn:not([disabled]):not(.ghost):hover { filter: brightness(1.06) saturate(1.05); transform: translateY(-1px); }
  .btn-soft:hover, .btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
}
.btn-primary:active, .g-cta-main:active, .atl-btn:not([disabled]):active, .btn-soft:active, .btn-ghost:active, .btn-danger:active { transform: translateY(0) scale(.97); }
.g-cta-main { box-shadow: var(--shadow-1), var(--shadow-accent); }
/* segmented controls: the chosen segment is the lifted one */
.seg button { transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.seg button.is-on { background: var(--surface-3); color: var(--ink); box-shadow: var(--shadow-1), inset 0 0 0 1px rgb(var(--glint-rgb)/.09); }
/* pickers: one selected ring everywhere */
.swatch.is-on, .pset.is-on { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--accent-2); }
.swatch, .pset { transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.swatch:active, .pset:active { transform: scale(.96); }
/* links inside copy */
.sheet-body a, .field-note a, .muted a { color: var(--accent-ink); text-underline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .btn-primary, .g-cta-main, .atl-btn, .seg button, .swatch, .pset { transition: none; }
  .btn-primary:hover, .g-cta-main:hover, .atl-btn:hover, .btn-primary:active, .g-cta-main:active, .atl-btn:active, .btn-soft:active, .btn-ghost:active, .btn-danger:active, .swatch:active, .pset:active { transform: none; }
}

/* ---------- Game Review: what-if mode ---------- */
.g-wi-start .ico { width: 16px; height: 16px; }
.cglyph.g-wi-glyph { background: var(--grad-accent); color: var(--on-accent); }
.cglyph.g-wi-glyph .ico { width: 24px; height: 24px; }
.coach.g-wi-card { box-shadow: var(--shadow-2), inset 0 0 0 1.5px rgb(var(--accent-rgb)/.45); }
.g-wi-line { margin: 2px 0 10px; font: 650 var(--fs-3)/1.6 var(--font-body); color: var(--ink-2); word-spacing: 2px; }
.g-wi-line i { font-style: normal; color: var(--ink-3); margin-right: 2px; font-variant-numeric: tabular-nums; }
.g-wi-mv { padding: 1px 5px; border-radius: var(--rad-1); color: var(--ink); }
.g-wi-mv.is-cur { background: rgb(var(--accent-rgb)/.24); box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb)/.5); }
.g-wi-mv.is-undone { color: var(--ink-3); }
.g-wi-now { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 0 0 10px; font-size: var(--fs-3); color: var(--ink-2); }
.g-wi-now b { color: var(--ink); }
.g-wi-depth, .g-wi-wait { color: var(--ink-3); font-size: var(--fs-2); }
.g-wi-cmp { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: var(--fs-2); }
.g-wi-cmp th, .g-wi-cmp td { padding: 7px 8px; text-align: left; border-top: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; }
.g-wi-cmp thead th { border-top: 0; padding: 0 8px 4px; font-size: var(--fs-1); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); text-align: right; }
.g-wi-cmp td.tnum { text-align: right; white-space: nowrap; }
.g-wi-cmp tr.is-alt th, .g-wi-cmp tr.is-alt td { color: var(--ink); background: rgb(var(--accent-rgb)/.1); }
.g-wi-cmp tr.is-alt th { border-radius: var(--rad-1) 0 0 var(--rad-1); }
.g-wi-cmp tr.is-alt td:last-child { border-radius: 0 var(--rad-1) var(--rad-1) 0; }
.g-wi-delta .up { color: var(--ok); }
.g-wi-delta .down { color: var(--err); }
.g-wi-verdict { font-weight: 650; }
.g-wi-verdict.v-muchBetter, .g-wi-verdict.v-better { color: var(--ok); }
.g-wi-verdict.v-muchWorse, .g-wi-verdict.v-worse { color: var(--err); }
.g-wi-note { color: var(--warn); }
.g-wi-card [data-g-wi="save"][aria-pressed="true"] { color: var(--gold); box-shadow: inset 0 0 0 1px rgb(var(--gold-rgb)/.5); }
.g-wi-list { margin: 12px 0 4px; padding: 14px 14px 8px; border-radius: var(--rad-4); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.g-wi-list h3 { margin: 0 0 8px; font: 750 var(--fs-3)/1.2 var(--font-body); color: var(--ink); }
.g-wi-list h3 span { color: var(--ink-3); font-weight: 650; margin-left: 4px; }
.g-wi-tree, .g-wi-tree ul { list-style: none; margin: 0; padding: 0; }
.g-wi-group { padding: 4px 0 8px; }
.g-wi-at { display: block; font-size: var(--fs-2); color: var(--ink-3); margin-bottom: 4px; }
.g-wi-at b { color: var(--ink-2); }
/* one column that never grows past the panel: a long line is cut with an ellipsis, so ☆ and × stay on screen */
.g-wi-group ul { border-left: 2px solid var(--line); margin-left: 4px; padding-left: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.g-wi-group li { display: flex; align-items: center; gap: 2px; min-width: 0; }
.g-wi-open { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 0; border-radius: var(--rad-2); background: var(--surface-2); color: var(--ink); text-align: left; cursor: pointer; transition: background var(--dur-2) var(--ease); }
.g-wi-open:hover { background: var(--surface-3); }
.g-wi-open .g-wi-line { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--fs-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-wi-open b { flex: none; }
.g-wi-keep, .g-wi-del { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--rad-2); background: transparent; color: var(--ink-3); font-size: 20px; cursor: pointer; }
.g-wi-keep.is-on { color: var(--gold); }
.g-wi-keep:hover, .g-wi-del:hover { background: var(--surface-2); color: var(--ink); }
.g-wi-del .ico { width: 18px; height: 18px; }

/* ---------- home hero: the streak line reads on any part of the photo ---------- */
.home-hero .hh-streak { padding: 5px 12px 5px 9px; border-radius: var(--rad-pill); background: rgb(var(--bg-deep-rgb)/.62); box-shadow: inset 0 0 0 1px rgb(var(--glint-rgb)/.08); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--ink-2); max-width: 100%; }
.home-hero .hh-streak.on { color: var(--ink); }

/* ---------- XP pop: on phones with a top bar it appears just below it, not over the level chip ---------- */
@media (max-width: 599px) { .app.flat-view .xp-pop { top: calc(env(safe-area-inset-top, 0px) + 66px); } }

/* ---------- touch screens: scrolling stays cheap (measured in docs/PERF.md) ---------- */

@media (pointer: coarse) {
  /* The ambient light stands still. As an endless animation on a fixed layer behind the page it kept the
     compositor drawing on every screen, also when nothing moved. */
  html.gp-motion body::before { animation: none; }
  /* Cards tilt under a mouse only, so they need no layer of their own (it was one per card, medal and label). */
  .atl-card, .atl-col, .start-tile, .gp-pool, .atl-drop-hero, .gp-friend, .atl-spot-card, .gp-join, .bot-tile, .gp-ach-card { transform-style: flat; will-change: auto; }
  /* The fixed bars were 90% opaque over a blur that had to be redone for every scrolled frame. */
  .app.board-view .toolbar, .app.flat-view .tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--raised); }
  .sheet-veil { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(var(--bg-deep-rgb)/.56); }
  .gp-pal-veil { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(var(--bg-deep-rgb)/.6); }
  /* Chips on the hero photo: a denser tint instead of a blur that scrolls with them. */
  .home-hero .hh-streak { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(var(--bg-deep-rgb)/.8); }
  .home-hero .hh-goal { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(var(--bg-deep-rgb)/.6); }
  .g-cta-alt { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(var(--bg-deep-rgb)/.5); }
  .gp-on-me { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgb(var(--bg-deep-rgb)/.5); }
  html.gp-rail-on .gp-rail { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
  /* Pieces: no layer per piece while they stand still (32 per board). A piece gets one while it is dragged;
     a piece that glides is animated by the compositor anyway. */
  .board .pc { will-change: auto; backface-visibility: visible; }
  .board .pc.dragging { will-change: transform; }
  /* Atelier: the endless sheens animate background-position and the effect previews animate inside an SVG.
     Neither can run on the compositor, so every card was repainted for every frame, also while scrolling.
     Here the sheen rests and the effect preview shows its burst open. */
  .atl-card.r-legendary::before, .atl-card.r-exclusive::before, .atl-rar-tag.r-legendary, .atl-rar-tag.r-exclusive { animation: none; }
  .atl-fx-parts, .atl-fx-ring { animation: none; transform: scale(1); opacity: 1; }
  .atl-fx-ring { opacity: .55; }
  /* The bobbing pieces on the drop card: an endless transform animation made every card drawn after it a layer
     of its own ("overlap"), nine of them on a phone. */
  .atl-dh-art i { animation: none; }
}

/* The Atelier covers the whole screen with an opaque page: the app under it is not drawn at all (it was laid
   out, painted and composited behind the Atelier, hero animations and board included). Body and Atelier share
   the --bg background, so the open and close fades look the same. */
:root:has(.atl.in) #app { visibility: hidden; }

/* An entrance that has ended keeps nothing: with `both` every card kept an animation (and a layer) alive. */
.gp-pop { animation-fill-mode: backwards; }

/* What cannot be seen does not animate: a hero scrolled away (motion.js sets gp-asleep), and the page
   under an open sheet or under the Atelier. */
.gp-asleep .gp-hero-bg, .gp-asleep .gp-motes i,
:root:has(#sheet:not([hidden])) .app .gp-hero-bg, :root:has(#sheet:not([hidden])) .app .gp-motes i, :root:has(#sheet:not([hidden])) .app .avatar.live img,
:root:has(.atl.in) .app .gp-hero-bg, :root:has(.atl.in) .app .gp-motes i, :root:has(.atl.in) .app .avatar.live img { animation-play-state: paused; }

/* ---------- touch screens: every control is a 44 px target (UX16-15) ---------- */

@media (pointer: coarse) {
  /* buttons and fields grow to 44 px where the layout has the room */
  .btn-primary, .btn-soft, .btn-ghost, .btn-primary.sm, .btn-soft.sm, .btn-ghost.sm, .cnt-more, .key-row, .pv, #ed-fen, .seg button, .sheet .tabs button, .side-tabs button { min-height: 44px; }
  .side-tabs button, #tab-moves, #tab-lines, #tab-report { min-width: 44px; }
  #vol-range { min-height: 44px; }
  /* small round and chip controls keep their look; their touch area reaches out to 44 px */
  /* (the top bar's controls and .icon-btn already do this further up) */
  .coach-toggle, .ms-mv, .atl-switch, .atl-gift { position: relative; }
  .coach-toggle:after, .ms-mv:after, .atl-switch:after, .atl-gift:after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
  }
  .icon-btn::after { inset: -3px; }
  /* the move strip clips what reaches outside it, so the strip itself and its chips grow */
  .app { --strip-h: 44px; }
  .ms-mv { min-width: 44px; min-height: 44px; }
}

/* ---------- Today's gambits (src/features/missions.js) ---------- */

.g-missions .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.g-ms-count { font-size: var(--fs-2); font-weight: 700; color: var(--ink-3); }
.g-ms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-ms { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px 8px 8px; border: 0; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); text-align: left; font: inherit; transition: background .15s; }
.g-ms:hover { background: var(--surface-2); }
.g-ms:focus-visible { outline: var(--focus-ring, 2px solid var(--accent)); outline-offset: 2px; }
.g-ms-ico { width: 40px; height: 40px; border-radius: var(--rad-3); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.g-ms-ico .ico, .g-ms-check { width: 22px; height: 22px; }
.g-ms-text { min-width: 0; display: grid; gap: 6px; }
.g-ms-text b { font-weight: 650; font-size: var(--fs-3, 15px); line-height: 1.25; }
.g-ms-bar { height: 4px; border-radius: var(--rad-pill); background: var(--surface-3, var(--surface-2)); overflow: hidden; }
.g-ms-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.g-ms-n { font-size: var(--fs-2); font-weight: 700; color: var(--ink-2); }
.g-ms-pay { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-2); font-weight: 700; color: var(--gold); }
.g-ms-crown { width: 15px; height: 15px; flex: none; }
.g-ms.is-done { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.g-ms.is-done .g-ms-ico { background: rgb(var(--good-rgb, var(--accent-rgb))/.16); color: var(--good, var(--accent)); }
.g-ms.is-done .g-ms-text b { text-decoration: line-through; text-decoration-color: rgb(var(--ink-rgb)/.35); }
.g-ms.is-done .g-ms-bar { visibility: hidden; }
.g-ms-bonus { display: flex; align-items: center; gap: 4px; margin: 10px 2px 0; font-size: var(--fs-2); color: var(--ink-3); }
.g-ms-bonus .g-ms-crown { color: var(--gold); }
.g-ms-bonus.is-done { color: var(--ink-2); font-weight: 650; }
@media (prefers-reduced-motion: reduce) { .g-ms, .g-ms-bar i { transition: none; } }

/* Puzzle Rush has four modes since "Clean sheet": two by two on wide screens instead of three and one. */
@media (min-width: 600px) { .rush-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Vision gym (src/features/vision.js) ---------- */

.g-vg-lead { margin: 0 0 14px; color: var(--ink-2); }
.g-vg-drills { display: grid; gap: 8px; margin: 0 0 12px; }
.g-vg-drill { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px 10px 10px; border: 0; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-vg-drill:hover { background: var(--surface-2); }
.g-vg-drill > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.g-vg-drill > span:nth-child(2) span { font-size: var(--fs-2); color: var(--ink-2); }
.g-vg-drill em { font-style: normal; font-weight: 700; font-size: var(--fs-2); color: var(--ink-3); }
.g-vg-ico { width: 44px; height: 44px; border-radius: var(--rad-3); background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.g-vg-ico .ico { width: 24px; height: 24px; }
.g-vg-ico i { width: 34px; height: 34px; background: center / 100% 100% no-repeat; }
.g-vg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.g-vg-prompt { display: grid; gap: 2px; min-width: 0; }
.g-vg-prompt span { font-size: var(--fs-2); color: var(--ink-2); }
.g-vg-prompt b { font: 800 44px / 1 var(--font-display); letter-spacing: .02em; color: var(--ink); }
.g-vg-prompt small { font-size: var(--fs-2); color: var(--ink-2); }
.g-vg-meta { display: grid; justify-items: end; gap: 4px; }
.g-vg-score { font: 800 28px / 1 var(--font-display); color: var(--ink); }
.g-vg-clock { font-weight: 700; color: var(--ink-2); }
.g-vg-clock.low { color: var(--bad, var(--accent)); }
.g-vg-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 440px); aspect-ratio: 1; margin: 0 auto; border-radius: var(--rad-1); overflow: hidden; touch-action: manipulation;
  background: var(--tex, none) center / 100% 100% no-repeat, repeating-conic-gradient(var(--sq-dark, var(--board-dark)) 0 25%, var(--sq-light, var(--board-light)) 0 50%) 0 0 / 25% 25%; box-shadow: var(--shadow-2); }
.g-vg-sq { border: 0; padding: 0; margin: 0; min-width: 0; background: transparent center / 88% 88% no-repeat; position: relative; cursor: pointer; }
.g-vg-sq:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; z-index: 1; }
.g-vg-prompt:focus { outline: none; }
.g-vg-sq.ok { background-color: rgb(var(--glint-rgb)/.45); }
.g-vg-sq.no { background-color: rgb(var(--board-check-rgb)/.55); }
.g-vg-sq.show { box-shadow: inset 0 0 0 calc(var(--sqs, 44px) * .08) var(--arrow-best); }
.g-vg-sq.long { background-color: rgb(var(--board-hl-rgb)/.55); }
.g-vg-sq.goal::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; box-shadow: 0 0 0 4px var(--arrow-best), inset 0 0 0 2px rgb(var(--glint-rgb)/.8); }
.g-vg-actions { display: flex; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.g-vg-result { display: grid; justify-items: center; gap: 4px; padding: 18px 12px; border-radius: var(--rad-4); background: var(--surface); text-align: center; }
.g-vg-result b { font: 800 64px / 1 var(--font-display); color: var(--ink); }
.g-vg-result span { color: var(--ink-2); }
.g-vg-result.record span:last-child { color: var(--gold); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .g-vg-sq { transition: none; } }

/* ---------- The Road (src/features/road.js) ---------- */

.g-road .sec-head, .g-missions .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.g-road-all { min-height: 44px; font-size: var(--fs-2); }
.g-road-card { display: grid; gap: 6px; padding: 14px; border-radius: var(--rad-4); background: var(--surface); }
.g-road-of { font-size: var(--fs-1); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.g-road-ch { font: 800 24px / 1.1 var(--font-display); color: var(--ink); }
.g-road-bar { display: flex; gap: 4px; margin: 4px 0 6px; }
.g-road-bar i { flex: 1; height: 6px; border-radius: var(--rad-pill); background: var(--surface-2); }
.g-road-bar i.on { background: var(--accent); }
.g-road-next { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 0; border-radius: var(--rad-3); background: var(--raised); color: var(--ink); text-align: left; font: inherit; box-shadow: var(--shadow-1); }
.g-road-next:hover { background: var(--surface-2); }
.g-road-next-l { font-size: var(--fs-1); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.g-road-next b { font-weight: 650; min-width: 0; }
.g-road-n { font-size: var(--fs-2); font-weight: 700; color: var(--ink-2); }
.g-road-go { width: 18px; height: 18px; color: var(--ink-2); }
.g-road-fin { margin: 0; padding: 14px; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); font-weight: 650; }
.g-rd-lead { margin: 0 0 14px; color: var(--ink-2); }
.g-rd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g-rd-ch details { border-radius: var(--rad-4); background: var(--surface); }
.g-rd-ch summary { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px 8px 10px; cursor: pointer; list-style: none; }
.g-rd-ch summary::-webkit-details-marker { display: none; }
.g-rd-ch summary:focus-visible { outline: var(--focus-ring, 2px solid var(--accent)); outline-offset: 2px; border-radius: var(--rad-4); }
.g-rd-node { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-weight: 800; }
.g-rd-node svg { width: 20px; height: 20px; }
.g-rd-ch.is-now .g-rd-node { background: var(--accent); color: var(--on-accent, var(--bg)); }
.g-rd-ch.is-done .g-rd-node { background: rgb(var(--good-rgb, var(--accent-rgb))/.18); color: var(--good, var(--accent)); }
.g-rd-name { display: grid; gap: 2px; min-width: 0; }
.g-rd-name span { font-size: var(--fs-2); color: var(--ink-3); }
.g-rd-steps { list-style: none; margin: 0; padding: 0 12px 12px 58px; display: grid; gap: 6px; }
.g-rd-steps li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 44px; }
.g-rd-mark { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); color: var(--good, var(--accent)); }
.g-rd-steps li.is-done .g-rd-mark { box-shadow: none; }
.g-rd-steps li.is-done .g-rd-step { color: var(--ink-3); }
.g-rd-step { min-width: 0; font-size: var(--fs-3, 15px); }
.g-rd-step .tnum { color: var(--ink-3); font-size: var(--fs-2); margin-left: 4px; }
.g-rd-pay { margin: 14px 2px 0; font-size: var(--fs-2); color: var(--ink-3); }
@media (max-width: 359px) { .g-rd-steps { padding-left: 14px; } }

/* ---------- Advent calendar (src/features/advent.js) ---------- */

.g-advent .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.g-advent h3 { display: flex; align-items: center; gap: 10px; }
.g-adv-art { width: 28px; height: 28px; border-radius: var(--rad-1); background: url("/art/boards/thumbs/bd-christmas.webp") center / cover no-repeat var(--surface-2); flex: none; }
.g-adv-doors { list-style: none; margin: 0 0 10px; padding: 10px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; border-radius: var(--rad-4); background: var(--surface); }
.g-adv-door { aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--rad-1); background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: var(--fs-2); }
.g-adv-door svg { width: 62%; height: 62%; color: var(--gold); }
.g-adv-door.is-open { background: rgb(var(--gold-rgb)/.16); }
.g-adv-door.is-now { box-shadow: inset 0 0 0 2px var(--accent); color: var(--ink); }
.g-adv-door.is-past { opacity: .5; }
.g-adv-today { margin-bottom: 8px; }
.g-adv-note { margin: 0 0 8px; padding: 12px 14px; border-radius: var(--rad-4); background: var(--surface); color: var(--ink-2); }
.g-adv-prize { display: flex; align-items: center; gap: 6px; margin: 2px 2px 0; font-size: var(--fs-2); color: var(--ink-3); }
.g-adv-prize svg { width: 16px; height: 16px; flex: none; color: var(--gold); }
.g-adv-prize.is-won { color: var(--ink-2); font-weight: 650; }
@media (max-width: 359px) { .g-adv-doors { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---------- Second thoughts (src/features/guard.js) ---------- */

.g-guard { position: fixed; left: 50%; bottom: calc(var(--tool-h, 56px) + env(safe-area-inset-bottom, 0px) + 12px); transform: translateX(-50%); z-index: 46; width: min(calc(100vw - 24px), 440px); box-sizing: border-box; padding: 12px 14px; border-radius: var(--rad-4); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line); display: grid; gap: 10px; }
.g-guard p { margin: 0; font-weight: 650; }
.g-guard div { display: flex; gap: 8px; flex-wrap: wrap; }
.g-guard button { min-height: 44px; }
@media (min-width: 900px) { .g-guard { bottom: 24px; } }

/* ---------- Club ladder (src/features/ladder.js) ---------- */

.g-ladder { margin: 12px 0; }
.g-ld-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px 8px 8px; border: 0; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-ld-card:hover { background: var(--surface-2); }
.g-ld-rank { width: 48px; height: 48px; border-radius: var(--rad-3); display: grid; place-items: center; background: var(--surface-2); font: 800 24px / 1 var(--font-display); }
.g-ld-text { display: grid; gap: 2px; min-width: 0; }
.g-ld-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-ld-div { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.g-ld-div b { font: 800 26px / 1 var(--font-display); }
.g-ld-div span { color: var(--ink-3); font-size: var(--fs-2); }
.g-ld-lead { margin: 0 0 12px; color: var(--ink-2); }
.g-ld-table { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.g-ld-table li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-ld-table li.is-up { box-shadow: inset 3px 0 0 var(--good, var(--accent)); }
.g-ld-table li.is-you { background: var(--raised); box-shadow: var(--shadow-1), inset 0 0 0 2px var(--accent); font-weight: 700; }
.g-ld-pos { color: var(--ink-3); font-weight: 700; }
.g-ld-pts { font-weight: 700; }
.g-ld-note { margin: 12px 2px 0; font-size: var(--fs-2); color: var(--ink-3); }

/* ---------- Gambit Wrapped (src/features/wrapped.js) ---------- */

.g-wrapped { margin: 12px 0; }
.g-wr-open { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px 8px 8px; border: 0; border-radius: var(--rad-4); background: linear-gradient(120deg, rgb(var(--gold-rgb)/.18), rgb(var(--accent-rgb)/.14)), var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-wr-open:hover { background: linear-gradient(120deg, rgb(var(--gold-rgb)/.24), rgb(var(--accent-rgb)/.2)), var(--surface-2); }
.g-wr-year { width: 64px; height: 48px; border-radius: var(--rad-3); display: grid; place-items: center; background: var(--raised); color: var(--gold); font: 800 22px / 1 var(--font-display); }
.g-wr-text { display: grid; gap: 2px; min-width: 0; }
.g-wr-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-wr-dots { list-style: none; margin: 0 0 14px; padding: 0; display: flex; gap: 4px; }
.g-wr-dots li { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.g-wr-dots li.is-on { background: var(--gold); }
.g-wr-card { min-height: 260px; padding: 24px 20px; border-radius: var(--rad-4); background: radial-gradient(120% 90% at 85% 0%, rgb(var(--accent-rgb)/.16), transparent 70%), var(--surface); display: grid; align-content: center; gap: 6px; touch-action: pan-y; user-select: none; }
.g-wr-kick { margin: 0; color: var(--gold); font-weight: 800; font-size: var(--fs-2); letter-spacing: .06em; text-transform: uppercase; }
.g-wr-big { margin: 0; font: 800 clamp(56px, 18vw, 88px) / 1 var(--font-display); color: var(--ink); overflow-wrap: anywhere; }
.g-wr-line { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink); }
.g-wr-note { margin: 6px 0 0; color: var(--ink-2); }
.g-wr-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 14px; }
.g-wr-nav button { min-height: 44px; min-width: 88px; }
.g-wr-pos { text-align: center; color: var(--ink-3); font-size: var(--fs-2); }

/* ---------- Puzzle duels (src/features/duel.js) ---------- */

.g-duel-chip { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 10px 14px; min-height: 44px; box-sizing: border-box; border-radius: var(--rad-4); background: rgb(var(--gold-rgb)/.14); color: var(--ink); font-weight: 700; }
.g-duel-chip b { font-weight: 700; }
.g-duel-chip svg { width: 18px; height: 18px; color: var(--gold); }
.g-duel-lead { margin: 0 0 12px; color: var(--ink-2); }
.g-duel-rules { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
.g-duel-big { margin: 4px 0 6px; font: 800 44px / 1.05 var(--font-display); }
.g-duel-acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.g-duel-acts button { min-height: 44px; }
.g-duel-name, .g-duel-link label { display: grid; gap: 6px; margin: 0; font-size: var(--fs-2); color: var(--ink-2); }
.g-duel-name input, .g-duel-link input { min-height: 44px; box-sizing: border-box; width: 100%; padding: 0 12px; border-radius: var(--rad-3); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.g-duel-link { margin: 12px 0 0; }
.g-duel-marks { display: inline-flex; gap: 4px; }
.g-duel-marks i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 13px; }
.g-duel-marks i.is-ok { background: rgb(var(--good-rgb, var(--accent-rgb))/.2); color: var(--good, var(--accent)); }
.g-duel-marks i.is-miss { background: var(--surface-2); color: var(--ink-3); }
.g-duel-solo { margin: 0 0 12px; }
.g-duel-table { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.g-duel-table li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name time" "marks marks"; gap: 6px 10px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-duel-table li b { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
.g-duel-table li .g-duel-marks { grid-area: marks; }
.g-duel-table li .tnum { grid-area: time; color: var(--ink-2); font-size: var(--fs-2); }
.g-duel-table li.is-win { box-shadow: inset 0 0 0 2px var(--gold); }
.g-forge-btn { display: block; margin: 2px 0 8px auto; min-height: 44px; }

/* Vision gym: position recall */
.g-vg-tray { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: min(100%, 440px); margin: 10px auto 0; }
.g-vg-tray button { aspect-ratio: 1; min-height: 44px; border: 0; border-radius: var(--rad-2, 8px); background: var(--surface-2) center / 80% 80% no-repeat; color: var(--ink-2); display: grid; place-items: center; }
.g-vg-tray button.is-on { box-shadow: inset 0 0 0 3px var(--accent); background-color: var(--raised); }
.g-vg-tray .g-vg-erase .ico { width: 22px; height: 22px; }
.g-vg-tray button:nth-child(7) { grid-column: 1; }
.g-vg-sq.missed { box-shadow: inset 0 0 0 calc(var(--sqs, 44px) * .08) var(--arrow-best); opacity: .7; }
/* QA18-11: on short phones the question sits at the top, over the header, not over the board's first rank */
@media (max-height: 640px) and (max-width: 899px) { .g-guard { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 8px); } }

/* ---------- Weakness radar (src/features/radar.js) ---------- */

.g-radar { margin: 12px 0; min-height: 64px; }
.g-rad-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 4px 14px 4px 4px; border: 0; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-rad-card:hover { background: var(--surface-2); }
.g-rad-text { display: grid; gap: 2px; min-width: 0; }
.g-rad-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-rad-mini .g-rad-svg { width: 64px; height: 64px; display: block; }
.g-rad-svg .g-rad-grid polygon, .g-rad-svg .g-rad-grid line { fill: none; stroke: var(--line); stroke-width: 1; }
.g-rad-svg .g-rad-shape { fill: rgb(var(--accent-rgb)/.28); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.g-rad-svg text { fill: var(--ink-2); font: 650 17px var(--font-ui, sans-serif); }
.g-rad-svg text.is-off { fill: var(--ink-3); }
.g-rad-lead { margin: 0 0 8px; color: var(--ink-2); }
.g-rad-big { display: grid; place-items: center; margin: 0 0 8px; }
.g-rad-big .g-rad-svg { width: min(100%, 400px); height: auto; }
.g-rad-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-rad-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btn" "bar btn"; align-items: center; gap: 4px 12px; padding: 8px 8px 8px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-rad-name { grid-area: name; display: grid; gap: 1px; min-width: 0; }
.g-rad-name span { font-size: var(--fs-2); color: var(--ink-2); }
.g-rad-bar { grid-area: bar; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.g-rad-bar i { display: block; height: 100%; background: var(--accent); }
.g-rad-list button { grid-area: btn; min-height: 44px; }
.g-rad-note { margin: 12px 2px 0; font-size: var(--fs-2); color: var(--ink-3); }

/* ---------- Ghost of your past self (src/features/ghost.js) ---------- */

.g-ghost { margin: 12px 0; }
.g-gh-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px 8px 8px; border: 0; border-radius: var(--rad-4); background: linear-gradient(120deg, rgb(var(--accent-rgb)/.12), transparent 70%), var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-gh-card:hover { background: var(--surface-2); }
.g-gh-card.is-locked .g-gh-elo { color: var(--ink-3); font-size: 16px; }
.g-gh-elo { width: 56px; height: 48px; border-radius: var(--rad-3); display: grid; place-items: center; background: var(--raised); color: var(--accent); font: 800 20px / 1 var(--font-display); }
.g-gh-text { display: grid; gap: 2px; min-width: 0; }
.g-gh-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-gh-big { margin: 0; font: 800 56px / 1 var(--font-display); color: var(--accent); }
.g-gh-lead { margin: 6px 0 12px; color: var(--ink-2); }

/* ---------- Seasons (src/features/seasons.js): art from theme tokens only ---------- */

.g-season { position: relative; }
.g-sn-art { height: 10px; margin: 0 0 10px; border-radius: 5px; background: linear-gradient(90deg, rgb(var(--gold-rgb)), rgb(var(--accent-rgb))); }
.g-season-babamarta .g-sn-art { background: repeating-linear-gradient(135deg, rgb(var(--err-rgb)) 0 9px, rgb(var(--glint-rgb)) 9px 18px); box-shadow: inset 0 0 0 1px rgb(var(--err-rgb)/.5); }
.g-season-newyear .g-sn-art { background: radial-gradient(circle at 10% 50%, rgb(var(--gold-rgb)) 0 3px, transparent 4px) 0 0 / 24px 10px, linear-gradient(90deg, rgb(var(--accent-rgb)/.5), rgb(var(--gold-rgb)/.5)); }
.g-season-summer .g-sn-art { background: linear-gradient(90deg, rgb(var(--warn-rgb)), rgb(var(--gold-rgb)), rgb(var(--info-rgb))); }
.g-season-halloween .g-sn-art { background: repeating-linear-gradient(90deg, rgb(var(--warn-rgb)) 0 14px, rgb(var(--shade-rgb)) 14px 20px); }
.g-sn-lead { margin: 0 0 10px; color: var(--ink-2); }

/* ---------- Weapon of the week (src/features/weapon.js) ---------- */

.g-weapon .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.g-wp-body { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--rad-4); background: var(--surface); }
.g-wp-ico { width: 44px; height: 44px; border-radius: var(--rad-3); display: grid; place-items: center; background: rgb(var(--gold-rgb)/.16); color: var(--gold); }
.g-wp-text { display: grid; gap: 2px; min-width: 0; }
.g-wp-text b { font-size: 18px; }
.g-wp-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-wp-steps { list-style: none; margin: 8px 2px; padding: 0; display: grid; gap: 4px; color: var(--ink-2); font-size: var(--fs-2); }
.g-wp-steps li { display: flex; gap: 8px; align-items: baseline; }
.g-wp-steps li.is-done { color: var(--ink-3); text-decoration: line-through; }
.g-wp-steps li span { width: 16px; flex: none; color: var(--good, var(--accent-ink)); font-weight: 800; }
.g-wp-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.g-wp-acts button { min-height: 44px; flex: 1 1 140px; }

/* ---------- Printable puzzle sheets (src/features/print.js): only on paper, black on white ---------- */

.g-pr-open-wrap { margin: 16px 0 4px; text-align: center; }
.g-pr-open { min-height: 44px; }
#g-print { display: none; }
@media print {
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; background: Canvas !important; color-scheme: light; }
  body::before, body::after { display: none !important; }
  body > *:not(#g-print) { display: none !important; }
  #g-print { display: block; color-scheme: light; background: Canvas; color: CanvasText; font: 11pt/1.3 var(--font-ui, sans-serif); }
  #g-print header h1 { margin: 0; font: 800 20pt/1.1 var(--font-display, sans-serif); }
  #g-print header p { margin: 2pt 0; }
  #g-print .g-pr-name { margin-top: 6pt; }
  #g-print .g-pr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10pt 10pt; margin: 10pt 0; }
  #g-print .g-pr-cell { margin: 0; break-inside: avoid; }
  #g-print .g-pr-board { width: 100%; display: block; }
  #g-print .g-pr-light { fill: Canvas; }
  #g-print .g-pr-dark rect { fill: CanvasText; fill-opacity: .22; }
  #g-print .g-pr-edge { fill: none; stroke: CanvasText; stroke-width: .03; }
  #g-print .g-pr-lab text { font-size: .32px; fill: CanvasText; }
  #g-print figcaption { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6pt; margin-top: 3pt; }
  #g-print figcaption b { font-size: 13pt; }
  #g-print .g-qr { width: 40pt; height: 40pt; }
  #g-print figcaption span { font-size: 9pt; }
  #g-print footer { break-inside: avoid; }
  #g-print .g-pr-answers { transform: rotate(180deg); font-size: 9pt; margin-top: 8pt; }
  @page { margin: 12mm; }
}

/* ---------- Turning points (src/features/turning.js) ---------- */

.g-tp-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.g-tp-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 20px; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 12px 8px 8px; border: 0; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-tp-row:hover { background: var(--surface-2); }
.g-tp-year { width: 56px; height: 44px; border-radius: var(--rad-3); display: grid; place-items: center; background: rgb(var(--gold-rgb)/.16); color: var(--gold); font: 800 18px / 1 var(--font-display); }
.g-tp-text { display: grid; gap: 2px; min-width: 0; }
.g-tp-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-tp-mark { color: var(--good, var(--accent)); font-weight: 800; }
.g-tp-meta { margin: 0 0 8px; color: var(--ink-3); font-size: var(--fs-2); }
.g-tp-story { margin: 0 0 12px; color: var(--ink); line-height: 1.5; }
.g-tp-note { margin: 4px 2px 0; color: var(--ink-3); font-size: var(--fs-2); }
.g-rw-btn { display: block; margin: 2px 0 8px auto; min-height: 44px; }

/* ---------- Coach's letter (src/features/letter.js) ---------- */

.g-letter { margin: 12px 0; }
.g-lt-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px 8px 8px; border: 0; border-radius: var(--rad-4); background: linear-gradient(120deg, rgb(var(--accent-rgb)/.16), transparent 70%), var(--surface); color: var(--ink); text-align: left; font: inherit; }
.g-lt-card.is-read { background: var(--surface); }
.g-lt-card:hover { background: var(--surface-2); }
.g-lt-ico { width: 48px; height: 48px; border-radius: var(--rad-3); display: grid; place-items: center; background: var(--raised); color: var(--accent); }
.g-lt-text { display: grid; gap: 2px; min-width: 0; }
.g-lt-text span { font-size: var(--fs-2); color: var(--ink-2); }
.g-lt p { margin: 0 0 10px; line-height: 1.5; }
.g-lt .g-duel-acts { margin: -4px 0 12px; }
.g-lt-sign { font-style: italic; color: var(--ink-2); }

/* ---------- Calm mode (src/features/calm.js): no numbers that pressure ---------- */

.g-calm #atl-chip, .g-calm .hh-streak, .g-calm .home-sec.nums, .g-calm .pz-rating, .g-calm .pz-tiles,
.g-calm .gp-pf-stats, .g-calm .pg-card, .g-calm .g-ladder, .g-calm .g-ms-pay, .g-calm .g-ms-bonus,
.g-calm .result-rating, .g-calm .atl-result-earn, .g-calm .gp-est, .g-calm .pz-delta, .g-calm .pbar-elo, .g-calm .g-tp-note, .g-calm .g-wp-pay, .g-calm .g-st-rating { display: none !important; }

/* ---------- Openings atlas (src/features/atlas.js) ---------- */

.g-atlas { margin: 12px 0; }
.g-at h3 { margin: 14px 0 6px; font-size: var(--fs-3, 15px); }
.g-at-focus { padding: 12px 14px; border-radius: var(--rad-4); background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); margin: 0 0 8px; }
.g-at-focus p { margin: 0 0 6px; }
.g-at-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.g-at-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "m n star" "bar bar bar"; align-items: center; gap: 2px 10px; padding: 6px 10px 6px calc(10px + var(--d, 0) * 10px); border-radius: var(--rad-3); background: var(--surface); }
.g-at-moves { grid-area: m; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.g-at-n { grid-area: n; color: var(--ink-2); font-size: var(--fs-2); }
.g-at-bar { grid-area: bar; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.g-at-bar i { display: block; height: 100%; background: var(--accent); }
.g-at-empty { color: var(--ink-3); margin: 0; }
.g-pc-wrap { margin: 12px 0 0; text-align: center; }
.g-pc-btn { min-height: 44px; }
/* Blindfold (src/features/blind.js): invisible, still tappable and draggable */
.g-blind-on #board .piece-layer { opacity: 0; }

/* ---------- Your chess character (src/features/character.js) ---------- */

.g-character { margin: 12px 0; }
.g-ch-big { margin: 0 0 4px; font: 800 36px / 1.05 var(--font-display); color: var(--accent); }
.g-ch-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.g-ch-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name n" "bar bar"; gap: 4px 10px; padding: 8px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-ch-name { grid-area: name; display: grid; gap: 1px; min-width: 0; }
.g-ch-name span { font-size: var(--fs-2); color: var(--ink-2); }
.g-ch-n { grid-area: n; font-weight: 700; }
.g-ch-list .g-at-bar { grid-area: bar; height: 6px; }

/* ---------- Living boards (src/features/alive.js): one overlay, opacity and transform only ---------- */

.g-alive { position: absolute; inset: 0; pointer-events: none; z-index: 6; opacity: 0; border-radius: inherit; }
.g-alive.is-check { box-shadow: inset 0 0 0 4px rgb(var(--board-check-rgb)), inset 0 0 40px rgb(var(--board-check-rgb)/.5); animation: g-alive-pulse .6s ease-out; }
.g-alive.is-wow { box-shadow: inset 0 0 0 4px rgb(var(--gold-rgb)), inset 0 0 60px rgb(var(--gold-rgb)/.45); animation: g-alive-pulse .8s ease-out; }
.g-alive.is-mate { background: rgb(var(--shade-rgb)/.55); animation: g-alive-dim 1.4s ease-out; }
@keyframes g-alive-pulse { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes g-alive-dim { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .g-alive { display: none; } }

/* ---------- Club night (src/features/club.js) ---------- */

.g-cl-names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.g-cl-table { margin: 0 0 12px; }
.g-cl-next { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-cl-next span { color: var(--ink-2); }
.g-ch-note { margin: 4px 2px 0; color: var(--ink-3); font-size: var(--fs-2); }

/* ---------- Game archive (src/features/archive.js) ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.g-archive { margin: 12px 0; }
.g-ar { display: grid; gap: 10px; align-content: start; grid-auto-rows: max-content; }
.g-ar > * { flex-shrink: 0; min-height: min-content; }
.g-ar-search input { width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--rad-pill); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.g-ar-search input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.g-ar-chips { flex: none; min-height: 42px; display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.g-ar-chips::-webkit-scrollbar { display: none; }
.g-ar-sel { flex: none; position: relative; display: inline-flex; align-items: center; min-height: 36px; border: 1px solid var(--line); border-radius: var(--rad-pill); background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--fs-2); }
.g-ar-sel select { appearance: none; -webkit-appearance: none; min-height: 36px; padding: 0 28px 0 12px; border: 0; border-radius: inherit; background: transparent; color: inherit; font: inherit; }
.g-ar-sel::after { content: "▾"; position: absolute; right: 11px; pointer-events: none; font-size: 11px; }
.g-ar-sel:focus-within { box-shadow: var(--focus-ring); }
.g-ar-sel.is-set { border-color: var(--accent); color: var(--ink); background: rgb(var(--accent-rgb)/.14); }
.g-ar-favf { padding: 0 12px; }
.g-ar-favf::after { content: none; }
.g-ar-count { margin: 0; color: var(--ink-3); font-size: var(--fs-2); }
.g-ar-count .link { margin-left: 6px; }
.g-ar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-ar-item { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: stretch; border-radius: var(--rad-3); background: var(--surface); }
.g-ar-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0 10px 10px; border: 0; background: none; color: var(--ink); text-align: left; font: inherit; border-radius: var(--rad-3) 0 0 var(--rad-3); }
.g-ar-row:hover { background: var(--surface-2); }
.g-ar-row .gl-res { margin-top: 2px; }
.g-ar-txt { display: grid; gap: 2px; min-width: 0; }
.g-ar-txt b .tnum { color: var(--ink-3); font-weight: 600; }
.g-ar-op { color: var(--ink-2); font-size: var(--fs-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-ar-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--ink-3); font-size: var(--fs-1); }
.g-ar-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.g-ar-tags i { font-style: normal; font-size: var(--fs-1); padding: 1px 8px; border-radius: var(--rad-pill); background: var(--raised); color: var(--ink-2); }
.g-ar-star { border: 0; background: none; color: var(--ink-3); font-size: 22px; border-radius: 0 var(--rad-3) var(--rad-3) 0; }
.g-ar-star.is-on { color: var(--gold); }
.g-ar-star:hover { background: var(--surface-2); }
.g-ar-none { margin: 8px 2px; }
.g-ar-foot { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.g-ar-foot .btn-soft { flex: 1 1 140px; }
.g-ar-back { justify-self: start; }
.g-ar-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; }
.g-ar-facts div { padding: 8px 12px; border-radius: var(--rad-3); background: var(--surface); min-width: 0; }
.g-ar-facts dt { color: var(--ink-3); font-size: var(--fs-1); }
.g-ar-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.g-ar-box { display: grid; gap: 8px; padding: 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-ar-box h3 { margin: 0; font-size: var(--fs-3); }
.g-ar-box .g-duel-acts { margin: 0; }
.g-ar-taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.g-ar-tag { display: inline-flex; align-items: center; gap: 2px; padding-left: 10px; border-radius: var(--rad-pill); background: var(--raised); color: var(--ink); font-size: var(--fs-2); }
.g-ar-tag button { min-width: 32px; min-height: 32px; border: 0; background: none; color: var(--ink-3); font-size: 18px; border-radius: var(--rad-pill); }
.g-ar-addtag { display: flex; gap: 8px; }
.g-ar-addtag input, .g-ar-box textarea, .g-ar-imp textarea { flex: 1; min-width: 0; box-sizing: border-box; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--rad-2); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; }
.g-ar-box textarea, .g-ar-imp textarea { width: 100%; resize: vertical; }
.g-ar-imp textarea { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.g-ar-saved { margin: 0; min-height: 1em; }
.g-ar-danger { display: flex; justify-content: center; padding: 4px 0 8px; }
.g-ar-del { color: var(--err); }
.g-ar-del.is-armed { background: var(--err); color: var(--on-err); }

/* ---------- Stats (src/features/stats.js) ---------- */

.g-stats { margin: -4px 0 12px; }
.g-st { display: grid; gap: 12px; align-content: start; grid-auto-rows: max-content; }
.g-st-sec { display: grid; gap: 8px; padding: 12px; border-radius: var(--rad-3); background: var(--surface); min-width: 0; }
.g-st-sec h3 { margin: 0; font-size: var(--fs-3); }
.g-st-sec .link { justify-self: start; }
.g-st-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.g-st-tile { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--rad-2); background: var(--raised); min-width: 0; }
.g-st-tile b { font: 800 22px / 1.1 var(--font-display); color: var(--ink); }
.g-st-tile span { font-size: var(--fs-2); color: var(--ink-2); }
.g-st-tile em { font-style: normal; font-size: var(--fs-1); color: var(--ink-3); }
.g-st-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.g-st-tabs button { flex: none; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--rad-pill); background: none; color: var(--ink-2); font: inherit; font-size: var(--fs-2); }
.g-st-tabs button.is-on { border-color: var(--accent); background: rgb(var(--accent-rgb)/.14); color: var(--ink); }
.g-st-chart { margin: 0; }
.g-st-chart svg { display: block; width: 100%; height: 120px; }
.g-st-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.g-st-area { fill: rgb(var(--accent-rgb)/.14); stroke: none; }
.g-st-peak { fill: var(--gold); }
.g-st-axis { display: flex; justify-content: space-between; margin-top: 4px; color: var(--ink-3); font-size: var(--fs-1); }
.g-st-wdl { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-st-wdl li { display: grid; grid-template-columns: 80px minmax(0, 1fr) 58px; align-items: center; gap: 8px; font-size: var(--fs-2); }
.g-st-wdl-k { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-st-wdl-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.g-st-wdl-bar i, .g-st-legend span::before { display: block; }
.g-st-wdl-bar .w, .g-st-legend .w::before { background: var(--ok); }
.g-st-wdl-bar .d, .g-st-legend .d::before { background: var(--ink-disabled); }
.g-st-wdl-bar .l, .g-st-legend .l::before { background: var(--err); }
.g-st-wdl-n { color: var(--ink-3); text-align: right; }
.g-st-legend { display: flex; gap: 14px; margin: 0; color: var(--ink-3); }
.g-st-legend span { display: inline-flex; align-items: center; gap: 5px; }
.g-st-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.g-st-heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; max-width: 420px; }
.g-st-heat i { aspect-ratio: 1; border-radius: 2px; background: var(--surface-2); }
.g-st-heat .l1 { background: rgb(var(--accent-rgb)/.55); }
.g-st-heat .l2 { background: rgb(var(--accent-rgb)/.8); }
.g-st-heat .l3 { background: var(--accent); }
.g-st-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; color: var(--ink-2); }
.g-st-ops { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g-st-ops li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n s" "bar bar"; gap: 3px 10px; font-size: var(--fs-2); }
.g-st-op-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-st-ops .tnum { color: var(--ink-3); }
.g-st-recs { display: grid; gap: 6px; margin: 0; }
.g-st-recs div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.g-st-recs div:last-child { border-bottom: 0; }
.g-st-recs dt { color: var(--ink-2); font-size: var(--fs-2); }
.g-st-recs dd { margin: 0; text-align: right; display: grid; }
.g-st-recs dd em { font-style: normal; color: var(--ink-3); font-size: var(--fs-1); }
.g-st-ops .g-st-op-n { grid-area: n; }
.g-st-ops .tnum { grid-area: s; }

/* ---------- Account tab (src/features/account.js) ---------- */

.g-acc { display: grid; gap: 12px; }
.g-acc-sec { display: grid; gap: 8px; padding: 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-acc-sec h3 { margin: 0; font-size: var(--fs-3); }
.g-acc-sec p { margin: 0; }
.g-acc-me { display: flex; align-items: center; gap: 12px; }
.g-acc-me > span:last-child { display: grid; gap: 2px; min-width: 0; }
.g-acc-me em { font-style: normal; font-size: var(--fs-2); color: var(--ink-2); }
.g-acc-av { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--raised); font-size: 24px; }
.g-acc-av img { width: 100%; height: 100%; object-fit: cover; }
.g-acc-row { display: flex; flex-wrap: wrap; gap: 8px; }
.g-acc textarea, .g-acc input[type=text], .g-acc input[type=time] { box-sizing: border-box; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--rad-2); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; resize: vertical; }
.g-acc input[type=time] { width: auto; min-width: 140px; }
.g-acc-count { justify-self: end; color: var(--ink-3); font-size: var(--fs-1); }
.g-acc .field { display: grid; gap: 4px; }
.g-acc-goals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.g-acc-goals button { display: grid; gap: 2px; min-height: 52px; padding: 6px 10px; text-align: left; }
.g-acc-goals button span { font-size: var(--fs-1); opacity: .8; }
.g-acc-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--ink-2); font-size: var(--fs-2); }
.g-acc-sec .link { justify-self: start; }
.g-acc-danger { border: 1px solid rgb(var(--err-rgb)/.4); }
.g-acc-wipe { color: var(--err); justify-self: start; }
.g-acc-wipe:disabled { opacity: .5; }
.g-acc-confirm { display: grid; gap: 8px; }
.g-acc-bio { margin: 4px 0 0; color: var(--ink-2); font-size: var(--fs-2); overflow-wrap: anywhere; }
/* five Settings tabs: never cut a label; when they do not fit one row (320 px, Bulgarian,
   text zoom) the row wraps instead of hiding a tab off the edge */
#sheet .set-tabs { flex-wrap: wrap; row-gap: 2px; }
#sheet .set-tabs button { flex: 1 1 auto; min-width: 44px; padding-inline: 10px; white-space: normal; overflow-wrap: break-word; }
@media (max-width: 379px) { #sheet .set-tabs button { padding-inline: 4px; } }

/* Settings rows (and every sheet's lists) never shrink, clip or overlap. The sheet body is a
   height-capped flex column: a .group (overflow: hidden) used to shrink with it, so on a
   phone the Play group showed two of its rows and hid "Always promote to a queen". */
.sheet-body > * { flex-shrink: 0; }
.sheet-body > .group, .group { flex-shrink: 0; }
.sheet-body { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.toggle { min-height: 44px; min-width: 0; }
.toggle > .tg { flex: none; }
.toggle > .tg-text { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.set-section, .set-section > *, .group > * { min-width: 0; }
.set-section > h3, .field-note { overflow-wrap: break-word; }
/* editor status is text: the state colours (4.5:1 on every surface in all 20 themes), not the 3:1 grade dots */
.ed-status { color: var(--ok); }
.ed-status.bad { color: var(--err); }
/* the piece preview shrinks with its sheet (text zoom, narrow phones) instead of running off it */
#sheet .pset-live { width: 100%; max-width: calc(var(--sqs) * 6); grid-template-columns: repeat(6, minmax(0, 1fr)); }
#sheet .pset-live .sq { width: auto; height: auto; aspect-ratio: 1; min-width: 0; }
/* theme names wrap rather than end in "…" (Midnight Sapphire, Imperial Emerald, Bulgarian names) */
.g-theme-name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; hyphens: auto; }

/* ---------- Confirm moves (src/features/gameopts.js) ---------- */

.g-confirm { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: flex; align-items: center; gap: 8px; margin: 0 auto; max-width: 480px; padding: 8px 8px 8px 16px; border-radius: var(--rad-4); background: var(--raised); box-shadow: var(--shadow-3); border: 1px solid var(--line-strong); }
.g-confirm span { flex: 1; min-width: 0; color: var(--ink-2); font-size: var(--fs-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-confirm .btn-primary, .g-confirm .btn-soft { flex: none; min-height: 44px; }
@media (min-width: 900px) { .g-confirm { bottom: 24px; } }

/* ---------- Friend codes (src/features/friends.js) ---------- */

.g-fr-code { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; border-radius: var(--rad-3); background: var(--raised); }
.g-fr-code > span:first-child { flex: 1 1 200px; display: grid; gap: 2px; min-width: 0; }
.g-fr-code em { font-style: normal; font-size: var(--fs-2); color: var(--ink-2); }
.g-fr-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.g-fr-add { display: flex; gap: 8px; margin-top: 10px; }
.g-fr-add input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--rad-2); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; }
.g-fr-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.g-fr-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--rad-3); background: var(--surface); }
.g-fr-av { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--raised); font-weight: 800; }
.g-fr-av img { width: 100%; height: 100%; object-fit: cover; }
.g-fr-txt { display: grid; gap: 2px; min-width: 0; }
.g-fr-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-fr-nums { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: var(--fs-1); color: var(--ink-2); }
.g-fr-nums i { font-style: normal; }
.g-fr-txt em { font-style: normal; font-size: var(--fs-1); color: var(--ink-3); }
.g-fr-acts { display: flex; align-items: center; gap: 2px; }
.g-fr-rm { font-size: 20px; color: var(--ink-3); }
.g-fr-rm.is-armed { color: var(--err); }
.g-calm .g-fr-nums .g-fr-r { display: none; }

/* ---------- Your week's plan (src/features/plan.js) ---------- */

.g-wplan .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.g-pl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-pl-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-pl-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); font-size: 13px; font-weight: 800; }
.g-pl-list li.is-done .g-pl-mark { border-color: var(--ok); background: var(--ok); color: var(--on-ok); }
.g-pl-txt { display: grid; gap: 4px; min-width: 0; }
.g-pl-txt b { font-size: var(--fs-3); overflow-wrap: anywhere; }
.g-pl-txt .g-at-bar { grid-area: auto; height: 6px; }
.g-pl-txt em { font-style: normal; font-size: var(--fs-1); color: var(--ink-3); }
.g-pl-list li.is-done .g-at-bar i { background: var(--ok); }
.g-pl-pay { margin: 8px 2px 0; }
/* QA25-6: names keep room at 320 px (the buttons move under them), the flag never disappears, a 44 px remove target */
.g-fr-txt b { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.g-fr-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-fr-txt b .gp-flag { flex: none; }
.g-fr-rm { min-width: 44px; min-height: 44px; }
@media (max-width: 460px) { .g-fr-row { grid-template-columns: 44px minmax(0, 1fr); } .g-fr-acts { grid-column: 2; justify-content: flex-start; gap: 6px; } }
/* Friend league (IDEAS #32) */
.g-fr-league { margin-top: 10px; padding: 12px; border-radius: var(--rad-3); background: var(--raised); }
.g-fr-league h4 { margin: 0 0 6px; font-size: var(--fs-3); }
.g-fr-league ol { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.g-fr-league li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; border-radius: var(--rad-2); }
.g-fr-league li.is-me { background: rgb(var(--accent-rgb)/.14); }
.g-fr-rank { color: var(--ink-3); font-weight: 800; }
.g-fr-lname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-fr-lname em { font-style: normal; color: var(--ink-3); font-size: var(--fs-1); }
.g-fr-league p { margin: 0; }
.g-fr-lg-none { margin: 10px 2px 0; }
.g-calm .g-fr-league, .g-calm .g-fr-lg-none { display: none; }
/* QA27-7: the "you" tag never hides behind a cut name */
.g-fr-lname { display: flex; align-items: baseline; gap: 6px; }
.g-fr-lname > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-fr-lname em { flex: none; }

/* ---------- Notes on moves (src/features/notes.js) ---------- */

.g-nt-text { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--accent); border-radius: 0 var(--rad-2) var(--rad-2) 0; background: rgb(var(--accent-rgb)/.08); color: var(--ink); font-size: var(--fs-2); overflow-wrap: anywhere; }
.g-nt { display: grid; gap: 8px; }
.g-nt textarea { box-sizing: border-box; width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--rad-2); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; resize: vertical; }
.g-nt-count { margin: 0; justify-self: end; color: var(--ink-3); font-size: var(--fs-1); }
.g-nt p { margin: 0; }

/* ---------- Endgame passport (src/features/passport.js) ---------- */

.g-passport { margin: -4px 0 12px; }
.g-pp { display: grid; gap: 10px; }
.g-pp-lead { margin: 0; color: var(--ink-2); }
.g-pp-bar { height: 6px; grid-area: auto; }
.g-pp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g-pp-item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-pp-stamp { width: 72px; height: 72px; border-radius: 50%; display: grid; place-content: center; text-align: center; gap: 2px; padding: 6px; box-sizing: border-box;
  border: 3px double var(--line-strong); color: var(--ink-3); transform: rotate(var(--tilt, 0deg)); font-size: 9px; line-height: 1.1; text-transform: uppercase; letter-spacing: .02em; }
.g-pp-stamp b { font-weight: 800; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.g-pp-stamp i { font-style: normal; font-size: 9px; }
.g-pp-item.is-stamped .g-pp-stamp { border-color: var(--accent); color: var(--accent); background: rgb(var(--accent-rgb)/.1); }
.g-pp-item:not(.is-stamped) .g-pp-stamp { opacity: .55; }
.g-pp-txt { display: grid; gap: 2px; min-width: 0; }
.g-pp-txt span { font-size: var(--fs-2); color: var(--ink-2); }
.g-pp-txt em { font-style: normal; font-size: var(--fs-1); color: var(--ink-3); }
.g-pp-item.is-stamped .g-pp-txt em { color: var(--ok); }
@media (max-width: 360px) { .g-pp-item { grid-template-columns: 64px minmax(0, 1fr); } .g-pp-stamp { width: 60px; height: 60px; font-size: 8px; } .g-pp-item .btn-soft { grid-column: 2; justify-self: start; } }

/* Time scramble (IDEAS #37) */
.g-sc-rules { margin: 0 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.g-sc-rules li + li { margin-top: 4px; }
.g-sc-count { margin: 0 0 10px; font-weight: 600; color: var(--ink); }
.g-sc-best { color: var(--good, var(--accent)); font-weight: 600; }
.g-sc-row.is-done { box-shadow: inset 0 0 0 1px var(--line-2), inset 3px 0 0 var(--good, var(--accent)); }
.start-tile[data-g-scramble] .st-glyph { font-size: 22px; font-style: normal; letter-spacing: -0.02em; }

/* QA38-4: Undo during a time scramble: looks off, still tappable so it can say why */
#toolbar .g-sc-off { opacity: .45; }

/* ---------- profile banners (IDEAS #40) ---------- */
.gp-pf-banner.g-bn-custom { position: relative; background: var(--bg-deep); }
.g-bn-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.g-bn-edit { position: absolute; top: 8px; right: 8px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--rad-pill); background: rgb(var(--bg-deep-rgb) / .62); color: var(--ink); font: 700 13px/1 var(--font-ui, inherit); cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.g-bn-edit .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.g-bn-edit:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.g-bn-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.g-bn-tile { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 8px 10px; border: 0; border-radius: var(--rad-3); background: var(--raised); color: var(--ink); text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.g-bn-tile.is-on { background: rgb(var(--accent-rgb) / .12); box-shadow: inset 0 0 0 2px var(--accent); }
.g-bn-tile:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.g-bn-prev { display: block; width: 100%; aspect-ratio: 3 / 1; border-radius: var(--rad-2); background: var(--bg-deep); }
.g-bn-classic { background: linear-gradient(180deg, rgb(var(--bg-deep-rgb) / .1), rgb(var(--bg-deep-rgb) / .55)), url("../../art/hero.webp") 60% 55% / cover no-repeat, var(--bg-deep); }
.g-bn-tile.is-locked .g-bn-prev { filter: grayscale(.85) brightness(.55); }
.g-bn-name { font-size: 14px; line-height: 1.2; }
.g-bn-meta { font-size: 12px; line-height: 1.3; color: var(--ink-3); }
.g-bn-tile.is-on .g-bn-meta { color: var(--accent-ink); font-weight: 700; }

/* a long toast uses the screen width (the core's left: 50% shrink-to-fit kept it to half the screen) */
.toast { width: max-content; box-sizing: border-box; }

/* ---------- your lines (IDEAS #35) ---------- */
.g-at-star { grid-area: star; width: 44px; height: 44px; margin: -10px -8px -10px 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--rad-pill); background: none; color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer; }
.g-at-star.is-on { color: var(--gold); }
.g-at-star:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.g-my { margin: 4px 0 8px; padding: 10px 12px; border-radius: var(--rad-3); background: var(--surface); }
.g-my h3 { margin: 0 0 4px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.g-my p { margin: 0 0 8px; }
.g-my .g-duel-acts { margin: 0; }

/* ---------- mistake bingo (IDEAS #30) ---------- */
.g-bingo { margin: 12px 0 0; }
.g-bg-mini { display: grid; grid-template-columns: repeat(3, 8px); gap: 2px; width: auto; padding: 0; background: none; }
.g-bg-mini i { width: 8px; height: 8px; border-radius: 2px; background: var(--surface-3); }
.g-bg-mini i.on { background: var(--gold); }
.g-bg-grid { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.g-bg-cell { width: 100%; min-height: 84px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 6px; border: 0; border-radius: var(--rad-3); background: var(--raised); color: var(--ink); text-align: center; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.g-bg-cell b { font-size: 13px; line-height: 1.2; overflow-wrap: anywhere; }
.g-bg-sub { font-size: 11.5px; line-height: 1.25; color: var(--ink-3); }
.g-bg-cell.is-any { box-shadow: inset 0 0 0 1px var(--line-strong); }
.g-bg-cell.is-on { background: rgb(var(--gold-rgb) / .16); box-shadow: inset 0 0 0 2px var(--gold); }
.g-bg-cell.is-on .g-bg-sub { color: var(--ink-2); font-weight: 700; }
.g-bg-cell.in-line { background: rgb(var(--gold-rgb) / .28); }
.g-bg-cell[aria-disabled="true"] { opacity: .6; }
.g-bg-cell:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* ---------- weekend swiss (IDEAS #36) ---------- */
.g-sw-when { margin: 0 0 10px; }
.g-sw-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; }
.g-sw-table th, .g-sw-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line-2); font-weight: 600; }
.g-sw-table thead th { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.g-sw-table td:first-child { width: 2.2em; color: var(--ink-2); }
.g-sw-table td:last-child, .g-sw-table thead th:last-child { text-align: right; width: 4em; }
.g-sw-table tr.is-me th, .g-sw-table tr.is-me td { color: var(--accent-ink); background: rgb(var(--accent-rgb) / .1); }
.g-my h3:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--rad-1); }
.g-my-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.g-my-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l rm" "s rm"; align-items: center; gap: 0 8px; padding: 4px 4px 4px 10px; border-radius: var(--rad-2); background: var(--raised); }
.g-my-line { grid-area: l; font-weight: 600; overflow-wrap: anywhere; }
.g-my-side { grid-area: s; }
.g-my-rm { grid-area: rm; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--rad-pill); background: none; color: var(--ink-2); font-size: 22px; line-height: 1; cursor: pointer; }
.g-my-rm:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.g-bg-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; padding: 4px 4px 4px 12px; border-radius: var(--rad-3); background: rgb(var(--gold-rgb) / .14); box-shadow: inset 0 0 0 1px rgb(var(--gold-rgb) / .5); font-weight: 700; font-size: 14px; }
.g-bg-chip .btn-ghost { min-height: 44px; min-width: 44px; }

/* ---------- guess the master's move (IDEAS #38) ---------- */
html.g-guess #evalbar { visibility: hidden; }
.g-masters { margin: 12px 0 0; }
.g-mst-score { font-weight: 700; }
/* QA51-1: move grades in the move list are hidden while you guess */
html.g-guess .ms-mv[class*="c-"], html.g-guess #moves .mv[class*="c-"] { color: inherit !important; }
html.g-guess .cbadge { display: none !important; }

/* ---------- odds games (IDEAS #44) ---------- */
.g-od-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.g-od-kind { min-height: 44px; padding: 6px 4px; border: 0; border-radius: var(--rad-3); background: var(--raised); color: var(--ink); font: 700 13px/1.2 inherit; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.g-od-kind.is-on { background: rgb(var(--accent-rgb) / .14); box-shadow: inset 0 0 0 2px var(--accent); }
.g-od-kind:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.g-od-sug { color: var(--accent-ink); }

/* ---------- bot arena (IDEAS #43) ---------- */
.g-ar-fire { color: var(--streak); font-weight: 800; }
.g-ar-games { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; }
.g-ar-games li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--rad-2); background: var(--raised); font-weight: 600; }

/* ---------- on this day (IDEAS #46) ---------- */
.g-otd { position: relative; margin: 12px 0 0; }
.g-otd-main { width: 100%; display: grid; gap: 4px; padding: 12px 52px 12px 14px; border: 0; border-radius: var(--rad-4); background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.g-otd-main:focus-visible, .g-otd-x:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.g-otd-k { font: 800 12px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.g-otd-main b { font-size: 15px; line-height: 1.3; }
.g-otd-acc { font-size: 13px; color: var(--ink-2); }
.g-otd-go { font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.g-otd-x { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--rad-pill); background: none; color: var(--ink-3); font-size: 22px; cursor: pointer; }

/* ---------- touch targets on every touch screen size (owner, 2026-12-01; tools/e2e/responsive.cjs) ---------- */
/* Phones, landscape phones and tablets: every control the finger uses has a 44 × 44 px touch area. */
@media (pointer: coarse) {
  .coach-toggle, .rv-top .icon-btn { min-width: 44px; min-height: 44px; }
  .tool-group.nav .tool, .tabs [role="tab"] { min-height: 44px; }
  #engine-chip.engine-chip.ok { position: relative; margin-inline: 18px; }   /* its 44 px area clears the chips beside it */
  /* the top bar's Install button (shown only when the browser offers installing): a 44 px area around its 36 px face */
  #gp-install.gp-install-btn { position: relative; margin-inline: 13px; }
  #gp-install.gp-install-btn::after { content: ""; position: absolute; inset: -4px -13px; }
  #engine-chip.engine-chip.ok::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
}
/* On a phone the top bar has no room for it next to the profile button: phones install from Home's install card and
   the install ask after a value moment (src/features/installNudge.js), so the top-bar button is left out there. */
@media (pointer: coarse) and (max-width: 480px) {
  #gp-install.gp-install-btn { display: none !important; }
}
