@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

/* ===========================================================================
   DevPath Design System
   ---------------------------------------------------------------------------
   One visual language for every page in the app.

   IMPORTANT - why `html:root` and not `:root`:
   Every page in this repo ships its own inline <style> block containing a
   `:root {}` token set. A plain `:root` here would lose to those blocks (equal
   specificity, and the inline <style> comes later in the document). `html:root`
   scores one point higher on specificity, so it wins regardless of source
   order. That lets this one file re-skin all ~18.5k pages without editing them.

   Contrast figures in comments are measured against --bg (#0B0F19) and are
   WCAG 2.2 ratios. AA needs 4.5:1 for body text, 3:1 for large/bold text and
   for non-text UI boundaries.
   =========================================================================== */

html:root {
  /* --- Base surfaces. Never pure black: #000 on an OLED panel produces harsh
         edge contrast and smearing on scroll. These sit at a comfortable
         luminance floor instead. ------------------------------------------- */
  /* Widest a page column grows (DESIGN.md "Page frame"). Pages fill the
     shell up to this; it only stops a line running across an ultrawide. */
  --ds-page-max:      1680px;
  --ds-settings-max:  1040px;  /* settings-style pages: index + one column of cards */
  --ds-settings-index-w: 200px;

  --ds-bg:            #0B0F19;  /* app canvas                                */
  --ds-bg-sunken:     #080B12;  /* wells, code blocks, inset areas           */
  --ds-surface:       #111827;  /* nav, bars, sticky chrome                  */
  --ds-surface-2:     #1A1F2E;  /* raised panels                             */
  --ds-surface-3:     #1E293B;  /* cards                                     */
  --ds-surface-4:     #243145;  /* card hover / nested cards                 */
  --ds-border:        #334155;  /* default border      - 2.4:1 vs bg         */
  --ds-border-subtle: #1F2937;  /* hairline dividers                         */
  --ds-border-strong: #475569;  /* focus-within, active borders - 3.4:1      */

  /* --- Text ----------------------------------------------------------------
         Four steps only. More than four and hierarchy stops reading. */
  --ds-text:          #F8FAFC;  /* 17.9:1 ✓ AAA                              */
  --ds-text-2:        #CBD5E1;  /* 12.1:1 ✓ AAA - body copy                  */
  --ds-text-muted:    #94A3B8;  /*  6.9:1 ✓ AA  - captions, metadata         */
  --ds-text-subtle:   #6E7D93;  /*  4.6:1 ✓ AA  - decorative/large first */
  --ds-text-on-fill:  #FFFFFF;  /* text sitting on a saturated fill          */

  /* --- Accent ---------------------------------------------------------------
         Two blues on purpose. A single blue cannot both pass AA as text on a
         dark canvas AND pass AA as a fill behind white text - those pull in
         opposite directions. So: -fill for backgrounds, plain for text. */
  --ds-accent:        #60A5FA;  /*  8.0:1 ✓ AA  - links, icons, accents      */
  --ds-accent-fill:   #2563EB;  /* white on this = 5.2:1 ✓ AA - buttons      */
  --ds-accent-hover:  #1D4ED8;
  --ds-accent-quiet:  rgba(96, 165, 250, .12);
  --ds-accent-line:   rgba(96, 165, 250, .32);

  /* --- Semantic -------------------------------------------------------------
         Each has a text tone (readable on dark) and a fill tone (readable
         under white). Hue alone never carries meaning - every semantic state
         in the components below also ships an icon or text label, so the
         system stays legible for deuteranopia/protanopia users. */
  --ds-success:       #34D399;  /* 10.3:1 ✓ */
  --ds-success-fill:  #059669;  /* white = 4.6:1 ✓ */
  --ds-success-quiet: rgba(52, 211, 153, .12);

  --ds-warning:       #FBBF24;  /* 12.6:1 ✓ */
  --ds-warning-fill:  #B45309;  /* white = 5.1:1 ✓ */
  --ds-warning-quiet: rgba(251, 191, 36, .12);

  --ds-danger:        #F87171;  /*  7.1:1 ✓ */
  --ds-danger-fill:   #DC2626;  /* white = 5.9:1 ✓ */
  --ds-danger-quiet:  rgba(248, 113, 113, .12);

  --ds-info:          var(--ds-accent);
  --ds-info-fill:     var(--ds-accent-fill);
  --ds-info-quiet:    var(--ds-accent-quiet);

  --ds-purple:        #C4B5FD;  /*  9.5:1 ✓ */
  --ds-purple-fill:   #7C3AED;  /* white = 5.3:1 ✓ */
  --ds-purple-quiet:  rgba(196, 181, 253, .12);

  /* --- Spacing - strict 8px system, 4px half-step for icon/text gaps ------ */
  --ds-space-1:  4px;
  --ds-space-2:  8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 24px;
  --ds-space-6: 32px;
  --ds-space-7: 48px;
  --ds-space-8: 64px;

  /* --- Typography ---------------------------------------------------------
         --ds-font-scale is multiplied into every step, so the accessibility
         panel's font-size slider scales the whole system proportionally
         rather than overriding sizes one by one. */
  --ds-font-scale: 1;
  --ds-font-sans: -apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --ds-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;

  /* rem, not px: at the default 16px root these are exactly 11.5 / 12.5 /
     14 / 16 / 20 / 26 / 34px, and a reader who raises the browser's own text
     size now gets bigger text too - px tokens ignored that setting entirely,
     leaving only the in-app slider (which multiplies on top of this). */
  --ds-text-xs:   calc(0.71875rem * var(--ds-font-scale));
  --ds-text-sm:   calc(0.78125rem * var(--ds-font-scale));
  --ds-text-base: calc(0.875rem   * var(--ds-font-scale));
  --ds-text-md:   calc(1rem       * var(--ds-font-scale));
  --ds-text-lg:   calc(1.25rem    * var(--ds-font-scale));
  --ds-text-xl:   calc(1.625rem   * var(--ds-font-scale));
  --ds-text-2xl:  calc(2.125rem   * var(--ds-font-scale));
  /* Display: one fluid step for marketing heroes, the focus clock and a
     hero figure - 40px on a phone, 64px on a wide screen. */
  --ds-text-3xl:  calc(clamp(2.5rem, 1.5rem + 3.5vw, 4rem) * var(--ds-font-scale));
  /* Relative, not a step: inline code / kbd inside text of any size. */
  --ds-text-inline: .9em;

  --ds-leading-tight: 1.2;
  --ds-leading-snug:  1.4;
  --ds-leading-body:  1.6;
  --ds-tracking-wide: .06em;

  /* --- Radius -------------------------------------------------------------
         Four steps (DESIGN.md, "Radius and elevation"): sm controls,
         default cards, xl dialogs, pill. -lg is the default step under the
         current design (legacy themes give it 14px). */
  --ds-radius-sm:   6px;
  --ds-radius:     10px;
  --ds-radius-lg:  14px;
  --ds-radius-xl:  20px;
  --ds-radius-pill: 999px;
  --ds-agent-w:    400px;  /* docked dashboard Agent panel column (DESIGN.md, "Agent panel") */

  /* --- Elevation - darkness, not blur haze. On a dark canvas a light shadow
         reads as fog; depth has to come from a darker cast plus a hairline. */
  --ds-shadow-sm: 0 1px 2px rgba(0, 0, 0, .40);
  /* Study-page screenshots: never taller than this, whatever their native size. */
  --ds-shot-max-h: min(420px, 60vh);
  --ds-shadow:    0 4px 12px rgba(0, 0, 0, .45);
  --ds-shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  --ds-shadow-xl: 0 24px 64px rgba(0, 0, 0, .65);

  /* --- Fixed swatches --------------------------------------------------------
     The mid-tone palette CLAUDE.md documents for JS-painted colours (a
     hardcoded hex fallback in var(--x, #4C6EF5) style, scattered across
     assets/js/*.js) named as tokens, so a plain CSS rule that wants the same
     fixed hues - a swatch scale, not a themed surface - can reference them
     instead of repeating the hex. Same hues in both themes on purpose. */
  --ds-swatch-blue:   #4C6EF5;
  --ds-swatch-purple: #8B5CF6;
  --ds-swatch-teal:   #0D9488;
  --ds-swatch-amber:  #C2740B;
  --ds-swatch-green:  #12905A;
  --ds-swatch-rose:   #DC2F52;
  --ds-swatch-orange: #DB6A1E;
  --ds-swatch-cyan:   #0E86A8;
  --ds-swatch-slate:  #64748B;

  /* --- Scrollbar ------------------------------------------------------------
     Thin, rounded, matched to the surface tokens - the default OS scrollbar
     (chunky, square, light-grey) was the one visibly un-themed element on an
     otherwise dark, tokenized page. */
  --ds-scrollbar-w: 10px;

  /* --- Motion - 150-250ms. Anything slower feels laggy on repeat use. ----- */
  --ds-motion-fast: 150ms;
  --ds-motion:      200ms;
  --ds-motion-slow: 250ms;
  --ds-ease: cubic-bezier(.2, .8, .2, 1);

  /* --- Z-index ------------------------------------------------------------
         Named layers instead of ad-hoc integers. The 9000-10000 band was
         already claimed by pre-existing floating widgets, so shell chrome
         sits below it and true overlays sit above it. */
  --ds-z-base:      1;
  --ds-z-sticky:    100;
  /* Full-page "loading your data" overlays (page-skeleton.254abf175d7a.js's .ds-skel-page,
     cloud-loading-overlay.254abf175d7a.js's #cloud-loading) belong here, below the shell
     chrome - the whole point of both is that the nav is real and already
     usable while the page's own data is still arriving, so the overlay must
     never outrank --ds-z-sidebar/--ds-z-navbar the way a true modal would. */
  --ds-z-loading:   7000;
  --ds-z-sidebar:   7900;
  --ds-z-navbar:    8000;
  --ds-z-legacy:    9000;   /* reserved: existing floating widgets           */
  --ds-z-backdrop:  10300;
  --ds-z-drawer:    10400;
  --ds-z-palette:   10500;
  --ds-z-toast:     10600;
  --ds-z-skiplink:  10700;

  --ds-navbar-h: 46px;
  --ds-sidebar-w: 248px;

  color-scheme: dark;

  /* ------------------------------------------------------------------------
     Bridge to the legacy token names.
     ~18.5k pages already style themselves with --bg / --surface / --accent /
     --must / --good / --text / --muted etc. Re-pointing those names here
     means every one of those pages adopts this palette with no edit at all.
     ---------------------------------------------------------------------- */
  --bg: var(--ds-bg);
  --surface: var(--ds-surface-3);
  --surface2: var(--ds-surface-4);
  --surface3: var(--ds-surface-4);
  --surface-raised: var(--ds-surface-4);
  --border: var(--ds-border);
  --border2: var(--ds-border-subtle);
  --border3: var(--ds-border-subtle);
  --text: var(--ds-text);
  --text-2: var(--ds-text-2);
  --muted: var(--ds-text-muted);
  --subtle: var(--ds-text-subtle);
  --dim: var(--ds-text-muted);
  --text2: var(--ds-text-muted);
  --text-bright: var(--ds-text);

  --accent: var(--ds-accent);
  --accent-bg: var(--ds-accent-quiet);
  --accent-bd: var(--ds-accent-line);
  --must: var(--ds-accent-fill);
  --must-bg: var(--ds-accent-quiet);
  --must-bd: var(--ds-accent-line);
  --must-border: var(--ds-accent-line);
  --good: var(--ds-purple);
  --good-bg: var(--ds-purple-quiet);
  --good-bd: rgba(196, 181, 253, .32);
  --good-border: rgba(196, 181, 253, .32);
  --skip: var(--ds-text-subtle);
  --skip-bg: rgba(100, 116, 139, .10);
  --skip-bd: rgba(100, 116, 139, .25);
  --skip-border: rgba(100, 116, 139, .25);
  --done: var(--ds-success);
  --done-bg: var(--ds-success-quiet);
  --done-bd: rgba(52, 211, 153, .30);
  --done-border: rgba(52, 211, 153, .30);
  --warn: var(--ds-warning);
  --warn-bg: var(--ds-warning-quiet);
  --warn-border: rgba(251, 191, 36, .30);
  --danger: var(--ds-danger);
  --danger-bg: var(--ds-danger-quiet);

  --blue: var(--ds-accent-fill);
  --cyan: var(--ds-accent);
  --purple: var(--ds-purple);
  --violet: var(--ds-purple);
  --green: var(--ds-success);
  --red: var(--ds-danger);
  --orange: var(--ds-warning);
  --yellow: var(--ds-warning);
  --teal: var(--ds-accent);
  --pink: #F472B6;
  --amber: var(--ds-warning);
  --rose: var(--ds-danger);
  --bad: var(--ds-danger);
  --faint: var(--ds-text-subtle);
  --brand: var(--ds-accent);
  --brand-dim: var(--ds-accent-line);
  --bg-elev: var(--ds-surface-3);
  --bg-elev2: var(--ds-surface-4);
  --bg-input: var(--ds-surface-2);
  --bg-raised: var(--ds-surface-3);
  --bg-card: var(--ds-surface-3);
  --card: var(--ds-surface-3);
  --card2: var(--ds-surface-4);
  --border-soft: var(--ds-border);
  --bdr: var(--ds-border);
  --bdr2: var(--ds-border-subtle);
  --shadow: var(--ds-shadow-lg);
  --r: var(--ds-radius);
  --easy: var(--ds-success);
  --med: var(--ds-warning);
  --hard: var(--ds-danger);

  --code-bg: var(--ds-bg-sunken);
  --code-bd: var(--ds-border-subtle);
  --code-border: var(--ds-border-subtle);
  --hl-kw: #93C5FD;
  --hl-str: var(--ds-success);
  --hl-num: var(--ds-warning);
  --hl-cm: var(--ds-text-muted);
  --hl-fn: var(--ds-purple);
  --hl-cls: #F472B6;
  --hl-ann: var(--ds-warning);
  --hl-type: #7DD3FC;
  --kw: var(--hl-kw);  --ty: var(--hl-type); --st: var(--hl-str);
  --cm: var(--hl-cm);  --num: var(--hl-num); --ann: var(--hl-ann);
  --op: var(--ds-accent); --fn: var(--hl-fn);

  --code-fg: var(--ds-text-2);

  /* Foreground for text/glyphs sitting on a --brand / --amber / --teal fill.
     Those fills are bright on dark and dark on light, so the readable
     foreground flips with the theme - pages must not hardcode either end. */
  --on-accent: #0B0F19;

  --font-body: var(--ds-font-sans);
  --font-mono: var(--ds-font-mono);
  --sans: var(--ds-font-sans);
  --mono: var(--ds-font-mono);
}

/* ===========================================================================
   LIGHT THEME
   ---------------------------------------------------------------------------
   Dark is the default, but this is not a dark-only system: /roadmap ships a
   light-first palette with its own [data-theme="dark"] override, so shell
   chrome has to be able to follow a light page instead of sitting on it as a
   dark slab. app-shell.254abf175d7a.js measures the page's real background luminance at
   boot and stamps data-ds-theme, so mixed-theme pages resolve automatically.

   Ratios below are against --ds-bg (#F8FAFC). Not pure white - a pure #FFF
   canvas under a full-page reading layout is the light-mode equivalent of
   pure black: too much raw contrast for long sessions.
   =========================================================================== */
