/* Night mode (docs/45). Linked on every active page BEFORE the page's own
   <style>. The light values live in each page's own :root and are not repeated
   here: this file only overrides them under :root[data-theme="dark"], which
   theme.js (and the inline head script) set to the resolved mode. It declares
   tokens and color-scheme only — never a component rule. */

:root { color-scheme: light; }

/* § 3.5 a browser that prints without firing beforeprint still prints light. */
@media print {
  :root[data-theme="dark"] {
    --accent: #4f6ef7;
    --accent-dark: #3a58e0;
    --accent-soft: #eef0fd;
    --ink: #1a1a2e;
    --ink-2: #555;
    --ink-3: #8a8f9c;
    --line: #e8eaf0;
    --line-2: #e0e2ea;
    --bg: #f7f8fa;
    --card: #fff;
    color-scheme: light;
  }
}

/* The dark palette, on screen only: printing keeps the light fallback above. */
@media screen {
  :root[data-theme="dark"] {
    /* § 4.1 the common ten, plus the sweep's tokens */
    --br-modal-bg: #1b1e2e;
    --bg: #121420;
    --card: #1b1e2e;
    --card-2: #20243a;
    --ink: #e6e7ee;
    --ink-2: #b6b9c8;
    --ink-3: #8c90a3;
    --line: #2a2e42;
    --line-2: #363b55;
    --accent: #8da0ff;
    --accent-dark: #a9b7ff;
    --accent-soft: #232a4a;
    --accent-2: #b09cff;
    --on-accent: #0f1222;
    --on-ink: #121420;
    --header-bg: rgba(27,30,46,0.88);
    --accent-line: #2f3860;
    --accent-line-2: #3a4575;
    --accent-hover: #2a3358;
    --figure-plate: #fff;
    --shadow: rgba(0,0,0,0.5);

    /* « Repère anatomique » pins (docs/50 § 8): the same in both themes,
       since they sit on the image's white plate */
    --pin: #3a58e0;
    --pin-empty: #fff;
    --pin-ring: #fff;
    --pin-ink: #fff;
    --pin-pass: #6b7080;
    --pin-ok: #23794a;
    --pin-bad: #c0392b;
    --pin-focus: #f59e0b;

    /* « Mots croisés » (docs/52 § 7): the pilot's dark grid */
    --xw-cell: #232842;
    --xw-word: #2b3a66;
    --xw-cursor: #8a6d1a;
    --xw-shown: #f0c36a;
    --xw-shown-bg: #3f3215;
    --xw-bar: #e6e7ee;

    /* the notes page's current-APE greens */
    --current-bg: #17301f;
    --current-line: #2d5a3c;
    --current-line-2: #3a6e4a;
    --current-soft: #1b3a26;
    --current-soft-2: #24482f;
    --current-ink: #9fe2b8;

    /* § 4.2 outcome colours */
    --good: #5fcf86;
    --good-soft: #17301f;
    --good-line: #2d5a3c;
    --good-ink: #9fe2b8;
    --bad: #ff7b6e;
    --bad-soft: #3a1f1c;
    --bad-line: #6a2f2a;
    --bad-ink: #ffb4ab;
    --warn: #f3a65a;
    --warn-soft: #33261a;
    --warn-line: #6b4a26;

    /* § 4.3 the reader's hierarchy */
    --theme-text: #e8976b;
    --theme-bar: #ce794a;
    --theme-tint: #2a2320;
    --theme-tint-strong: #3b2d25;
    --theme-recap-tint: #2b2616;
    --theme-recap-bar: #e0b45c;
    --theme-recap-text: #f0c870;

    /* § 4.4 the BPS grid and the vignette's highlight */
    --bio: #8fb0ff;
    --bio-tint: #1c2745;
    --bio-line: #3a4f8a;
    --psycho: #f0a26c;
    --psycho-tint: #3a2719;
    --psycho-line: #7a4a28;
    --social: #6fd39a;
    --social-tint: #17301f;
    --social-line: #2e5a3c;
    --symptom: #b8bccd;
    --symptom-tint: #262a3a;
    --symptom-line: #3f4458;
    --mark: #4a3f12;
    --mark-line: #a88a2a;
    --handle-line: #c9a227;
    --handle-ink: #f0d070;

    /* the ECG paper stays pink in both modes (§ 1.2 #4) */
    --paper: #fff7f7;
    --grid-minor: #f6c9c9;
    --grid-major: #e48f8f;
    --trace: #1a1a2e;

    /* § 4.7 the admin's names and the Usage charts */
    --muted: #b0b4c4;
    --border: #2a2e42;
    --field-border: #363b55;
    --viz-1: #6ea8ff;
    --viz-2: #ff8f5e;
    --viz-3: #4fd39c;
    --viz-gray: #7d8194;
    --viz-gray-2: #4a4e62;
    --viz-heat-1: #232a4a;
    --viz-heat-2: #3b4777;
    --viz-heat-3: #5767a3;
    --viz-heat-4: #7f8fd1;
    --viz-heat-5: #a9b7ff;

    color-scheme: dark;
  }
}

