/* ReflexLab — Swiss Precision Telemetry Lab Design System
 * Grounded in STEP1_REF_LOCK.md (Geist + Geist Mono, Shadow-as-Border, Tabular Precision)
 * Zero width/height transitions (GPU transform/opacity only). Zero gray ad dummies.
 */

:root {
  /* Surface */
  --bg-canvas: #F6F5F0;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EEECE4;
  --bg-control: #E5E2D8;

  /* Ink & Border (WCAG AA >= 4.5:1) */
  --ink-primary: #141619;
  --ink-secondary: #4A4F57;
  --ink-muted: #5C626B;
  --border-hairline: #EAE8E0;
  --border-default: #DCDAD0;
  --ring-card: 0 0 0 1px rgba(20, 22, 25, 0.09), 0 2px 6px rgba(20, 22, 25, 0.04);
  --ring-focus: 0 0 0 2px #FFFFFF, 0 0 0 4px #0F766E;

  /* Brand & Test State Accent */
  --accent-primary: #0F766E;
  --accent-hover: #0B5C56;
  --accent-soft: rgba(15, 118, 110, 0.10);
  --stage-armed-bg: #1F242B;
  --stage-armed-ink: #F8FAFC;
  --stage-go-bg: #047857;
  --stage-go-ink: #FFFFFF;
  --semantic-error: #9F2D20;
  --semantic-error-soft: #FCEAE8;
  --semantic-warn: #B45309;
  --semantic-warn-soft: #FEF3C7;

  /* Typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Radii & Spacing */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --container-max: 1128px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga" 1;
}

body {
  margin: 0;
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  overflow-x: clip;
  min-height: 100vh;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.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;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ============================================================================
 * HEADER (Strictly position: static across all viewports)
 * ========================================================================== */

.site-header {
  position: static;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-primary);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  min-height: 44px;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
  color: var(--accent-primary);
}

.brand-mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent-primary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: color 140ms ease;
}

.nav-link:hover {
  color: var(--ink-primary);
  text-decoration: none;
}

.nav-mobile {
  display: none;
}

/* Top Non-Medical Disclaimer Strip */
.disclaimer-strip {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  padding: 7px 0;
}

.disclaimer-strip p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-muted);
}

/* ============================================================================
 * PAGE HERO & WORKBENCH GRID (1440px equal-height <= 40px diff)
 * ========================================================================== */

.main-content {
  padding-top: 20px;
  padding-bottom: 56px;
}

.hero-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.hero-title {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: var(--ink-primary);
}

.hero-subtitle {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(360px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}

.surface-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--ring-card);
}

/* Left Deck: 4-Tab Benchmark Workbench */
.workbench-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.tab-btn:hover {
  color: var(--ink-primary);
}

.tab-btn[aria-selected="true"] {
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(20, 22, 25, 0.08), 0 1px 3px rgba(20, 22, 25, 0.06);
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-default);
  flex-shrink: 0;
}

.tab-btn[data-done="true"] .tab-dot {
  background: var(--accent-primary);
}

/* Interactive Stage Container */
.bench-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.bench-panel[hidden] {
  display: none;
}

.bench-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 28px;
}

.bench-kicker {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.bench-stat-inline {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

/* Stage Box (Fixed min-height 360px, touch-action: manipulation) */
.stage-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 360px;
  padding: 24px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  box-shadow: inset 0 0 0 1px var(--border-default);
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, color 120ms ease;
}

.stage-box.is-clickable {
  cursor: pointer;
}

/* Reaction Stage States */
.stage-box.state-armed {
  background: var(--stage-armed-bg);
  color: var(--stage-armed-ink);
  box-shadow: none;
}

.stage-box.state-go {
  background: var(--stage-go-bg);
  color: var(--stage-go-ink);
  box-shadow: none;
}

.stage-box.state-error {
  background: var(--semantic-error-soft);
  color: var(--semantic-error);
  box-shadow: inset 0 0 0 1px rgba(159, 45, 32, 0.35);
}

.stage-glyph {
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.stage-primary-value {
  margin: 0;
  font-size: 48px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.stage-heading {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stage-desc {
  margin: 6px 0 0;
  max-width: 420px;
  font-size: 14px;
  line-height: 1.45;
  color: inherit;
  opacity: 0.88;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

/* Reaction Trial Chips Strip */
.trial-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.trial-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 12px;
  color: var(--ink-muted);
}

.trial-chip.is-recorded {
  background: var(--accent-soft);
  color: var(--accent-primary);
}

.trial-chip strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-primary);
}

.trial-chip.is-recorded strong {
  color: var(--accent-primary);
}

/* Number Memory UI */
.number-display {
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.15;
  word-break: break-all;
  max-width: 100%;
  color: var(--ink-primary);
  margin: 8px 0 18px;
}

.meter-track {
  width: 100%;
  max-width: 320px;
  height: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-control);
  overflow: hidden;
}

.meter-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.meter-fill.is-animated {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.number-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  margin-top: 8px;
}

.numeric-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: center;
}

