/* Worksheet generator design tokens (4.1 Visual overhaul).
   Derived from the companion bot palette (Circuit Village). Tool first: calm surfaces,
   teal actions, peach only as a small accent. Every text pair is checked to WCAG AA by
   `node tests/run.js tokens`. Pages read these variables only (no one-off colors or sizes);
   later themes (4.12) and the high-contrast option (4.11) are token swaps.
   Worksheet pages themselves stay black on white (print ignores color tokens). */
:root {
  color-scheme: light dark;
  /* surfaces and text */
  --bg: #F4F7EE;  --surface: #FFFDF6;  --surface-2: #EAF1E2;
  --ink: #23404A; --ink-2: #48636C;
  --line: #C9D6C0;            /* decorative dividers only */
  --field-border: #6F8A88;    /* borders of inputs, checkboxes, toggles (3:1 or better) */
  /* actions */
  --primary: #2F6F66; --primary-hover: #265A53; --on-primary: #FFFFFF;
  --accent: #F2A48B;  --on-accent: #23404A;      /* peach: highlights, streak, mascot moments */
  --mint: #CFF1D8; --yellow: #F6E7A0;
  /* feedback: never red for a wrong answer (amber "hmm"); error is for form validation only */
  --ok: #26703F; --ok-bg: #DDF2E2;
  --hmm: #9A4F1B; --hmm-bg: #FCE7D2;
  --error: #A3303A; --error-bg: #F9E3E3;
  /* audience tints */
  --teacher-tint: #E1F3E4; --parent-tint: #FBE6DC;
  --mode-tint: var(--teacher-tint);
  --focus: #23404A;
  /* release-notes stages (one per step a feature moves through) */
  --st-idea: #5B6878; --st-reviewed: #2F6F66; --st-building: #8A5A12; --st-beta: #7A4E8A; --st-released: #3B7A36;
  /* tooltip (inverse of the page) */
  --tip-bg: #23404A; --tip-ink: #FFFDF6;
  /* the worksheet preview "paper" (always black on white) */
  --paper-answer: #000;
  accent-color: var(--primary);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16262D; --surface: #1E353E; --surface-2: #27444E;
    --ink: #EAF3EA; --ink-2: #AFC5C3; --line: #3A5863; --field-border: #7A9C9A;
    --primary: #8BD3C1; --primary-hover: #A5DECF; --on-primary: #12262C;
    --ok: #8FD6A6; --ok-bg: #213F34; --hmm: #F0B27E; --hmm-bg: #3D2F28;
    --error: #F5A9AE; --error-bg: #432A2E;
    --teacher-tint: #1F3B36; --parent-tint: #3A2E2D; --focus: #EAF3EA;
    --st-idea: #AAB6C4; --st-reviewed: #8BD3C1; --st-building: #EBCB8B; --st-beta: #D4AEDF; --st-released: #A3D69A;
    --tip-bg: #EAF3EA; --tip-ink: #16262D;
  }
}
:root[data-theme="dark"] {
  --bg: #16262D; --surface: #1E353E; --surface-2: #27444E;
  --ink: #EAF3EA; --ink-2: #AFC5C3; --line: #3A5863; --field-border: #7A9C9A;
  --primary: #8BD3C1; --primary-hover: #A5DECF; --on-primary: #12262C;
  --ok: #8FD6A6; --ok-bg: #213F34; --hmm: #F0B27E; --hmm-bg: #3D2F28;
  --error: #F5A9AE; --error-bg: #432A2E;
  --teacher-tint: #1F3B36; --parent-tint: #3A2E2D; --focus: #EAF3EA;
  --st-idea: #AAB6C4; --st-reviewed: #8BD3C1; --st-building: #EBCB8B; --st-beta: #D4AEDF; --st-released: #A3D69A;
  --tip-bg: #EAF3EA; --tip-ink: #16262D;
}
[data-mode="teacher"] { --mode-tint: var(--teacher-tint); }
[data-mode="parent"]  { --mode-tint: var(--parent-tint); }

:root {
  /* type: system fonts only (fast, print-safe, no downloads); monospace only for codes */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
  --fs-xs: .8125rem; --fs-sm: .9375rem; --fs-md: 1rem; --fs-lg: 1.125rem;
  --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: 2.25rem;
  --fs-practice: clamp(2.25rem, 7vw, 4rem);          /* the problem itself on the practice page */
  --lh-body: 1.5; --lh-tight: 1.2;
  /* shape (matches the mascot's rounded forms) */
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;
  /* space (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  /* elevation and outline */
  --shadow-1: 0 1px 2px rgb(35 64 74 / .10);
  --shadow-2: 0 2px 6px rgb(35 64 74 / .14), 0 8px 24px rgb(35 64 74 / .08);
  --shadow-paper: 0 2px 4px rgb(35 64 74 / .15), 0 10px 28px rgb(35 64 74 / .12);
  --shadow-sticker: 0 3px 0 var(--ink);               /* games and practice buttons only */
  --border: 1px solid var(--line);
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 5px var(--focus);
  /* motion */
  --t-fast: 120ms; --t-med: 200ms; --ease: cubic-bezier(.2,.7,.2,1);
  --tap: 44px;                                        /* minimum touch target */
  /* density: Teacher is tighter, Parent roomier (set per mode below) */
  --pad-card: var(--s-4); --gap-stack: var(--s-3);
}
[data-mode="teacher"] { --pad-card: var(--s-4); --gap-stack: var(--s-3); }
[data-mode="parent"]  { --pad-card: var(--s-5); --gap-stack: var(--s-4); }
@media (prefers-reduced-motion: reduce) { :root { --t-fast: 0ms; --t-med: 0ms; } }
