/* =========================================================================
   qbTrainer: "The Buzzer Station"
   A competition control-desk identity: deep navy room, warm buzzer-lamp
   amber as the throughline, lockout-style teal (correct) / red (buzzed),
   electric indigo for legendary. Space Grotesk + Inter + JetBrains Mono.
   ========================================================================= */

:root {
  /* surfaces (light "exam room") */
  --bg: #E7ECF4;
  --bg-glow: #f7e9cf;
  --surface: #ffffff;
  --surface-2: #f1f5fb;
  --line: #d3dbe9;
  --ink: #141a2e;
  --ink-soft: #5b6580;

  /* signal palette */
  --buzz: #E8970C;          /* the lamp */
  --buzz-deep: #b06f00;
  --buzz-tint: #fcefd6;
  --signal: #0bab97;        /* correct */
  --signal-tint: #d8f3ef;
  --alarm: #e0454b;         /* buzzed / wrong */
  --alarm-tint: #fadddf;
  --violet: #6354ec;        /* legendary / accent */

  --font-logo: "Raleway", "Bebas Neue", "Space Grotesk", system-ui, sans-serif;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --r-sm: 9px;
  --r: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(20,26,46,.06), 0 2px 8px rgba(20,26,46,.05);
  --sh-2: 0 6px 22px rgba(20,26,46,.10);
  --sh-3: 0 18px 50px rgba(20,26,46,.16);
  --lamp-glow: 0 0 0 4px rgba(232,151,12,.18), 0 8px 30px rgba(232,151,12,.35);
}

body.dark {
  --bg: #0a0c18;
  --bg-glow: #1b2138;
  --surface: #141a30;
  --surface-2: #1b2238;
  --line: #2a3252;
  --ink: #e9edfa;
  --ink-soft: #98a2c2;

  --buzz: #ffb633;
  --buzz-deep: #ffca6b;
  --buzz-tint: #2a2410;
  --signal: #22d3bc;
  --signal-tint: #0e2d2c;
  --alarm: #ff5e66;
  --alarm-tint: #321820;
  --violet: #9384ff;

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 8px 26px rgba(0,0,0,.45);
  --sh-3: 0 22px 60px rgba(0,0,0,.6);
  --lamp-glow: 0 0 0 4px rgba(255,182,51,.16), 0 8px 36px rgba(255,182,51,.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 78px 20px 60px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s, color .4s;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
.readout { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------------- top bar ---------------- */
/* Three tracks so the tab pair sits dead-centre in the bar regardless of how
   wide the brand and the tool buttons are. */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-logo); font-weight: 900; font-size: 1.4rem; letter-spacing: .06em; }
.brand__lamp {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd98a, var(--buzz));
  box-shadow: 0 0 10px var(--buzz);
}
.topbar__actions { display: flex; gap: 8px; justify-self: end; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.05rem; cursor: pointer; transition: transform .12s, background .2s, border-color .2s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--buzz); }

/* Daily TRAIN streak (item 20/3.0) -- shared topbar chrome, visible on both
   tabs, so it deliberately uses the SAME theme tokens as the rest of the
   topbar rather than Train's fixed-dark tokens. Plain, no glow -- it's
   numeric content, not one of the 3 named glow surfaces. */
.streak-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 40px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: var(--font-mono); font-weight: 600; font-size: .95rem;
}