html[data-ds-theme="light"]:root {
  color-scheme: light;
  --ds-bg:            #F8FAFC;
  --ds-bg-sunken:     #EEF2F7;
  --ds-surface:       #FFFFFF;
  --ds-surface-2:     #F1F5F9;
  --ds-surface-3:     #FFFFFF;
  --ds-surface-4:     #F1F5F9;
  --ds-border:        #B8C4D3;
  --ds-border-subtle: #D9E0EA;
  --ds-border-strong: #8592A6;

  --ds-text:          #0F172A;  /* 16.9:1 ✓ AAA */
  --ds-text-2:        #334155;  /*  9.0:1 ✓ AAA */
  --ds-text-muted:    #3B4757;  /*  9.0:1 ✓ AAA */
  --ds-text-subtle:   #4E5B6E;  /*  6.6:1 ✓ AA  */

  --ds-accent:        #1D4ED8;  /*  7.0:1 ✓ AA  */
  --ds-accent-fill:   #2563EB;  /* white = 5.2:1 ✓ */
  --ds-accent-hover:  #1E40AF;
  --ds-accent-quiet:  rgba(37, 99, 235, .10);
  --ds-accent-line:   rgba(37, 99, 235, .28);

  --ds-success:       #047857;  /*  5.1:1 ✓ */
  --ds-success-fill:  #047857;
  --ds-success-quiet: rgba(4, 120, 87, .10);
  --ds-warning:       #B45309;  /*  4.6:1 ✓ */
  --ds-warning-fill:  #B45309;
  --ds-warning-quiet: rgba(180, 83, 9, .10);
  --ds-danger:        #B91C1C;  /*  6.4:1 ✓ */
  --ds-danger-fill:   #B91C1C;
  --ds-danger-quiet:  rgba(185, 28, 28, .10);
  --ds-purple:        #6D28D9;  /*  7.4:1 ✓ */
  --ds-purple-fill:   #6D28D9;
  --ds-purple-quiet:  rgba(109, 40, 217, .10);

  --ds-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --ds-shadow:    0 4px 12px rgba(15, 23, 42, .08);
  --ds-shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --ds-shadow-xl: 0 24px 64px rgba(15, 23, 42, .18);

  /* Syntax highlighting. The dark set above is tuned for #080B12; every one of
     those tones is 2-3:1 on a light well and the near-white --hl-fn is
     invisible outright, so light mode needs its own set rather than inheriting.
     Ratios are against --ds-bg-sunken (#EEF2F7), the code-block background. */
  --hl-kw:   #6D28D9;  /*  7.0:1 ✓ */
  --hl-type: #0E7490;  /*  4.9:1 ✓ */
  --hl-str:  #047857;  /*  4.8:1 ✓ */
  --hl-num:  #A34B07;  /*  5.3:1 on code-block surfaces (#B45309 was 4.5) */
  --hl-cm:   var(--ds-text-muted);  /* subtle failed 4.5:1 on code-block surfaces */
  --hl-fn:   #1D4ED8;  /*  6.6:1 ✓ */
  --hl-cls:  #BE185D;  /*  5.4:1 ✓ */
  --hl-ann:  #A34B07;  /*  5.3:1 on code-block surfaces */
  --code-fg: var(--ds-text-2);
  --on-accent: #FFFFFF;
  --pink: #BE185D;    /* the dark-mode #F472B6 is 2.1:1 on a light page */

  /* Legacy page-local names that nothing above re-pointed, so in light mode
     they stayed the near-black their page's inline :root gave them - code
     blocks and tinted boxes rendered as dark slabs under dark text. */
  --bg2: var(--ds-surface-2);
  --bg3: var(--ds-bg-sunken);
  --bg4: var(--ds-border-subtle);
  --codebg: var(--ds-bg-sunken);
  --bg-code: var(--ds-bg-sunken);
  --blue-bg: var(--ds-accent-quiet);   --blue-bg2: var(--ds-accent-quiet);
  --cyan-bg: var(--ds-accent-quiet);   --blue-d: var(--ds-accent-quiet);
  --blue-dim: var(--ds-accent-quiet);  --cyan-dim: var(--ds-accent-quiet);
  --blue-border: var(--ds-accent-line);
  --purple-bg: var(--ds-purple-quiet); --purple-d: var(--ds-purple-quiet);
  --purple-dim: var(--ds-purple-quiet); --purple-dark: var(--ds-purple-quiet);
  --purple-border: rgba(109, 40, 217, .28);
  --green-bg: var(--ds-success-quiet); --green-dim: var(--ds-success-quiet);
  --red-bg: var(--ds-danger-quiet);    --red-d: var(--ds-danger-quiet);
  --red-dim: var(--ds-danger-quiet);   --red-dark: var(--ds-danger-quiet);
  --red-border: rgba(185, 28, 28, .28);
  --amber-bg: var(--ds-warning-quiet); --amber-dim: var(--ds-warning-quiet);
  --orange-bg: var(--ds-warning-quiet); --orange-d: var(--ds-warning-quiet);
  --orange-dim: var(--ds-warning-quiet);
  --amber-border: rgba(180, 83, 9, .28);
  --pink-bg: rgba(190, 24, 93, .10);   --pink-d: rgba(190, 24, 93, .10);
  --pink-dim: rgba(190, 24, 93, .10);
}
/* Light mode only: pale dark-theme colours inlined in page markup (style="color:#...")
   are near-invisible on a light page. Dark mode keeps the inline value. */
html[data-ds-theme="light"] [style*="color:#f87171"],
html[data-ds-theme="light"] [style*="color:#F87171"] { color: var(--ds-danger) !important; }
html[data-ds-theme="light"] [style*="color:#4ade80"],
html[data-ds-theme="light"] [style*="color:#4ADE80"] { color: var(--ds-success) !important; }
html[data-ds-theme="light"] [style*="color:#fbbf24"],
html[data-ds-theme="light"] [style*="color:#FBBF24"],
html[data-ds-theme="light"] [style*="color:#ffe0a3"],
html[data-ds-theme="light"] [style*="color:#FFE0A3"] { color: var(--ds-warning) !important; }
html[data-ds-theme="light"] [style*="color:#a78bfa"],
html[data-ds-theme="light"] [style*="color:#A78BFA"] { color: var(--ds-purple) !important; }
html[data-ds-theme="light"] [style*="color:#7dd3fc"],
html[data-ds-theme="light"] [style*="color:#7DD3FC"],
html[data-ds-theme="light"] [style*="color:#60a5fa"],
html[data-ds-theme="light"] [style*="color:#60A5FA"] { color: var(--ds-accent) !important; }
html[data-ds-theme="light"] [style*="color:#cbd5e1"],
html[data-ds-theme="light"] [style*="color:#CBD5E1"],
html[data-ds-theme="light"] [style*="color:#dde4f0"],
html[data-ds-theme="light"] [style*="color:#DDE4F0"] { color: var(--ds-text-2) !important; }
html[data-ds-theme="light"] [style*="color:#94a3b8"],
html[data-ds-theme="light"] [style*="color:#94A3B8"],
html[data-ds-theme="light"] [style*="color:#9ca3af"],
html[data-ds-theme="light"] [style*="color:#9CA3AF"] { color: var(--ds-text-muted) !important; }
html[data-ds-theme="light"] [style*="color:#c3e88d"],
html[data-ds-theme="light"] [style*="color:#C3E88D"] { color: var(--hl-str) !important; }
html[data-ds-theme="light"] [style*="color:#f472b6"],
html[data-ds-theme="light"] [style*="color:#F472B6"] { color: var(--pink) !important; }
/* Generated phase pages ship a ghost numeral (colour --border2, ~1.2:1) in an
   inline style. It is the topic's number, so it has to be readable in dark too;
   `html .topic-num` beats the page's `.topic-num` but not `.content--fresh .topic-num`. */
html .topic-num { color: var(--ds-text-muted); }
html[data-ds-theme="light"] .topic-num { color: var(--ds-text-muted); }
html[data-ds-theme="light"] .answer-body { background: var(--ds-bg-sunken); }
html[data-ds-theme="light"] .co-amazon { color: #fff; }
html[data-ds-theme="light"] .g-nav__btn--go { color: var(--on-accent); }
html[data-ds-theme="light"] .ds-backdrop { background: rgba(15, 23, 42, .45); }

/* ===========================================================================
   ACCESSIBILITY PREFERENCES
   Driven by data-* attributes the accessibility panel writes onto <html>.
   =========================================================================== */

/* One typeface on every page, shell or not. design-new.254abf175d7a.css (injected by the
   app shell) sets Geist, so pages without the shell - landing, login, labs,
   and dialogs that open before the shell runs - used to fall back to the
   system stack and read as a different site. The same family and type
   scale are declared here, one :root lower than design-new so it still owns
   them where it loads. Legacy themes keep their own system stack. */
html:not([data-ds-design="legacy"]):root:root {
  --ds-font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ds-font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  --ds-text-xs:   calc(0.75rem    * var(--ds-font-scale));
  --ds-text-sm:   calc(0.8125rem  * var(--ds-font-scale));
  --ds-text-lg:   calc(1.1875rem  * var(--ds-font-scale));
  --ds-text-xl:   calc(1.5rem     * var(--ds-font-scale));
  --ds-text-2xl:  calc(2rem       * var(--ds-font-scale));
}

html[data-ds-font="lg"]  { --ds-font-scale: 1.15; }
html[data-ds-font="xl"]  { --ds-font-scale: 1.35; }
html[data-ds-font="xxl"] { --ds-font-scale: 1.6; }

/* Raise every text tone to its next step up and harden borders. */
html[data-ds-contrast="high"]:root {
  --ds-text-2:      #FFFFFF;
  --ds-text-muted:  #E2E8F0;
  --ds-text-subtle: #CBD5E1;
  --ds-border:      #64748B;
  --ds-border-subtle: #475569;
  --ds-accent:      #93C5FD;
  --ds-bg:          #05070C;
}
html[data-ds-contrast="high"] *,
html[data-ds-contrast="high"] *::before,
html[data-ds-contrast="high"] *::after { border-color: var(--ds-border-strong) !important; }

/* "Underline links" is for links inside reading text. Chrome (nav, headers,
   sidebars, brand marks, icon links, tabs, cards) already reads as a link by
   position, and a full-weight underline under a logo or menu item looks broken. */
html[data-ds-links="underline"] a:not(.ds-btn):not(.ds-nav-link):not([role="tab"]):not([role="button"]):not(.link-btn):not(:has(> svg, > img)):not(nav a, header a, aside a, [role="navigation"] a, .ds-shell-side a, .ds-shell-top a, .ds-mobilenav a, .ds-dock a, .ds-breadcrumb a) {
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
html[data-ds-links="highlight"] a:not(.ds-btn) {
  background: var(--ds-warning-quiet) !important;
  outline: 1px solid var(--ds-warning) !important;
  border-radius: var(--ds-radius-sm);
}

html[data-ds-focus="strong"] :focus-visible {
  outline: 4px solid var(--ds-warning) !important;
  outline-offset: 3px !important;
  border-radius: var(--ds-radius-sm);
}

/* One typeface everywhere. Thousands of pages ship their own font-family
   ('Inter', 'SF Mono', 'JetBrains Mono' on labels, system stacks...), so the
   same kind of text looked different page to page. Every element now wears
   the theme's sans face; only real code (code/kbd/pre/samp and what is inside
   them) keeps the mono face. !important because the page rules are inline
   <style> blocks. A code editor that is a <textarea> opts in with .ds-mono.
   A font chosen in Settings (--ds-user-font) is honoured,
   and the dyslexia-friendly font still wins - it is excluded. */
html:root:not([data-ds-dyslexic="on"]) body,
html:root:not([data-ds-dyslexic="on"]) body *:not(code, kbd, pre, samp, pre *, code *, kbd *, samp *, .ds-mono, .ds-mono *, svg text, .CodeMirror *, .monaco-editor *, .cm-editor *) {
  font-family: var(--ds-user-font, var(--ds-font-sans)) !important;
}
html:root:not([data-ds-dyslexic="on"]) body :is(code, kbd, pre, samp, pre *, code *, kbd *, samp *, .ds-mono, .ds-mono *) {
  font-family: var(--ds-font-mono) !important;
}

html[data-ds-dyslexic="on"] body,
html[data-ds-dyslexic="on"] body * {
  font-family: 'Comic Sans MS', 'Trebuchet MS', Verdana, sans-serif !important;
  letter-spacing: .05em;
  word-spacing: .16em;
}

html[data-ds-spacing="on"] body p,
html[data-ds-spacing="on"] body li,
html[data-ds-spacing="on"] body td {
  line-height: 2 !important;
  letter-spacing: .12em !important;
  word-spacing: .16em !important;
}

/* Both the OS-level setting and the in-app toggle must silence motion. */
html[data-ds-motion="reduce"] *,
html[data-ds-motion="reduce"] *::before,
html[data-ds-motion="reduce"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  /* ...except an indicator whose whole job is to say "still working".
   *
   * The blanket rule above is the standard one, and it is right for decoration
   * - but it also caps a loading spinner at ONE iteration of .001ms, which
   * stops it dead. Measured on the six pages carrying the #auth-checking veil:
   * with reduced motion on, the ring rendered one microsecond-long rotation
   * and then sat there, a static circle with a coloured segment. A person
   * waiting on a slow Firebase sign-in could not tell that from a hung page,
   * so the setting that is supposed to make the product calmer made it look
   * broken instead.
   *
   * Motion that communicates status is the recognised exception to reducing
   * motion, so these keep turning - slower, because there is no reason for a
   * status indicator to be brisk. Anything else that genuinely needs to keep
   * moving can opt in with data-ds-motion="essential" rather than by adding
   * another selector here. */
  .ds-spinner,
  #auth-checking > div,
  [data-ds-motion="essential"] {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }
}

/* Reading guide - a ruler that tracks the pointer to hold your line. */
#ds-reading-guide {
  position: fixed; left: 0; right: 0; height: 40px; pointer-events: none;
  z-index: var(--ds-z-toast);
  border-top: 2px solid var(--ds-warning);
  border-bottom: 2px solid var(--ds-warning);
  background: rgba(251, 191, 36, .07);
  display: none;
}
html[data-ds-guide="on"] #ds-reading-guide { display: block; }

/* ===========================================================================
   FOUNDATIONS
   =========================================================================== */

/* A visible focus ring on every interactive element, everywhere. :focus-visible
   keeps it off for mouse users so it never reads as visual noise. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
  border-radius: var(--ds-radius-sm);
}

/* --- Links ------------------------------------------------------------------
   No link wears the browser's look: no default blue/purple, no underline.
   Colour is a zero-specificity floor, so a component that colours its own
   links still wins. The underline is removed with !important because ~5,900
   generated pages ship their own `a:hover{text-decoration:underline}`; the
   one way back is the reader's own "Underline links" setting
   (data-ds-links="underline", above), which this rule steps aside for.
   Done-state strike-throughs on links are kept. DESIGN.md, "Links". */
:where(a:any-link) { color: var(--ds-accent); }
:where(a:any-link):hover { color: color-mix(in srgb, var(--ds-accent) 78%, var(--ds-text)); }
html:root:not([data-ds-links="underline"]) :is(a, .text-button, .sl-link, .signout-link, .tsv-upgrade):not(.fb-item.is-done a) {
  text-decoration-line: none !important;
}

/* A disclosure that kept the browser's triangle gets the design system's
   chevron. Only unclassed <details> (and the few listed) - every classed one
   already draws its own marker, often on ::before. */
:where(details:not([class]), .rr-paste, .ds-notify__details) > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--ds-space-2); }
:where(details:not([class]), .rr-paste, .ds-notify__details) > summary::-webkit-details-marker { display: none; }
:where(details:not([class]), .rr-paste, .ds-notify__details) > summary::before {
  content: ""; flex: none; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  rotate: -45deg; transition: rotate var(--ds-motion-fast) var(--ds-ease); opacity: .7;
}
:where(details:not([class])[open], .rr-paste[open], .ds-notify__details[open]) > summary::before { rotate: 45deg; }

.ds-skip-link {
  position: absolute; left: var(--ds-space-2); top: -100px;
  z-index: var(--ds-z-skiplink);
  background: var(--ds-accent-fill); color: var(--ds-text-on-fill);
  padding: var(--ds-space-3) var(--ds-space-4);
  border-radius: var(--ds-radius);
  font: 600 var(--ds-text-base) / 1 var(--ds-font-sans);
  text-decoration: none;
  transition: top var(--ds-motion-fast) var(--ds-ease);
}
.ds-skip-link:focus { top: var(--ds-space-2); }

/* Available to any page; used by the shell for screen-reader-only labels. */
.ds-sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ===========================================================================
   COMPONENTS
   =========================================================================== */

/* --- Every button's pressed and disabled look ------------------------------
   73 button classes grew up page by page and most defined a hover and
   nothing else. These are the floor, at zero specificity (:where), so a
   component that styles its own states still wins. `translate`, not
   `transform`, so a button that is already transformed keeps its transform. */
:where(button, [role="button"], .ds-btn):not(:disabled):not([aria-disabled="true"]):active { translate: 0 1px; }
:where(button:disabled, [role="button"][aria-disabled="true"]) { cursor: not-allowed; opacity: .55; }
:where(button[aria-busy="true"]) { cursor: progress; }
@media (pointer: coarse) {
  :where(.d-btn, .sd-btn, .sg-btn, .xc-btn, .fb-btn) { min-height: 44px; }
}

