:root {
  color-scheme: dark;
  --board: #1a1222; --panel: #140d18; --sidebar: #18111e; --header: #180f1e;
  --surface: #241727; --surface-faint: #19111f; --field: #251729; --control: #291a2d; --control-strong: #4a2449;
  --frame: #764775; --stroke: #62415f; --line: #37263c; --line-strong: #492f49;
  --tree-line: #59415b; --scroll-thumb: #93619a; --scroll-track: #39243d;
  --text: #fff8ff; --muted: #ccbbd0; --accent: #ff80d5; --accent-soft: #f9b1ec; --focus: #ffa8e6;
  --hover: #36213b; --selected: #4b2749; --selected-text: #fff7ff; --selection-line: #aa528f;
  --primary: #552951; --primary-border: #ef7ace; --primary-ink: #fff7fd; --notification: #f958aa;
  --basic: #75e2ad; --middle: #83d6ff; --advanced: #fbc17a;
  --basic-fill: #162d25; --middle-fill: #192a3e; --advanced-fill: #36291e;
  --progress-track: #4d2a50; --danger: #ff81c2; --success-surface: #25382b;
  --warning: #ffc069; --warning-ink: #351a15; --warning-surface: #352621;
  --hero-border: #993875; --hero-fallback: #311c3a; --hero-text: #fff9ff;
  --frame-width: 1rem;
  --match-fill: #ffe29b; --match-ink: #251e0d;
  --home-illustration: url("assets/dark-home.webp");
  --level-illustration: url("assets/dark-level.webp");
  --article-illustration: url("assets/dark-article.webp");
}
:root[data-theme="twilight"] {
  --board: #432e4a; --panel: #423049; --sidebar: #48354e; --header: #423048;
  --surface: #523b56; --surface-faint: #46324b; --field: #422d48; --control: #573e58; --control-strong: #7e4872;
  --frame: #b38db3; --stroke: #856587; --line: #654e6c; --line-strong: #795b7b;
  --tree-line: #896789; --scroll-thumb: #b78ab7; --scroll-track: #6b506c;
  --text: #fff8ff; --muted: #f4dcf2; --accent: #ffa9df; --accent-soft: #ffd0ef; --focus: #ffd3ef;
  --hover: #634a67; --selected: #85517f; --selected-text: #fff9ff; --selection-line: #bd79ad;
  --primary: #86517b; --primary-border: #eca4d5; --primary-ink: #fff8ff; --notification: #fa9ad2;
  --basic: #a5eec7; --middle: #afd6ff; --advanced: #ffd193;
  --basic-fill: #3d524a; --middle-fill: #434a62; --advanced-fill: #604c44;
  --progress-track: #765073; --danger: #ffadd9; --success-surface: #4c594e;
  --warning: #ffce80; --warning-ink: #3f2923; --warning-surface: #624e4c;
  --hero-border: #c384b7; --hero-fallback: #754f7c;
  --home-illustration: url("assets/twilight-home.webp");
  --level-illustration: url("assets/twilight-level.webp");
  --article-illustration: url("assets/twilight-article.webp");
}
:root[data-theme="light"] {
  color-scheme: light;
  --board: #f8f0f8; --panel: #fffefe; --sidebar: #fffefe; --header: #fffefe;
  --surface: #f6edf8; --surface-faint: #fcf7fd; --field: #fffcff; --control: #f2e6f4; --control-strong: #efcce6;
  --frame: #cba8cb; --stroke: #cba7cb; --line: #ebddec; --line-strong: #e5d6e7;
  --tree-line: #c5a6c6; --scroll-thumb: #d4acd2; --scroll-track: #f5e8f5;
  --text: #2c0e2b; --muted: #60385f; --accent: #a41374; --accent-soft: #99076b; --focus: #a52280;
  --hover: #f4e4f3; --selected: #f4d3ec; --selected-text: #3c0d33; --selection-line: #d681ba;
  --primary: #9a2f7b; --primary-border: #9a2f7b; --primary-ink: #fff; --notification: #dc258c;
  --basic: #16784e; --middle: #216caa; --advanced: #8e560d;
  --basic-fill: #e7f5ee; --middle-fill: #e6effa; --advanced-fill: #faefdb;
  --progress-track: #eacde8; --danger: #a02a70; --success-surface: #e6f0e4;
  --warning: #bb6506; --warning-ink: #fffdf5; --warning-surface: #fff6e9;
  --hero-border: #d9b9d9; --hero-fallback: #f7d1ed; --hero-text: #2c102b;
  --home-illustration: url("assets/light-home.webp");
  --level-illustration: url("assets/light-level.webp");
  --article-illustration: url("assets/light-article.webp");
}
:root[data-theme="contrast"] {
  --board: #09070c; --panel: #0c0a0e; --sidebar: #0d0a10; --header: #0d0b10;
  --surface: #1c161f; --surface-faint: #100d14; --field: #0e0b10; --control: #201826; --control-strong: #3f2642;
  --frame: #efc6f0; --stroke: #e5bfe8; --line: #715776; --line-strong: #c3a0c5;
  --tree-line: #c2a2c3; --scroll-thumb: #f39ade; --scroll-track: #312036;
  --text: #fffaff; --muted: #f4e1f4; --accent: #ff9bdd; --accent-soft: #ffd9f4; --focus: #8ee9ff;
  --hover: #35263a; --selected: #f897db; --selected-text: #17091a; --selection-line: #ffd4f6;
  --primary: #f897db; --primary-border: #ffc8ed; --primary-ink: #17091a; --notification: #f792db;
  --basic: #99ffc4; --middle: #8edcff; --advanced: #ffd390;
  --basic-fill: #142f24; --middle-fill: #152c3b; --advanced-fill: #36291c;
  --progress-track: #69436c; --danger: #ffa4dd; --success-surface: #30322e;
  --warning: #ffde49; --warning-ink: #252016; --warning-surface: #302920;
  --hero-border: #efc6f0; --hero-fallback: #301825; --frame-width: 1.5rem;
  --arrow-ink: #17091a;
  --home-illustration: url("assets/contrast-home.webp");
  --level-illustration: url("assets/contrast-level.webp");
  --article-illustration: url("assets/contrast-article.webp");
}
:root[data-theme="paper"] {
  color-scheme: light;
  --board: #f9efe0; --panel: #fdf5e8; --sidebar: #fdf5e9; --header: #fef7eb;
  --surface: #f8ecdb; --surface-faint: #fcf4e6; --field: #fdf5e7; --control: #f7e9d7; --control-strong: #eac4cd;
  --frame: #c1ab95; --stroke: #cbb09a; --line: #ead9c5; --line-strong: #decbb6;
  --tree-line: #c5ae98; --scroll-thumb: #a67883; --scroll-track: #e9d7c5;
  --text: #1e120f; --muted: #604337; --accent: #902e62; --accent-soft: #8a365f; --focus: #a43168;
  --hover: #f1e0d2; --selected: #efd0d4; --selected-text: #3e1427; --selection-line: #d3a1ac;
  --primary: #a24c75; --primary-border: #a24c75; --primary-ink: #fff8ee; --notification: #ba3972;
  --basic: #266b49; --middle: #315f97; --advanced: #87530b;
  --basic-fill: #e8eee1; --middle-fill: #e3e8ed; --advanced-fill: #f6ead6;
  --progress-track: #deb2bc; --danger: #a12c5a; --success-surface: #eee6d3;
  --warning: #ac6320; --warning-ink: #fffaf0; --warning-surface: #fff2da;
  --hero-border: #dbb29e; --hero-fallback: #f4dace; --hero-text: #1b100c;
  --home-illustration: url("assets/paper-home.webp");
  --level-illustration: url("assets/paper-level.webp");
  --article-illustration: url("assets/paper-article.webp");
}
:root[data-theme="northern"] {
  --board: #112c37; --panel: #0c222c; --sidebar: #112b36; --header: #0d242e;
  --surface: #17333e; --surface-faint: #102832; --field: #152f39; --control: #1b3a44; --control-strong: #27535b;
  --frame: #93adb5; --stroke: #4c6e77; --line: #304b55; --line-strong: #49636d;
  --tree-line: #48616b; --scroll-thumb: #77d0d3; --scroll-track: #34525e;
  --text: #f4fcff; --muted: #c6dde3; --accent: #8df5ee; --accent-soft: #b3ffff; --focus: #abfffd;
  --hover: #1d404c; --selected: #2b6971; --selected-text: #f5ffff; --selection-line: #69b5bc;
  --primary: #67bfbd; --primary-border: #a7ffff; --primary-ink: #081c21; --notification: #ff847f;
  --basic: #8de9b3; --middle: #8bdcff; --advanced: #ffd08a;
  --basic-fill: #163932; --middle-fill: #163749; --advanced-fill: #373331;
  --progress-track: #30616a; --danger: #ff9c91; --success-surface: #204333;
  --warning: #ffc16a; --warning-ink: #2a2216; --warning-surface: #37352b;
  --hero-border: #4a8994; --hero-fallback: #254855; --hero-text: #f4fcff;
  --home-illustration: url("assets/northern-home.webp");
  --level-illustration: url("assets/northern-level.webp");
  --article-illustration: url("assets/northern-article.webp");
}
:root[data-theme="contrast"] :is(.level-card .card-arrow, .square) { background: var(--tone); }
:root[data-theme="contrast"] .result-row[aria-pressed="true"] .pill { border-color: var(--stroke); }
:root:is([data-theme="light"], [data-theme="paper"]) .steps .number {
  --step-fill: var(--tone); --step-ink: #fff;
}
:root[data-theme="contrast"] .steps .number {
  --step-fill: var(--tone); --step-ink: #111018;
}

:root {
  --nav-dot: #f080ca; --nav-dot-alt: #dba2e6;
}
:root[data-theme="twilight"] {
  --nav-dot: #f3a8df; --nav-dot-alt: #f7b7e7;
}
:root[data-theme="light"] {
  --nav-dot: #dc51aa; --nav-dot-alt: #ec64bf;
}
:root[data-theme="contrast"] {
  --nav-dot: #ffa5e7; --nav-dot-alt: #ffa5e7;
}
:root[data-theme="paper"] {
  --nav-dot: #df78ad; --nav-dot-alt: #d25c9c;
}
:root[data-theme="northern"] {
  --nav-dot: #eda7bf; --nav-dot-alt: #d6a8e4;
}
:root[data-theme="contrast"] .level-card { border-color: var(--tone); }
