/* Zuvio study-room tokens: the one place the look is decided. Every page loads this first (the app,
   sign-in, sign-up, account), and every rule after it uses these names instead of its own numbers,
   so a radius, a size or a colour is the same wherever it appears. docs/DESIGN.md says which to use
   where; .claude/skills/core-design/SKILL.md holds the rules for changing the page.

   The tactile look: lavender-white or violet-black paper, cards and buttons on a solid lip, Zuvio
   violet for the one thing to do, a colour for every subject. Semantic names keep surfaces, controls
   and reading settings consistent across themes. The purple orb keeps its own light. */

:root {
  /* ---- corners: five steps and a pill */
  --r-xs: 8px; /* tiny things: a progress track, a key cap, a badge, a tag */
  --r-sm: 12px; /* controls: an input, a square button, a row in a list */
  --r-md: 16px; /* buttons, small cards: a chat bubble, a menu, an answer tile */
  --r-lg: 24px; /* cards and panels: a card on the page, the chat, the drawer */
  --r-xl: 28px; /* sheets over the page: settings, a review, the feedback panel */
  --r-full: 999px; /* pills: chips, the main buttons, the bars that float */

  /* ---- type: one scale (the system's typeface: San Francisco on Apple devices) */
  /* Figtree reads; Gabarito, round and heavy, sets titles, questions, buttons and big numbers. Both
     ship with the app (scripts/vendor.ts), so every device draws the same letters. */
  --font: "Figtree", -apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-display: "Gabarito", "Figtree", -apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* The board's other typefaces (a lesson may set a thing in one: web/board/scene.ts FONTS). Each
     falls back to a system face of its kind while the real one loads, or offline. */
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif; /* long reading: a definition, a quote */
  --font-hand: "Caveat", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive; /* a note jotted down: a mnemonic, an aside */
  --font-title: "Instrument Serif", "Iowan Old Style", Georgia, serif; /* a few big words: a title, a key idea, a flashcard's front */
  --text-2xs: 11px; /* overlines, meters, tiny labels */
  --text-xs: 12px; /* hints, secondary lines */
  --text-sm: 13px; /* labels, list rows, small buttons */
  --text-md: 14px; /* controls, chips */
  --text-base: 15px; /* reading: the chat, cards */
  --text-read: 16px; /* CORE's words in the chat page: long reading, on a 1.7 line */
  --text-lg: 17px; /* inputs (16px or more: no zoom on a phone), big buttons, questions */
  --text-xl: 20px; /* section titles */
  --text-2xl: 24px; /* sheet titles */
  --text-3xl: 28px; /* page titles */
  --text-display: 44px; /* the greeting */
  --text-field: 15px; /* what she types: 17px on a touch screen, below */
  --weight-light: 300; /* big numbers: a mark, a meter (set large and light) */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-display: 700; /* Gabarito titles, questions, buttons (Zuvio 2: Gabarito is always 700) */
  --weight-black: 700; /* a page's big title, a big number (Zuvio 2: never heavier than 700) */
  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.5;
  --leading-read: 1.7; /* explanations and study notes */

  /* ---- space: a 4-point grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  /* Shared measures for the study room, panels and sustained reading. */
  --layout-content: 1120px;
  --layout-reading: 760px;
  --layout-notes: 320px;
  --layout-sidebar: 232px;
  --layout-gutter: clamp(16px, 3vw, 40px);

  /* ---- controls: three heights, touch-sized from the middle one up */
  --control-sm: 32px;
  --control-md: 44px;
  --control-lg: 48px;
  --control-xl: 56px; /* a sign-in step's fields and its big button (Zuvio 2) */

  /* ---- the lip: a solid edge under what she can press or pick up (docs/DESIGN.md, "The tactile
     look"). Pressing pushes a button down onto it. No blurry shadows on the page. */
  --lip: 4px;
  /* ---- edges (Zuvio 2): a card is a flat sheet with one hairline; a control's edge is a little firmer */
  --edge: 1px;
  --edge-control: 1.5px;
  --lip-pressed: 1px;

  /* ---- motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* settles like a spring, no overshoot */
  --dur-fast: 0.15s; /* hover, press */
  --dur: 0.25s; /* things moving into place */
  --dur-slow: 0.4s; /* sheets, the board gliding */

  /* ---- colour: night (the default). Chat writing and the surrounding
     interface share neutral charcoal surfaces. */
  --paper: #0f0d17; /* the page: a deep violet-black */
  --card: #191624; /* anything on the page */
  --well: #141220; /* sunk into a card: inputs, the message box, code */
  --raised: #231f31; /* the row she is on, a pressed chip */
  --raised-2: #302b40; /* one more step: a selected segment */
  --ink: #f3f1f9; /* text */
  --ink-2: #b6b1c7; /* secondary text */
  --ink-3: #9b96ae; /* hints, placeholders, meters */
  --on-ink: #16131f; /* text on something drawn in ink */
  --line: #2b2739; /* a hairline between things, a card's edge */
  --line-strong: #3d3850; /* a control's edge */
  --hairline: #2b2739; /* an edge on the paper */
  --hairline-strong: #3d3850;
  --lip-card: #0a0910; /* the solid edge under a card */
  --lip-control: #0a0910; /* ...under a control */
  --violet: #a894ff; /* CORE's own colour as text and detail: the orb, focus, a lesson's highlights */
  --violet-soft: #221c3f;
  --action: #6a4bf5; /* the main button: Zuvio violet, the same at night and by day */
  --on-action: #ffffff;
  --action-lip: #3a22a8;
  /* CORE's orb, painted: the little one by its name, and the whole orb until the living one (three.js)
     has loaded (web/orb.ts). A deeper violet than the text's, as the orb is a light, not a word. */
  --orb-paint: radial-gradient(circle, #fff 0 8%, #ddd4ff 16%, #7c5cff 42%, #2a1a86 66%, #06050d 74%);
  --success: #4fd58f;
  --success-soft: #12301f;
  --warning: #ffc145;
  --warning-soft: #35290f;
  --danger: #ff8a8a;
  --danger-soft: #3a1a1e;
  /* Right and "not yet" as surfaces she presses: Continue after a right answer, the streak */
  --good: #168447; --on-good: #ffffff; --good-lip: #0f5e31; --good-ink: #8be8b4; --good-soft: rgba(30, 158, 85, 0.18);
  --warm: #e07b00; --on-warm: #ffffff; --warm-lip: #7a4300; --warm-ink: #ffcf85; --warm-soft: rgba(224, 123, 0, 0.18);
  --streak: #ffb020; --streak-lip: #b87400; --streak-ink: #ffcf6b; --streak-soft: rgba(255, 176, 32, 0.16);
  --info: #8ab4ff; /* a definition on the board (a card's role; the others are success, warning, danger) */
  --highlighter: rgba(255, 214, 90, 0.24); /* a stroke of highlighter on the board: a part of a formula a step lights */
  --focus: var(--violet); /* the keyboard's ring, the same everywhere */
  --scrim: rgba(8, 6, 14, 0.56); /* dims the page behind a sheet */
  --glass: #191624; /* what floats: bars, the speech bubble, toasts */
  --glow: none; /* the one light, over the page's top */
  /* What the board draws itself (tools.ts reads these), and the colours of code in replies */
  --draw-ink: #f3f1f9; --draw-muted: #b6b1c7; --draw-grid: #2b2739;
  --draw-stand: #4b4a5c; --draw-metal: #8e8da1; --draw-plot: #0f0d17;
  --hl-comment: #8b949e; --hl-keyword: #ff7b72; --hl-string: #a5d6ff; --hl-number: #79c0ff;
  --hl-title: #d2a8ff; --hl-type: #ffa657; --hl-attr: #79c0ff; --hl-meta: #8b949e;
  /* Hues for the board: a lesson can name one ("color": "teal") and get the right shade in night and day */
  --hue-violet: #a591ff; --hue-blue: #6aa7ff; --hue-teal: #3ed0c0; --hue-green: #4fd58f;
  --hue-amber: #ffc145; --hue-orange: #ff9f5a; --hue-rose: #ff7a9c; --hue-slate: #9ea3b5;
  /* The board's own colours (board.css): where the page's tokens aren't quite what chalk on slate or
     ink on paper wants. Night is this set, day the one under html[data-theme="light"] */
  --b-paper: #1c1a15; --b-sticky: #2d2713; --b-note-ink: #e9e2cf; /* a printed page, a note stuck on */
  --b-tape: rgba(255, 255, 255, 0.13); --b-pencil: #b0a9d0; /* a sticky note's tape, a focus lesson's pencil notes */
  --b-soft: #b3acdc;
  --b-edge: #b4aee0; --b-edge-dash: #726ba8; --b-violet: #b9a6ff; --b-ask: #c4b5fd; --b-wrong: #ff8a87;
  --b-now-bg: rgba(255, 214, 90, 0.16); --b-now-bar: #ffd65a; --b-changed-bg: rgba(255, 214, 90, 0.2);
  --b-src-edge: #4a4757; --b-src-ink: #c9c5d6; --b-added-bg: #261f3d; --b-added-edge: #7c5cd6; --b-added-ink: #d4c5ff;
  --b-flash-back: #2c2716; --b-veil: rgba(10, 7, 28, 0.5);
  --b-code-bg: rgba(255, 255, 255, 0.07); --b-pre-bg: rgba(255, 255, 255, 0.07); --b-tcode-bg: rgba(255, 255, 255, 0.05);
  --b-gap-bg: rgba(255, 255, 255, 0.06); --b-gap-focus: rgba(255, 255, 255, 0.12);
  --b-msg-bg: rgba(15, 11, 36, 0.85); --b-note-bg: rgba(15, 11, 36, 0.85);
  /* Neutral teaching surfaces follow the page theme. The #flat-board block
     below maps these values to the renderer's existing names. */
  --b-card: #191624; /* a card, a panel, a tile's plate */
  --b-well: #141220; /* sunk into a card: a gap, her line, a code block */
  --b-raised: #231f31; /* a chip, an option, a key */
  --b-raised-2: #302b40; /* one step more: hover, the chosen one */
  --b-ink-2: #c4bfd3; /* secondary text on the board */
  --b-ink-3: #9b96ae; /* hints, ticks, the card's small title */
  --b-line: #2b2739; --b-line-strong: #3d3850;
  --b-hairline: #2b2739; --b-hairline-strong: #3d3850;
  --b-lip: #0a0910; /* the solid edge under a card or an answer tile on the board */
  --b-glass: #191624; /* the dock with Zuvio's words */
  --b-plot: #0f0d17; --b-grid: #2b2739; --b-draw-ink: #f3f1f9; --b-draw-muted: #b6b1c7; --b-stand: #4b4a5c; --b-metal: #8e8da1;
  --b-shadow-md: 0 12px 40px rgba(0, 0, 0, 0.32);
  --b-shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.4);
  --b-next: var(--action); --b-on-next: var(--on-action); /* Next, the one thing to do: the violet button */
  --b-cover: rgba(18, 16, 25, 0.66); /* behind a lesson's title, over the drawing, before step 1 */
  --orb-ring: 0 0 0 10px rgba(15, 11, 36, 0.92), 0 0 80px 4px rgba(124, 92, 255, 0.42);
  --shadow-sm: 0 var(--lip) 0 var(--lip-card); /* a card: its solid lip */
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.32); /* what floats: a bar, a menu */
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.4); /* a sheet over the page */
  color-scheme: dark;
  font-synthesis-weight: none; /* never fake a bold a face doesn't have (Instrument Serif has one weight) */

  --ui-active: var(--ui-violet);
  --ui-active-soft: var(--ui-violet-soft);
}

