/* Design tokens (plans/APP_PRODUCT_DESIGN_20261105.md section 4). Variables only: no rule here paints anything.
   Colour roles are semantic; a view never uses a raw colour. There is no verdict colour: a result is shown by the server's word and a shape (js/status.js), colour only reinforces it.
   Themes: light (default), dark (system setting unless the user chose Light, or the user's choice Dark), more contrast, forced colors.
   The user's choices arrive as attributes on <html>: data-theme (js/theme.js), data-density (boolean, js/theme.js), data-motion (js/motion.js). */
:root {
  /* type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;
  --fs-3xl: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
  --lh-tight: 1.2; --lh-body: 1.5;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;
  /* space (4 px base) */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4rem;
  /* radius */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-full: 999px;
  /* elevation (dark theme replaces the shadow by a ring) */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .08);
  --sh-2: 0 4px 12px rgba(16, 24, 40, .12);
  --sh-3: 0 12px 32px rgba(16, 24, 40, .2);
  --scrim: rgba(10, 14, 20, .5);
  /* z-index */
  --z-sticky: 10; --z-nav: 20; --z-popover: 30; --z-dialog: 40; --z-toast: 50;
  /* motion: only opacity and transform animate; reduced motion zeroes the durations (base.css) */
  --dur-1: 100ms; --dur-2: 160ms; --dur-3: 240ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  /* layout */
  --sidebar-w: min(15rem, 20vw); --sidebar-w-collapsed: 4rem; --topbar-h: 3.5rem; --content-max: 72rem;
  --hit: 2.75rem;      /* touch target: 44 px (Guided); Dense keeps controls at least 24 px (WCAG 2.5.8) */
  --chip-h: 28px;      /* the header's one-row controls: the pill, Retry now and its answer */
  --ctl-h: 2.75rem;    /* the height of buttons, inputs and selects */
  --ring: 2px;
  /* colour roles, light */
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --surface-sunken: #e9ecf0;
  --border: #dde1e7; --border-strong: #79818f;
  --text: #12171f; --text-2: #444d5b; --text-3: #586271;
  --accent: #3b49d6; --accent-hover: #2f3bb8; --accent-fg: #ffffff; --accent-soft: #e9ebfd; --focus: #3b49d6;
  --ok: #17673a; --ok-soft: #e3f3e8;
  --warn: #8a4b00; --warn-soft: #fdf0d9;
  --err: #b3261e; --err-soft: #fde9e7;
  --info: #1b5fb4; --info-soft: #e5f0fc;
  --neutral: #444d5b; --neutral-soft: #eceff3;
  --banner-bg: #fff1d6; --banner-fg: #1a1a1a;
  --knot-l: block; --knot-d: none;
  color-scheme: light;
  /* aliases: the names the first version of the app used. They keep every existing rule, view and test working; new code uses the roles above. */
  --fg: var(--text); --muted: var(--text-2); --panel: var(--surface); --line: var(--border-strong); --st-ok: var(--ok);
}
/* Theme (R13): dark by the system unless the user chose Light; dark by the user's choice at any system setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1015; --surface: #151a21; --surface-2: #1d232c; --surface-sunken: #090b0f;
    --border: #272e39; --border-strong: #6f7a8a;
    --text: #e9edf3; --text-2: #aeb7c4; --text-3: #9ba5b4;
    --accent: #95a2ff; --accent-hover: #b0baff; --accent-fg: #0b0e14; --accent-soft: #222850; --focus: #95a2ff;
    --ok: #74d493; --ok-soft: #13291c; --warn: #ffbe6b; --warn-soft: #33250e; --err: #ff9188; --err-soft: #3a1815;
    --info: #80b6ff; --info-soft: #132a47; --neutral: #aeb7c4; --neutral-soft: #232a34;
    --sh-1: 0 0 0 1px rgba(255, 255, 255, .06); --sh-2: 0 0 0 1px rgba(255, 255, 255, .09), 0 8px 24px rgba(0, 0, 0, .45); --sh-3: 0 0 0 1px rgba(255, 255, 255, .12), 0 16px 40px rgba(0, 0, 0, .6);
    --scrim: rgba(0, 0, 0, .62);
    --banner-bg: #3a2a0f; --banner-fg: #f2f2f2;
    --knot-l: none; --knot-d: block;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1015; --surface: #151a21; --surface-2: #1d232c; --surface-sunken: #090b0f;
  --border: #272e39; --border-strong: #6f7a8a;
  --text: #e9edf3; --text-2: #aeb7c4; --text-3: #9ba5b4;
  --accent: #95a2ff; --accent-hover: #b0baff; --accent-fg: #0b0e14; --accent-soft: #222850; --focus: #95a2ff;
  --ok: #74d493; --ok-soft: #13291c; --warn: #ffbe6b; --warn-soft: #33250e; --err: #ff9188; --err-soft: #3a1815;
  --info: #80b6ff; --info-soft: #132a47; --neutral: #aeb7c4; --neutral-soft: #232a34;
  --sh-1: 0 0 0 1px rgba(255, 255, 255, .06); --sh-2: 0 0 0 1px rgba(255, 255, 255, .09), 0 8px 24px rgba(0, 0, 0, .45); --sh-3: 0 0 0 1px rgba(255, 255, 255, .12), 0 16px 40px rgba(0, 0, 0, .6);
  --scrim: rgba(0, 0, 0, .62);
  --banner-bg: #3a2a0f; --banner-fg: #f2f2f2;
  --knot-l: none; --knot-d: block;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
/* More contrast (the system setting): borders take the strong role, the two quieter text roles take the main text colour. */
@media (prefers-contrast: more) {
  :root { --border: var(--border-strong); --text-2: var(--text); --text-3: var(--text); --sh-1: none; --sh-2: none; }
  :root:not([data-theme]) { --border-strong: #3d4552; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --border-strong: #b6bfcc; } }
@media (prefers-contrast: more) { :root[data-theme="dark"] { --border-strong: #b6bfcc; } :root[data-theme="light"] { --border-strong: #3d4552; } }
/* Dense (Settings > Appearance): the controls shrink to 32 px, spacing tightens; table cells and sort buttons stay at least 24 px (css/app.css). */
:root[data-density] { --ctl-h: 2rem; --hit: 2rem; }
/* Forced colors (Windows High Contrast and similar): the browser replaces colours anyway; the roles map to system colours so a custom property read by script is still a real colour. */
@media (forced-colors: active) {
  :root {
    --bg: Canvas; --surface: Canvas; --surface-2: Canvas; --surface-sunken: Canvas; --border: CanvasText; --border-strong: CanvasText;
    --text: CanvasText; --text-2: CanvasText; --text-3: CanvasText; --accent: LinkText; --accent-hover: LinkText; --accent-fg: Canvas; --accent-soft: Canvas; --focus: Highlight;
    --ok: CanvasText; --ok-soft: Canvas; --warn: CanvasText; --warn-soft: Canvas; --err: CanvasText; --err-soft: Canvas; --info: CanvasText; --info-soft: Canvas; --neutral: CanvasText; --neutral-soft: Canvas;
    --banner-bg: Canvas; --banner-fg: CanvasText; --sh-1: none; --sh-2: none; --sh-3: none;
  }
}
