:root{--page:#fff;--paper:#fff;--hero-tint:#e9f0fa;--feature-teal:#e7f1f5;--feature-lilac:#efedf7;--subtle-surface:#f5f7fa;--soft-border:#dbe3ed;--art-muted:#869ab3;--button-hover:#235ac9}
.theme-system{padding:0;border:0;background:transparent;color:var(--secondary);font:inherit;cursor:pointer}
.theme-system:hover{color:var(--accent)}
.theme-toggle{border-radius:50%}
.theme-toggle:hover{background:var(--accent-soft)}
.resource-preview-card[data-topic-theme=formalization]{--topic-tint:#e9f0fa}
.resource-preview-card[data-topic-theme=math4ai]{--topic-tint:#e6f2f7}
.resource-preview-card[data-topic-theme=teaching]{--topic-tint:#f1eff9}
.resource-preview-card[data-topic-theme=applications]{--topic-tint:#e9f1f4}

html[data-theme=dark]{color-scheme:dark;--ink:#e8edf5;--secondary:#adb8c8;--quiet:#909daf;--surface:#141d28;--line:#2a3544;--accent:#8bafff;--accent-hover:#acc7ff;--navy:#d8e6ff;--accent-soft:#23344f;--page:#0e141c;--paper:#17212d;--hero-tint:#22344c;--feature-teal:#1e3540;--feature-lilac:#2e2c43;--subtle-surface:#1b2634;--soft-border:#334256;--art-muted:#94a8c3;--button-hover:#2d61cb}
html[data-theme=dark] body{background:var(--page)}
html[data-theme=dark] ::selection{background:#38588a;color:#fff}
html[data-theme=dark] .site-header{background:rgba(14,20,28,.91)}
html[data-theme=dark] .site-header.is-expanded,html[data-theme=dark] .nav-preview,html[data-theme=dark] .header-panel,html[data-theme=dark] .main-nav.is-open{background:#141d28}
html[data-theme=dark] .brand-mark{filter:brightness(0) invert(.86) sepia(.2) saturate(1.5) hue-rotate(175deg)}
html[data-theme=dark] .main-nav a{color:var(--secondary)}
html[data-theme=dark] .main-nav .nav-preview a{color:var(--navy)}
html[data-theme=dark] .main-nav a:hover,html[data-theme=dark] .main-nav a[aria-current=page],html[data-theme=dark] .main-nav .nav-link[aria-expanded=true]{color:var(--accent)}
html[data-theme=dark] .prototype-strip{background:#111923;color:var(--quiet)}
html[data-theme=dark] .home-page .hero-line:last-child{color:#a6b1c2}
html[data-theme=dark] .home-page .hero{--hero-glow-base:#101923;--hero-glow-reading:#0e141c;--hero-glow-left:#213449;--hero-glow-right:#20364e}
html[data-theme=dark] .button{background:var(--paper);color:var(--navy);border-color:#536883}
html[data-theme=dark] .button:hover,html[data-theme=dark] .button:focus-visible{background:var(--button-hover);border-color:var(--button-hover);color:#fff}
html[data-theme=dark] .topic-card{background:linear-gradient(160deg,var(--topic-tint,#22344c),var(--paper) 100%)}
html[data-theme=dark] :is(.topic-card,.resource-preview-card)[data-topic-theme=formalization]{--topic-tint:#23354e}
html[data-theme=dark] :is(.topic-card,.resource-preview-card)[data-topic-theme=math4ai]{--topic-tint:#1d3543}
html[data-theme=dark] :is(.topic-card,.resource-preview-card)[data-topic-theme=teaching]{--topic-tint:#302e45}
html[data-theme=dark] :is(.topic-card,.resource-preview-card)[data-topic-theme=applications]{--topic-tint:#253840}
html[data-theme=dark] .round-arrow{background:#263345;color:var(--secondary)}
html[data-theme=dark] .topic-card:hover .round-arrow{background:var(--button-hover);color:#fff}
html[data-theme=dark] .topic-note,html[data-theme=dark] .draft-note{color:var(--quiet)}
html[data-theme=dark] .topic-card-art{--art-ink:#91a6c2;--art-line:#53647a;--art-surface:#263547;--art-text:#b8c8dc}
html[data-theme=dark] .topic-card-art [fill="#f5f5f7"],html[data-theme=dark] .topic-card-art [fill="#e8e8ed"]{fill:#263445}
html[data-theme=dark] .topic-card-art [fill="#fff"]{fill:#35465b}
html[data-theme=dark] .topic-card-art [fill="#525258"]{fill:#b8c8dc}
html[data-theme=dark] .topic-card-art [stroke="#d2d2d7"],html[data-theme=dark] .topic-card-art [stroke="#b7b7bd"]{stroke:#6c7d94}
html[data-theme=dark] .filter-buttons button[aria-pressed=true]{background:var(--button-hover);color:#fff}
html[data-theme=dark] .filter-buttons button:hover{box-shadow:inset 0 0 0 1px var(--soft-border)}
html[data-theme=dark] .empty-symbol{color:#78889e}
html[data-theme=dark] .footer-links a:hover{color:var(--accent)}
html[data-theme=dark] .resource-path{border-color:var(--line)}
html[data-theme=dark] .navigation-backdrop{background:rgba(0,0,0,.36)}
html[data-theme=dark] .search-field input::placeholder{color:var(--quiet)}
html[data-theme=dark] .search-field:focus-within{box-shadow:0 1px 0 var(--soft-border)}
html[data-theme=dark] .search-clear{background:#2b394b}
html[data-theme=dark] .search-result{border-color:var(--line)}
html[data-theme=dark] .skip-link{background:#d8e6ff;color:#101823}

@media(max-width:420px){
  .header-inner{gap:7px}.header-actions{gap:2px}.icon-button{width:28px;height:34px;padding:6px}
  .language-switch a{min-width:24px;padding:0 4px}
  html[lang=en] .brand-name{font-size:11px;max-width:100px;overflow:hidden;text-overflow:ellipsis}
  .footer-links{flex-wrap:wrap}
}
@media print{
  html[data-theme=dark]{color-scheme:light;--ink:#1d1d1f;--secondary:#555;--quiet:#666;--surface:#f5f5f7;--line:#ddd;--navy:#172e48;--page:#fff;--paper:#fff;--hero-tint:#edf2f8;--soft-border:#ddd}
  html[data-theme=dark] body{background:#fff;color:#111}.theme-toggle,.theme-system{display:none!important}
  html[data-theme=dark] .home-page .hero-line:last-child{color:#555}
}