/* A field that removed its outline still shows where focus is. Element +
   pseudo-class (0,1,1) outranks the single-class `outline:none` rules that
   removed it, without !important. */
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 1px; }

/* --- Heading scale --------------------------------------------------------
   The default every page starts from (DESIGN.md, "Type"). Zero specificity
   via :where(), so a page that deliberately sizes a heading still wins - this
   only replaces the browser default, which is how page titles had drifted
   from 1rem to 3.65rem across 30 pages. */
:where(h1) { font-size: var(--ds-text-2xl); line-height: var(--ds-leading-tight, 1.2); }
:where(h2) { font-size: var(--ds-text-xl);  line-height: var(--ds-leading-tight, 1.2); }
:where(h3) { font-size: var(--ds-text-lg);  line-height: 1.3; }
:where(h4) { font-size: var(--ds-text-md);  line-height: 1.4; }

/* --- Button --------------------------------------------------------------- */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--ds-space-2);
  padding: var(--ds-space-2) var(--ds-space-4);
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-sm);
  font: 600 var(--ds-text-base) / 1 var(--ds-font-sans);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  touch-action: manipulation;
  transition: background var(--ds-motion-fast) var(--ds-ease),
              border-color var(--ds-motion-fast) var(--ds-ease),
              color var(--ds-motion-fast) var(--ds-ease),
              transform var(--ds-motion-fast) var(--ds-ease);
}
.ds-btn--primary { background: var(--ds-accent-fill); color: var(--ds-text-on-fill); position: relative; overflow: hidden; }
.ds-btn--primary:hover { background: var(--ds-accent-hover); }
/* Shimmer sweep on hover - a thin diagonal highlight crossing the fill, not a
   second surface, so it stays a low-alpha wash over --ds-accent-fill/hover
   rather than a hardcoded colour needing a theme pair. */
.ds-btn--primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .35) 50%, transparent 60%);
  background-size: 250% 100%;
  background-position: 150% 0;
  pointer-events: none;
}
.ds-btn--primary:hover::after { animation: ds-btn-shimmer .9s ease; }
@keyframes ds-btn-shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ds-btn--primary::after { display: none; }
}
/* Secondary tier: a quiet outlined button - transparent fill, hairline
   border, medium weight. Reads as "the other option" next to a filled
   primary instead of a second, greyer slab. */
.ds-btn--secondary { background: transparent; color: var(--ds-text-2); border-color: var(--ds-border-subtle); font-weight: 500; letter-spacing: -.01em; }
.ds-btn--secondary:hover { background: var(--ds-surface-2); color: var(--ds-text); border-color: var(--ds-border-strong); }
.ds-btn--ghost { background: transparent; color: var(--ds-text-2); }
.ds-btn--ghost:hover { background: var(--ds-surface-3); color: var(--ds-text); }
.ds-btn--danger { background: var(--ds-danger-fill); color: var(--ds-text-on-fill); }
.ds-btn--danger:hover { filter: brightness(1.08); }
.ds-btn--sm { min-height: 28px; padding: var(--ds-space-1) var(--ds-space-3); font-size: var(--ds-text-sm); }
.ds-btn--icon { padding: var(--ds-space-2); min-width: 36px; }
.ds-btn:not([disabled]):not([aria-disabled="true"]):active { transform: translateY(1px); }
/* A finger is not a cursor: 36px is a comfortable mouse target and a missed
   tap. Touch screens get the 44px WCAG / platform minimum; a small button
   still reaches the 40px floor the phone UI audit holds every control to. */
@media (pointer: coarse) { .ds-btn { min-height: 44px; } .ds-btn--sm { min-height: 40px; } .ds-btn--icon { min-width: 40px; } }
/* iOS zooms the whole page when a field under 16px takes focus, and does not
   zoom back out. Every text field on a touch screen is at least 16px - one
   rule rather than a fix per page (sign-in, Git Atlas and Revision search
   were all 12-14px). The :not() list keeps the specificity above the
   page-level class rules that set the smaller size. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea { font-size: max(16px, 1em); } /* type-ok: 16px stops iOS zooming into a focused field */
}
.ds-btn[disabled], .ds-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* --- Card ----------------------------------------------------------------- */
.ds-card {
  background: var(--ds-surface-3);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-5);
}
.ds-card--interactive {
  cursor: pointer;
  transition: border-color var(--ds-motion-fast) var(--ds-ease),
              background var(--ds-motion-fast) var(--ds-ease),
              transform var(--ds-motion-fast) var(--ds-ease),
              box-shadow var(--ds-motion-fast) var(--ds-ease);
}
.ds-card--interactive:hover {
  border-color: var(--ds-border-strong); background: var(--ds-surface-4);
  transform: translateY(-2px); box-shadow: var(--ds-shadow);
}
.ds-card--interactive:active { transform: translateY(0); }

/* --- Input ---------------------------------------------------------------- */
/* Fields are width:100% + padding + border almost everywhere; under the UA's
   content-box that overflows the container (planner dialog, 2026-12-03).
   :where() keeps this at zero specificity so a page can still opt out. */
:where(input, select, textarea) { box-sizing: border-box; }
.ds-input, .ds-select, .ds-textarea {
  width: 100%; max-width: 100%; box-sizing: border-box;
  background: var(--ds-surface-2);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  padding: var(--ds-space-2) var(--ds-space-3);
  color: var(--ds-text);
  font: 400 var(--ds-text-base) / var(--ds-leading-snug) var(--ds-font-sans);
  min-height: 36px;
}
.ds-input::placeholder { color: var(--ds-text-subtle); }
.ds-input:focus-visible, .ds-select:focus-visible, .ds-textarea:focus-visible {
  outline: 2px solid var(--ds-accent); outline-offset: 1px; border-color: transparent;
}
.ds-label {
  display: block; margin-bottom: var(--ds-space-1);
  font: 600 var(--ds-text-sm) / 1 var(--ds-font-sans);
  color: var(--ds-text-2);
}
.ds-field-error { color: var(--ds-danger); font-size: var(--ds-text-sm); margin-top: var(--ds-space-1); }

/* --- Badge - always paired with a text label, never colour alone ---------- */
/* Switch: an on/off setting that applies at once (no Save). A real checkbox
   with role="switch", so keyboard, form and screen-reader behaviour are the
   browser's. DESIGN.md, "Components". */
.ds-switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 36px; height: 20px; margin: 0;
  border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-pill); background: var(--ds-surface-3);
  cursor: pointer; transition: background var(--ds-motion-fast) var(--ds-ease), border-color var(--ds-motion-fast) var(--ds-ease); }
.ds-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ds-text-muted); transition: transform var(--ds-motion-fast) var(--ds-ease), background var(--ds-motion-fast) var(--ds-ease); }
.ds-switch:checked { background: var(--ds-accent-fill); border-color: var(--ds-accent-fill); }
.ds-switch:checked::after { transform: translateX(16px); background: var(--ds-text-on-fill); }
.ds-switch:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-switch:disabled { opacity: .5; cursor: not-allowed; }

.ds-badge {
  display: inline-flex; align-items: center; gap: var(--ds-space-1);
  padding: 2px var(--ds-space-2);
  border-radius: var(--ds-radius-pill);
  font: 600 var(--ds-text-xs) / 1.6 var(--ds-font-mono);
  border: 1px solid transparent; white-space: nowrap;
}
.ds-badge--neutral { background: var(--ds-surface-4); color: var(--ds-text-muted); border-color: var(--ds-border); }
.ds-badge--info    { background: var(--ds-accent-quiet);  color: var(--ds-accent);  border-color: var(--ds-accent-line); }
.ds-badge--success { background: var(--ds-success-quiet); color: var(--ds-success); border-color: rgba(52,211,153,.3); }
.ds-badge--warning { background: var(--ds-warning-quiet); color: var(--ds-warning); border-color: rgba(251,191,36,.3); }
.ds-badge--danger  { background: var(--ds-danger-quiet);  color: var(--ds-danger);  border-color: rgba(248,113,113,.3); }

/* --- Table ---------------------------------------------------------------- */
.ds-table-wrap { overflow-x: auto; border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-lg); }
.ds-table { width: 100%; border-collapse: collapse; font-size: var(--ds-text-base); }
.ds-table caption { text-align: left; padding: var(--ds-space-3) var(--ds-space-4); color: var(--ds-text-muted); font-size: var(--ds-text-sm); }
.ds-table th, .ds-table td { padding: var(--ds-space-3) var(--ds-space-4); text-align: left; border-bottom: 1px solid var(--ds-border-subtle); }
.ds-table thead th {
  background: var(--ds-surface-2); color: var(--ds-text-muted);
  font: 600 var(--ds-text-xs) / 1 var(--ds-font-mono);
  text-transform: uppercase; letter-spacing: var(--ds-tracking-wide);
  position: sticky; top: 0;
}
.ds-table tbody tr:last-child td { border-bottom: none; }
.ds-table tbody tr:hover { background: var(--ds-surface-2); }
.ds-table td[data-numeric], .ds-table th[data-numeric] { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Tabs ----------------------------------------------------------------- */
.ds-tabs { display: flex; gap: var(--ds-space-1); border-bottom: 1px solid var(--ds-border-subtle); overflow-x: auto; }
.ds-tab {
  padding: var(--ds-space-3) var(--ds-space-4);
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--ds-text-muted); font: 600 var(--ds-text-base) / 1 var(--ds-font-sans);
  cursor: pointer; white-space: nowrap;
}
.ds-tab:hover { color: var(--ds-text); }
.ds-tab[aria-selected="true"] { color: var(--ds-accent); border-bottom-color: var(--ds-accent); }

/* --- Breadcrumb ----------------------------------------------------------- */
.ds-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ds-space-2); font-size: var(--ds-text-sm); }
.ds-breadcrumb ol { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ds-space-2); list-style: none; margin: 0; padding: 0; }
.ds-breadcrumb li { display: flex; align-items: center; gap: var(--ds-space-2); }
.ds-breadcrumb a { color: var(--ds-text-muted); text-decoration: none; }
.ds-breadcrumb a:hover { color: var(--ds-accent); text-decoration: underline; }
.ds-breadcrumb [aria-current="page"] { color: var(--ds-text); font-weight: 600; }
.ds-breadcrumb .ds-crumb-sep { color: var(--ds-text-muted); }
/* A crumb is a 17px line of text and a missed tap on a phone. The link box
   grows to 40px and the negative margin gives the height back, so the strip
   keeps its height and only the tap area changes. */
@media (pointer: coarse) { .ds-breadcrumb a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 40px; margin-block: -11px; } }

/* --- Empty state ---------------------------------------------------------- */
.ds-empty { text-align: center; padding: var(--ds-space-8) var(--ds-space-5); max-width: 420px; margin: 0 auto; }
.ds-empty__icon { font-size: var(--ds-text-2xl); opacity: .55; margin-bottom: var(--ds-space-4); }
.ds-empty__title { font: 700 var(--ds-text-md) / var(--ds-leading-snug) var(--ds-font-sans); color: var(--ds-text); margin-bottom: var(--ds-space-2); }
.ds-empty__body { color: var(--ds-text-muted); font-size: var(--ds-text-base); line-height: var(--ds-leading-body); margin-bottom: var(--ds-space-5); }

/* --- Skeleton - shimmer is decorative, so it is aria-hidden in markup -----
   These primitives shipped with the design system and had zero users: every
   page that waits on Firestore covered itself with a full-screen spinner
   instead, which tells you something is happening but not what is coming, and
   throws the layout away and rebuilds it the moment data lands.

   A skeleton is the alternative: the shape of the page, drawn from the same
   tokens, in place, so the arriving content lands in a frame the eye has
   already parsed. assets/js/page-skeleton.254abf175d7a.js composes the presets out of the
   classes below; markup can also use them directly.

   TONE. A skeleton bar is almost always drawn ON a card, so it has to step
   away from --ds-surface-3 - and in opposite directions per theme, because
   the card is near-black on dark and pure white on light. Two tokens already
   step the right way in both:

       base  --ds-surface-4   #243145 (lighter than the dark card)
                              #F1F5F9 (darker than the white card)
       shine --ds-border      #334155 / #CBD5E1

   The shipped values were surface-3 -> surface-4, which makes the base
   identical to the card it sits on: invisible on dark, and #FFFFFF on
   #FFFFFF on light. */
html:root {
  --ds-skeleton-base:  var(--ds-surface-4);
  --ds-skeleton-shine: var(--ds-border);
}
.ds-skeleton {
  background: linear-gradient(90deg, var(--ds-skeleton-base) 25%, var(--ds-skeleton-shine) 37%, var(--ds-skeleton-base) 63%);
  background-size: 400% 100%;
  animation: ds-shimmer 1.4s ease infinite;
  border-radius: var(--ds-radius-sm);
}
.ds-skeleton--text { height: 1em; margin-bottom: var(--ds-space-2); }
.ds-skeleton--title { height: 1.6em; width: 45%; margin-bottom: var(--ds-space-3); }
/* Widths are the point of a text skeleton: four bars of identical length read
   as a table, not a paragraph. */
.ds-skeleton--line { height: 11px; margin-bottom: var(--ds-space-2); }
.ds-skeleton--line:last-child { margin-bottom: 0; }
.ds-skeleton--w90 { width: 90% } .ds-skeleton--w75 { width: 75% }
.ds-skeleton--w60 { width: 60% } .ds-skeleton--w45 { width: 45% }
.ds-skeleton--w30 { width: 30% }
.ds-skeleton--pill { height: 26px; width: 84px; border-radius: var(--ds-radius-pill); }
.ds-skeleton--circle { border-radius: 50%; width: 38px; height: 38px; flex: 0 0 auto; }
.ds-skeleton--block { height: 120px; border-radius: var(--ds-radius); }
.ds-skeleton--ring { border-radius: 50%; width: 96px; height: 96px; margin: 0 auto; }
.ds-skeleton--bar { height: 8px; border-radius: var(--ds-radius-pill); }

/* --- Composed shapes ------------------------------------------------------
   A skeleton card must sit in the same box as the real card it stands in for,
   or the content jumps when it swaps in. These reuse the panel geometry the
   rest of the system uses (.ds-card): same radius, same border, same padding. */
