/* Theme is a local visual preference only; no birth data or analytics are touched. */
html[data-color-mode="dark"]{color-scheme:dark;--bg:#15120e;--panel:#1f1a14;--surface:#1f1a14;--raised:#2b241b;--text:#eee5d3;--ink:#eee5d3;--muted:#b8ab94;--gold:#e8c47b;--line:#4a3f30;--focus:#e8937c;--plum:#e8937c;--plum-dark:#8a2a20}
html[data-color-mode="dark"] :is(input,select){color-scheme:dark}
html[data-color-mode="dark"] body>header,html[data-color-mode="dark"] .reading-units{background:#0f0c09}
html[data-color-mode="dark"] .reading-units{box-shadow:0 0 0 100vmax #0f0c09}
html[data-color-mode="dark"] :is(.hero-cta,.primary,.button,#profile-save,.palace.selected,.report-continuation>summary,.catalog-categories a[aria-current],.pattern-actions button){background:#9e3328;border-color:#b4513e;color:#fff}
html[data-color-mode="dark"] :is(.form-card input,.form-card select,#profile-name,#profile-select,.year-controls input,.reading-library input,.catalog-search input){background:#120f0b;color:var(--text);border-color:var(--line)}
html[data-color-mode="dark"] :is(.chart-center,.report-card>.report-action,.catalog-chart-cta,.catalog-search button,#catalog-empty button,.pattern-judgement,.pattern-result,.pattern-kind,.pattern-verdict){background:var(--raised);color:var(--text)}
html[data-color-mode="dark"] :is(.catalog-results .topic,#catalog-empty,.pattern-report){background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-color-mode="dark"] :is(.catalog-categories a:hover,.catalog-results .topic:hover){background:var(--raised)}
html[data-color-mode="dark"] .chart-cell:not(.selected){background:#1f1a14}
html[data-color-mode="dark"] .chart-cell:not(.selected):is([data-chart-branch="0"],[data-chart-branch="2"],[data-chart-branch="4"],[data-chart-branch="6"],[data-chart-branch="8"],[data-chart-branch="10"]){background:#2a231a}
html[data-color-mode="dark"] .chart-cell:not(.selected):hover{background:#3a3024}
html[data-color-mode="dark"] .chart-cell.selected{background:#3b3020;border-color:#e8c47b}
html[data-color-mode="dark"] .chart-major{color:var(--text)}
html[data-color-mode="dark"] .chart-hua{background:#3b3020;color:#f0d698;border-color:#927944}
html[data-color-mode="dark"] :is(.chart-evidence-marker,.pattern-report>summary b,.pattern-report a,.pattern-item>summary strong,.pattern-judgement h4,.pattern-technical-details>summary){color:var(--plum)}
html[data-color-mode="dark"] :is(.pattern-report>summary small,.pattern-item>summary small,.pattern-result-guide,.pattern-detail-result,.pattern-check-state){color:var(--muted)}
html[data-color-mode="dark"] :is(.pattern-item,.pattern-configurations,.pattern-pending,.pattern-technical-details,.pattern-sources){border-color:var(--line)}
html[data-color-mode="dark"] :is(.pattern-chevron,.pattern-item-chevron){border-color:var(--plum)}
html[data-color-mode="dark"] :is(.pattern-adverse-note,.pattern-check-state[data-check-state="unmet"],#error,#report-error){color:#f0a08c}
html[data-color-mode="dark"] .pattern-check-state[data-check-state="unknown"]{color:var(--gold)}
html[data-color-mode="dark"] .pattern-verdict[data-result="not_formed"]{background:#3d1f19;color:#f6b7a6}
html[data-color-mode="dark"] .pattern-verdict[data-result="configuration"]{background:#2b2620;color:#d8cdb8}
/* Reference: recessed black track, rounded-square glass, pixel crescent and travelling edge light. */
body>header .theme-switch{position:relative;flex:0 0 104px;width:104px;height:56px;min-height:56px;padding:0;margin:0 0 0 12px;border:1px solid #11121a;border-radius:19px;background:linear-gradient(160deg,#050508,#11121a);box-shadow:inset 0 3px 7px #000c,inset 0 -1px 1px #ffffff13;color:#fff;cursor:pointer;overflow:visible;isolation:isolate;touch-action:pan-y pinch-zoom;user-select:none;-webkit-tap-highlight-color:transparent}
.theme-switch-thumb{position:absolute;top:3px;left:3px;width:48px;height:48px;display:grid;place-items:center;border-radius:15px;border:1px solid #ffffff45;background:radial-gradient(ellipse at 50% 115%,#e8c98a55,transparent 62%),linear-gradient(145deg,#ffffff30,#ffffff0b 55%,#e8c98a1a);box-shadow:inset 0 1px 1px #ffffff80,inset 1px 0 2px #ffffff28,0 2px 5px #0008;backdrop-filter:blur(8px);transition:transform .62s cubic-bezier(.22,.72,.17,1);will-change:transform}
.theme-switch-pixels{width:29px;height:29px;fill:#fffef1;filter:drop-shadow(0 0 2px #fff9)}
.theme-switch-rim{position:absolute;inset:-2px;width:50px;height:50px;overflow:visible;fill:none;pointer-events:none}
.theme-switch-rim rect{stroke:#f3e6c8;stroke-width:1.3;stroke-linecap:round;stroke-dasharray:32 68;filter:drop-shadow(0 0 1px #fff) drop-shadow(0 0 3px #e8c98a) drop-shadow(0 0 6px #c9a45c);animation:theme-edge-travel 3s linear infinite}
[data-color-mode="dark"] .theme-switch-thumb{transform:translateX(48px)}
@keyframes theme-edge-travel{to{stroke-dashoffset:-100}}
body>header .theme-switch:focus-visible{outline:3px solid #e8c98a;outline-offset:4px}
@media(max-width:600px){body>header .theme-switch{margin-left:auto}body>header .brand{min-width:0}body>header.knowledge-header{flex-wrap:wrap}body>header.knowledge-header nav{order:3;width:100%;justify-content:flex-end}.has-chart>header{flex-wrap:wrap}.has-chart .header-profile{order:3;flex-basis:100%;flex-direction:row;justify-content:space-between;max-width:none}.has-chart .theme-switch{margin-left:auto}body>header .header-nav{order:3;flex-basis:100%;justify-content:flex-end}}
@media(prefers-reduced-motion:reduce){.theme-switch-thumb{transition:none}.theme-switch-rim rect{animation:none;stroke-dashoffset:-15}}

body>header .theme-switch.is-dragging{cursor:grabbing}.theme-switch.is-dragging .theme-switch-thumb{transition:none}
html[data-color-mode="dark"] .age-seal{background:#9e3328;box-shadow:inset 0 0 0 4px #9e3328,inset 0 0 0 6px #fbf7ee}
html[data-color-mode="dark"] .birth-dashboard .branch-node.is-ming text{fill:#15120e}