/* ---- colour: day (the app sets data-theme="light"; Settings > Appearance picks it). The study sheet
   (the lesson as one page of notes, flat.ts) is always day: it is paper, for reading and for printing */
html[data-theme="light"],
.study-sheet {
  --paper: #f6f4fb; /* a little lavender in the paper, so white cards stand off it */
  --card: #ffffff;
  --well: #faf9fd;
  --raised: #efecf7;
  --raised-2: #e6e3ef;
  --ink: #1a1626;
  --ink-2: #5d5870;
  --ink-3: #686379;
  --on-ink: #ffffff;
  --line: #e7e3f1;
  --line-strong: #d3cee0;
  --hairline: #e7e3f1;
  --hairline-strong: #d3cee0;
  --lip-card: #e1dcec;
  --lip-control: #d3cee0;
  --action-lip: #4a2fc9;
  --violet: #5a3be6;
  --violet-soft: #eeeaff;
  --success: #137a3f;
  --success-soft: #e3f6ea;
  --good-ink: #0f5e31; --good-lip: #0f5e31; --good-soft: #e9f8ef;
  --warm-ink: #6b3b00; --warm-lip: #a85c00; --warm-soft: #fff4db;
  --streak-lip: #d98a00; --streak-ink: #a35f00; --streak-soft: #fff4db;
  --warning: #8f5400;
  --warning-soft: #fff3d6;
  --danger: #c4282d;
  --danger-soft: #fdecec;
  --info: #1d4ed8;
  --highlighter: rgba(255, 214, 90, 0.55);
  --scrim: rgba(26, 22, 38, 0.32);
  --glass: #ffffff;
  --glow: none;
  --draw-ink: #1a1626; --draw-muted: #5d5870; --draw-grid: #e7e3f1;
  --draw-stand: #cdcac2; --draw-metal: #8c8a94; --draw-plot: #ffffff;
  --hl-comment: #8a8476; --hl-keyword: #cf222e; --hl-string: #0a3069; --hl-number: #0550ae;
  --hl-title: #8250df; --hl-type: #953800; --hl-attr: #0550ae; --hl-meta: #57606a;
  --hue-violet: #6a4bf5; --hue-blue: #2f6fe6; --hue-teal: #0c8a8a; --hue-green: #1a8a4b;
  --hue-amber: #b46a00; --hue-orange: #d0561a; --hue-rose: #d63a7c; --hue-slate: #5d5870;
  --b-paper: #fbf7ec; --b-sticky: #fff1a8; --b-note-ink: #5b5330; --b-soft: var(--ink-2);
  --b-tape: rgba(255, 255, 255, 0.62); --b-pencil: #6b665c;
  --b-edge: var(--ink); --b-edge-dash: var(--ink-3); --b-violet: var(--violet); --b-ask: #5b3fd6; --b-wrong: var(--danger);
  --b-now-bg: rgba(255, 214, 90, 0.5); --b-now-bar: var(--ink); --b-changed-bg: rgba(255, 214, 90, 0.45);
  --b-src-edge: var(--line-strong); --b-src-ink: #5c574d; --b-added-bg: #f4f0ff; --b-added-edge: #a78bfa; --b-added-ink: #5b21b6;
  --b-flash-back: #fff3c4; --b-veil: rgba(244, 241, 234, 0.45);
  --b-code-bg: rgba(0, 0, 0, 0.06); --b-pre-bg: rgba(0, 0, 0, 0.05); --b-tcode-bg: rgba(0, 0, 0, 0.04);
  --b-gap-bg: rgba(29, 28, 26, 0.05); --b-gap-focus: rgba(29, 28, 26, 0.1);
  --b-msg-bg: rgba(255, 253, 248, 0.85); --b-note-bg: transparent;
  --b-card: #ffffff; --b-well: #faf9fd; --b-raised: #efecf7; --b-raised-2: #e6e3ef;
  --b-ink-2: #4e4961; --b-ink-3: #686379;
  --b-line: #e7e3f1; --b-line-strong: #d3cee0;
  --b-hairline: #e7e3f1; --b-hairline-strong: #d3cee0;
  --b-lip: #e1dcec;
  --b-glass: #ffffff;
  --b-plot: #ffffff; --b-grid: #e7e3f1; --b-draw-ink: #1a1626; --b-draw-muted: #5d5870; --b-stand: #cdcac2; --b-metal: #8c8a94;
  --b-shadow-md: 0 12px 40px rgba(26, 22, 38, 0.1);
  --b-shadow-lg: 0 24px 70px rgba(26, 22, 38, 0.16);
  --b-next: var(--action); --b-on-next: var(--on-action);
  --b-cover: rgba(255, 255, 255, 0.68);
  --orb-ring: 0 0 0 10px rgba(255, 253, 248, 0.9), 0 30px 60px rgba(70, 40, 160, 0.35);
  --shadow-sm: 0 var(--lip) 0 var(--lip-card);
  --shadow-md: 0 12px 40px rgba(26, 22, 38, 0.1);
  --shadow-lg: 0 24px 70px rgba(26, 22, 38, 0.16);
  color-scheme: light;

  --ui-active: var(--ui-violet);
  --ui-active-soft: var(--ui-violet-soft);
}