.ds-skel-card {
  background: var(--ds-surface-3);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-5);
  min-width: 0;
}
.ds-skel-card__head { display: flex; align-items: center; gap: var(--ds-space-3); margin-bottom: var(--ds-space-4); }
.ds-skel-card__head > div:last-child { flex: 1 1 auto; min-width: 0; }
.ds-skel-row { display: flex; align-items: center; gap: var(--ds-space-3); padding: var(--ds-space-3) 0; border-bottom: 1px solid var(--ds-border-subtle); }
.ds-skel-row:last-child { border-bottom: 0 }
.ds-skel-row__body { flex: 1 1 auto; min-width: 0 }
.ds-skel-grid { display: grid; gap: var(--ds-space-4); grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.ds-skel-stats { display: grid; gap: var(--ds-space-4); grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
/* Presets stack these, and two grids with their own internal gap still butt
   up against each other at the seam. */
.ds-skel-grid + .ds-skel-grid, .ds-skel-stats + .ds-skel-grid,
.ds-skel-stats + .ds-skel-stats { margin-top: var(--ds-space-4); }

/* --- Page-level skeleton --------------------------------------------------
   Replaces the full-screen spinner. Sits under the app shell's fixed topbar
   rather than over it: the nav is real, already interactive, and covering it
   only makes the wait feel longer. */
.ds-skel-page {
  position: fixed; inset: var(--ds-navbar-h, 56px) 0 0 0;
  z-index: var(--ds-z-loading, 7000);
  background: var(--ds-bg);
  overflow: hidden;
  padding: var(--ds-space-5);
  transition: opacity .25s ease;
}
.ds-skel-page[hidden] { display: none }
.ds-skel-page.is-leaving { opacity: 0; pointer-events: none }
/* Held invisible for page-skeleton.254abf175d7a.js's SHOW_DELAY_MS: a fast load never sees it. */
.ds-skel-page.is-pending { opacity: 0; visibility: hidden; pointer-events: none; transition: none }
.ds-skel-page__inner { max-width: 1280px; margin: 0 auto; display: grid; gap: var(--ds-space-4); }
/* The one line of real text on the overlay. Announced; the bars are not. */
.ds-skel-page__msg {
  display: flex; align-items: center; gap: var(--ds-space-2);
  font: 600 var(--ds-text-sm) / 1.4 var(--ds-font-mono);
  color: var(--ds-text-muted);
  margin-bottom: var(--ds-space-2);
}
@keyframes ds-shimmer { from { background-position: 100% 50% } to { background-position: 0 50% } }

/* A shimmer is an animation with no stop condition, which is exactly what a
   vestibular-motion setting is asking about. Hold the mid-tone instead of
   turning the placeholder invisible. */
@media (prefers-reduced-motion: reduce) {
  .ds-skeleton { animation: none; background: var(--ds-skeleton-base) }
  .ds-skel-page { transition: none }
}

/* --- Generic error state ---------------------------------------------------
   assets/js/error-state.js. The opposite outcome of the same wait a skeleton
   stands in for, so it borrows the skeleton's card geometry (.ds-skel-card's
   radius/border/padding) rather than inventing a second panel shape - the two
   need to swap for each other without the container changing size. */
.ds-error-state {
  background: var(--ds-surface-3);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-6, 32px) var(--ds-space-5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ds-space-2);
}
.ds-error-state--compact { padding: var(--ds-space-5); }
.ds-error-state__icon {
  width: 32px; height: 32px;
  color: var(--ds-danger);
  margin-bottom: var(--ds-space-2);
}
.ds-error-state__title {
  margin: 0;
  font: 600 var(--ds-text-sm) / 1.4 var(--ds-font-sans);
  color: var(--ds-text);
}
.ds-error-state__msg {
  margin: 0;
  max-width: 44ch;
  font: 400 var(--ds-text-sm) / 1.5 var(--ds-font-sans);
  color: var(--ds-text-muted);
}
.ds-error-state__retry {
  margin-top: var(--ds-space-2);
  font: 600 var(--ds-text-sm) / 1 var(--ds-font-sans);
  padding: 8px 16px;
  border-radius: var(--ds-radius);
  border: 1px solid var(--ds-border);
  background: var(--ds-surface-2);
  color: var(--ds-text);
  cursor: pointer;
}
.ds-error-state__retry:hover { background: var(--ds-surface-4); }
.ds-error-state__retry:disabled { opacity: .6; cursor: default; }

/* Full-page variant - same layer and footprint as .ds-skel-page, and mutually
   exclusive with it: whichever loading overlay owned the page hands off to
   this instead of uncovering a page with nothing rendered underneath. */
.ds-error-page {
  position: fixed; inset: var(--ds-navbar-h, 56px) 0 0 0;
  z-index: var(--ds-z-loading, 7000);
  background: var(--ds-bg);
  display: flex; align-items: center; justify-content: center;
  padding: var(--ds-space-5);
  transition: opacity .25s ease;
}
.ds-error-page.is-leaving { opacity: 0; pointer-events: none; }
.ds-error-page__inner { max-width: 420px; width: 100%; }
.ds-error-page .ds-error-state { padding: var(--ds-space-6, 32px) var(--ds-space-5); }

@media (prefers-reduced-motion: reduce) {
  .ds-error-page { transition: none; }
}

/* --- Spinner -------------------------------------------------------------- */
.ds-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--ds-border);
  border-top-color: var(--ds-accent);
  animation: ds-spin .8s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg) } }

/* --- Alerts (error / success / info) -------------------------------------- */
.ds-alert {
  display: flex; gap: var(--ds-space-3); align-items: flex-start;
  padding: var(--ds-space-4);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-size: var(--ds-text-base); line-height: var(--ds-leading-body);
}
.ds-alert--error   { background: var(--ds-danger-quiet);  border-color: color-mix(in srgb, var(--ds-danger) 35%, transparent); }
.ds-alert--success { background: var(--ds-success-quiet); border-color: color-mix(in srgb, var(--ds-success) 35%, transparent); }
.ds-alert--warning { background: var(--ds-warning-quiet); border-color: color-mix(in srgb, var(--ds-warning) 35%, transparent); }
.ds-alert--info    { background: var(--ds-accent-quiet);  border-color: color-mix(in srgb, var(--ds-accent) 35%, transparent); }

/* --- No accent stripe down the left edge, anywhere ------------------------
   A thick coloured border-left on a callout / card / nav row is the most
   recognisable generated-UI tell. The shared stylesheets no longer draw one,
   but ~50,000 generated phase and topic pages carry their own inline <style>
   with the old callout rules, so they are neutralised here, once, instead of
   rewriting every file: a callout keeps its tinted background and gets an
   even hairline all round. */
html:root :is(.summary, .warn, .info, .tip, .hq, .iq, .alert, .real-world-box,
  .mnemonic-box, .one-liner, .answer-box, .mt, .flow-content,
  .alert-warn, .alert-tip, .alert-info, .alert-danger, .alert-purple,
  .card.must, .card.good, .card.skip) {
  border-left-width: 1px !important;
  border-left-style: solid !important;
  border-left-color: var(--ds-border-subtle) !important;
}
html:root :is(.summary, .warn, .info, .tip, .hq, .one-liner, .mt, .real-world-box,
  .mnemonic-box, .answer-box) {
  border-top: 1px solid var(--ds-border-subtle);
  border-right: 1px solid var(--ds-border-subtle);
  border-bottom: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-sm, 6px) !important;
}
html:root .toc-link { border-left-color: transparent !important; }

/* --- Toast ---------------------------------------------------------------- */
.ds-toasts {
  position: fixed; bottom: var(--ds-space-5); left: 50%; transform: translateX(-50%);
  z-index: var(--ds-z-toast);
  display: flex; flex-direction: column; gap: var(--ds-space-2);
  pointer-events: none;
}
.ds-toast {
  display: flex; align-items: center; gap: var(--ds-space-3);
  background: var(--ds-surface-4); color: var(--ds-text);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: var(--ds-space-3) var(--ds-space-4);
  box-shadow: var(--ds-shadow-lg);
  font-size: var(--ds-text-base);
  animation: ds-toast-in var(--ds-motion) var(--ds-ease);
  pointer-events: auto;
}
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* --- Modal / drawer backdrop --------------------------------------------- */
.ds-backdrop {
  position: fixed; inset: 0; background: rgba(3, 6, 12, .72);
  backdrop-filter: blur(3px);
  z-index: var(--ds-z-backdrop);
  overscroll-behavior: contain;
}
/* Frosted rather than a flat opaque panel - color-mix() is declared after
   the solid fallback, so a browser without it keeps the plain surface
   instead of an unreadable transparent one. Neither color-mix() nor
   backdrop-filter is scanned by lint:theme (only background/border/color/
   etc. literals are), so this needed no ALLOW entry. */
.ds-modal {
  background: var(--ds-surface-3);
  background: color-mix(in srgb, var(--ds-surface-3) 82%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-xl);
  width: 100%; max-width: 560px; box-sizing: border-box;
  display: flex; flex-direction: column; max-height: 85vh;
}
.ds-modal__head { padding: var(--ds-space-4) var(--ds-space-5); border-bottom: 1px solid var(--ds-border-subtle); display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-4); }
.ds-modal__body { padding: var(--ds-space-5); overflow-y: auto; overscroll-behavior: contain; }
.ds-modal__foot { padding: var(--ds-space-4) var(--ds-space-5); border-top: 1px solid var(--ds-border-subtle); display: flex; justify-content: flex-end; gap: var(--ds-space-2); }

/* --- Tooltip (card) --------------------------------------------------------
   A `data-tip` attribute rendered as a themed card on hover/focus, in place
   of a bare `title=` attribute's flat OS bubble (unreachable by touch, and
   looks like it belongs to the browser rather than the product). Put the
   `ds-tip` class and `data-tip="…"` on the element itself, plus
   `tabindex="0"` so keyboard users reach it. Defaults to opening above the
   element; add `ds-tip--below` on anything sitting near a container's top
   edge, where an upward card would clip. */
.ds-tip { position: relative; }
.ds-tip::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translate(-50%, 4px); min-width: 130px; max-width: 240px;
  background: var(--ds-surface-3); color: var(--ds-text);
  border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-lg); padding: var(--ds-space-2) var(--ds-space-3);
  font: 500 var(--ds-text-xs) / 1.4 var(--ds-font-mono); text-align: left; white-space: normal;
  pointer-events: none; opacity: 0; visibility: hidden; z-index: 60;
  transition: opacity .12s ease, transform .12s ease;
}
.ds-tip::before {
  content: ''; position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 4px);
  width: 9px; height: 9px; background: var(--ds-surface-3);
  border-right: 1px solid var(--ds-border-subtle); border-bottom: 1px solid var(--ds-border-subtle);
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
  opacity: 0; visibility: hidden; z-index: 61; transition: opacity .12s ease;
}
.ds-tip:hover::after, .ds-tip:focus-visible::after,
.ds-tip:hover::before, .ds-tip:focus-visible::before {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.ds-tip--below::after, .ds-tip--below::before { bottom: auto; top: calc(100% + 8px); }
.ds-tip--below::before {
  clip-path: polygon(0 0, 100% 0, 0 100%); border-right: none; border-bottom: none;
  border-left: 1px solid var(--ds-border-subtle); border-top: 1px solid var(--ds-border-subtle);
}

/* --- Styled <select> --------------------------------------------------
   assets/js/ds-select.f8d46f708205.js wraps a select.ds-select-enhance in this markup so
   its OPEN panel reads like the product rather than OS chrome, which no
   amount of CSS on a bare <select> can reach. The trigger's box (colour,
   border, padding, font) is copied from the original select's own computed
   style, so only the listbox card needs rules here. */
.ds-select-box { position: relative; display: inline-block; }
.ds-select-native {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.ds-select-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  appearance: none; -webkit-appearance: none; text-align: left; cursor: pointer;
}
.ds-select-trigger { min-height: 36px; box-sizing: border-box; }
.ds-select-trigger--plain {
  padding: 6px 10px; font: inherit; color: var(--ds-text); background: var(--ds-surface);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm, 6px);
}
.ds-select-trigger--plain:hover { border-color: var(--ds-border-strong, var(--ds-text-muted)); }
.ds-select-trigger:disabled { cursor: not-allowed; opacity: .6; }
.ds-select-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-select-caret { font-size: var(--ds-text-xs); line-height: 1; opacity: .7; transition: transform .12s ease; flex: none; }
.ds-select-trigger[aria-expanded="true"] .ds-select-caret { transform: rotate(180deg); }
.ds-select-panel {
  /* position:fixed, placed by JS on open (panel.style.top/left/width) rather
     than position:absolute off .ds-select-box: a select nested inside an
     ancestor with overflow-y:auto (e.g. the roadmap's tool-dd-panel) forces
     that ancestor's overflow-x to auto too per spec, which clipped an
     absolutely-positioned panel at the ancestor's own edge instead of the
     viewport's. */
  position: fixed; max-height: 280px;
  overflow-y: auto; background: var(--ds-surface-3); color: var(--ds-text);
  border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-lg); padding: var(--ds-space-2); z-index: 9500;
}
.ds-select-option {
  padding: var(--ds-space-2) var(--ds-space-3); border-radius: var(--ds-radius-sm);
  font: 500 var(--ds-text-sm) / 1.3 var(--ds-font-sans); cursor: pointer; white-space: nowrap;
}
.ds-select-option.is-active { background: var(--ds-surface-4); }
.ds-select-option.is-selected { color: var(--ds-accent); font-weight: 700; }
.ds-select-option.is-disabled { color: var(--ds-text-muted); cursor: not-allowed; }

/* --- Styled date picker -----------------------------------------------
   assets/js/ds-datepicker.a70a13d273b4.js does for <input type="date|month"> what
   ds-select.f8d46f708205.js does for <select>: the native calendar is OS chrome, so the
   input is hidden and this trigger + calendar card stands in for it. */
.ds-date-box { position: relative; display: inline-block; }
.ds-date-native {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.ds-date-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  appearance: none; -webkit-appearance: none; text-align: left; cursor: pointer;
  min-height: 36px; box-sizing: border-box;
}
.ds-date-trigger--plain {
  padding: 6px 10px; font: inherit; color: var(--ds-text); background: var(--ds-surface);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm, 6px);
}
.ds-date-trigger--plain:hover { border-color: var(--ds-border-strong, var(--ds-text-muted)); }
.ds-date-trigger:disabled { cursor: not-allowed; opacity: .6; }
.ds-date-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-date-trigger-label.is-empty { color: var(--ds-text-muted); }
.ds-date-icon {
  flex: none; width: 14px; height: 14px; opacity: .7;
  border: 1.5px solid currentColor; border-top-width: 4px; border-radius: var(--ds-radius-sm); box-sizing: border-box;
}
.ds-date-panel {
  position: fixed; z-index: 9500; width: 272px; box-sizing: border-box;
  background: var(--ds-surface-3); color: var(--ds-text);
  border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-lg); padding: var(--ds-space-3);
  font: 500 var(--ds-text-sm) / 1.3 var(--ds-font-sans);
}
.ds-date-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--ds-space-2); }
.ds-date-title { font-weight: 700; }
.ds-date-nav, .ds-date-cell, .ds-date-link {
  appearance: none; background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
  border-radius: var(--ds-radius-sm);
}
.ds-date-nav { width: 30px; height: 30px; font-size: var(--ds-text-lg); line-height: 1; }
.ds-date-nav:hover, .ds-date-cell:hover:not(:disabled), .ds-date-link:hover:not(:disabled) { background: var(--ds-surface-4); }
.ds-date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ds-date-grid--month { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ds-date-dow { text-align: center; font-size: var(--ds-text-xs, 11px); color: var(--ds-text-muted); padding: 4px 0; }
.ds-date-cell { height: 32px; text-align: center; font-variant-numeric: tabular-nums; }
.ds-date-cell--month { height: 40px; }
.ds-date-cell.is-today { box-shadow: inset 0 0 0 1px var(--ds-accent); }
.ds-date-cell.is-selected { background: var(--ds-accent-fill, var(--ds-accent)); color: var(--on-accent); font-weight: 700; }
.ds-date-cell:disabled { color: var(--ds-text-subtle); cursor: not-allowed; opacity: .5; }
.ds-date-nav:focus-visible, .ds-date-cell:focus-visible, .ds-date-link:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 1px; }
.ds-date-foot { display: flex; justify-content: space-between; margin-top: var(--ds-space-2); padding-top: var(--ds-space-2); border-top: 1px solid var(--ds-border-subtle); }
.ds-date-link { padding: 4px 8px; color: var(--ds-accent); font-weight: 600; }
.ds-date-link:disabled { color: var(--ds-text-subtle); cursor: not-allowed; }

/* --- Native element floor ----------------------------------------------
   Nothing renders in the browser's own look (DESIGN.md, "Links and native
   elements"). Selects and date fields have popups and are replaced by
   ds-select.f8d46f708205.js / the date picker above; everything else is drawn here.
   Every rule is wrapped in :where() (specificity 0), so a page or component
   that styles its own control still wins - this only replaces the UA
   default. Checkbox/radio/range/progress use appearance:none and draw the
   whole control, because accent-color alone still leaves the OS shape. */

/* Text fields */
:where(textarea, input:not([type]), input[type="text"], input[type="search"], input[type="email"],
       input[type="password"], input[type="url"], input[type="tel"], input[type="number"]) {
  background: var(--ds-surface-2); color: var(--ds-text);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm, 6px);
  padding: var(--ds-space-2) var(--ds-space-3); font: inherit; line-height: 1.5;
  caret-color: var(--ds-accent);
  transition: border-color var(--ds-motion-fast) var(--ds-ease), background-color var(--ds-motion-fast) var(--ds-ease);
}
:where(textarea) { scrollbar-width: thin; scrollbar-color: var(--ds-border) transparent; }
:where(textarea, input):hover:not(:disabled):not(:focus) { border-color: var(--ds-border-strong); }
:where(textarea, input)::placeholder { color: var(--ds-text-subtle); opacity: 1; }
:where(textarea, input):focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 1px; border-color: transparent; }
:where(textarea, input):disabled { opacity: .55; cursor: not-allowed; }
/* Chrome paints autofilled fields pale blue/yellow; keep them on the surface. */
:where(input, textarea):-webkit-autofill {
  -webkit-text-fill-color: var(--ds-text); caret-color: var(--ds-accent);
  box-shadow: 0 0 0 1000px var(--ds-surface-2) inset;
  transition: background-color 9999s step-end;
}
:where(input[type="search"])::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; cursor: pointer;
  background: var(--ds-text-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
:where(input[type="number"])::-webkit-inner-spin-button { opacity: .45; cursor: pointer; }
:where(input)::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
:where(input)::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Plain buttons: an unclassed <button> (or input button) is a secondary
   .ds-btn, never the grey OS bevel. Classed buttons style themselves. */
:where(button:not([class]), input[type="button"], input[type="submit"], input[type="reset"]) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2);
  min-height: 36px; padding: 0 var(--ds-space-4); cursor: pointer;
  background: var(--ds-surface-3); color: var(--ds-text);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm, 6px);
  font: 600 var(--ds-text-sm) / 1 var(--ds-font-sans);
  transition: background-color var(--ds-motion-fast) var(--ds-ease), border-color var(--ds-motion-fast) var(--ds-ease);
}
:where(button:not([class]), input[type="button"], input[type="submit"], input[type="reset"]):hover:not(:disabled) {
  background: var(--ds-surface-4); border-color: var(--ds-border-strong);
}
:where(input[type="submit"]) { background: var(--ds-accent-fill); border-color: transparent; color: var(--ds-text-on-fill); }
:where(input[type="submit"]):hover:not(:disabled) { background: var(--ds-accent-hover); border-color: transparent; }