/* ---------------- top-level tabs (centre of the top bar) ---------------- */
.tabbar {
  display: flex; gap: 4px;
  padding: 4px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.tab {
  font-family: var(--font-display); font-weight: 700; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .18em; text-indent: .18em;
  padding: 8px 22px; border-radius: var(--r-pill); cursor: pointer;
  border: 0; background: transparent; color: var(--ink-soft);
  transition: color .2s, background .25s, box-shadow .25s;
}
.tab:hover { color: var(--ink); }
.tab.is-on { background: var(--buzz); color: #20180a; box-shadow: var(--lamp-glow); }

.pane { display: none; }
.pane.is-active { display: block; }

/* =========================================================================
   TRAIN (3.0) -- a single-color halation identity, isolated from Play.

   --glow-color is the ONE accent used everywhere the glow effect appears:
   the TRAIN tab label, the Drill button, the performance graph's line, and
   (at reduced intensity) a selected mode toggle. It lives at :root only
   because a CSS variable has to be declared somewhere its consumers (the
   tab label, outside #paneTrain) can see it; no rule anywhere in Play reads
   it, so picking it here changes nothing about Play's rendering. Everything
   else Train-specific (background, ink, line colors) is scoped inside
   #paneTrain and never touches --bg/--ink/body.dark, so Play's light/dark
   toggle is unaffected by this section and vice versa.
   ========================================================================= */
:root {
  --glow-color: #4fd1ff;
  --train-max-width: 1180px;
}

/* TRAIN tab label. Black background only while it's the active tab.
   No blur/glow at rest OR on hover (3.0.29, items 2/3) -- the only glow left
   on this pill is an outer-border glow while selected, drawn with an INSET
   box-shadow rather than a real `border` property so the pill's own box
   never grows by the glow's width (item 10: the topbar must never resize).
   More specific than .tab / .tab.is-on, so neither general rule (which
   Play's tab still uses) is touched. */
.tab[data-tab="train"].is-on {
  background: #0a0a0f; color: #ffffff;
  box-shadow:
    inset 0 0 0 1.5px rgba(255,255,255,.85),
    0 0 8px var(--glow-color),
    0 0 16px color-mix(in srgb, var(--glow-color) 40%, transparent);
}
/* The global focus ring is violet; inside/on Train it reads off-white instead (item 12). */
.tab[data-tab="train"]:focus-visible { outline-color: var(--train-ink-soft, #9a9aa6); }

#paneTrain {
  /* Train's own fixed-dark identity, deliberately not var(--bg)/var(--ink)/
     body.dark -- this pane looks the same in light or dark mode. */
  --train-bg: #0a0a0f;
  --train-surface: #14141b;
  --train-line: #26262f;
  --train-ink: #e9e9ee;        /* soft off-white -- body text, tables, counts. Never glows. */
  --train-ink-soft: #9a9aa6;

  /* Bleed out of body's topbar-clearing padding so this reads as a real
     black canvas under the (blurred) topbar, not a card on the usual page. */
  margin: -78px -20px -60px;
  padding: 98px 20px 60px;
  min-height: 100vh;
  background: var(--train-bg);
  color: var(--train-ink);
}
/* The global focus ring is violet everywhere else; off-white inside Train (item 12). */
#paneTrain :focus-visible { outline-color: var(--train-ink-soft); }

/* Same entrance as Play's own screens on load (.screen.is-active, reusing
   its "fade" keyframes) -- scoped to #paneTrain specifically, not the
   shared .pane.is-active rule, so Play's own tab-switching stays exactly
   as it was: unanimated, byte-for-byte. */
#paneTrain.is-active { animation: fade .35s ease; }

.train-hero { text-align: center; max-width: var(--train-max-width); margin: 0 auto 6px; }
/* Mirrors Play's .eyebrow exactly (same font/size/letter-spacing/margin) --
   white instead of amber, since Train never uses Play's accent (item 11). */
.train-eyebrow {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .26em;
  font-size: .72rem; color: #ffffff; margin: 0 0 12px;
}
.train-hero__title {
  font-family: var(--font-logo); font-weight: 900; font-size: clamp(2.7rem, 6.6vw, 4.4rem);
  letter-spacing: .04em; line-height: 1; margin: 0; color: #eafcff;
  text-shadow:
    0 0 6px rgba(255,255,255,.9),
    0 0 20px var(--glow-color),
    0 0 44px color-mix(in srgb, var(--glow-color) 55%, transparent);
}

/* Whiter and much bigger (item 1, 3.0.29) than the original small gray label. */
.train-section-label {
  max-width: var(--train-max-width); margin: 34px auto 16px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.7rem;
  color: var(--train-ink);
}

.train-drill-note { color: var(--train-ink-soft); font-size: .82rem; margin: 12px auto 0; max-width: 440px; line-height: 1.5; text-align: center; }

/* Shown when statsReady times out (dashboard.js) instead of leaving the
   dashboard blank indefinitely. Fixed red rather than --alarm, which tracks
   the light/dark toggle Train otherwise ignores. */
.train-error {
  max-width: var(--train-max-width); margin: 0 auto 16px; padding: 12px 16px;
  border: 1px solid #ff5e66; border-radius: var(--r); background: #321820;
  color: var(--train-ink); font-weight: 500; text-align: center;
}

/* Drill button. Text-shadow only, same recipe as the tab label; the
   border/background stay plain train-surface tones, not tinted with
   --glow-color, so the glow stays confined to the label text. */
.train-drill-btn {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: .03em;
  padding: 14px 34px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--train-line);
  background: var(--train-surface);
  color: #eafcff;
  text-shadow:
    0 0 6px rgba(255,255,255,.9),
    0 0 20px var(--glow-color),
    0 0 44px color-mix(in srgb, var(--glow-color) 55%, transparent);
  transition: transform .15s, border-color .2s;
}
/* Hover adds a border glow (item 9, 3.0.29) via box-shadow -- never changes
   the button's own box (box-shadow paints outside layout, unlike a real
   border-width change), so this can't violate item 4's "never resize" rule. */
.train-drill-btn:hover {
  transform: translateY(-1px); border-color: var(--train-ink-soft);
  box-shadow: 0 0 10px var(--glow-color), 0 0 22px color-mix(in srgb, var(--glow-color) 45%, transparent);
}
.train-drill-btn:disabled { opacity: .5; cursor: not-allowed; text-shadow: none; box-shadow: none; }
/* Centered, outside every card, at the very bottom, much larger (item 4). */
.train-drill-btn--hero {
  display: block; margin: 36px auto 0;
  font-size: 1.4rem; padding: 22px 60px;
}

.train-card {
  background: var(--train-surface); border: 1px solid var(--train-line); border-radius: var(--r-lg);
  padding: 22px; display: flex; flex-direction: column;
}
.train-card__title { text-align: center; font-size: 1.05rem; font-weight: 600; color: var(--train-ink); margin: 0 0 16px; }
.train-card--wide { max-width: var(--train-max-width); margin: 0 auto 0; }

/* Heatmap card only (item 5, 3.0.35): title left, its Stat dropdown right,
   sharing one row instead of the other card's plain centered title. */
.train-card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.train-card__title--left { text-align: left; margin: 0; }

/* The graph fills whatever's left of its card's height (item 5, 3.0.29) --
   min-height: 0 is what lets a flex child shrink/grow past its content's
   own intrinsic size instead of being clamped by it. */
.train-graph { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* The 2 side-by-side dashboard cards: same width, stretched so their
   bottoms land on the same line, with the page-edge margin equal to the
   gap between them (item 1, 11). */
.train-columns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  max-width: var(--train-max-width); margin: 0 auto 20px; align-items: stretch;
}

/* ---- performance heatmap ---- */
.train-grid-scroll { overflow-x: auto; }
.train-grid {
  display: grid; grid-template-columns: 118px repeat(4, minmax(52px, 1fr)); gap: 2px;
  min-width: 440px;
}
.train-grid__col-head, .train-grid__row-head {
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .03em;
  color: var(--train-ink-soft); display: flex; align-items: center; padding: 0 6px; height: 22px;
}
.train-grid__col-head { justify-content: center; text-transform: uppercase; }
.train-cell {
  position: relative; height: 24px; border-radius: 4px;
  display: flex; align-items: center; justify-content: flex-end; padding: 0 6px;
}
.train-cell--nodata { background: var(--train-line); opacity: .55; }
.train-cell__count { font-family: var(--font-mono); font-size: .64rem; color: rgba(255,255,255,.75); }

.train-legend { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; font-size: .72rem; color: var(--train-ink-soft); }
.train-legend__ramp { width: 80px; height: 9px; border-radius: var(--r-pill); background: linear-gradient(90deg, hsl(0,65%,40%), hsl(60,65%,40%), hsl(120,65%,40%)); }
.train-legend__nodata { width: 14px; height: 9px; border-radius: 3px; background: var(--train-line); opacity: .55; margin-left: 12px; }

/* ---- dropdown filters (categories/difficulty; item 3, 11) ---- */
.train-dropdown-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.train-dropdown { position: relative; }
.train-dropdown__toggle {
  display: flex; align-items: center; gap: 10px; justify-content: space-between; min-width: 190px;
  font-family: var(--font-body); font-size: .85rem; cursor: pointer;
  padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--train-line);
  background: var(--train-bg); color: var(--train-ink);
}
.train-dropdown__toggle:hover { border-color: var(--train-ink-soft); }
.train-dropdown__label { color: var(--train-ink-soft); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.train-dropdown__value { font-weight: 600; }
.train-dropdown__caret { color: var(--train-ink-soft); font-size: .7rem; }
.train-dropdown__panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  min-width: 230px; max-height: 280px; overflow-y: auto;
  background: var(--train-surface); border: 1px solid var(--train-line); border-radius: var(--r);
  padding: 8px; box-shadow: 0 14px 32px rgba(0,0,0,.55);
}
.train-dropdown.is-open .train-dropdown__panel { display: block; }
.train-dropdown__option { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 6px; font-size: .85rem; color: var(--train-ink); cursor: pointer; }
.train-dropdown__option:hover { background: var(--train-bg); }
.train-dropdown__option input { accent-color: var(--train-ink-soft); }

/* ---- performance graph ---- */
.train-graph__svg { width: 100%; height: 100%; flex: 1; min-height: 0; display: block; }
.train-graph__grid line { stroke: var(--train-line); stroke-width: 1; }
.train-graph__axislabel { fill: var(--train-ink); font-family: var(--font-mono); font-size: 10px; } /* off-white, always legible, even with no data (item 9) */

/* Graph line: smooth curve, off-white stroke and glow matching the "Train"
   hero heading's exact recipe (item 6, 3.0.35): the same #eafcff core color
   and the same 3 drop-shadow blur radii/layering as its text-shadow, via
   stacked drop-shadow filters -- the SVG analogue of a text-shadow. */
.train-graph__line {
  fill: none; stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round;
  stroke: #eafcff;
  filter:
    drop-shadow(0 0 6px rgba(255,255,255,.9))
    drop-shadow(0 0 20px var(--glow-color))
    drop-shadow(0 0 44px color-mix(in srgb, var(--glow-color) 55%, transparent));
}
.train-graph__dot {
  fill: #eafcff;
  stroke: var(--train-bg); stroke-width: 2px; /* surface ring, separates the dot from the line under it */
}
.train-graph__empty, .train-graph__note {
  color: var(--train-ink-soft); font-size: .85rem; text-align: center; margin: 10px 0 0; line-height: 1.5;
}

/* ---- session setup ---- */
.train-config__block { margin: 0 0 24px; }
.train-config__block:last-child { margin-bottom: 0; }
.train-config__label { font-size: .92rem; font-weight: 600; color: var(--train-ink); margin: 0 0 12px; text-align: left; }
.train-config__hint { font-size: .78rem; color: var(--train-ink-soft); margin: 8px 0 0; line-height: 1.5; }

/* Modes: always one row (item 11); a touch whiter + a reduced-intensity
   glow (vs. the Drill button's) when selected. */
.train-mode-toggles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.train-mode-toggle {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 11px 13px; border-radius: var(--r); border: 1px solid var(--train-line); background: var(--train-surface);
  transition: border-color .2s, background .2s;
}
.train-mode-toggle input { margin-top: 3px; accent-color: var(--train-ink-soft); }
.train-mode-toggle span { font-size: .82rem; color: var(--train-ink-soft); line-height: 1.4; }
.train-mode-toggle span b { color: var(--train-ink); font-weight: 600; }
/* Selected glow lives on the border, not the words (item 3, 3.0.35) -- an
   inset box-shadow, same "never resize the box" technique as the TRAIN tab
   pill's border glow, just at reduced intensity. */
.train-mode-toggle.is-on {
  border-color: var(--train-ink-soft); background: #1c1c25;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.6),
    0 0 6px var(--glow-color),
    0 0 12px color-mix(in srgb, var(--glow-color) 30%, transparent);
}
.train-mode-toggle.is-on span b { color: #ffffff; }

/* Stop-condition presets: rounded boxes like the mode toggles, single-
   select, with a "best for" description; a bit more visual weight than a
   plain chip when picked (item 11). */
.train-stop-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 6px; }
.train-preset {
  text-align: left; cursor: pointer; width: 100%;
  padding: 11px 13px; border-radius: var(--r); border: 1px solid var(--train-line); background: var(--train-surface);
  color: var(--train-ink-soft); transition: border-color .2s, background .2s, color .2s;
}
.train-preset__title { display: block; color: var(--train-ink); font-size: .85rem; font-weight: 600; margin-bottom: 3px; }
.train-preset__desc { display: block; font-size: .76rem; line-height: 1.4; }
/* Same border-glow recipe as a selected mode toggle (item 3, 3.0.35). */
.train-preset.is-on {
  border-color: #ffffff; background: #22222c; color: var(--train-ink);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.6),
    0 0 6px var(--glow-color),
    0 0 12px color-mix(in srgb, var(--glow-color) 30%, transparent);
}
.train-preset.is-on .train-preset__title { color: #ffffff; }

.train-stopbuilder { margin-top: 14px; display: flex; flex-direction: column; align-items: center; }
.train-stopbuilder__op { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: .85rem; color: var(--train-ink-soft); }
.train-stoprow {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px;
  padding: 8px; border-radius: var(--r-sm); background: var(--train-surface); border: 1px solid var(--train-line);
  flex-wrap: wrap; width: 100%; max-width: 560px;
}
.train-stoprow__negate { display: flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--train-ink-soft); font-family: var(--font-mono); }
.train-stoprow__negate input { accent-color: var(--train-ink-soft); }
.train-stoprow__remove {
  margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--train-line);
  background: transparent; color: var(--train-ink-soft); cursor: pointer; line-height: 1;
}
.train-stoprow__remove:hover { color: var(--train-ink); border-color: var(--train-ink-soft); }
.train-stopbuilder__add {
  border: 1px dashed var(--train-line); background: transparent; color: var(--train-ink-soft);
  border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer; font-size: .82rem;
}
.train-stopbuilder__add:hover { color: var(--train-ink); border-color: var(--train-ink-soft); }