/* ---- colour: the talk stage. Talk mode puts CORE alone on the night stage whatever the theme: these
   are the night values again, set on the body, which wins over the page's day values above it. */
body.talk {
  --draw-ink: #f3f1f9; --draw-muted: #b6b1c7; --draw-grid: #2b2739; --draw-stand: #4b4a5c; --draw-metal: #8e8da1; --draw-plot: #0f0d17;
  --hl-comment: #8b949e; --hl-keyword: #ff7b72; --hl-string: #a5d6ff; --hl-number: #79c0ff;
  --hl-title: #d2a8ff; --hl-type: #ffa657; --hl-attr: #79c0ff; --hl-meta: #8b949e;
    --hue-violet: #a591ff; --hue-blue: #6aa7ff; --hue-teal: #3ed0c0; --hue-green: #4fd58f;
  --hue-amber: #ffc145; --hue-orange: #ff9f5a; --hue-rose: #ff7a9c; --hue-slate: #9ea3b5;
  --orb-ring: 0 0 0 10px rgba(15, 11, 36, 0.92), 0 0 80px 4px rgba(124, 92, 255, 0.42);
  --b-card: #191624; --b-well: #141220; --b-raised: #231f31; --b-raised-2: #302b40; --b-ink-2: #c4bfd3; --b-ink-3: #9b96ae;
  --b-line: #2b2739; --b-line-strong: #3d3850;
  --b-hairline: #2b2739; --b-hairline-strong: #3d3850;
  --b-glass: #191624;
  --b-plot: #0f0d17; --b-grid: #2b2739; --b-draw-ink: #f3f1f9; --b-draw-muted: #b6b1c7; --b-stand: #4f4791; --b-metal: #9892bd;
  --b-shadow-md: 0 12px 40px rgba(0, 0, 0, 0.28);
  --b-shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.36);
  --b-next: var(--action); --b-on-next: var(--on-action); --b-cover: rgba(20, 21, 23, 0.64);
  --paper: #0f0d17;
  --card: #191624;
  --well: #141220;
  --raised: #231f31;
  --raised-2: #302b40;
  --ink: #f3f1f9;
  --ink-2: #b6b1c7;
  --ink-3: #9b96ae;
  --on-ink: #16131f;
  --line: #2b2739;
  --line-strong: #3d3850;
  --hairline: #2b2739;
  --hairline-strong: #3d3850;
  --violet: #a591ff;
  --violet-soft: rgba(165, 145, 255, 0.14);
  --success: #4fd58f;
  --success-soft: rgba(61, 214, 140, 0.12);
  --warning: #ffc145;
  --warning-soft: rgba(255, 193, 69, 0.12);
  --danger: #ff8a8a;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --highlighter: rgba(255, 214, 90, 0.24);
  --scrim: rgba(12, 15, 16, 0.36);
  --glass: #191624;
  --lip-card: #0a0910; --lip-control: #0a0910; --action-lip: #3a22a8; --b-lip: #0a0910;
  --shadow-sm: 0 var(--lip) 0 var(--lip-card);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.36);
  color-scheme: dark;

  --ui-active: var(--ui-violet);
  --ui-active-soft: var(--ui-violet-soft);
}