.numeric-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--ring-focus);
}

.digit-diff-box {
  width: 100%;
  max-width: 440px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--ring-card);
  text-align: left;
}

.diff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}

.diff-label {
  color: var(--ink-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.diff-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
}

.diff-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 26px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.diff-char.is-match {
  background: var(--accent-soft);
  color: var(--accent-primary);
}

.diff-char.is-miss {
  background: var(--semantic-error-soft);
  color: var(--semantic-error);
}

/* Visual Memory Grid (5x5 tiles guaranteed >= 54x54px even on 390px) */
.visual-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 340px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.lives-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.life-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.life-pip.is-lost {
  background: var(--border-default);
}

.visual-grid {
  display: grid;
  justify-content: center;
  gap: 8px;
  margin: 0 auto;
  touch-action: manipulation;
  user-select: none;
}

.visual-grid[data-size="3"] {
  grid-template-columns: repeat(3, 72px);
}

.visual-grid[data-size="4"] {
  grid-template-columns: repeat(4, 64px);
}

.visual-grid[data-size="5"] {
  grid-template-columns: repeat(5, 58px);
}

.visual-tile {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 54px;
  min-height: 54px;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-control);
  box-shadow: inset 0 0 0 1px rgba(20, 22, 25, 0.08);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 110ms ease, background-color 110ms ease;
}

.visual-tile:active {
  transform: scale(0.96);
}

.visual-tile.is-lit,
.visual-tile.is-found {
  background: var(--accent-primary);
  box-shadow: none;
}

.visual-tile.is-wrong {
  background: var(--semantic-error);
  box-shadow: none;
}

.visual-tile.is-missed {
  background: var(--semantic-warn-soft);
  box-shadow: inset 0 0 0 2px var(--semantic-warn);
}

/* Typing Speed UI */
.typing-stage {
  align-items: stretch;
  justify-content: space-between;
  text-align: left;
  user-select: text;
}

.typing-telemetry {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.typing-metric {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-hairline);
}

.typing-metric-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.typing-metric-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-primary);
  margin-top: 2px;
}

.typing-passage-box {
  position: relative;
  padding: 14px 16px 36px;
  scroll-padding-bottom: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-default);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-muted);
  height: 176px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-bottom: 12px;
}

.t-char.is-ok {
  color: var(--ink-primary);
}

.t-char.is-err {
  color: var(--semantic-error);
  background: var(--semantic-error-soft);
  border-radius: 2px;
}

.t-char.is-cur,
.t-char.is-current {
  background: var(--accent-soft);
  color: var(--accent-primary);
  box-shadow: inset 0 -2px 0 var(--accent-primary);
}

.typing-input {
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}

.typing-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--ring-focus);
}

.typing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ============================================================================
 * BUTTONS
 * ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 140ms ease, color 140ms ease, transform 110ms ease, box-shadow 140ms ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--accent-primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 0 0 1px var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
  box-shadow: 0 0 0 1px var(--border-hairline);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

/* ============================================================================
 * RIGHT DECK: BRAIN REFLEX AGE SCOREBOARD (Balanced Height with Left Deck)
 * ========================================================================== */

.scoreboard-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px 20px;
  gap: 14px;
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.score-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  white-space: nowrap;
}

.status-pill.is-provisional {
  background: var(--semantic-warn-soft);
  color: var(--semantic-warn);
}

.status-pill.is-verified {
  background: var(--accent-soft);
  color: var(--accent-primary);
}

.age-readout-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  box-shadow: inset 0 0 0 1px var(--border-hairline);
}

.age-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.age-number {
  font-size: 48px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink-primary);
}

.age-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
}

.age-label {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.tier-block {
  text-align: right;
}

.tier-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--ink-primary);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tier-percentile {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-primary);
}

.composite-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.composite-meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-muted);
}

.composite-meter-wrap .meter-track {
  max-width: none;
}

.score-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-hairline);
}

.score-row-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.score-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-primary);
}

.score-row-ref {
  font-size: 12px;
  color: var(--ink-muted);
}

.score-row-right {
  text-align: right;
  flex-shrink: 0;
}

.score-row-val {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-primary);
}

.score-row-pct {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
}