.train-stoprow select, .train-stoprow input, .train-stopbuilder__op select {
  font-family: var(--font-body); font-size: .82rem;
  background: var(--train-bg); color: var(--train-ink); border: 1px solid var(--train-line);
  border-radius: var(--r-sm); padding: 5px 8px;
}
.train-stoprow input[type="number"] { width: 70px; }

/* Plain, non-glowing action button (Next / Back to dashboard) -- the glow
   is reserved for the Drill button specifically, not every button here. */
.train-btn {
  font-family: var(--font-display); font-weight: 700; font-size: .95rem; cursor: pointer;
  padding: 12px 26px; border-radius: var(--r-pill); border: 1px solid var(--train-line);
  background: var(--train-surface); color: var(--train-ink);
  transition: transform .15s, border-color .2s;
}
.train-btn:hover { transform: translateY(-1px); border-color: var(--train-ink-soft); }

/* Deliberately its own class, not a reuse of Play's .ghost-btn -- that rule
   reads var(--ink)/var(--line) and hovers to var(--buzz), all theme-
   following tokens that would clash with Train's fixed-dark surface (an
   amber hover has no business appearing anywhere in this pane). */
.train-exit-btn {
  font-family: var(--font-body); font-weight: 600; font-size: .9rem; cursor: pointer;
  padding: 13px 20px; border-radius: var(--r); border: 1.5px dashed var(--train-line);
  background: transparent; color: var(--train-ink-soft); transition: border-color .2s, color .2s;
}
.train-exit-btn:hover { border-color: var(--train-ink-soft); color: var(--train-ink); }