/* ============================================================== study-room chrome
   Shared surfaces for navigation, conversations, tools, settings and account pages: the tactile
   look (docs/DESIGN.md). Lavender-white or violet-black paper, white or deep cards on a solid lip,
   Zuvio violet for the one thing to do, a colour and a picture for every subject. Figtree reads,
   Gabarito sets titles, buttons and big numbers. The purple orb keeps its own light. */
:root {
  --ui-paper: #0f0d17; /* the page */
  --ui-card: #191624; /* a card, a bar, a sheet */
  --ui-well: #141220; /* sunk into a card: fields, the message box */
  --ui-raised: #231f31; /* the row she is on, a pressed chip, a round button */
  --ui-raised-2: #302b40; /* one step more: hover on a raised thing, the chosen segment, a track */
  --ui-ink: #f3f1f9; /* text, and the main button */
  --ui-ink-2: #b6b1c7; /* secondary text */
  --ui-ink-3: #9b96ae; /* hints, placeholders, meters */
  --ui-on-ink: #16131f; /* text on something drawn in ink: a chosen chip */
  --ui-line: #2b2739; /* a hairline between things */
  --ui-line-strong: #3d3850; /* a control's edge, where one must show */
  --ui-hairline: #2b2739; /* an edge on the paper */
  --ui-hairline-strong: #3d3850;
  --ui-violet: #a894ff; /* the orb, a selected thing, explicitly purple teaching content */
  --ui-violet-soft: #221c3f;
  --ui-accent: #6a4bf5; /* the main button, Zuvio violet: the one thing to do (Continue, Send, New chat) */
  --ui-on-accent: #ffffff; /* text on the main button */
  --ui-accent-lip: #3a22a8; /* the solid edge under it */
  --ui-lip: #0a0910; /* the solid edge under a card */
  --ui-lip-control: #3d3850; /* ...under a secondary button, an answer tile: a grey lip */
  --ui-seg: #3d3850; --ui-seg-shadow: none; /* the chosen key of a segmented choice */
  /* the floating tab bar: frosted, a hair of light round it */
  --ui-tabbar: rgba(30, 26, 46, 0.88); --ui-tabbar-line: rgba(255, 255, 255, 0.1); --ui-tabbar-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --ui-glow: rgba(124, 92, 255, 0.24); --ui-glow-end: rgba(124, 92, 255, 0); /* Zuvio's light on the paper behind its greeting */
  --ui-plan: #8e78ff; /* the dashed outline of what's planned and not yet done */
  --ui-field: #231f31; /* the box she types to Zuvio in */
  --ui-behind: #050409; /* what's left of the page behind a sheet */
  --ui-phones: #edeaf7; /* Zuvio's headphones in a focus session */
  --ui-glass-on-photo: rgba(255, 255, 255, 0.14); /* a round button over the camera */
  --ui-danger-edge: #5f262c; --ui-warning-edge: #5c4513; --ui-success-edge: #1b4a30; /* the lip under "Didn't know", "With effort", "Knew it" */
  --ui-good: #168447; --ui-on-good: #ffffff; --ui-good-lip: #0f5e31; /* Continue after a right answer */
  --ui-streak: #ffb020; --ui-streak-lip: #b87400; --ui-streak-ink: #ffcf6b; --ui-streak-soft: rgba(255, 176, 32, 0.16); /* days in a row */
  --ui-on-streak: #3d2400; /* words on the amber */
  /* the tick in a chosen checkbox, drawn in --ui-on-accent (white on the violet) */
  --ui-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
  --ui-bubble: #2a2350; /* her messages in the chat: soft violet with ink (Zuvio 2's Ask Zuvio) */
  --ui-on-bubble: #f3f1f9;
  --ui-success: #4fd58f;
  --ui-success-soft: #12301f;
  --ui-warning: #ffc145;
  --ui-warning-soft: #35290f;
  --ui-danger: #ff8a8a;
  --ui-danger-soft: #3a1a1e;
  --ui-focus: var(--ui-violet);
  --ui-scrim: rgba(12, 15, 16, 0.36);
  --ui-glass: #191624; /* what floats is solid: no frosted glass */
  /* A subject's picture (web/subject-art.ts): white tints over the subject's colour, night and day alike */
  --art-1: rgba(255, 255, 255, 0.94); --art-2: rgba(255, 255, 255, 0.5); --art-3: rgba(255, 255, 255, 0.22); --art-shade: rgba(10, 9, 16, 0.2);
  /* Ambient decoration is disabled on study surfaces. */
  --ui-glow: none;
  /* Reserved decoration hook; no grain over reading surfaces. */
  --ui-grain: none;
  /* Elevation (Zuvio 2): a card lies flat at night and casts a soft shadow by day; only what she
     presses (the main button, an answer tile) has a lip; what floats (a menu, a sheet) casts a shadow */
  --ui-shadow-sm: 0 0 0 rgba(0, 0, 0, 0);
  --ui-shadow-md: 0 12px 40px rgba(0, 0, 0, 0.32);
  --ui-shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.4);
  /* Subjects: each lesson wears its subject's colour (web/subject-art.ts picks it from the lesson's
     subject). The picture's ground (--subj-*), and the ink and soft tint for words and tags on a card */
  --subj-maths: #6a4bf5; --subj-maths-ink: #a894ff; --subj-maths-soft: #221c3f;
  --subj-physics: #2f7bf6; --subj-physics-ink: #6aa7ff; --subj-physics-soft: #16233d;
  --subj-biology: #1e9e55; --subj-biology-ink: #7fdca7; --subj-biology-soft: rgba(30, 158, 85, 0.2);
  --subj-chemistry: #119a8c; --subj-chemistry-ink: #3ed0c0; --subj-chemistry-soft: #0f2e2c;
  --subj-history: #f2762e; --subj-history-ink: #ff9f5a; --subj-history-soft: #3a2416;
  --subj-geography: #0fa3a3; --subj-geography-ink: #6fe0dc; --subj-geography-soft: rgba(15, 163, 163, 0.2);
  --subj-language: #e8478b; --subj-language-ink: #ff7a9c; --subj-language-soft: #3a1826;
  --subj-code: #231f31; --subj-code-ink: #c4bfd3; --subj-code-soft: rgba(196, 191, 211, 0.14);
  --subj-other: #5d5870; --subj-other-ink: #c4bfd3; --subj-other-soft: rgba(196, 191, 211, 0.14);
  /* Corners by role: round and soft, the same steps as tokens.css's --r-* */
  --ui-r-xs: 8px; /* a track, a key cap, a badge, a tag */
  --ui-r-sm: 12px; /* fields, list rows, small buttons */
  --ui-r-md: 16px; /* buttons, chips, options, menus */
  --ui-r-lg: 24px; /* cards, the chat's card */
  --ui-r-xl: 28px; /* sheets over the page */
  --ui-r-pill: 999px; /* status chips and intentionally round controls */
  --ui-r-full: 999px; /* a circle */
  /* Zuvio 2's own corners, measured from the design's boards (docs/DESIGN.md, "Lamplight") */
  --ui-r-icon: 32%; /* an icon on its soft square: 13px at 40, 15 at 48, 18 at 56 */
  --ui-r-add: 15px; /* the violet "+" in the tab bar */
  --ui-r-add-sm: 9px; /* ...and in the laptop's sidebar */
  --ui-r-nav: 14px; /* a row of the sidebar, a small data tile */
  --ui-r-action: 18px; /* the main button, 56px tall */
  --ui-r-list: 20px; /* a card of rows */
  --ui-r-tile: 22px; /* a tile on Today, the Ask Zuvio card */
  --ui-r-pane: 26px; /* a pane of the Mac's boards in the coding tutor (learn.css) */
  --ui-r-dot: 3.5px; /* a file's tile on the Mac's Atlas, 12px square (learn.css) */
  --ui-r-bar: 5px; /* a cell of the course's scale, 16px tall (learn-course.css) */
  --ui-r-step: 10px; /* the minus and plus of his focus, 32px square (learn-course.css) */
  --ui-r-split: 4px; /* a subject's part of the week's bar, 12px tall (learn-week.css) */
  --ui-r-hero: 28px; /* the session card, a sheet's top */
  --ui-r-sheet: 32px; /* the Ask Zuvio sheet's top */
  --ui-r-tail: 6px; /* the corner of her bubble that points at her */
  /* ...and its type, by who is speaking (the design's Type board): Figtree reads, Gabarito acts and
     counts (always 700), Instrument Serif is Zuvio's voice */
  --z-title: 34px; /* a tab's big title */
  --z-greet: 33px; /* Zuvio's greeting on a phone */
  --z-greet-wide: 46px; /* ...and on an iPad or a laptop */
  --z-voice: 21px; /* a line Zuvio says */
  --z-card-title: 22px; /* a card's title */
  --z-number: 18px; /* a tile's number */
  --z-button: 19px; /* the main button's word */
  --z-row: 16px; /* a row's name */
  --z-tab: 10.5px; /* a tab's word in the floating bar */
  --z-card-title-wide: 26px; /* a card's title on an iPad or a laptop */
  --z-button-wide: 21px; /* ...and the main button's word there */
  --z-side: 252px; /* the sidebar of an iPad or a laptop */
  --z-gap: 14px; --z-gap-wide: 22px; /* between the blocks of a page */
  --z-pad: 20px; /* a phone page's side padding */
  --z-pad-card: 18px; /* inside a card */
  --z-room: 28px; /* on a phone, between the blocks of a page: one thing at a time, with room around it */
  --ui-font: var(--font); /* Figtree */
  --ui-font-display: var(--font-display); /* Gabarito: titles, the greeting, buttons, big numbers (set heavy: --weight-display) */
  --ui-text-hello: 44px; /* the greeting on the welcome page */
  --ui-text-voice: 56px; /* Zuvio's big line beside a sign-in form, on an iPad or a laptop (auth.css) */
  /* The layout's fixed pieces: her sidebar on a laptop (the study desk), and on a phone the tab bar
     and a chat's top bar */
  --ui-desk: var(--layout-sidebar);
  --ui-tabs: 64px;
  --ui-bar: 56px;
  /* A focus session's phone-down screen (web/focus.ts): nearly black, as the screen stays on face down */
  --ui-night: #05030d;
  /* ...and what's on it, the same by day and at night (that screen and Capture are always night):
     ink, its quieter shade, and a raised part */
  --ui-night-ink: #f4f1ff; --ui-night-ink-2: #aea6c8; --ui-night-raised: #1c1830; --ui-night-line: #2e2945;
  --ui-day-paper: #f6f4fb; /* the day look's paper, in the look's preview */
  --ui-night-paper: #0f0d17; --ui-night-line-strong: #3d3850; /* its panel at the foot, and the chosen segment on it */
  /* Zuvio 2, "Lamplight" (docs/DESIGN.md): Zuvio drawn as the orb in its graduation cap (zuvio-orb.css),
     speaking in Instrument Serif, with amber only where Zuvio is alive (never a button: violet stays
     the one thing to do) */
  --ui-orb: radial-gradient(circle at 32% 26%, #fff4dc 0%, #ffd8a8 10%, #d9b8ff 30%, #9b7dff 52%, #6a4bf5 74%, #4429bd 92%, #2f1b93 100%);
  --ui-orb-glow: 0 10px 34px rgba(124, 92, 255, 0.5); /* the light it gives */
  --ui-orb-eye: #1b1040; /* its eyes, the same at night and by day: they are on the orb */
  --ui-orb-under: rgba(24, 10, 90, 0.45); --ui-orb-shine: rgba(255, 255, 255, 0.45); /* its shade below, its light on top */
  /* its life (zuvio-orb.css): the warm lamp inside that drifts, the glint in a wide eye, the halo and the ring
     it gives while it talks or listens, and the grey it turns when live help is used up */
  --ui-orb-core: radial-gradient(circle, rgba(255, 244, 220, 0.98) 0%, rgba(255, 216, 168, 0.6) 34%, rgba(255, 216, 168, 0) 68%);
  --ui-orb-glint: #ffffff; --ui-orb-halo: rgba(168, 148, 255, 0.22); --ui-orb-ripple: rgba(168, 148, 255, 0.5); --ui-orb-ripple-end: rgba(168, 148, 255, 0);
  --ui-orb-rest: radial-gradient(circle at 32% 26%, #f1eef8 0%, #d5cfe6 14%, #a9a1c6 40%, #7a7299 68%, #554e73 90%, #3f3959 100%);
  --ui-cap: #ffc27a; /* the cap's tassel and button */
  --ui-aura: rgba(124, 92, 255, 0.22); /* the glow on the paper behind it */
  --ui-lamp: #ffc27a; /* amber: Zuvio's own words and marks */
  --ui-lamp-soft: #33261a; /* a note from Zuvio */
  /* The owner's coding tutor (public/learn.css): code's colours, its icon tiles and the edge of a
     chosen answer, from the "My CORE Design" canvas (docs/DESIGN.md) */
  --ui-blue: #6aa7ff; --ui-blue-soft: #16233d; --ui-teal: #3ed0c0; --ui-teal-soft: #0f2e2c;
  --ui-rose: #ff7a9c; --ui-rose-soft: #3a1826; --ui-select: #8e78ff;
  --ui-orange: #ff9f5a; --ui-orange-soft: #36200f; --ui-slate: #a9b1c9; --ui-slate-soft: #1d2130;
  --ui-success-line: #1e4a31; --ui-warning-line: #6b5216; --ui-warning-ink: #ffe2a3;
  /* The terminal of the owner's coding tutor (learn-projects.css): night in both themes, as a
     terminal is; inside it every --ui-* colour takes its night value (the night list below) */
  --ui-term: #0a0911; --ui-term-line: #1f1b2e; --ui-term-tab: #2a2540;
  --ui-font-voice: var(--font-title); /* Instrument Serif: what Zuvio says, and the big titles */

  --ui-active: var(--ui-violet);
  --ui-active-soft: var(--ui-violet-soft);
}
@media (max-width: 640px) {
  :root {
    --ui-text-hello: 44px;
  }
}
html[data-theme="light"] {
  /* Day: the same room with the lights on, a little lavender left in the paper and the lines */
  --ui-paper: #f6f4fb;
  --ui-card: #ffffff;
  --ui-well: #faf9fd;
  --ui-raised: #efecf7;
  --ui-raised-2: #e6e3ef;
  --ui-ink: #1a1626;
  --ui-ink-2: #5d5870;
  --ui-ink-3: #686379;
  --ui-on-ink: #ffffff;
  --ui-line: #e7e3f1;
  --ui-line-strong: #d3cee0;
  --ui-hairline: #e7e3f1;
  --ui-hairline-strong: #d3cee0;
  --ui-violet: #5a3be6;
  --ui-violet-soft: #eeeaff;
  --ui-accent: #6a4bf5;
  --ui-on-accent: #ffffff;
  --ui-accent-lip: #4a2fc9;
  --ui-lip: #e1dcec;
  --ui-lip-control: #d3cee0;
  --ui-seg: #ffffff; --ui-seg-shadow: 0 1px 2px rgba(26, 22, 38, 0.1);
  --ui-tabbar: rgba(255, 255, 255, 0.92); --ui-tabbar-line: #e7e3f1; --ui-tabbar-shadow: 0 10px 28px rgba(26, 22, 38, 0.12);
  --ui-glow: rgba(124, 92, 255, 0.14); --ui-glow-end: rgba(124, 92, 255, 0); --ui-plan: #6a4bf5;
  --ui-field: #eae6f4; --ui-behind: #a9a5b8;
  --ui-phones: #edeaf7; --ui-glass-on-photo: rgba(255, 255, 255, 0.14);
  --ui-danger-edge: #f2c4c4; --ui-warning-edge: #ebd49a; --ui-success-edge: #b4dec4;
  --ui-good-lip: #0f5e31;
  --ui-streak-lip: #d98a00; --ui-streak-ink: #a35f00; --ui-streak-soft: #fff4db;
  --ui-bubble: #e7e1ff;
  --ui-on-bubble: #1a1626;
  --ui-success: #137a3f;
  --ui-success-soft: #e3f6ea;
  --ui-warning: #8f5400;
  --ui-warning-soft: #fff3d6;
  --ui-danger: #c4282d;
  --ui-danger-soft: #fdecec;
  --ui-scrim: rgba(26, 22, 38, 0.32);
  --ui-glow: none;
  --ui-grain: none;
  --ui-shadow-sm: 0 1px 2px rgba(26, 22, 38, 0.05), 0 10px 28px rgba(26, 22, 38, 0.06);
  --ui-shadow-md: 0 12px 40px rgba(26, 22, 38, 0.1);
  --ui-shadow-lg: 0 24px 70px rgba(26, 22, 38, 0.16);
  --subj-maths-ink: #5a3be6; --subj-maths-soft: #eeeaff;
  --subj-physics-ink: #2259c7; --subj-physics-soft: #e6efff;
  --subj-biology-ink: #137a3f; --subj-biology-soft: #e2f6ea;
  --subj-chemistry-ink: #086e6e; --subj-chemistry-soft: #ddf4f2;
  --subj-history-ink: #b84710; --subj-history-soft: #fdebdd;
  --subj-geography-ink: #0c7a7a; --subj-geography-soft: #ddf5f4;
  --subj-language-ink: #c02a69; --subj-language-soft: #fde6ef;
  --subj-code: #1a1626; --subj-code-ink: #1a1626; --subj-code-soft: #efecf7;
  --subj-other-ink: #5d5870; --subj-other-soft: #efecf7;
  --ui-orb-glow: 0 10px 22px rgba(74, 47, 201, 0.32);
  --ui-cap: #f0a030;
  --ui-aura: rgba(124, 92, 255, 0.12);
  --ui-lamp: #a35a00;
  --ui-lamp-soft: #fff1df;
  --ui-blue: #2259c7; --ui-blue-soft: #e6efff; --ui-teal: #086e6e; --ui-teal-soft: #ddf4f2;
  --ui-rose: #c02a69; --ui-rose-soft: #fde6ef; --ui-select: #6a4bf5;
  --ui-orange: #a8440f; --ui-orange-soft: #ffede0; --ui-slate: #545b70; --ui-slate-soft: #eceef5;
  --ui-success-line: #bfe6ce; --ui-warning-line: #f1d48a; --ui-warning-ink: #6b3f00;

  --ui-active: var(--ui-violet);
  --ui-active-soft: var(--ui-violet-soft);
  --ui-glass: var(--ui-card);

}
/* The talk stage is night whatever the theme, and so are a focus session's phone-down screen
   (web/focus.ts), a photo of hers open big (web/stuff.ts), the coding tutor's terminal and his
   editor's panel under the code (its terminal and problems, learn-editor.css) */
body.talk, .focus-session.is-down, .st-viewer, .lc-term, .lc-ed-panel {
  --ui-paper: #0f0d17; --ui-card: #191624; --ui-well: #141220; --ui-raised: #231f31; --ui-raised-2: #302b40;
  --ui-ink: #f3f1f9; --ui-ink-2: #b6b1c7; --ui-ink-3: #9b96ae; --ui-on-ink: #16131f;
  --ui-line: #2b2739; --ui-line-strong: #3d3850; --ui-hairline: #2b2739; --ui-hairline-strong: #3d3850;
  --ui-violet: #a894ff; --ui-violet-soft: #221c3f;
  --ui-accent: #6a4bf5; --ui-on-accent: #ffffff; --ui-accent-lip: #3a22a8; --ui-lip: #0a0910; --ui-lip-control: #3d3850; --ui-seg: #3d3850; --ui-seg-shadow: none;
  --ui-bubble: #2a2350; --ui-on-bubble: #f3f1f9;
  --ui-success: #4fd58f; --ui-success-soft: #12301f; --ui-warning: #ffc145; --ui-warning-soft: #35290f;
  --ui-danger: #ff8a8a; --ui-danger-soft: #3a1a1e; --ui-scrim: rgba(12, 15, 16, 0.36);
  --ui-orb-glow: 0 10px 34px rgba(124, 92, 255, 0.5); --ui-cap: #ffc27a; --ui-aura: rgba(124, 92, 255, 0.22);
  --ui-lamp: #ffc27a; --ui-lamp-soft: #33261a;
  --ui-blue: #6aa7ff; --ui-blue-soft: #16233d; --ui-teal: #3ed0c0; --ui-teal-soft: #0f2e2c;
  --ui-rose: #ff7a9c; --ui-rose-soft: #3a1826; --ui-select: #8e78ff;
  --ui-orange: #ff9f5a; --ui-orange-soft: #36200f; --ui-slate: #a9b1c9; --ui-slate-soft: #1d2130;
  --ui-success-line: #1e4a31; --ui-warning-line: #6b5216; --ui-warning-ink: #ffe2a3;
  --ui-glow: none;
  /* (a token made of other tokens is worked out where it is set: set again here, on the night values) */
  --ui-focus: var(--ui-violet); --ui-glass: #191624;
  --ui-shadow-sm: 0 0 0 rgba(0, 0, 0, 0);
  --ui-shadow-md: 0 12px 40px rgba(0, 0, 0, 0.28);
  --ui-shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.36);

  --ui-active: var(--ui-violet);
  --ui-active-soft: var(--ui-violet-soft);
}