/* § 4.6 the break-game chrome: brainrot.css declares these on .br-root, which
   would otherwise win over :root, so the dark twins are scoped the same way. */
:root[data-theme="dark"] .br-root {
  --br-ink: #e6e7ee;
  --br-ink-3: #9a9eb0;
  --br-line: #363b55;
  --br-accent: #5fcf86;
  --br-card: #1b1e2e;
  --br-card-2: #20243a;
  --br-copy: #b6b9c8;
  --br-on-accent: #0f1222;
  --br-accent-soft: rgba(95,207,134,0.12);
  --br-accent-soft-2: rgba(95,207,134,0.16);
  --br-overlay: #1b1e2e;
  --br-edge: rgba(255,255,255,0.14);
  --br-grid-bg: #15241a;
  --br-grid-line: #2c4a30;
  --br-grid-fill: #3f7a3a;
  --br-grid-ink: #fff;
  --br-grid-btn: rgba(255,255,255,0.15);
  --br-grid-hint: #9fb98f;
  --br-grid-hint-2: #9fb98f;
  --br-scene-flappy-bg: #111f29;
  --br-scene-flappy-pipe: #529578;
  --br-scene-bird: #dcb45b;
  --br-scene-stack-bg: #141d29;
  --br-scene-stack-flash: #1c302c;
  --br-scene-combo: #8ed6aa;
  --br-scene-mine-bg: #15241a;
  --br-scene-mine-edge: #456143;
  --br-scene-mine-covered-odd: #375533;
  --br-scene-mine-covered-even: #41623b;
  --br-scene-mine-hover-odd: #52784a;
  --br-scene-mine-hover-even: #5b8252;
  --br-scene-mine-open-odd: #242d35;
  --br-scene-mine-open-even: #2b353e;
  --br-scene-mine-symbol: #c2d4b4;
  --br-scene-mine-fill: #8fa783;
  --br-scene-flag-pole: #d5decc;
  --br-scene-flag: #ff9588;
  --br-scene-mine-focus: #d9e9ae;
  --br-scene-number-1: #8bb8ff;
  --br-scene-number-2: #8ad39a;
  --br-scene-number-3: #ff9b91;
  --br-scene-number-4: #c5acff;
  --br-scene-number-5: #efbc80;
  --br-scene-number-6: #82d6dc;
  --br-scene-number-7: #d3dbe6;
  --br-scene-number-8: #b8c1cc;
  --br-scene-slope-rail: #56cba5;
  --br-scene-slope-ball: #86d3dc;
  --br-scene-atha-bg: #111c22;
  --br-scene-atha-wall: #3f7d63;
  --br-scene-atha-pellet: #7f9a8c;
  --br-scene-atha-power: #ff8fa0;
  --br-scene-atha-player: #f0a04b;
  --br-scene-atha-c1: #e0705f;
  --br-scene-atha-c2: #a98be0;
  --br-scene-atha-c3: #5fb7dc;
  --br-scene-atha-scared: #7d93aa;
}