/* Deliberately its own class, not a reuse of Play's .btn--primary -- that
   rule fills with var(--buzz) (amber) and glows on hover via
   var(--lamp-glow), a second accent hue with no place in this pane. */
.train-btn-primary {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; cursor: pointer;
  padding: 13px 24px; border-radius: var(--r); border: 1px solid var(--train-ink);
  background: var(--train-ink); color: var(--train-bg);
  transition: transform .12s, opacity .2s;
}
.train-btn-primary:hover { transform: translateY(-1px); opacity: .92; }

/* ---- drill runner ---- */
.train-runner { max-width: 640px; margin: 0 auto; text-align: center; }
.train-runner__meta {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--train-ink-soft); margin: 0 0 20px;
}
.train-runner__clue { font-size: 1.25rem; line-height: 1.55; color: var(--train-ink); margin: 0 0 26px; }
.train-runner__form { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.train-runner__input {
  flex: 1; max-width: 360px; padding: 12px 16px; border-radius: var(--r);
  border: 1px solid var(--train-line); background: var(--train-bg); color: var(--train-ink); font-size: 1rem;
}
.train-runner__input:focus { outline: none; border-color: var(--train-ink-soft); }
.train-runner__feedback { font-size: 1.05rem; font-weight: 600; margin: 0 0 18px; }
.train-runner__feedback.is-correct { color: #4fd18a; }
.train-runner__feedback.is-incorrect { color: #ef6f6f; }
.train-runner__actions { display: flex; gap: 12px; justify-content: center; }
.train-runner__summary { max-width: 640px; margin: 0 auto; text-align: center; }
.train-runner__summary h2 { color: var(--train-ink); margin-bottom: 10px; }
.train-runner__summary p { color: var(--train-ink-soft); }
.train-runner__summarystats { font-family: var(--font-mono); font-size: .95rem; color: var(--train-ink) !important; margin: 10px 0 22px; }

@media (max-width: 900px) {
  .train-columns { grid-template-columns: 1fr; }
  .train-mode-toggles { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- account gate ----------------
   Sits above everything and covers both panes. `is-locked` hides the app
   chrome underneath so a signed-out visitor can't see or tab into it. */
.authgate {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-glow), var(--bg));
}
.authgate[hidden] { display: none; }
body.is-locked { overflow: hidden; }
body.is-locked .topbar,
body.is-locked .pane { visibility: hidden; }

.authgate__card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); padding: 34px 30px 28px; text-align: center;
}
.authgate__brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; }
.authgate__logo { font-family: var(--font-logo); font-weight: 900; font-size: 2.2rem; letter-spacing: .04em; margin: 0; }
.authgate__lede { color: var(--ink-soft); line-height: 1.6; font-size: .92rem; margin: 0 0 20px; }
.authgate__big { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin: 0 0 10px; }
.authgate__label {
  display: block; text-align: left; font-family: var(--font-mono); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .18em; color: var(--ink-soft); margin-bottom: 6px;
}
.authgate__input {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 12px;
}
.authgate__input:focus { outline: none; border-color: var(--buzz); box-shadow: var(--lamp-glow); }
.authgate__submit { width: 100%; justify-content: center; }
.authgate__note { color: var(--ink-soft); font-size: .78rem; line-height: 1.5; margin: 16px 0 0; }
.authgate__card code {
  font-family: var(--font-mono); font-size: .82em; background: var(--surface-2);
  padding: 1px 5px; border-radius: 5px;
}