/* What CORE draws and writes keeps the look it had: inside the board, its popover, the Stage, the
   study sheet and Zuvio's notes in the chat, every --ui-* name means the token it replaced, so a
   page rule that reaches in there (a button, a link) draws as before, in the typeface and ink they
   had. (:where weighs nothing: their own rules still win; this only changes what they inherit.) */
:where(#flat-board, #board-pop, .stage-sheet, .study-sheet, .msg.assistant, .msg.note, #notes-sample) {
  --ui-paper: var(--paper); --ui-card: var(--card); --ui-well: var(--well); --ui-raised: var(--raised);
  --ui-raised-2: var(--raised-2); --ui-ink: var(--ink); --ui-ink-2: var(--ink-2); --ui-ink-3: var(--ink-3);
  --ui-on-ink: var(--on-ink); --ui-line: var(--line); --ui-line-strong: var(--line-strong);
  --ui-hairline: var(--hairline); --ui-hairline-strong: var(--hairline-strong);
  --ui-violet: var(--violet); --ui-violet-soft: var(--violet-soft);
  --ui-accent: var(--action); --ui-on-accent: var(--on-action); --ui-accent-lip: var(--action-lip);
  --ui-lip: var(--lip-card); --ui-lip-control: var(--lip-control); --ui-bubble: var(--raised); --ui-on-bubble: var(--ink);
  --ui-success: var(--success); --ui-success-soft: var(--success-soft); --ui-warning: var(--warning);
  --ui-warning-soft: var(--warning-soft); --ui-danger: var(--danger); --ui-danger-soft: var(--danger-soft);
  --ui-focus: var(--focus); --ui-scrim: var(--scrim); --ui-glass: var(--glass); --ui-glow: var(--glow);
  --ui-shadow-sm: var(--shadow-sm); --ui-shadow-md: var(--shadow-md); --ui-shadow-lg: var(--shadow-lg);
  --ui-r-xs: var(--r-xs); --ui-r-sm: var(--r-sm); --ui-r-md: var(--r-md); --ui-r-lg: var(--r-lg);
  --ui-r-xl: var(--r-xl); --ui-r-pill: var(--r-full); --ui-r-full: var(--r-full);
  --ui-font: var(--font); --ui-font-display: var(--font-display); --ui-text-hello: var(--text-display);
  font-family: var(--font);
  color: var(--text, var(--ink));
}