/* Checkbox and radio: a 16px box drawn from tokens; the tick is a white
   SVG because --ds-text-on-fill is white on every palette. */
:where(input[type="checkbox"], input[type="radio"]) {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 16px; height: 16px; margin: 0 var(--ds-space-2) 0 0; vertical-align: -3px; cursor: pointer;
  background: var(--ds-surface-2) center / 12px 12px no-repeat;
  border: 1.5px solid var(--ds-border-strong); border-radius: var(--ds-radius-sm);
  transition: background-color var(--ds-motion-fast) var(--ds-ease), border-color var(--ds-motion-fast) var(--ds-ease), box-shadow var(--ds-motion-fast) var(--ds-ease);
}
:where(input[type="radio"]) { border-radius: 50%; }
:where(input[type="checkbox"], input[type="radio"]):hover:not(:disabled) { border-color: var(--ds-accent); }
:where(input[type="checkbox"]):checked {
  background-color: var(--ds-accent-fill); border-color: var(--ds-accent-fill);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
:where(input[type="checkbox"]):indeterminate {
  background-color: var(--ds-accent-fill); border-color: var(--ds-accent-fill);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}
:where(input[type="radio"]):checked {
  background-color: var(--ds-accent-fill); border-color: var(--ds-accent-fill);
  box-shadow: inset 0 0 0 3px var(--ds-surface-2);
}
:where(input[type="checkbox"], input[type="radio"]):disabled { opacity: .5; cursor: not-allowed; }
:where(label:has(> input[type="checkbox"], > input[type="radio"])) { cursor: pointer; }

/* Range: a pill track and a filled thumb. */
:where(input[type="range"]) {
  -webkit-appearance: none; appearance: none; height: 20px; padding: 0; cursor: pointer;
  background: transparent; border: 0;
}
:where(input[type="range"])::-webkit-slider-runnable-track { height: 6px; border-radius: var(--ds-radius-pill); background: var(--ds-border); }
:where(input[type="range"])::-moz-range-track { height: 6px; border-radius: var(--ds-radius-pill); background: var(--ds-border); }
:where(input[type="range"])::-moz-range-progress { height: 6px; border-radius: var(--ds-radius-pill); background: var(--ds-accent-fill); }
:where(input[type="range"])::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -5px;
  border-radius: 50%; background: var(--ds-accent-fill); border: 2px solid var(--ds-bg);
  box-shadow: var(--ds-shadow-sm); transition: scale var(--ds-motion-fast) var(--ds-ease);
}
:where(input[type="range"])::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--ds-accent-fill);
  border: 2px solid var(--ds-bg); box-shadow: var(--ds-shadow-sm);
}
:where(input[type="range"]):hover::-webkit-slider-thumb { scale: 1.15; }

/* Progress */
:where(progress) {
  -webkit-appearance: none; appearance: none; height: 6px; border: 0; overflow: hidden;
  border-radius: var(--ds-radius-pill); background: var(--ds-surface-3); vertical-align: middle;
}
:where(progress)::-webkit-progress-bar { background: var(--ds-surface-3); border-radius: var(--ds-radius-pill); }
:where(progress)::-webkit-progress-value { background: var(--ds-accent-fill); border-radius: var(--ds-radius-pill); transition: width var(--ds-motion-slow) var(--ds-ease); }
:where(progress)::-moz-progress-bar { background: var(--ds-accent-fill); border-radius: var(--ds-radius-pill); }

:where(input[type="file"]) { color: var(--ds-text-muted); font: inherit; }
:where(input[type="file"])::file-selector-button {
  margin-right: var(--ds-space-3); padding: 6px 12px; cursor: pointer;
  background: var(--ds-surface-3); color: var(--ds-text); font: inherit; font-weight: 600;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm, 6px);
}
:where(input[type="file"])::file-selector-button:hover { background: var(--ds-surface-4); }
:where(input[type="color"]) {
  width: 36px; height: 32px; padding: 2px; cursor: pointer; background: var(--ds-surface-2);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm, 6px);
}

:where(fieldset) { border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius); padding: var(--ds-space-3) var(--ds-space-4) var(--ds-space-4); }
:where(legend) { padding: 0 var(--ds-space-2); color: var(--ds-text-muted); font-size: var(--ds-text-sm); font-weight: 600; }

/* Content elements */
:where(table) { border-collapse: collapse; font-variant-numeric: tabular-nums; }
:where(table:not([role="presentation"])) :where(th, td) { padding: var(--ds-space-2) var(--ds-space-3); border-bottom: 1px solid var(--ds-border-subtle); text-align: left; vertical-align: top; }
:where(table:not([role="presentation"])) :where(th) { color: var(--ds-text); font-weight: 600; }
:where(table:not([role="presentation"])) :where(thead th) { color: var(--ds-text-muted); font-size: var(--ds-text-sm); border-bottom-color: var(--ds-border); }
:where(hr) { border: 0; border-top: 1px solid var(--ds-border-subtle); }
:where(blockquote) {
  margin-inline: 0; padding: var(--ds-space-2) var(--ds-space-4);
  border-left: 2px solid var(--ds-border-strong); border-radius: 0;
  background: var(--ds-surface-2); color: var(--ds-text-2);
}
:where(kbd) {
  display: inline-block; min-width: 1.6em; padding: 2px 6px; text-align: center;
  font: 600 var(--ds-text-inline) / 1.2 var(--ds-font-mono); color: var(--ds-text);
  background: var(--ds-surface-3); border: 1px solid var(--ds-border); border-bottom-width: 2px;
  border-radius: var(--ds-radius-sm);
}
:where(mark) { background: var(--ds-warning-quiet); color: inherit; border-radius: var(--ds-radius-sm); box-shadow: 0 0 0 .12em var(--ds-warning-quiet); }
:where(abbr[title]) { text-decoration: none; cursor: help; }
:where(ul, ol) > :where(li)::marker { color: var(--ds-text-subtle); }
:where(iframe) { border: 0; }
:where(dialog) {
  color: var(--ds-text); background: var(--ds-surface-3);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-xl);
}
:where(dialog)::backdrop { background: rgba(5, 7, 12, .55); backdrop-filter: blur(2px); }
::selection { background: var(--ds-accent-line); }

/* Links by context. Inline links in reading text are semibold and get a
   tinted pill on hover (box-shadow, so no reflow); standalone links in
   footers are muted until hovered. */
:where(p, td, dd, figcaption, blockquote, .callout, .note, .tip, .info, .warn) > :where(a:any-link) { font-weight: 600; }
:where(li) > :where(a:any-link) { font-weight: 500; }
:where(p, li, td, dd, figcaption, blockquote, .callout, .note, .tip, .info, .warn) > :where(a:any-link) {
  border-radius: var(--ds-radius-sm); transition: background-color var(--ds-motion-fast) var(--ds-ease), box-shadow var(--ds-motion-fast) var(--ds-ease), color var(--ds-motion-fast) var(--ds-ease);
}
:where(p, li, td, dd, figcaption, blockquote, .callout, .note, .tip, .info, .warn) > :where(a:any-link):hover {
  background: var(--ds-accent-quiet); box-shadow: 0 0 0 2px var(--ds-accent-quiet);
}
:where(footer, .footer, [class*="footer"]) :where(a:any-link) { color: var(--ds-text-muted); font-weight: 500; }
:where(footer, .footer, [class*="footer"]) :where(a:any-link):hover { color: var(--ds-text); background: none; box-shadow: none; }

/* --- Progress ------------------------------------------------------------- */
.ds-progress { height: 6px; background: var(--ds-surface-2); border-radius: var(--ds-radius-pill); overflow: hidden; }
.ds-progress__fill { height: 100%; background: var(--ds-accent-fill); border-radius: inherit; transition: width var(--ds-motion-slow) var(--ds-ease); }

/* --- Page header ---------------------------------------------------------- */
.ds-page-head { display: flex; flex-direction: column; gap: var(--ds-space-2); margin-bottom: var(--ds-space-5); }
.ds-page-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-4); flex-wrap: wrap; }
.ds-page-title { font: 700 var(--ds-text-xl) / var(--ds-leading-tight) var(--ds-font-sans); color: var(--ds-text); text-wrap: balance; margin: 0; }
.ds-page-desc { color: var(--ds-text-muted); font-size: var(--ds-text-base); line-height: var(--ds-leading-body); max-width: 68ch; margin: 0; }

/* --- Stat ----------------------------------------------------------------- */
.ds-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--ds-space-4); }
.ds-stat { background: var(--ds-surface-3); border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius); padding: var(--ds-space-4); }
.ds-stat__num { font: 700 var(--ds-text-xl) / 1 var(--ds-font-mono); color: var(--ds-text); font-variant-numeric: tabular-nums; }
.ds-stat__label { font: 600 var(--ds-text-xs) / 1 var(--ds-font-mono); color: var(--ds-text-muted); text-transform: uppercase; letter-spacing: var(--ds-tracking-wide); margin-top: var(--ds-space-2); }

/* Never let wide content push the page sideways.

   `clip`, not `hidden`. They look identical - neither shows a horizontal
   scrollbar - but `overflow-x: hidden` makes the element a scroll container,
   and a scroll container is what `position: sticky` measures against. With
   hidden on html/body, every sticky element on every page resolved against a
   body that never actually scrolls (the viewport does), so it silently never
   stuck: see the note beside .ds-crumbbar in app-shell.254abf175d7a.js, where the
   breadcrumb bar was reverted to static after exactly this, and
   pages/roadmap.html's .filter-dock, which is unusable without sticky working.

   `overflow-x: clip` clips the overflow without establishing a scroll
   container, so sticky descendants behave. It also does not create a
   containing block for `position: fixed`, so the shell navbar, sidebar and
   FAB are unaffected. Chrome 90+, Firefox 81+, Safari 16+. */
.ds-scroll-x { overflow-x: auto; max-width: 100%; }
html, body { max-width: 100%; overflow-x: clip; }

/* The page always scrolls, even while a modal, drawer, sidebar or highlight
   panel is open. Several widgets lock it by setting overflow:hidden on
   html/body (inline or via an *-open class); this beats both. The full-screen
   diagram viewer is the one exception - it covers the whole page. */
html:not(.dgm-has-full), html:not(.dgm-has-full) body { overflow-y: visible !important; }

/* The clip above stops the PAGE scrolling sideways, which on its own just
   cuts wide content off at the edge of a phone. These let that content
   scroll inside its own box instead, so nothing is unreachable. */
img, video { max-width: 100%; height: auto; }
pre { max-width: 100%; overflow-x: auto; }
/* A code block's caption is a span, and a span beside <code> shares its line:
   "MULTI-STAGE Dockerfile" ran into "FROM" on the first line. Block-level makes
   it a caption above the code, the margin the older page styles already give it. */
pre > .pre-label { display: block; }
@media (max-width: 640px) {
  table { display: block; max-width: 100%; overflow-x: auto; }
}

/* --- Horizontal scroller with edge shadows ------------------------------- */
/* A row that scrolls sideways with its scrollbar hidden (tab strips, chip
   rows) gives no sign there is more. These "scroll shadows" show a soft edge
   only on a side that has content beyond it, with no script: the two `local`
   covers travel with the content and hide the `scroll` shadows once an end is
   reached. Set --ds-scroll-bg to the row's own background. */
.ds-scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  background:
    linear-gradient(to right, var(--ds-scroll-bg, var(--ds-surface)) 30%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--ds-scroll-bg, var(--ds-surface)) 30%, transparent) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ds-text) 24%, transparent), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ds-text) 24%, transparent), transparent) right center / 12px 100% no-repeat scroll,
    var(--ds-scroll-bg, var(--ds-surface));
}
.ds-scroll-x::-webkit-scrollbar { display: none; }

/* --- Global scrollbar --------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ds-border-strong, #475569) transparent;
}
*::-webkit-scrollbar { width: var(--ds-scrollbar-w, 10px); height: var(--ds-scrollbar-w, 10px); }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--ds-border-strong, #475569);
  border-radius: var(--ds-radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ds-text-subtle, #64748b); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ── Page header ──────────────────────────────────────────────────────────
   Several pages (revision, cram, company-questions, mock-interview,
   study-profiles) carried their own .topbar from before the shared shell
   existed: a back link plus links to the other hub pages, all of which the
   shell's nav already provides. The result was two stacked navigation bars -
   the shell at y=0 and the page's own at y=56 - which is what "header
   alignment is incorrect" and "doesn't match the design system" were
   describing. Those bars are gone; this is what replaces them: the page's
   title, in the shared type scale, with navigation left to the one shell. */
.ds-pagehead {
  /* width:100% + border-box, not just max-width: on pages whose <body> is a
     flex column (revision, cram, company-questions) a block with only
     max-width shrink-wraps to its text and then `margin:0 auto` centres that
     narrow box against the full viewport - measured 318px wide starting at
     x=605, ignoring the sidebar inset entirely. Filling first, then capping,
     puts it in the same column as the rest of the page. */
  width: 100%;
  box-sizing: border-box;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--ds-space-6) var(--ds-space-5) var(--ds-space-4);
}
.ds-pagehead h1 {
  margin: 0;
  font: 800 var(--ds-text-2xl) / 1.2 var(--ds-font-sans);
  color: var(--ds-text);
  letter-spacing: -0.01em;
}
.ds-pagehead p {
  margin: 8px 0 0;
  font: 400 var(--ds-text-sm) / 1.6 var(--ds-font-sans);
  color: var(--ds-text-muted);
  max-width: 70ch;
}
@media (max-width: 640px) {
  .ds-pagehead { padding: var(--ds-space-5) var(--ds-space-4) var(--ds-space-3); }
  .ds-pagehead h1 { font-size: var(--ds-text-xl); }
}
/* Phase pages historically embedded a dark-only copy of the generated phase
   navigation. Keep the shared design-system tokens authoritative even before a
   page is regenerated by scripts/add_phase_nav.py. */
html:root .phase-nav-btn {
  border-color: var(--border);
  background: var(--surface);
}

/* Give even minimal/scaffold documents the same canvas and type foundation.
   Full pages can still add layout, but browser-default white must never leak
   through when the shared shell is in dark mode. */
html:root body {
  background-color: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font-sans);
}

/* Page-level roadmap and focus status share one deterministic rail. On wide
   phase pages they sit side-by-side; on smaller pages they stack without
   displacing the page-owned topic sidebar. */
.ds-page-widgets {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(480px, 1.2fr);
  gap: var(--ds-space-3);
  width: 100%;
  padding: var(--ds-space-3) var(--ds-space-4) var(--ds-space-5);
  box-sizing: border-box;
}
/* The rail is inserted unconditionally next to the breadcrumb on every
   shelled page (see insertBreadcrumbs in app-shell-core.254abf175d7a.js) even when no
   widget ever mounts into it - most pages, the dashboard included. Left
   styled, its own padding still reserved visible empty space between the
   breadcrumb and the page's real content. */
.ds-page-widgets:empty { display: none; }
.ds-page-widgets > #dp-roadmap-sync {
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}
.ds-page-widgets > :only-child { grid-column: 1 / -1; }
@media (max-width: 1180px) {
  .ds-page-widgets { grid-template-columns: minmax(0, 1fr); }
}
/* Generated phase pages pad their .hero and sections 56px (24px under
   900px). The breadcrumb and widget rail sit above the hero with their own
   24px/16px gutters, so the three stacked blocks started at three different
   x positions. Put them on the page's one gutter, and pull the hero up so
   the rail and the phase details read as one header instead of two islands. */