/* ---------------- screens ---------------- */
.screen { display: none; max-width: 940px; margin: 0 auto; }
.screen.is-active { display: block; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- hero ---------------- */
.hero { text-align: center; padding: 26px 0 8px; }
.eyebrow {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .26em;
  font-size: .72rem; color: var(--buzz-deep); margin: 0 0 12px;
}
body.dark .eyebrow { color: var(--buzz); }
.hero__title { font-size: clamp(2.5rem, 7vw, 4.2rem); font-weight: 700; line-height: .98; }
.hero__title--logo { font-family: var(--font-logo); font-weight: 900; font-size: clamp(4rem, 14vw, 8rem); letter-spacing: .04em; line-height: 1; color: var(--ink); }
.hero__buzz { color: var(--buzz); position: relative; }
.hero__buzz::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .08em; height: .12em;
  background: var(--buzz); border-radius: 2px; opacity: .35;
}
.hero__sub { color: var(--ink-soft); font-size: 1.05rem; margin: 14px auto 0; max-width: 460px; }

.notice {
  background: var(--alarm-tint); color: var(--ink); border: 1px solid var(--alarm);
  border-radius: var(--r); padding: 12px 16px; margin: 18px auto; max-width: 560px; text-align: center; font-weight: 500;
}

/* Errors anchor to the bottom of the viewport, never inline, never up top. */
.errorbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 210; max-width: min(560px, calc(100vw - 32px));
  background: var(--alarm); color: #fff; border-radius: var(--r-pill);
  padding: 12px 22px; font-weight: 600; font-size: .95rem; text-align: center;
  box-shadow: var(--sh-3); animation: errpop .25s ease;
}
@keyframes errpop { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------- panels ---------------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 22px; margin: 18px 0; box-shadow: var(--sh-1);
}
.panel__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.panel__num { font-family: var(--font-mono); font-size: .8rem; color: var(--buzz); font-weight: 700; }
.panel__head h2 { font-size: 1.15rem; font-weight: 600; }
.panel__hint { margin-left: auto; color: var(--ink-soft); font-size: .82rem; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  font-family: var(--font-body); font-size: .92rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  cursor: pointer; transition: transform .12s, border-color .2s, background .2s;
}
.chip:hover { transform: translateY(-1px); }
.chip.is-on { border-color: var(--buzz); background: var(--buzz-tint); color: var(--buzz-deep); }
body.dark .chip.is-on { color: var(--buzz); }
.chip__emoji { font-size: 1.05em; }