/* The board draws on its own surfaces (--b-card and the rest, above): inside it, the names board.css
   and the page's rules draw with mean those, so at night a lesson sits on the charcoal of the page
   around it and by day on paper, with nothing in board.css renamed. (An id outweighs the theme's
   selectors; the --b-* names are read where they are used, so they still follow the theme.) */
#flat-board, #board-pop {
  --card: var(--b-card); --well: var(--b-well); --raised: var(--b-raised); --raised-2: var(--b-raised-2);
  --ink-2: var(--b-ink-2); --ink-3: var(--b-ink-3);
  --line: var(--b-line); --line-strong: var(--b-line-strong); --hairline: var(--b-hairline); --hairline-strong: var(--b-hairline-strong);
  --glass: var(--b-glass); --shadow-md: var(--b-shadow-md); --shadow-lg: var(--b-shadow-lg);
  --draw-plot: var(--b-plot); --draw-grid: var(--b-grid); --draw-ink: var(--b-draw-ink); --draw-muted: var(--b-draw-muted);
  --draw-stand: var(--b-stand); --draw-metal: var(--b-metal);
}

/* An iPhone or iPad zooms the page into a field whose text is under 16px: there, fields are 17px */
@media (pointer: coarse) {
  :root {
    --text-field: 17px;
  }
}