.main:has(> .hero) > .ds-crumbbar,
.main:has(> .hero) > .ds-page-widgets { padding-inline: 56px; }
.main:has(> .ds-page-widgets:not(:empty)) > .hero { padding-top: var(--ds-space-4); }
.main:has(> .ds-page-widgets:not(:empty)) > .hero > .phase-meta-strip:first-child { margin-top: 0; }
@media (max-width: 900px) {
  .main:has(> .hero) > .ds-crumbbar,
  .main:has(> .hero) > .ds-page-widgets { padding-inline: 24px; }
}
@media (max-width: 700px) {
  .ds-page-widgets { padding-inline: var(--ds-space-3); }
}
html:root .phase-nav-btn:hover {
  border-color: var(--accent);
  background: var(--surface2);
}
html:root .phase-nav-lbl { color: var(--muted); }
html:root .phase-nav-title { color: var(--text); }
/* The phase Previous/Next bar is styled by assets/css/phase-nav.254abf175d7a.css, which
   scripts/add_phase_nav.py links with a content hash next to the markup it
   writes - never from here, where a day-stale copy once unstyled it. */

/* "View topic →" carries no styling of its own anywhere - it is a bare class
   in the generated markup - so it renders as a 12px line box, a third of the
   44px target the shell already gives its own controls. Widened only for a
   coarse pointer, the same way app-shell-core.254abf175d7a.js widens the topbar, so mouse
   density is unchanged. */
html:root .topic-view-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 4px 10px;
  border: 1px solid var(--accent-bd, var(--ds-border));
  border-radius: var(--ds-radius-pill);
  background: var(--accent-bg, transparent);
  color: var(--accent);
  font: 600 var(--ds-text-xs)/1 var(--ds-font-sans);
  letter-spacing: .01em;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
html:root .topic-view-link:hover { border-color: var(--accent); text-decoration: none; }
html:root .topic-view-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) {
  html:root .topic-view-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

/* Phase diagrams should explain the content, not occupy a full laptop screen.
   The wrapper remains responsive and smaller diagrams keep their natural size. */
html:root .topic .svg-wrap { max-width: 760px; margin-inline: auto; }
html:root .phase-focus-toast {
  border-color: var(--accent-bd);
  background: var(--ds-surface);
  color: var(--text);
}
html:root .phase-study-target { outline-color: var(--accent) !important; }
html:root .phase-study-target::before {
  background: var(--must);
  color: var(--ds-text-on-fill);
}
html:root body.phase-focus-mode { background: var(--bg) !important; }
html:root .pfr-card {
  border-color: var(--border);
  background: var(--ds-surface);
  color: var(--text);
  box-shadow: var(--ds-shadow-xl);
}
html:root .pfr-sub { color: var(--muted); }
html:root .pfr label,
html:root .pfr legend { color: var(--text-2); }
html:root .pfr input,
html:root .pfr select,
html:root .pfr textarea {
  border-color: var(--border);
  background: var(--ds-bg-sunken);
  color: var(--text);
}
html:root .pfr-choice,
html:root .pfr-actions button {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-2);
}
html:root .pfr-choice[aria-pressed="true"],
html:root .pfr-actions .primary {
  border-color: var(--must);
  background: var(--must);
  color: var(--ds-text-on-fill);
}

/* ===========================================================================
   REFINEMENTS - Linear / shadcn-style polish
   ---------------------------------------------------------------------------
   Borrowed patterns, not borrowed code: Kobra/shadcn compose from Radix
   primitives with Tailwind utility classes, which this static/vanilla-JS site
   cannot adopt without shipping a second, conflicting styling system (see
   CLAUDE.md's "one visual language" rule at the top of this file). What
   survives the translation is the LOOK - depth from layered shadow + a
   hairline inset highlight rather than blur alone, an accent-colored glow on
   focused primary actions, and cards that read as one elevation step instead
   of a flat outline - reimplemented entirely with the tokens already above.
   No new selectors are required anywhere: every rule below re-styles the
   existing .ds-card / .ds-btn--primary / .ds-stat / .ds-input contract. */

/* Card: a second, tighter inset highlight along the top edge (Linear's
   "glass" cards) layered under the existing box-shadow on hover, instead of
   only pushing the card up. Declared as occupying the --ds-shadow custom
   property together so hover keeps exactly one shadow declaration. */
.ds-card {
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .04);
}
html[data-ds-theme="light"] .ds-card {
  box-shadow: inset 0 1px 0 0 rgba(15, 23, 42, .03);
}
.ds-card--interactive:hover {
  box-shadow: var(--ds-shadow), inset 0 1px 0 0 rgba(255, 255, 255, .06);
}
html[data-ds-theme="light"] .ds-card--interactive:hover {
  box-shadow: var(--ds-shadow), inset 0 1px 0 0 rgba(15, 23, 42, .04);
}

/* Primary button: a soft accent-colored glow on hover/focus, on top of the
   existing shimmer sweep - shadcn/Linear both use a coloured shadow rather
   than a plain dark one to make the primary action read as "lit", not just
   "raised". Kept in --ds-accent-line's low-alpha family so it tracks the
   theme instead of being a fixed hex. */
.ds-btn--primary:hover, .ds-btn--primary:focus-visible {
  box-shadow: 0 0 0 1px var(--ds-accent-line), 0 6px 20px -4px var(--ds-accent-quiet);
}

/* Stat tiles: a 2px accent rail on the leading edge, the same left-border
   language dashboard.254abf175d7a.js's focus-board source cards already use ("the colour
   belongs to the SOURCE" - see CLAUDE.md). Neutral by default so a stat with
   no owning source stays plain; opt in per-tile with --ds-stat-accent. */
.ds-stat {
  --ds-stat-accent: var(--ds-border-subtle);
  
  transition: border-color var(--ds-motion-fast) var(--ds-ease),
              background var(--ds-motion-fast) var(--ds-ease);
}

/* Inputs: the same inset-highlight-on-focus treatment as the button glow,
   scaled down, so a focused field reads as "active" rather than only
   "outlined". Layered with the existing focus-visible outline, not replacing
   it - accessibility posture is unchanged. */
.ds-input:focus-visible, .ds-select:focus-visible, .ds-textarea:focus-visible {
  box-shadow: 0 0 0 3px var(--ds-accent-quiet);
}

/* Page title: a tighter tracking + slightly heavier weight reads closer to
   Linear/shadcn's dashboard headers than the system default; kept inside the
   existing --ds-text-2xl step so nothing reflows. */
.ds-page-title { letter-spacing: -0.015em; }
.ds-pagehead h1 { letter-spacing: -0.015em; }

/* ===========================================================================
   EDITORIAL PASS - generated phase pages
   ---------------------------------------------------------------------------
   ~1,000 phase pages were generated with the same template tics: a diagonal
   three-stop gradient behind the hero, a two-tone title with the second half
   painted accent blue, an emoji pill above it, a row of stat chips under it,
   and gradient-washed quote boxes. Each one is decoration asking for
   attention the content should have. Rewriting the pages would be ~1,000
   diffs; this block overrides the shared class names instead, the same way
   the tokens above re-skin the inline :root blocks. `html:root` prefixes win
   over each page's inline <style> regardless of source order.
   =========================================================================== */
html:root .hero {
  background: var(--ds-bg);
  border-bottom: 1px solid var(--ds-border-subtle);
}
/* One-colour title. The accent is for things you can act on. */
html:root .hero h1 {
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ds-text);
}
html:root .hero h1 span { color: inherit; }
/* The eyebrow becomes a label, not a badge. */
html:root .hero-eyebrow {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-text-xs);
  letter-spacing: var(--ds-tracking-wide);
  text-transform: uppercase;
}
html:root .hero-sub { color: var(--ds-text-2); }
/* Stats read as one quiet line of metadata separated by hairlines, rather
   than five buttons that are not buttons. A linked stat keeps its affordance. */
html:root .hero-stats { gap: 0; }
html:root .hero-stat {
  background: none;
  border: 0;
  border-left: 1px solid var(--ds-border-subtle);
  border-radius: 0;
  padding: 2px 16px;
  color: var(--ds-text-muted);
  font-weight: 500;
}
html:root .hero-stat:first-child { border-left: 0; padding-left: 0; }
html:root .hero-stat span { color: var(--ds-text); font-weight: 650; }
html:root a.hero-stat { color: var(--ds-accent); text-decoration: none; }
html:root a.hero-stat:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Pull quotes: a rule, not a gradient wash. */
html:root .hq {
  background: none;
  border: 0;
  
  border-radius: 0;
  padding: 4px 0 4px 16px;
  font-style: normal;
}

/* Reset-to-defaults in the customise drawers: quiet outline, full width,
   danger tint only on intent - not a glossy slab. */
.ds-btn.ds-btn--reset {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 16px; padding: 10px 16px;
  background: transparent; color: var(--ds-text-2);
  border: 1px dashed var(--ds-border-strong); border-radius: var(--ds-radius);
  font-weight: 600; letter-spacing: .01em;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .12s ease;
}
.ds-btn.ds-btn--reset svg { transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.ds-btn.ds-btn--reset:hover {
  color: var(--danger); background: var(--danger-bg);
  border-color: var(--ds-danger); border-style: solid;
}
.ds-btn.ds-btn--reset:hover svg { transform: rotate(-300deg); }
.ds-btn.ds-btn--reset:active { transform: scale(.98); }
.ds-btn.ds-btn--reset:focus-visible { outline: 2px solid var(--ds-focus, var(--brand)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .ds-btn.ds-btn--reset, .ds-btn.ds-btn--reset svg { transition: none; }
}

/* --- Button & tag polish (matches the landing CTA) -------------------------
   Pill shape, a soft top highlight and a tight shadow instead of flat fills.
   html :is() keeps specificity at 0 so page-level button styles still win. */
html :is(.ds-btn, .btn):not(.ds-btn--icon) { border-radius: var(--ds-radius-pill); padding-inline: var(--ds-space-4); font-weight: 600; letter-spacing: -.005em;
  transition: background var(--ds-motion-fast) var(--ds-ease), border-color var(--ds-motion-fast) var(--ds-ease), box-shadow .2s var(--ds-ease), transform .2s var(--ds-ease); }
html :is(.ds-btn--primary, .btn--primary, .btn-primary, .btn--pri, .btn.primary) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ds-accent-fill) 88%, var(--ds-text-on-fill)), var(--ds-accent-fill));
  color: var(--ds-text-on-fill); border-color: color-mix(in srgb, var(--ds-accent-fill) 75%, var(--ds-text));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ds-text-on-fill) 28%, transparent), 0 1px 2px color-mix(in srgb, var(--ds-text) 14%, transparent), 0 4px 10px -4px color-mix(in srgb, var(--ds-accent-fill) 45%, transparent); }
html :is(.ds-btn--primary, .btn--primary, .btn-primary, .btn--pri, .btn.primary):hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ds-text-on-fill) 28%, transparent), 0 2px 4px color-mix(in srgb, var(--ds-text) 14%, transparent), 0 8px 16px -6px color-mix(in srgb, var(--ds-accent-fill) 55%, transparent); }
html :is(.btn:not(.btn--primary, .btn-primary, .btn--pri, .btn--danger, .primary)) {
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ds-text-on-fill) 6%, transparent), 0 1px 2px color-mix(in srgb, var(--ds-text) 10%, transparent); }
html :is(.ds-btn--secondary, .btn):hover { border-color: var(--ds-border-strong); }
html :is(.ds-btn, .btn):not([disabled]):active { transform: translateY(0); box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ds-text) 18%, transparent); }
html :is(.ds-badge) { border-radius: var(--ds-radius-pill); padding-inline: .6em; font-weight: 600; letter-spacing: .01em; box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ds-text-on-fill) 8%, transparent); }
@media (prefers-reduced-motion: reduce) { html :is(.ds-btn, .btn):hover { transform: none; } }

/* Font picker (Settings > Themes > Font). The shell sets data-ds-userfont (data-ds-font is the text SIZE) and
   --ds-user-font on <html>; many pages hardcode their own family, so the
   override is broad, and code keeps its monospace. Mobile mirrors this in
   web/src/styles/app.css with the same ds-font key. */
html[data-ds-userfont] body,
html[data-ds-userfont] body *:not(code):not(kbd):not(samp):not(pre):not(pre *):not(code *):not(svg *) {
  font-family: var(--ds-user-font) !important;
}

/* --- "Did you know?" strip (assets/js/tips.254abf175d7a.js) - inline, never floating -- */
.ds-dyk {
  display: flex; align-items: baseline; gap: var(--ds-space-3);
  padding: var(--ds-space-2) var(--ds-space-4);
  border: 1px dashed var(--ds-border); border-radius: var(--ds-radius);
  color: var(--ds-text-muted); font-size: var(--ds-text-sm, 13px); line-height: 1.5;
}
.ds-dyk[hidden] { display: none; }
.ds-dyk-label { flex: none; font-weight: 600; color: var(--ds-accent); white-space: nowrap; }
.ds-dyk-text { flex: 1; min-width: 0; margin: 0; }
.ds-dyk-text strong { color: var(--ds-text); font-weight: 600; }
.ds-dyk-text a { color: var(--ds-accent); }
.ds-dyk-next, .ds-dyk-hide { flex: none; background: none; border: 0; color: var(--ds-text-muted); cursor: pointer; font: inherit; padding: 0 4px; }
.ds-dyk-next { font-size: var(--ds-text-md); }
.ds-dyk-next:hover, .ds-dyk-hide:hover { color: var(--ds-text); }
@media (max-width: 600px) { .ds-dyk { flex-wrap: wrap; } .ds-dyk-text { flex-basis: 100%; order: 3; } .ds-dyk-label { margin-right: auto; } }

/* ── Site announcement (assets/js/site-announcement.254abf175d7a.js) ───────────────────
   One admin notice, pinned just under the fixed navbar, centred. Tone sets
   the tint, the leading icon and the label; nothing else varies. */
.ds-announcement {
  position: fixed; left: 50%; top: calc(var(--ds-navbar-h, 46px) + var(--ds-space-2));
  transform: translateX(-50%); z-index: calc(var(--ds-z-navbar) - 1);
  width: min(760px, calc(100vw - 2 * var(--ds-space-4)));
  display: flex; align-items: center; gap: var(--ds-space-3);
  padding: var(--ds-space-2) var(--ds-space-2) var(--ds-space-2) var(--ds-space-3);
  border: 1px solid var(--ds-accent-line); border-radius: var(--ds-radius-lg);
  background: linear-gradient(var(--ds-accent-quiet), var(--ds-accent-quiet)), var(--ds-surface);
  color: var(--ds-text); font-size: var(--ds-text-sm); line-height: 1.45;
  box-shadow: var(--ds-shadow-lg);
  animation: ds-announce-in .28s cubic-bezier(.2, .8, .2, 1);
}
.ds-announcement[data-tone="success"] {
  --ds-ann: var(--ds-success);
  border-color: color-mix(in srgb, var(--ds-success) 40%, transparent);
  background: linear-gradient(var(--ds-success-quiet), var(--ds-success-quiet)), var(--ds-surface);
}
.ds-announcement[data-tone="warn"] {
  --ds-ann: var(--ds-warning);
  border-color: color-mix(in srgb, var(--ds-warning) 45%, transparent);
  background: linear-gradient(var(--ds-warning-quiet), var(--ds-warning-quiet)), var(--ds-surface);
}
.ds-announcement__icon {
  flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 50%; color: var(--ds-ann, var(--ds-accent));
  background: color-mix(in srgb, var(--ds-ann, var(--ds-accent)) 16%, transparent);
}
.ds-announcement__icon svg { width: 16px; height: 16px; }
.ds-announcement__body { flex: 1; min-width: 0; margin: 0; }
.ds-announcement__label {
  display: inline-block; margin-right: var(--ds-space-2);
  font-size: var(--ds-text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ds-ann, var(--ds-accent));
}
.ds-announcement__link {
  flex: 0 0 auto; padding: 5px var(--ds-space-3); border-radius: var(--ds-radius-pill);
  font-weight: 700; font-size: var(--ds-text-xs); white-space: nowrap; text-decoration: none;
  color: var(--ds-text-on-fill); background: var(--ds-accent-fill);
}
.ds-announcement__link:hover { background: var(--ds-accent-hover); }
.ds-announcement__close {
  flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px;
  border: 0; border-radius: var(--ds-radius-sm); background: transparent;
  color: var(--ds-text-muted); font-size: var(--ds-text-lg); line-height: 1; cursor: pointer;
}
.ds-announcement__close:hover, .ds-announcement__close:focus-visible { color: var(--ds-text); background: var(--ds-surface-2, var(--ds-border-subtle)); }
.ds-announcement.is-leaving { animation: ds-announce-out .18s ease-in forwards; }
@keyframes ds-announce-in { from { opacity: 0; transform: translate(-50%, -10px); } }
@keyframes ds-announce-out { to { opacity: 0; transform: translate(-50%, -10px); } }
@media (max-width: 600px) {
  .ds-announcement { flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-3); }
  .ds-announcement__body { flex-basis: calc(100% - 76px); }
  .ds-announcement__link { margin-left: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .ds-announcement, .ds-announcement.is-leaving { animation: none; }
}
/* ── Dock tool panels: one interior ─────────────────────────────────────
   Every panel opened from the widget dock carries `.ds-dock-panel`
   (widget-dock.254abf175d7a.js). The box is set there; these rules give the inside one
   language too - type, header, close, buttons, fields, lists - so eighteen
   widgets read as one product. Widget CSS still owns layout and content;
   these win only on the shared vocabulary. See DESIGN.md, "Dock tool panels". */