/* segmented difficulty */
.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.seg__btn {
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding: 10px 22px; border-radius: var(--r); cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  transition: transform .12s, color .2s, border-color .2s, background .2s;
}
.seg__btn:hover { transform: translateY(-1px); color: var(--ink); }
.seg__btn.is-on { color: #fff; border-color: transparent; }
.seg__btn--easy.is-on { background: #2faf6b; }
.seg__btn--medium.is-on { background: #e0a212; color: #20180a; }
.seg__btn--hard.is-on { background: var(--alarm); }
.seg__btn--expert.is-on { background: var(--violet); }

/* bot grid */
.botgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.botcard {
  text-align: left; font-family: var(--font-body); color: var(--ink);
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 14px; cursor: pointer; transition: transform .12s, border-color .2s, box-shadow .2s;
}
.botcard:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.botcard.is-on { border-color: var(--buzz); box-shadow: var(--lamp-glow); }
.botcard__top { display: flex; align-items: center; gap: 8px; }
.botcard__emoji { font-size: 1.4rem; }
.botcard__name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.botcard__tag { color: var(--ink-soft); font-size: .8rem; font-style: italic; margin: 3px 0 10px; min-height: 2.2em; }
.statbar { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.statbar__l { font-family: var(--font-mono); font-size: .62rem; color: var(--ink-soft); width: 26px; letter-spacing: .05em; }
.statbar__track { flex: 1; height: 7px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.statbar__fill { display: block; height: 100%; border-radius: var(--r-pill); }
.statbar__fill--spd { background: var(--buzz); }
.statbar__fill--acc { background: var(--signal); }
.statbar__fill--foc { background: var(--violet); }
.statbar .readout { font-size: .72rem; color: var(--ink-soft); width: 10px; }
.botcard__spec { margin-top: 9px; font-size: .76rem; color: var(--ink-soft); }

/* Locked "more coming soon" placeholder: distinct, muted, not clickable. */
.botcard--soon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; cursor: default; min-height: 104px;
  border-style: dashed; background: transparent; color: var(--ink-soft); opacity: .72;
}
.botcard--soon:hover { transform: none; box-shadow: none; border-color: var(--line); }
.botcard--soon .botcard__top { flex-direction: column; gap: 4px; }
.botcard--soon .botcard__emoji { font-size: 1.7rem; filter: grayscale(.35); }
.botcard--soon .botcard__name { font-size: 1rem; color: var(--ink-soft); }
.botcard--soon .botcard__tag { margin: 0; min-height: 0; font-style: normal; }

/* settings */
/* flex-start, not center: the Questions slider carries a footer note
   (#poolNote) that Timer doesn't, so center-aligning let Timer's whole
   label+track sit visibly lower than Questions' (bugfix, 3.0.35). */
.settings { display: flex; flex-wrap: wrap; gap: 26px; align-items: flex-start; }
.slider { flex: 1; min-width: 230px; }
.slider__label { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: .95rem; margin-bottom: 10px; }
.slider__label .readout { color: var(--buzz-deep); font-size: 1.1rem; }
body.dark .slider__label .readout { color: var(--buzz); }
/* How many clues the current category/difficulty mix actually has. The corpus
   grows a packet at a time, so a round can legitimately be shorter than asked. */
.slider__note { display: block; margin-top: 8px; font-size: .82rem; color: var(--ink-soft); min-height: 1.2em; }
.slider__note.is-short { color: var(--alarm); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--signal), var(--buzz), var(--alarm)); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--buzz); box-shadow: var(--sh-1); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 3px solid var(--buzz); cursor: pointer;
}
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: .95rem; }
.toggle input { position: absolute; opacity: 0; }
.toggle__track { width: 46px; height: 26px; border-radius: var(--r-pill); background: var(--line); position: relative; transition: background .2s; }
.toggle__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--sh-1); transition: transform .2s; }
.toggle input:checked + .toggle__track { background: var(--buzz); }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ---------------- launch buttons ---------------- */
.launch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 26px 0 0; }
.mode {
  text-align: left; cursor: pointer; color: #fff; border: none; border-radius: var(--r-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 3px;
  transition: transform .12s, box-shadow .2s; box-shadow: var(--sh-2);
}
.mode:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }
.mode--faceoff { background: linear-gradient(135deg, #f0a91e, #e0454b); }
.mode--solo { background: linear-gradient(135deg, #0bab97, #1f7fd6); }
.mode--tournament { background: linear-gradient(135deg, #6354ec, #b03ad0); }
.mode__kicker { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .18em; opacity: .9; }
.mode__name { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; line-height: 1; }
.mode__desc { font-size: .85rem; opacity: .92; margin-top: 4px; }
.launch--secondary { grid-template-columns: 1fr; margin-top: 14px; }
.ghost-btn {
  font-family: var(--font-body); font-weight: 600; font-size: .95rem; cursor: pointer;
  padding: 13px 20px; border-radius: var(--r); border: 1.5px dashed var(--line);
  background: transparent; color: var(--ink); transition: border-color .2s, color .2s;
}
.ghost-btn:hover { border-color: var(--buzz); color: var(--buzz-deep); }
body.dark .ghost-btn:hover { color: var(--buzz); }

/* ---------------- game ---------------- */
#game.is-active { max-width: 760px; }
.gamebar { display: flex; align-items: stretch; gap: 12px; margin-bottom: 14px; }
.scorecard {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 16px; display: flex; flex-direction: column; align-items: center; box-shadow: var(--sh-1);
}
.scorecard__who { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.scorecard__pts { font-family: var(--font-mono); font-weight: 700; font-size: 2rem; line-height: 1; margin-top: 2px; }
.scorecard--bot { border-color: color-mix(in srgb, var(--alarm) 40%, var(--line)); }
.gamebar__mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 120px; }
.tag {
  font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--buzz-deep); background: var(--buzz-tint); padding: 4px 10px; border-radius: var(--r-pill);
}
body.dark .tag { color: var(--buzz); }
.counter { font-size: .9rem; color: var(--ink-soft); }

/* bracket */
.bracket { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.bracket__bot {
  display: flex; align-items: center; gap: 5px; font-size: .8rem; padding: 5px 10px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  transition: all .3s;
}
.bracket__emoji { font-size: 1.05em; }
.bracket__bot.is-done { color: var(--signal); border-color: var(--signal); text-decoration: line-through; opacity: .8; }
.bracket__bot.is-current { color: #fff; background: var(--buzz); border-color: var(--buzz); box-shadow: var(--lamp-glow); font-weight: 700; }
.bracket__bot.is-upcoming { opacity: .65; }

/* stage */
.stage {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 30px 26px 26px; box-shadow: var(--sh-2);
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.reader {
  font-size: clamp(1.3rem, 3vw, 1.7rem); line-height: 1.5; text-align: center; min-height: 4.5em;
  display: flex; align-items: center; justify-content: center; max-width: 620px; font-weight: 500;
}

.instrument { height: 118px; display: flex; align-items: center; justify-content: center; }
.timer { position: relative; width: 110px; height: 110px; visibility: hidden; }
.ring { width: 110px; height: 110px; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--line); stroke-width: 8; }
.ring__bar { fill: none; stroke: var(--buzz); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .95s linear, stroke .3s; }
.timer--answer .ring__bar { stroke: var(--signal); }
.ring__num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: var(--ink);
}

/* the buzzer lamp: the signature element */
.buzzer {
  font-family: var(--font-display); cursor: default;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 190px; padding: 18px; border-radius: var(--r-lg);
  border: 2px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  transition: transform .1s, box-shadow .25s, background .25s, border-color .25s, color .25s;
}
.buzzer__bell { font-size: 2rem; filter: grayscale(.6); transition: filter .25s; }
.buzzer__label { font-weight: 700; font-size: 1.25rem; }
.buzzer__key {
  font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .14em;
  padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid currentColor; opacity: .65;
}
.buzzer--idle { opacity: .7; }
.buzzer--open {
  cursor: pointer; color: var(--buzz-deep); background: var(--buzz-tint);
  border-color: var(--buzz); box-shadow: var(--lamp-glow); animation: lamp 1.3s ease-in-out infinite;
}
body.dark .buzzer--open { color: var(--buzz); }
.buzzer--open .buzzer__bell { filter: none; animation: shake 1.3s ease-in-out infinite; }
.buzzer--open:hover { transform: translateY(-2px); }
.buzzer--open:active { transform: scale(.96); }
.buzzer--you { color: #fff; background: var(--signal); border-color: var(--signal); }
.buzzer--you .buzzer__bell { filter: none; }
.buzzer--bot { color: #fff; background: var(--alarm); border-color: var(--alarm); }
.buzzer--bot .buzzer__bell { filter: none; }
@keyframes lamp { 50% { box-shadow: 0 0 0 6px rgba(232,151,12,.10), 0 12px 40px rgba(232,151,12,.55); } }
@keyframes shake { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* answer + result */
.answer { display: flex; gap: 10px; width: 100%; max-width: 520px; }
.answer__input {
  flex: 1; font-family: var(--font-body); font-size: 1.05rem; padding: 13px 16px;
  border-radius: var(--r); border: 2px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.answer__input:focus { outline: none; border-color: var(--signal); }
.btn {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; cursor: pointer;
  padding: 13px 24px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--buzz); border-color: var(--buzz); color: #20180a; box-shadow: var(--sh-1); }
.btn--primary:hover { box-shadow: var(--lamp-glow); }
.result { font-size: 1.15rem; min-height: 1.6em; text-align: center; font-weight: 600; }
.result--good { color: var(--signal); }
.result--bad { color: var(--alarm); }
.result--fast { color: var(--buzz-deep); }
body.dark .result--fast { color: var(--buzz); }
.result--neutral { color: var(--ink-soft); }
.result .ans { color: var(--ink-soft); font-weight: 500; }
.result .dot, .review__meta .dot { color: var(--ink-soft); margin: 0 6px; opacity: .6; }
.fastbuzz {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  font-family: var(--font-mono); font-weight: 700; font-size: .82em; letter-spacing: .06em;
  color: #20180a; background: var(--buzz); padding: 2px 9px; border-radius: var(--r-pill);
  box-shadow: 0 1px 5px rgba(232,151,12,.45);
}
body.dark .fastbuzz { color: #20180a; background: var(--buzz); box-shadow: 0 1px 6px rgba(255,182,51,.5); }
/* The lightning bolt: filled, crisp, inherits its container's colour. */
.bolt {
  width: 1.05em; height: 1.05em; flex: none; fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.22));
}
.review__mark .bolt { width: 1.3em; height: 1.3em; }
.ghost-btn--exit { margin: 16px auto 0; display: block; }

/* ---------------- review ---------------- */
#review.is-active { max-width: 760px; }
.review__head { text-align: center; margin-bottom: 22px; }
.review__head h1 { font-size: 2.2rem; margin: 4px 0; }
.review__summary { margin-top: 12px; }
.verdict { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; }
.verdict--win { color: var(--signal); }
.verdict--lose { color: var(--alarm); }
.verdict--tie, .verdict--solo { color: var(--buzz-deep); }
body.dark .verdict--tie, body.dark .verdict--solo { color: var(--buzz); }
.scoreline { font-size: 1.05rem; color: var(--ink-soft); margin-top: 6px; }
.scoreline .readout { color: var(--ink); font-size: 1.3rem; font-weight: 700; }
.scoreline__v { margin: 0 8px; opacity: .6; }
.buzzsum { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 12px; color: var(--ink-soft); font-size: .92rem; }
.buzzsum .readout { color: var(--ink); }

.review__list { list-style: none; padding: 0; margin: 0; counter-reset: q; }
.review__item {
  display: flex; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); counter-increment: q;
}
.review__mark {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; background: var(--surface-2); border: 1.5px solid var(--line);
}
.review__mark.is-correct { color: var(--signal); border-color: var(--signal); }
.review__mark.is-wrong { color: var(--alarm); border-color: var(--alarm); }
.review__mark.is-bot { background: transparent; }
.review__mark.is-pass { color: var(--ink-soft); }
.review__qa { flex: 1; }
.review__q { font-weight: 500; line-height: 1.45; }
.review__q::before { content: counter(q) ". "; font-family: var(--font-mono); color: var(--ink-soft); font-size: .85em; }
.review__a { margin-top: 4px; }
.review__alabel { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.review__meta { margin-top: 5px; font-size: .82rem; color: var(--ink-soft); display: flex; align-items: center; flex-wrap: wrap; }
.review__cat { margin-left: auto; }
.review__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }

/* ---------------- overlays / modals ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,10,22,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px);
}
.modal {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); max-width: 720px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 26px 28px;
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal__close {
  position: absolute; top: 14px; right: 16px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 1.2rem; cursor: pointer;
}
.modal__close:hover { color: var(--alarm); border-color: var(--alarm); }
.modal__title { font-size: 1.4rem; margin-bottom: 16px; }
.count { font-family: var(--font-mono); font-size: .8rem; color: var(--buzz-deep); }
body.dark .count { color: var(--buzz); }
.danger-btn {
  display: block; margin: 22px auto 0; padding: 9px 22px; border-radius: var(--r-pill);
  background: transparent; color: var(--alarm); border: 1.5px solid var(--alarm); font-weight: 600; cursor: pointer;
}
.danger-btn:hover { background: var(--alarm); color: #fff; }

/* Scrollable sheets: modals and the review list share one scroll treatment
   so every panel caps at the same height and scrolls identically. */
.modal, .review__list {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  overscroll-behavior: contain;
}
.modal::-webkit-scrollbar, .review__list::-webkit-scrollbar { width: 10px; }
.modal::-webkit-scrollbar-thumb, .review__list::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: padding-box;
}
.modal::-webkit-scrollbar-thumb:hover, .review__list::-webkit-scrollbar-thumb:hover {
  background: var(--ink-soft); background-clip: padding-box;
}
.review__list { max-height: 62vh; overflow-y: auto; padding-right: 6px; }

/* how-to */
.howto h3 { font-size: 1rem; margin: 16px 0 6px; color: var(--buzz-deep); }
body.dark .howto h3 { color: var(--buzz); }
.howto p { margin: 0 0 8px; line-height: 1.55; color: var(--ink); }
.howto__keys { list-style: none; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; }
.howto__keys li { color: var(--ink-soft); }
kbd {
  font-family: var(--font-mono); font-size: .8rem; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--ink);
}
.howto__code, .custom code {
  display: block; font-family: var(--font-mono); font-size: .8rem; white-space: pre; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 6px 0; color: var(--ink);
}
.custom code { white-space: pre-wrap; }
.howto__note { font-size: .85rem; color: var(--ink-soft); }

/* custom panel */
.custom__ok { color: var(--signal); font-weight: 600; }
.custom__err { color: var(--alarm); font-weight: 600; }
.custom__note { font-size: .88rem; color: var(--ink-soft); }
.custom__actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 22px; }
.stats-h { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--buzz-deep); margin-bottom: 8px; }
body.dark .stats-h { color: var(--buzz); }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th, .stats-table td { padding: 5px 6px; text-align: left; font-size: .9rem; border-bottom: 1px solid var(--line); }
.stats-table th { font-weight: 500; color: var(--ink-soft); }
.stats-table td.readout { text-align: right; }

/* trophies */
.trophy-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.trophy {
  position: relative; width: 190px; height: 56px; border-radius: var(--r); padding: 0 12px;
  display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); overflow: hidden; color: #20180a;
}
.trophy__emoji { font-size: 1.4rem; }
.trophy__name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trophy__desc {
  position: absolute; inset: auto 0 0 0; background: rgba(8,10,22,.9); color: #fff; font-size: .74rem;
  padding: 4px 8px; transform: translateY(100%); transition: transform .2s;
}
.trophy:hover .trophy__desc { transform: none; }
.trophy--easy { background: #b7f0c4; border-color: #57c97e; }
.trophy--medium { background: #ffe6a3; border-color: #e0a212; }
.trophy--hard { background: #ffc1c4; border-color: var(--alarm); }
.trophy--epic { background: #bfe2ff; border-color: #3a93e0; }
.trophy--legendary { background: #ffe07a; border-color: #f0a91e; }
.trophy--secret {
  background: linear-gradient(135deg, #f8ffae, #43c6ac 45%, #191654); color: #fff; border-color: var(--violet);
  box-shadow: 0 0 14px rgba(99,84,236,.5);
}
.trophy--secret .trophy__name { text-shadow: 0 1px 4px #191654; }
.empty { color: var(--ink-soft); text-align: center; width: 100%; }

/* round intro */
.round-intro {
  position: fixed; inset: 0; z-index: 120; background: rgba(8,10,22,.92); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; animation: fade .3s;
}
.round-intro__emoji { font-size: 4rem; animation: pop .6s; }
.round-intro__round { font-family: var(--font-mono); letter-spacing: .18em; color: var(--buzz); }
.round-intro__name { font-family: var(--font-display); font-weight: 700; font-size: 2.4rem; }
.round-intro__sub { color: #aab; font-size: .95rem; }

/* toasts */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--buzz);
  border-left-width: 4px; border-radius: var(--r); padding: 12px 16px; box-shadow: var(--sh-3);
  transform: translateX(120%); opacity: 0; transition: transform .35s, opacity .35s; max-width: 280px;
}
.toast.is-in { transform: none; opacity: 1; }
.toast__emoji { font-size: 1.6rem; }
.toast__text { font-size: .9rem; line-height: 1.3; }
.toast__text b { color: var(--buzz-deep); }
body.dark .toast__text b { color: var(--buzz); }

/* confetti */
.confetti { position: fixed; inset: 0; z-index: 150; pointer-events: none; display: none; width: 100vw; height: 100vh; }

/* ---------------- responsive ---------------- */
@media (max-width: 680px) {
  body { padding-top: 70px; }
  .launch { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .gamebar { flex-wrap: wrap; }
  .gamebar__mid { order: -1; width: 100%; flex-direction: row; justify-content: space-between; }
  .review__cat { margin-left: 0; width: 100%; }
  #paneTrain { margin-top: -70px; padding-top: 90px; }
}

/* ---------------- accessibility ---------------- */
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