/* ---- the same keyboard focus ring everywhere */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0s;
    --dur: 0s;
    --dur-slow: 0s;
  }
}

/* Reading type (Settings > Appearance > Reading type; compat.js sets <html data-reading> before
   the page is drawn, from this device's choice): a typeface made to be easy to read, for everything
   she reads: the interface, the chat, the board's cards, her hand notes and the serif. Titles in the
   title face, maths and code keep theirs. A little more space between letters and words, which is
   what helps most readers with dyslexia whatever the face (docs/LEARNING.md 2.9). It sits on <html>,
   above :root's blocks, so it wins over both the page's tokens and what the board inherits. */
html[data-reading] {
  --font-serif: var(--font); --font-hand: var(--font);
  --ui-font: var(--font); --ui-font-display: var(--font);
}
html:is([data-reading="atkinson"], [data-reading="lexend"]) { letter-spacing: 0.01em; word-spacing: 0.05em; } /* OpenDyslexic is spaced wide already */
html[data-reading="atkinson"] { --font: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif; --font-display: var(--font); }
html[data-reading="lexend"] { --font: "Lexend", ui-sans-serif, system-ui, sans-serif; --font-display: var(--font); }
html[data-reading="opendyslexic"] { --font: "OpenDyslexic", ui-sans-serif, system-ui, sans-serif; --font-display: var(--font); }

/* Always night, whatever the theme: Capture (the camera's picture reads best on black) and a focus
   session's phone-down screen. Their ink and raised parts are the night ones by day too. */
.capture, .focus-session.is-down {
  --ui-ink: var(--ui-night-ink); --ui-ink-2: var(--ui-night-ink-2); --ui-ink-3: var(--ui-night-ink-2); --ui-raised: var(--ui-night-raised);
  --ui-card: var(--ui-night-raised); --ui-line: var(--ui-night-line); --ui-paper: var(--ui-night-paper); --ui-line-strong: var(--ui-night-line-strong);
}