.score-row.is-done .score-row-pct {
  color: var(--accent-primary);
  font-weight: 600;
}

.score-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 2px;
}

/* ============================================================================
 * AD SLOTS (Strictly display: none when inactive — ZERO gray placeholders)
 * ========================================================================== */

.ad-slot {
  margin: 28px 0;
}

.ad-slot[data-ad-active="false"] {
  display: none;
}

/* ============================================================================
 * SECTION 3: SHARE CARD STUDIO (Balanced 2-panel full-width)
 * ========================================================================== */

.section-block {
  margin-top: 32px;
}

.section-heading {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.section-lead {
  margin: 0 0 18px;
  font-size: 15px;
  color: var(--ink-secondary);
}

.share-studio {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 24px;
  padding: 22px;
  align-items: center;
}

.share-preview-frame {
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  padding: 10px;
  box-shadow: inset 0 0 0 1px var(--border-default);
}

#share-card-preview {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  display: block;
}

.share-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-controls h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.share-controls p {
  margin: 0;
  font-size: 15px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.share-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-feedback {
  min-height: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-primary);
}

.inapp-save-note {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

/* ============================================================================
 * SECTION 4: EDITORIAL GUIDE, NORMATIVE TABLE & FAQ
 * ========================================================================== */

.editorial-card {
  padding: 28px 30px;
}

.editorial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.editorial-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
}

.editorial-section p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.62;
  color: var(--ink-secondary);
}

.editorial-section p:last-child {
  margin-bottom: 0;
}

.norm-table-wrap {
  margin-top: 24px;
  overflow-x: auto;
}

.norm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.norm-table th,
.norm-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-hairline);
}

.norm-table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: var(--bg-canvas);
}

.norm-table td {
  color: var(--ink-secondary);
}

.faq-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-hairline);
}

.faq-block h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  box-shadow: inset 0 0 0 1px var(--border-hairline);
  padding: 0 16px;
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-primary);
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--ink-muted);
  margin-left: 12px;
}

.faq-item[open] summary::after {
  content: "-";
  color: var(--accent-primary);
}

.faq-answer {
  padding: 0 0 14px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.faq-answer p {
  margin: 0;
}

.bottom-disclaimer {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* ============================================================================
 * STATIC POLICY PAGES (/about/, /privacy/, /terms/, /contact/)
 * ========================================================================== */

.doc-card {
  max-width: 780px;
  margin: 12px auto 0;
  padding: 28px 32px;
}

.doc-card h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.doc-meta {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--ink-muted);
}

.doc-card h2 {
  margin: 24px 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.doc-card p,
.doc-card li {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.doc-card ul {
  padding-left: 20px;
}

/* ============================================================================
 * FOOTER
 * ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface);
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 13px;
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.footer-links a:hover {
  color: var(--ink-primary);
}

/* ============================================================================
 * RESPONSIVE BREAKPOINTS (Mobile 390px Priority)
 * ========================================================================== */

@media (max-width: 960px) {
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .share-studio {
    grid-template-columns: 1fr;
  }

  .editorial-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-inner {
    height: 48px;
  }

  .nav-desktop {
    display: none;
  }

  .nav-mobile {
    display: flex;
    gap: 12px;
  }

  .main-content {
    padding-top: 14px;
    padding-bottom: 40px;
  }

  .hero-title {
    font-size: 22px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .workbench-card,
  .scoreboard-card {
    padding: 14px;
  }

  .tab-bar {
    gap: 4px;
    padding: 3px;
  }

  .tab-btn {
    padding: 0 4px;
    font-size: 13px;
    gap: 4px;
  }

  .tab-dot {
    width: 5px;
    height: 5px;
  }

  .stage-box {
    min-height: 340px;
    padding: 18px 12px;
  }

  .typing-passage-box {
    height: 184px;
    padding: 14px 14px 36px;
  }

  .stage-primary-value {
    font-size: 40px;
  }

  .number-display {
    font-size: 36px;
  }

  /* Guarantee 5x5 tiles >= 54x54px inside 390px mobile viewport without horizontal overflow */
  .visual-grid[data-size="3"] {
    grid-template-columns: repeat(3, 68px);
    gap: 8px;
  }

  .visual-grid[data-size="4"] {
    grid-template-columns: repeat(4, 62px);
    gap: 8px;
  }

  .visual-grid[data-size="5"] {
    grid-template-columns: repeat(5, 56px);
    gap: 7px;
  }

  .share-studio {
    padding: 16px;
  }

  .editorial-card,
  .doc-card {
    padding: 18px 16px;
  }

  .score-actions {
    grid-template-columns: 1fr;
  }
}

/* Reduced Motion Respect */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
