:root{--settings-surface:#fff;--settings-border:#d9e3e1;--danger:#a3332c}
.settings-grid{display:grid;gap:20px;max-width:760px}.settings-section{padding:24px;background:var(--settings-surface);border:1px solid var(--settings-border);border-radius:14px}.settings-section h2{font-size:21px;margin-bottom:12px}.settings-section p{color:var(--muted)}.settings-section label{display:block;font-size:16px;font-weight:600;margin:16px 0 8px}.settings-section select{width:100%;padding:12px;border:1px solid var(--settings-border);border-radius:8px;background:var(--settings-surface);color:inherit;font-size:16px;min-height:46px}.settings-help{font-size:14px;margin:12px 0 0}.reset-button{color:var(--danger);border:1px solid var(--danger);background:transparent;padding:12px 18px;border-radius:8px;font-size:16px;min-height:46px}.sidebar-bottom .settings-link{display:flex;gap:9px;align-items:center;text-decoration:none;font-size:14px;padding:10px 0}.settings-link svg{width:18px;height:18px;flex:none}.settings-link[aria-current=page]{font-weight:700;text-decoration:underline}.settings-section [role=status]{min-height:1.5em;margin-top:12px;color:var(--muted)}
:root[data-theme=mint]{--bg:#15191d;--surface:#20272b;--side:#101619;--text:#e7eeec;--sub:#b0c2bd;--edge:#43544e;--tint:#2b3935;--primary:#85d9bd;--on-primary:#10251c}
:root[data-theme=navy]{--bg:#101827;--surface:#1b2940;--side:#0b1220;--text:#e7eef9;--sub:#b4c4dc;--edge:#435674;--tint:#293b57;--primary:#87b9ff;--on-primary:#0b1c35}
:root[data-theme=forest]{--bg:#10211e;--surface:#1a302b;--side:#0a1916;--text:#e7efe8;--sub:#b5c7bd;--edge:#425f52;--tint:#2a4238;--primary:#d7be7b;--on-primary:#231e0b}
:root[data-theme=amber]{--bg:#101010;--surface:#202020;--side:#080808;--text:#eeece8;--sub:#c4beb6;--edge:#53504b;--tint:#34312c;--primary:#e9ab60;--on-primary:#281b0d}
:root[data-theme=blue]{--bg:#f2f6fc;--surface:#fff;--side:#e4edf8;--text:#213d5b;--sub:#506784;--edge:#becde1;--tint:#e5edf8;--primary:#326fc0;--on-primary:#fff}
:root[data-theme=cream]{--bg:#faf6ef;--surface:#fffdfa;--side:#efe4d6;--text:#49372f;--sub:#766051;--edge:#d6c7b8;--tint:#f1e7db;--primary:#ad5036;--on-primary:#fff}
html[data-theme]:not([data-theme=classic]){background:var(--bg);color:var(--text);--ink:var(--text);--muted:var(--sub);--line:var(--edge);--white:var(--surface);--accent:var(--primary);--settings-surface:var(--surface);--settings-border:var(--edge)}
html[data-theme]:not([data-theme=classic]) body{background:var(--bg);color:var(--text)}
html[data-theme]:not([data-theme=classic]) :where(.sidebar,.mobile-header){background:var(--side);color:var(--text)}
html[data-theme]:not([data-theme=classic]) :where(.brand,.mobile-brand,.nav-item,.sidebar-bottom .quote,.sidebar-bottom a,.sidebar-bottom p,.nav-item small,.nav-symbol,.nav-heading,.mobile-brand i){color:var(--sub)}
html[data-theme]:not([data-theme=classic]) :where(.brand,.mobile-brand){color:var(--text)}
html[data-theme]:not([data-theme=classic]) :where(.brand-dot,.head-mark){color:var(--primary)}
html[data-theme]:not([data-theme=classic]) :where(.nav-item.active,.tab.active,.primary){background:var(--primary);color:var(--on-primary);border-color:var(--primary)}
html[data-theme]:not([data-theme=classic]) .nav-item.active :where(small,.nav-symbol){color:var(--on-primary)}
html[data-theme]:not([data-theme=classic]) :where(.primary:hover:not(:disabled),.tab.active:hover){background:var(--primary);filter:brightness(.94)}
html[data-theme]:not([data-theme=classic]) :where(.category-card,.panel,.lesson-body,.lesson-card,.answer,.secondary,.answer-input,.search,.control select,.skip){background:var(--surface);color:var(--text);border-color:var(--edge)}
html[data-theme]:not([data-theme=classic]) :where(.category-card.wide,.study-aside,.toc,.detail-note,.missed,.stat-pill,.mode-chip,.badge,.accents button,.letter,.lesson-table th){background:var(--tint);color:var(--text)}
html[data-theme]:not([data-theme=classic]) :where(.tab,.control,.count,.card-bottom span:first-child,.eyebrow,.progress-meta,.prompt,.study-aside p,.study-aside .aside-label,.forms td:first-child,.lesson-section p,.lesson-card small,.toc a,.footer,.score span){color:var(--sub)}
html[data-theme]:not([data-theme=classic]) .tab.active{color:var(--on-primary)}
html[data-theme]:not([data-theme=classic]) :where(.controls,.table-wrap td,.table-wrap th,.dictionary-item,.lesson-section,.example,.topline,.home-note,.footer,.study-aside hr,.count,.tab){border-color:var(--edge)}
html[data-theme]:not([data-theme=classic]) .progress-bar{background:var(--tint)}
html[data-theme]:not([data-theme=classic]) .progress-bar i{background:var(--primary)}
html[data-theme]:not([data-theme=classic]) :where(.score,.lesson-num,.speak){color:var(--primary)}
html[data-theme]:not([data-theme=classic]) :where(.speak:hover,.speak.speaking,.nav-item:hover:not(.active),.answer:hover:not(:disabled)){background:var(--tint);color:var(--text)}
html[data-theme]:not([data-theme=classic]) .mobile-header button{background:var(--tint);color:var(--text)}
html[data-theme]:not([data-theme=classic]) :where(.answer.correct,.feedback){background:#193d2e;border-color:#79cda4;color:#c4f2d8}
html[data-theme]:not([data-theme=classic]) :where(.answer.wrong,.feedback.bad,.badge.strong){background:#462820;border-color:#df9e85;color:#ffe0d4}
html[data-theme]:not([data-theme=classic]){--danger:#f1a48b}
html[data-theme]:is([data-theme=blue],[data-theme=cream]){--danger:#a3332c}
html[data-theme]:is([data-theme=blue],[data-theme=cream]) :where(.answer.correct,.feedback){background:#e5f3e9;color:#235737;border-color:#639579}
html[data-theme]:is([data-theme=blue],[data-theme=cream]) :where(.answer.wrong,.feedback.bad,.badge.strong){background:#fbe9e0;color:#873e28;border-color:#bb7156}
@media(max-width:720px){.settings-section{padding:20px}.settings-section select{max-width:100%}}
html[data-theme]:not([data-theme=classic]) .toc .primary{color:var(--on-primary);background:var(--primary)}

/* Active controls own both foreground and background, including hover/focus. */
html[data-theme]:not([data-theme=classic]) .tab.active,
html[data-theme]:not([data-theme=classic]) .primary,
html[data-theme]:not([data-theme=classic]) .nav-item.active{background:var(--primary);color:var(--on-primary);border-color:var(--primary)}
html[data-theme]:not([data-theme=classic]) .feedback p{color:inherit}
html[data-theme]:not([data-theme=classic]) input::placeholder{color:var(--sub);opacity:1}

/* Stateful rules must outrank the base :hover:not(:disabled) selectors. */
html[data-theme]:not([data-theme=classic]) .answer:hover:not(:disabled),
html[data-theme]:not([data-theme=classic]) .answer:focus-visible:not(:disabled){background:var(--tint);color:var(--text);border-color:var(--primary)}
html[data-theme]:not([data-theme=classic]) .secondary:hover:not(:disabled),
html[data-theme]:not([data-theme=classic]) .secondary:focus-visible,
html[data-theme]:not([data-theme=classic]) .tab:not(.active):hover{background:var(--tint);color:var(--text);border-color:var(--primary)}
html[data-theme]:not([data-theme=classic]) .primary:hover:not(:disabled),
html[data-theme]:not([data-theme=classic]) .primary:focus-visible,
html[data-theme]:not([data-theme=classic]) .tab.active:hover{background:var(--primary);color:var(--on-primary)}
html[data-theme]:not([data-theme=classic]) .review-controls select{background:var(--surface);color:var(--text);border-color:var(--edge)}
html[data-theme]:not([data-theme=classic]) .toc a.secondary:hover{background:var(--tint);color:var(--text)}