.ds-dock-panel{font-family:var(--ds-font-sans)!important;font-size:var(--ds-text-sm,14px);line-height:1.5;
  color:var(--ds-text)!important;padding:0 16px 16px!important;scrollbar-width:thin;scrollbar-color:var(--ds-border-strong) transparent}
/* Header: the panel's own `*head*`/`*header*` row, pinned while the body scrolls. */
.ds-dock-panel > [class*="head"]{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin:0 -16px 12px!important;padding:14px 12px 12px 16px!important;background:var(--ds-surface)!important;
  border-bottom:1px solid var(--ds-border-subtle,var(--ds-border))!important}
.ds-dock-panel textarea{display:block;width:100%!important;box-sizing:border-box;min-height:64px}
.ds-dock-panel label{display:block}
.ds-dock-panel [class*="grab"]{display:none!important}
.ds-dock-panel h1,.ds-dock-panel h2,.ds-dock-panel h3{font-size:var(--ds-text-md,15px)!important;font-weight:700!important;
  letter-spacing:-.01em;line-height:1.3;margin:0!important;color:var(--ds-text)!important}
.ds-dock-panel h4,.ds-dock-panel h5,.ds-dock-panel h6{font-size:var(--ds-text-xs,12px)!important;font-weight:700!important;
  text-transform:uppercase;letter-spacing:.06em;color:var(--ds-text-muted)!important;margin:14px 0 6px!important}
.ds-dock-panel p{margin:0 0 8px}
.ds-dock-panel small,.ds-dock-panel [class*="muted"],.ds-dock-panel [class*="hint"],.ds-dock-panel [class*="sub"]{color:var(--ds-text-muted)}
.ds-dock-panel a{color:var(--ds-accent)}
.ds-dock-panel button,.ds-dock-panel .btn,.ds-dock-panel [role="button"]{font:600 var(--ds-text-xs,13px)/1.2 var(--ds-font-sans)!important;
  min-height:32px;padding:7px 12px;border-radius:var(--ds-radius)!important;border:1px solid var(--ds-border)!important;
  background:var(--ds-surface-2)!important;color:var(--ds-text)!important;box-shadow:none!important;cursor:pointer;
  transition:background .15s,border-color .15s,color .15s}
.ds-dock-panel button:hover:not(:disabled){background:var(--ds-surface-3)!important;border-color:var(--ds-border-strong)!important}
.ds-dock-panel button:focus-visible,.ds-dock-panel input:focus-visible,.ds-dock-panel textarea:focus-visible,.ds-dock-panel select:focus-visible{
  outline:2px solid var(--ds-accent)!important;outline-offset:2px}
.ds-dock-panel button:disabled{opacity:.5;cursor:not-allowed}
.ds-dock-panel button[class*="primary"],.ds-dock-panel button[type="submit"],.ds-dock-panel button[class*="cta"],
.ds-dock-panel button[aria-pressed="true"],.ds-dock-panel button.is-active,.ds-dock-panel button.active{
  background:var(--ds-accent-fill,var(--ds-accent))!important;border-color:transparent!important;color:var(--ds-text-on-fill,#fff)!important}
/* The close control: one ghost square, top-right of the sticky header. */
.ds-dock-panel button[aria-label*="lose" i],.ds-dock-panel button[title*="lose" i],.ds-dock-panel button[class*="close"]{
  width:32px;height:32px;min-height:32px;padding:0!important;display:inline-grid;place-items:center;
  background:transparent!important;border-color:transparent!important;color:var(--ds-text-muted)!important;font-size:var(--ds-text-lg) !important}
.ds-dock-panel button[aria-label*="lose" i]:hover,.ds-dock-panel button[class*="close"]:hover{background:var(--ds-surface-3)!important;color:var(--ds-text)!important}
.ds-dock-panel input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),.ds-dock-panel textarea,.ds-dock-panel select{
  font:var(--ds-text-sm,14px)/1.45 var(--ds-font-sans)!important;color:var(--ds-text)!important;
  background:var(--ds-bg-sunken,var(--ds-bg))!important;border:1px solid var(--ds-border)!important;
  border-radius:var(--ds-radius)!important;padding:8px 10px!important;box-shadow:none!important}
.ds-dock-panel textarea::placeholder,.ds-dock-panel input::placeholder{color:var(--ds-text-subtle,var(--ds-text-muted))}
.ds-dock-panel input[type="checkbox"],.ds-dock-panel input[type="radio"],.ds-dock-panel input[type="range"]{accent-color:var(--ds-accent)}
.ds-dock-panel ul,.ds-dock-panel ol{margin:0;padding-left:18px}
.ds-dock-panel ul[class],.ds-dock-panel ol[class]{padding-left:0;list-style:none}
.ds-dock-panel hr{border:0;border-top:1px solid var(--ds-border-subtle,var(--ds-border));margin:12px 0}
.ds-dock-panel code,.ds-dock-panel pre{font-family:var(--ds-font-mono)!important;font-size:var(--ds-text-sm)}
.ds-dock-panel pre{background:var(--ds-bg-sunken,var(--ds-bg));border:1px solid var(--ds-border);border-radius:var(--ds-radius);padding:10px 12px;overflow:auto}
@media (prefers-reduced-motion:reduce){.ds-dock-panel button{transition:none}}

/* --- Site footer under a sidebar layout -----------------------------------
   site-footer.254abf175d7a.js gives .ds-site-footer margin-top:48px to separate it from
   ordinary page content. Under a full-height .layout (phase pages: sticky
   sidebar + main) that margin is an empty band where the sidebar stops and
   the backdrop shows through, so the footer sits flush there. (0,2,0) beats
   the injected rule regardless of source order. */
.layout ~ .ds-site-footer{margin-top:0}

/* Account sync (assets/js/account-sync.254abf175d7a.js) - DESIGN.md, "Account sync".
   .ds-sync-status is the one-line save state a page shows next to the thing
   it saves (saving / synced / offline / error / on this device only); the
   state is a data attribute so the colour follows the theme. .ds-sync-import
   is the one-time "study data on this device" question. */
.ds-sync-status { font-size: var(--ds-text-xs); color: var(--ds-text-muted); min-height: 1.2em; }
.ds-sync-status[data-sync="offline"] { color: var(--ds-warning); }
.ds-sync-status[data-sync="error"] { color: var(--ds-danger); }
.ds-sync-import { width: min(440px, calc(100vw - 32px)); padding: var(--ds-space-5); border-radius: var(--ds-radius-lg); }
.ds-sync-import__title { margin: 0 0 var(--ds-space-2); font-size: var(--ds-text-lg); color: var(--ds-text); outline: none; }
.ds-sync-import__body, .ds-sync-import__note { margin: 0 0 var(--ds-space-3); font-size: var(--ds-text-sm); color: var(--ds-text-2); }
.ds-sync-import__list { margin: 0 0 var(--ds-space-3); padding-left: var(--ds-space-5); font-size: var(--ds-text-sm); color: var(--ds-text); }
.ds-sync-import__status { margin: 0 0 var(--ds-space-3); font-size: var(--ds-text-sm); color: var(--ds-text); }
.ds-sync-import__status:empty { display: none; }
.ds-sync-import__actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
@media (max-width: 420px) { .ds-sync-import__actions .ds-btn { flex: 1 1 100%; } }

/* --- Roadmap: "Plan" on a phase heading (phase-plan-button.254abf175d7a.js) ---------- */
.ds-phase-plan {
  flex: none; margin-right: var(--ds-space-2); padding: 2px var(--ds-space-2);
  background: none; border: 1px dashed var(--ds-border); border-radius: var(--ds-radius-sm);
  color: var(--ds-text-muted); cursor: pointer;
}
.ds-phase-plan:hover, .ds-phase-plan:focus-visible { color: var(--ds-text); border-color: var(--ds-text-muted); }
.ds-phase-plan[aria-pressed="true"] { border-style: solid; border-color: var(--ds-accent); color: var(--ds-accent); }
.sp-phase { font-weight: 500; }
/* A planned phase is greyed in its tool's list - its topics are paced on its own row. */
.phase-block[data-phase-planned] > :not(.phase-label) { opacity: .55; filter: grayscale(.6); }
.phase-block[data-phase-planned] > .phase-label { color: var(--ds-text-muted); }
.ds-tool-own {
  margin-left: auto; padding: 0 var(--ds-space-2); border-radius: var(--ds-radius-pill);
  background: var(--ds-surface-2); color: var(--ds-text-muted); font-size: var(--ds-text-xs); font-weight: 600;
}

/* --- Per tool plan lock ---------------------------------------------------
   A Per day tool is locked until the dated tools' last date (plan-lock.254abf175d7a.js):
   still readable, visibly disabled, no status can change. */
[data-plan-locked] { opacity: .45; filter: grayscale(1); cursor: not-allowed !important; }
html[data-plan-locked-page] .tp-row,
html[data-plan-locked-page] .dp-roadmap-sync { opacity: .45; filter: grayscale(1); cursor: not-allowed; }
.ds-plan-lock-banner {
  display: flex; align-items: center; gap: var(--ds-space-3);
  max-width: 960px; margin: var(--ds-space-4) auto; padding: var(--ds-space-3) var(--ds-space-4);
  background: color-mix(in srgb, var(--ds-warning) 8%, var(--ds-surface-1));
  border: 1px solid color-mix(in srgb, var(--ds-warning) 35%, var(--ds-border));
  border-radius: var(--ds-radius-lg); color: var(--ds-text);
}
.ds-plan-lock-banner__icon {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: color-mix(in srgb, var(--ds-warning) 18%, transparent);
}
.ds-plan-lock-banner__icon svg { fill: none; stroke: var(--ds-warning); stroke-width: 2; stroke-linecap: round; }
.ds-plan-lock-banner__body { display: grid; gap: 2px; min-width: 0; font-size: var(--ds-text-sm); }
.ds-plan-lock-banner__body span { color: var(--ds-text-muted); }
.ds-plan-lock-banner__chip {
  flex: none; margin-left: auto; padding: 2px var(--ds-space-2); border-radius: var(--ds-radius-pill);
  border: 1px solid var(--ds-border); color: var(--ds-text-muted); font-size: var(--ds-text-xs, 12px);
}
@media (max-width: 560px) { .ds-plan-lock-banner__chip { display: none; } }
#tool-dd-list .tool-btn[data-plan-locked] { pointer-events: auto; }

/* ── Notification inbox ────────────────────────────────────────────────────
   The topbar bell (.ds-inbox-btn) and its panel (.ds-inbox), rendered by
   assets/js/notification-inbox.js. Rules: DESIGN.md, "Notification inbox". */
.ds-inbox-btn { position: relative; }
.ds-inbox-badge {
  position: absolute; top: 1px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--ds-radius-pill); background: var(--ds-danger-fill); color: var(--ds-text-on-fill);
  font-size: var(--ds-text-xs); font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--ds-surface); pointer-events: none;
}
.ds-inbox-badge[hidden] { display: none; }
.ds-inbox {
  position: fixed; top: calc(var(--ds-navbar-h) + var(--ds-space-2)); right: var(--ds-space-3);
  z-index: var(--ds-z-drawer); width: min(400px, calc(100vw - 2 * var(--ds-space-3)));
  max-height: calc(100vh - var(--ds-navbar-h) - var(--ds-space-5));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ds-surface-2); color: var(--ds-text);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-xl);
  animation: ds-inbox-in .16s ease-out;
}
.ds-inbox[hidden] { display: none; }
@keyframes ds-inbox-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ds-inbox { animation: none; } }
.ds-inbox__head { display: flex; align-items: center; gap: var(--ds-space-2); padding: var(--ds-space-3) var(--ds-space-4); border-bottom: 1px solid var(--ds-border-subtle); }
.ds-inbox__head h2 { margin: 0 auto 0 0; font-size: var(--ds-text-md); font-weight: 600; }
.ds-inbox__markall { background: none; border: 0; padding: var(--ds-space-1); color: var(--ds-accent); font: inherit; font-size: var(--ds-text-sm); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ds-inbox__markall:disabled { color: var(--ds-text-subtle); cursor: default; text-decoration: none; }
.ds-inbox__close { width: 28px; height: 28px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-text-muted); font-size: var(--ds-text-lg); line-height: 1; cursor: pointer; }
.ds-inbox__close:hover { color: var(--ds-text); background: var(--ds-surface-3); }
.ds-inbox__tabs { display: flex; gap: var(--ds-space-1); margin: var(--ds-space-3) var(--ds-space-4) var(--ds-space-2); padding: 3px; border-radius: var(--ds-radius); background: var(--ds-bg-sunken); }
.ds-inbox__tab { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 32px; border: 0; border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-text-muted); font: inherit; font-size: var(--ds-text-sm); cursor: pointer; }
.ds-inbox__tab[aria-selected="true"] { background: var(--ds-surface-3); color: var(--ds-text); box-shadow: var(--ds-shadow-sm); }
.ds-inbox__count { color: var(--ds-text-subtle); font-variant-numeric: tabular-nums; }
.ds-inbox__list { list-style: none; margin: 0; padding: var(--ds-space-1) var(--ds-space-3) var(--ds-space-3); overflow-y: auto; display: grid; gap: var(--ds-space-2); }
.ds-inbox__item { position: relative; display: flex; gap: var(--ds-space-3); padding: var(--ds-space-3); border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius); background: var(--ds-surface-3); color: inherit; text-decoration: none; }
a.ds-inbox__item:hover { background: var(--ds-surface-4); border-color: var(--ds-border); }
.ds-inbox__item:focus-visible, .ds-inbox__tab:focus-visible, .ds-inbox__markall:focus-visible, .ds-inbox__close:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-inbox__icon { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: var(--ds-radius-pill); background: var(--ds-info-quiet); color: var(--ds-info); }
.ds-inbox__icon[data-tone="warn"] { background: var(--ds-warning-quiet); color: var(--ds-warning); }
.ds-inbox__icon[data-tone="success"] { background: var(--ds-success-quiet); color: var(--ds-success); }
.ds-inbox__text { min-width: 0; display: grid; gap: 2px; padding-right: var(--ds-space-3); }
.ds-inbox__title { font-size: var(--ds-text-base); font-weight: 600; }
.ds-inbox__detail { font-size: var(--ds-text-sm); color: var(--ds-text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ds-inbox__meta { display: flex; align-items: center; gap: var(--ds-space-2); margin-top: 4px; font-size: var(--ds-text-xs); color: var(--ds-text-muted); }
.ds-inbox__tag { padding: 1px 8px; border-radius: var(--ds-radius-pill); background: var(--ds-info-quiet); color: var(--ds-info); font-weight: 600; }
.ds-inbox__tag[data-tone="warn"] { background: var(--ds-warning-quiet); color: var(--ds-warning); }
.ds-inbox__tag[data-tone="success"] { background: var(--ds-success-quiet); color: var(--ds-success); }
.ds-inbox__dot { position: absolute; top: var(--ds-space-3); right: var(--ds-space-3); width: 8px; height: 8px; border-radius: var(--ds-radius-pill); background: var(--ds-accent); }
.ds-inbox__item:not(.is-unread) .ds-inbox__title { font-weight: 500; color: var(--ds-text-2); }
.ds-inbox__empty { padding: var(--ds-space-5) var(--ds-space-3); text-align: center; color: var(--ds-text-muted); font-size: var(--ds-text-sm); }
@media (max-width: 600px) {
  .ds-inbox { left: 0; right: 0; top: var(--ds-navbar-h); width: 100%; max-height: calc(100vh - var(--ds-navbar-h)); border-radius: 0 0 var(--ds-radius-lg) var(--ds-radius-lg); }
}
.ds-inbox__close[aria-pressed="true"] { color: var(--ds-accent); border-color: var(--ds-accent-line); background: var(--ds-accent-quiet); }
.ds-inbox__close { display: inline-grid; place-items: center; }
.ds-inbox__tabs[hidden], .ds-inbox__list[hidden], .ds-inbox__prefs[hidden] { display: none; }
.ds-inbox__tab { padding: 0 4px; font-size: var(--ds-text-xs); }
.ds-inbox__foot { display: flex; justify-content: center; gap: var(--ds-space-4); padding: var(--ds-space-1) 0; }
.ds-inbox__foot a.ds-inbox__markall { display: inline-block; }
.ds-inbox__prefs { display: grid; gap: var(--ds-space-1); padding: var(--ds-space-3) var(--ds-space-4) var(--ds-space-4); overflow-y: auto; }
.ds-inbox__prefs-note { margin: 0 0 var(--ds-space-2); color: var(--ds-text-muted); font-size: var(--ds-text-sm); }
.ds-inbox__pref { display: flex; align-items: center; gap: var(--ds-space-2); min-height: 32px; font-size: var(--ds-text-sm); color: var(--ds-text-2); cursor: pointer; }
.ds-inbox__pref input { accent-color: var(--ds-accent-fill); width: 16px; height: 16px; }

/* Back to top (assets/js/back-to-top.254abf175d7a.js): one round button, bottom-right,
   shown after the first screen of scrolling. Sits above the phase pages' bottom
   nav (--ds-phasenav-h is 0 elsewhere) and under every drawer and palette.
   --ds-totop-lift (set by the script) is the visible height of the site
   footer, so at the page end the button rises above it instead of covering it. */
button.ds-totop {
  position: fixed; right: var(--ds-space-4); bottom: calc(var(--ds-totop-lift, 0px) + var(--ds-phasenav-h, 0px) + var(--ds-space-4) + env(safe-area-inset-bottom, 0px));
  z-index: var(--ds-z-legacy); display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--ds-border); border-radius: 50%; background: var(--ds-surface); color: var(--ds-text-muted);
  box-shadow: var(--ds-shadow-lg); cursor: pointer; font: inherit;
  opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease, color .12s ease, border-color .12s ease;
}
/* The widget dock's right rail lives in the same corner: step left of it.
   On a phone the button also clears the bottom tab bar (--ds-mobilenav-h,
   measured by the shell), and centres so it never meets either dock rail. */
body:has(.ds-dock--right:not(.ds-dock-off)) button.ds-totop { right: calc(var(--ds-space-4) + 52px); }
@media (max-width: 900px) {
  button.ds-totop, body:has(.ds-dock--right:not(.ds-dock-off)) button.ds-totop {
    right: auto; left: calc(50% - 20px);
    bottom: calc(var(--ds-totop-lift, 0px) + var(--ds-mobilenav-h, 0px) + var(--ds-phasenav-h, 0px) + var(--ds-space-3) + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 520px) {
  button.ds-totop, body:has(.ds-dock--right:not(.ds-dock-off)) button.ds-totop { bottom: calc(var(--ds-totop-lift, 0px) + var(--ds-mobilenav-h, 69px) + var(--ds-phasenav-h, 0px) + var(--ds-space-3) + env(safe-area-inset-bottom, 0px)); }
}
.ds-totop.is-on { opacity: 1; transform: none; }
.ds-totop:hover { color: var(--ds-text); border-color: var(--ds-border-strong, var(--ds-accent)); }
.ds-totop:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; color: var(--ds-text); }
.ds-totop[hidden] { display: none; }
@media print { .ds-totop { display: none; } }
@media (prefers-reduced-motion: reduce) { .ds-totop { transition: none; transform: none; } }

/* ── Consent notice (assets/js/consent.254abf175d7a.js) ────────────────────────────────
   One non-blocking card, bottom-left, asked once. Allow and No thanks are the
   same size and weight: a lopsided pair is not a free choice. */
.ds-consent {
  position: fixed; left: var(--ds-space-4); bottom: calc(var(--ds-consent-lift, 0px) + var(--ds-space-4));
  z-index: var(--ds-z-legacy);
  width: min(420px, calc(100vw - 2 * var(--ds-space-4)));
  padding: var(--ds-space-3) var(--ds-space-4);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg);
  background: var(--ds-surface); color: var(--ds-text);
  font-size: var(--ds-text-sm); line-height: 1.5; box-shadow: var(--ds-shadow-lg);
}
.ds-consent__body { margin: 0 0 var(--ds-space-3); color: var(--ds-text-muted); }
.ds-consent__body strong { display: block; color: var(--ds-text); margin-bottom: 2px; }
.ds-consent__body a { color: var(--ds-accent); }
.ds-consent__actions { display: flex; gap: var(--ds-space-2); justify-content: flex-end; }
button.ds-consent__btn {
  flex: 1 1 0; min-height: 36px; padding: 0 var(--ds-space-3);
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius);
  background: var(--ds-surface-2, var(--ds-surface)); color: var(--ds-text);
  font: inherit; font-weight: 600; cursor: pointer;
}
button.ds-consent__btn:hover, button.ds-consent__btn:focus-visible { border-color: var(--ds-accent); }
@media (max-width: 600px) {
  .ds-consent { left: var(--ds-space-4); right: var(--ds-space-4); width: auto;
    bottom: calc(var(--ds-space-4) + env(safe-area-inset-bottom, 0px) + var(--ds-phasenav-h, 0px)); }
}
@media print { .ds-consent { display: none; } }

