/* Design tokens. Light is default; dark via OS preference unless user forced light, or via data-theme="dark". */
:root {
  --font-ui: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --bg: #f3eee4;
  --bg-grid: rgba(70, 58, 36, 0.07);
  --surface: #fffcf6;
  --surface-2: #f8f3e9;
  --surface-3: #efe8da;
  --ink: #1f1c17;
  --ink-2: #565046;
  --ink-3: #8a8374;
  --line: #2b2720;
  --line-soft: #e0d8c7;
  --shadow: 0 2px 0 var(--line);
  --shadow-soft: 0 1px 0 rgba(43, 39, 32, 0.12), 0 8px 24px -12px rgba(43, 39, 32, 0.25);

  --accent: #2f8a63;          /* primary action / progress */
  --accent-soft: #d6eedf;
  --accent-ink: #11402c;

  /* Pointer & state colours used by visualizers */
  --c-l: #e2682c;  --c-l-soft: #fbe0cf;   /* left / i / slow-alt */
  --c-r: #2f6fd6;  --c-r-soft: #d6e4fa;   /* right / j / slow */
  --c-f: #c23a72;  --c-f-soft: #f8d7e5;   /* fast */
  --c-w: #2f9e72;  --c-w-soft: rgba(47, 158, 114, 0.14); /* window */
  --c-ok: #2f9e72; --c-ok-soft: #d3f0e1;
  --c-bad: #d2453d; --c-bad-soft: #fad9d6;
  --c-hot: #e9b23a; --c-hot-soft: #fbedc8;
  --c-dim: 0.35;

  /* Step tags */
  --tag-problem: #d2453d;   --tag-problem-bg: #fbe3e0;
  --tag-brute: #c56a14;     --tag-brute-bg: #fbe8d2;
  --tag-insight: #7a4fc9;   --tag-insight-bg: #ebe1fb;
  --tag-walk: #2f6fd6;      --tag-walk-bg: #dce8fb;
  --tag-edge: #9a7a0c;      --tag-edge-bg: #f8eec4;
  --tag-complexity: #2f8a63; --tag-complexity-bg: #d6eedf;
  --tag-recap: #4f4a40;     --tag-recap-bg: #e9e3d6;

  --key-bg: #ece4fb; --key-line: #c8b6ee; --key-ink: #3d2a6b;

  /* Syntax */
  --syn-kw: #a33f8a; --syn-type: #2b72b8; --syn-fn: #a35a12; --syn-str: #2f8a4b;
  --syn-num: #b4441e; --syn-com: #8a8374; --code-active: #fbedc8; --code-active-line: #e9b23a;

  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --topbar-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17150f; --bg-grid: rgba(240, 228, 200, 0.05);
    --surface: #211e17; --surface-2: #1c1a14; --surface-3: #2b271f;
    --ink: #f2ecdf; --ink-2: #c4bcac; --ink-3: #8f8877;
    --line: #6b6352; --line-soft: #3a352b;
    --shadow: 0 2px 0 #050403;
    --shadow-soft: 0 1px 0 rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6);
    --accent: #4cc08e; --accent-soft: #1d3a2d; --accent-ink: #c9f2dd;
    --c-l: #f08a4b; --c-l-soft: #4a2c1b; --c-r: #6c9df0; --c-r-soft: #1f2f4d;
    --c-f: #e86a9e; --c-f-soft: #4a1f31; --c-w: #4cc08e; --c-w-soft: rgba(76, 192, 142, 0.16);
    --c-ok: #4cc08e; --c-ok-soft: #1d3a2d; --c-bad: #f0726a; --c-bad-soft: #4a201d;
    --c-hot: #f0c35a; --c-hot-soft: #45391b;
    --tag-problem: #f0857d; --tag-problem-bg: #43211e; --tag-brute: #f0a45a; --tag-brute-bg: #442d16;
    --tag-insight: #b393f0; --tag-insight-bg: #2f2447; --tag-walk: #7aa8f2; --tag-walk-bg: #1d2b45;
    --tag-edge: #e6c65a; --tag-edge-bg: #3d3416; --tag-complexity: #5fcf9b; --tag-complexity-bg: #193a2b;
    --tag-recap: #cfc7b5; --tag-recap-bg: #33302a;
    --key-bg: #2a2340; --key-line: #4a3d73; --key-ink: #dccff9;
    --syn-kw: #e48ad0; --syn-type: #79b4ee; --syn-fn: #efb36e; --syn-str: #8fd39b;
    --syn-num: #f29a74; --syn-com: #8f8877; --code-active: #3a3220; --code-active-line: #f0c35a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17150f; --bg-grid: rgba(240, 228, 200, 0.05);
  --surface: #211e17; --surface-2: #1c1a14; --surface-3: #2b271f;
  --ink: #f2ecdf; --ink-2: #c4bcac; --ink-3: #8f8877;
  --line: #6b6352; --line-soft: #3a352b;
  --shadow: 0 2px 0 #050403;
  --shadow-soft: 0 1px 0 rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6);
  --accent: #4cc08e; --accent-soft: #1d3a2d; --accent-ink: #c9f2dd;
  --c-l: #f08a4b; --c-l-soft: #4a2c1b; --c-r: #6c9df0; --c-r-soft: #1f2f4d;
  --c-f: #e86a9e; --c-f-soft: #4a1f31; --c-w: #4cc08e; --c-w-soft: rgba(76, 192, 142, 0.16);
  --c-ok: #4cc08e; --c-ok-soft: #1d3a2d; --c-bad: #f0726a; --c-bad-soft: #4a201d;
  --c-hot: #f0c35a; --c-hot-soft: #45391b;
  --tag-problem: #f0857d; --tag-problem-bg: #43211e; --tag-brute: #f0a45a; --tag-brute-bg: #442d16;
  --tag-insight: #b393f0; --tag-insight-bg: #2f2447; --tag-walk: #7aa8f2; --tag-walk-bg: #1d2b45;
  --tag-edge: #e6c65a; --tag-edge-bg: #3d3416; --tag-complexity: #5fcf9b; --tag-complexity-bg: #193a2b;
  --tag-recap: #cfc7b5; --tag-recap-bg: #33302a;
  --key-bg: #2a2340; --key-line: #4a3d73; --key-ink: #dccff9;
  --syn-kw: #e48ad0; --syn-type: #79b4ee; --syn-fn: #efb36e; --syn-str: #8fd39b;
  --syn-num: #f29a74; --syn-com: #8f8877; --code-active: #3a3220; --code-active-line: #f0c35a;
  color-scheme: dark;
}