/* A wrapped row starts flush left: on a phone the hairline-separated stats
   become a two-column grid, so no line opens with a separator or an indent. */
@media (max-width: 600px) {
  html:root .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
  html:root .hero-stat, html:root .hero-stat:first-child { border-left: 0; padding: 2px 0; }
}

/* ===========================================================================
   Diagram palette (--dg-*) - hand-drawn SVG diagrams in phase pages
   (Topics/NN-slug/diagrams/*.svg). scripts/theme_diagram_svg.py rewrites each
   colour as var(--dg-<role>, <light hex>), and assets/js/inline-diagrams.0556698fd04a.js
   inlines the SVG so these tokens apply. Saturated fills (blue/green/amber/
   purple) are the same in both themes - they already read on dark and light;
   neutrals and pale tints swap. Rules: DESIGN.md, "Diagrams".
   =========================================================================== */
html:root {
  --dg-card: #141a26;      --dg-card-2: #1a2130;
  --dg-ink: #e6e9ef;       --dg-muted: #a3acbd;   --dg-line: #b4bccb;  --dg-border: #3a4356;
  --dg-on-fill: #ffffff;
  --dg-red: #f07a7a;       --dg-red-tint: #2a1719; --dg-dead-ink: #f4a6a6;
  --dg-dead-a: #3a1d22;    --dg-dead-b: #4d262c;
  --dg-blue: #4f7cff;      --dg-on-blue-2: #e8eeff; --dg-blue-tint: #172340; --dg-blue-ink: #9db4ff;
  --dg-amber: #f5b942;     --dg-on-amber: #3a2a00;  --dg-amber-tint: #2b2414; --dg-amber-ink: #f3c96b;
  --dg-amber-line: #c89b3a;
  --dg-green: #2f9e6e;     --dg-teal: #278a5f;     --dg-on-green-2: #eafff4; --dg-green-tint: #11281f;
  --dg-green-ink: #74d9aa;
  --dg-purple: #8b5cf6;    --dg-on-purple-2: #f1eaff; --dg-purple-tint: #211a38; --dg-purple-ink: #c7adff;
  --dg-slate: #56657d;     --dg-on-slate-2: #e2e8f0; --dg-grey: #283041;
}
html[data-ds-theme="light"]:root {
  --dg-card: #ffffff;      --dg-card-2: #f8fafc;
  --dg-ink: #1f2430;       --dg-muted: #5b6475;   --dg-line: #3b4252;  --dg-border: #cbd5e1;
  --dg-red: #d64545;       --dg-red-tint: #fff5f5; --dg-dead-ink: #9b2c2c;
  --dg-dead-a: #f6d9d9;    --dg-dead-b: #e7b4b4;
  --dg-blue-tint: #eef2ff; --dg-blue-ink: #2b4cc7;
  --dg-amber-tint: #fff8e6; --dg-amber-ink: #7a5a00; --dg-amber-line: #b78a22;
  --dg-green: #34b37d;     --dg-teal: #2f9e6e;    --dg-green-tint: #eafaf2; --dg-green-ink: #1f7a52;
  --dg-purple-tint: #f6f1ff; --dg-purple-ink: #5b33b0;
  --dg-slate: #475569;     --dg-grey: #e9edf3;
}

/* ===========================================================================
   AI tag - marks every AI feature's entry point (DESIGN.md, "AI tag").
   Added by assets/js/ai-label.0272aa0495d1.js, or written into a feature's own markup.
   =========================================================================== */
.ds-ai-tag {
  display: inline-flex; align-items: center; vertical-align: middle;
  margin-left: .4em; padding: 0 .4em; height: 1.35em;
  font-size: var(--ds-text-xs); font-weight: 700; letter-spacing: .04em; line-height: 1;
  color: var(--ds-purple); background: transparent;
  border: 1px solid var(--ds-purple); border-radius: var(--ds-radius-pill);
  font-family: inherit; text-transform: uppercase; pointer-events: none;
}
.ds-ai-tag--corner {
  position: absolute; top: -6px; right: -6px; margin: 0;
  font-size: var(--ds-text-xs); height: 18px; background: var(--ds-bg);
}

/* ===========================================================================
   SYNTAX COLOURS - every code block on the site
   ---------------------------------------------------------------------------
   code-highlight.254abf175d7a.js emits tk-* spans; code-copy.254abf175d7a.js (shell-loaded) runs it on
   any block that arrives plain. :where() keeps these at zero specificity so a
   surface's own sheet (topic-split-view.254abf175d7a.css, code-viewer.fb79ad6b5c58.css) still wins.
   =========================================================================== */
:where(.tk-kw) { color: var(--hl-kw); }
:where(.tk-type, .tk-tag) { color: var(--hl-type); }
:where(.tk-str) { color: var(--hl-str); }
:where(.tk-num) { color: var(--hl-num); }
:where(.tk-com) { color: var(--hl-cm); font-style: italic; }
:where(.tk-ann, .tk-prompt) { color: var(--hl-ann); }
:where(.tk-fn) { color: var(--hl-fn); }
:where(.tk-attr, .tk-var) { color: var(--hl-cls); }
:where(.tk-add) { color: var(--ds-success); }
:where(.tk-del) { color: var(--ds-danger); }

/* ===== Dashboard summary kit (DESIGN.md, "Dashboard summary kit") =====
   Four pieces: a hero context line, a setup checklist, stat cards with a
   trend chip, and a segmented coverage bar. Solid surfaces only - no glass. */
.ds-hero-sub { margin: 0 0 var(--ds-space-3); font-size: var(--ds-text-sm); color: var(--ds-text-muted); max-width: 60ch; }

.ds-checklist { display: grid; gap: var(--ds-space-3); }
.ds-checklist-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ds-space-3); }
.ds-checklist-head h2 { margin: 0; font-size: var(--ds-text-base); font-weight: 700; }
.ds-checklist-meta { display: flex; align-items: center; gap: var(--ds-space-3); font-size: var(--ds-text-xs); color: var(--ds-text-muted); }
.ds-checklist-progress { display: flex; align-items: center; gap: var(--ds-space-3); font: 600 var(--ds-text-xs)/1 var(--ds-font-mono); color: var(--ds-success); }
.ds-checklist-progress .ds-checklist-track { flex: 1; height: 6px; border-radius: var(--ds-radius-pill); background: var(--ds-border-subtle); overflow: hidden; }
.ds-checklist-progress .ds-checklist-track > i { display: block; height: 100%; background: var(--ds-success-fill); border-radius: inherit; transition: width .6s var(--ds-ease); }
.ds-checklist ol { list-style: none; margin: 0; padding: var(--ds-space-2); display: grid; gap: 2px;
  background: var(--ds-surface-2); border: 1px solid var(--ds-border-subtle, var(--ds-border)); border-radius: var(--ds-radius); }
.ds-checklist li a, .ds-checklist li > span { display: flex; align-items: center; gap: var(--ds-space-3); padding: 8px 10px;
  border-radius: var(--ds-radius-sm); color: var(--ds-text); text-decoration: none; font-size: var(--ds-text-sm); min-height: 40px; }
.ds-checklist li a:hover { background: var(--ds-surface-3); }
.ds-checklist li a:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 1px; }
.ds-checklist-box { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ds-text-muted);
  display: inline-grid; place-items: center; font-size: var(--ds-text-xs); line-height: 1; }
.ds-checklist li.is-done .ds-checklist-box { border-color: var(--ds-success); color: var(--ds-success); background: var(--ds-success-quiet); }
.ds-checklist li.is-done .ds-checklist-text { text-decoration: line-through; color: var(--ds-text-muted); }
.ds-checklist-go { margin-left: auto; font-size: var(--ds-text-xs); color: var(--ds-text-muted); }

.ds-statcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--ds-space-3); }
.ds-statcard { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--ds-surface-2); border: 1px solid var(--ds-border-subtle, var(--ds-border)); border-radius: var(--ds-radius); }
.ds-statcard-lbl { font-size: var(--ds-text-xs); color: var(--ds-text-muted); }
.ds-statcard-row { display: flex; align-items: center; gap: var(--ds-space-2); flex-wrap: wrap; }
.ds-statcard-num { font: 700 var(--ds-text-xl)/1.1 var(--ds-font-mono); color: var(--ds-text); font-variant-numeric: tabular-nums; }
.ds-statcard-cmp { font-size: var(--ds-text-xs); color: var(--ds-text-muted); }
.ds-trend { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: var(--ds-radius-pill);
  font: 600 var(--ds-text-xs)/1.4 var(--ds-font-mono); background: var(--ds-surface-3); color: var(--ds-text-muted); }
.ds-trend[hidden] { display: none; }
.ds-trend--up { background: var(--ds-success-quiet); color: var(--ds-success); }
.ds-trend--down { background: var(--ds-danger-quiet); color: var(--ds-danger); }

.ds-segbar { display: grid; gap: var(--ds-space-2); }
.ds-segbar-track { display: flex; gap: 3px; height: 14px; }
.ds-segbar-track > i { display: block; height: 100%; border-radius: var(--ds-radius-sm); min-width: 0; transition: flex-basis .6s var(--ds-ease); }
.ds-segbar-track > i[data-zero] { display: none; }
.ds-seg--done { background: var(--ds-success-fill); }
.ds-seg--unclear { background: var(--ds-warning); }
.ds-seg--left { background: var(--ds-border-subtle); }
.ds-segbar-legend { display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-4); margin: 0; padding: 0; list-style: none;
  font-size: var(--ds-text-xs); color: var(--ds-text-muted); }
.ds-segbar-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ds-segbar-legend b { color: var(--ds-text); font-family: var(--ds-font-mono); font-weight: 600; }
.ds-segbar-legend .ds-seg-dot { width: 8px; height: 8px; border-radius: 50%; }
@media (prefers-reduced-motion: reduce) {
  .ds-checklist-progress .ds-checklist-track > i, .ds-segbar-track > i { transition: none; }
}

/* Phase page version switch: links a rewritten phase page and its
   previous version (phase-NN_old.html) both ways. See DESIGN.md. */
.phase-version-switch {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 0 0 16px; padding: 10px 14px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius);
  background: var(--ds-surface-2, var(--ds-surface)); color: var(--ds-text-muted);
  font-size: var(--ds-text-sm);
}
.phase-version-switch a {
  color: var(--ds-accent); font-weight: 600; text-decoration: underline;
  min-height: 44px; display: inline-flex; align-items: center;
}
