/* Palette resolves from the early theme controller; screen-only keeps print light. */
:root{color-scheme:light;--component-0:#7048b8;--component-1:#087b62;--component-2:#b05411;--component-3:#246bb4;--component-4:#b52f69;--component-5:#6c7214}
/* Selection is also a border/underline, never just a hue. */
.component-character[aria-pressed=true],.component-chip[aria-pressed=true]{text-decoration:underline;text-underline-offset:.2em}
.component-stroke-group.is-selected path{stroke:currentColor;stroke-width:3}
@media screen{:root[data-theme="dark"]{color-scheme:dark;--paper:#151c19;--surface:#202b25;--ink:#eef2e8;--muted:#b7c5b8;--line:#819482;--accent:#ffb495;--accent-wash:#473229;--green-wash:#304235;--raised:#2b3a30;--focus:#ffc38c;--component-0:#c4a7ff;--component-1:#6ee0b6;--component-2:#ffbb78;--component-3:#91c5ff;--component-4:#ffa0c7;--component-5:#d4dc7c}
:root[data-theme="dark"] body{background:var(--paper);color:var(--ink)}
:root[data-theme="dark"] .study-eyebrow,:root[data-theme="dark"] .sidebar-motto,:root[data-theme="dark"] .study-seal,:root[data-theme="dark"] .character-meaning-label,:root[data-theme="dark"] .lesson-chevron,:root[data-theme="dark"] .course-control svg,:root[data-theme="dark"] .source-line,:root[data-theme="dark"] .brand-caption,:root[data-theme="dark"] .page-footer,:root[data-theme="dark"] .pdf-page,:root[data-theme="dark"] .source-note,:root[data-theme="dark"] .data-note,:root[data-theme="dark"] .example-source,:root[data-theme="dark"] .example-pinyin-origin,:root[data-theme="dark"] .example-translation-origin,:root[data-theme="dark"] .example-missing{color:var(--muted)}
:root[data-theme="dark"] .study-practice,:root[data-theme="dark"] .lesson-heading,:root[data-theme="dark"] .study-seal,:root[data-theme="dark"] .flash-card,:root[data-theme="dark"] .example-body,:root[data-theme="dark"] .character-meaning-card,:root[data-theme="dark"] .dictionary-notes .data-note{background:var(--raised);border-color:var(--line)}
:root[data-theme="dark"] .lesson-number,:root[data-theme="dark"] .component-character,:root[data-theme="dark"] .component-chip,:root[data-theme="dark"] .reading-size-select{background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .translation,:root[data-theme="dark"] .example-chinese,:root[data-theme="dark"] .example-translation{color:var(--ink)}
:root[data-theme="dark"] .example-pinyin,:root[data-theme="dark"] .component-reading,:root[data-theme="dark"] .component-sources a{color:var(--accent)}
:root[data-theme="dark"] .example-component,:root[data-theme="dark"] .additional-badge{background:var(--accent-wash);color:var(--accent)}
:root[data-theme="dark"] .uncertain-badge{background:#493b20;color:#ffda8c}
:root[data-theme="dark"] .repeat-badge{background:var(--green-wash);color:#c1ddb9}
:root[data-theme="dark"] .word-example,:root[data-theme="dark"] .component-sources,:root[data-theme="dark"] .example-body{border-color:var(--line)}
:root[data-theme="dark"] .search-control input::placeholder{color:var(--muted)}
:root[data-theme="dark"] .lesson-toggle:hover,:root[data-theme="dark"] .component-open:hover,:root[data-theme="dark"] .component-character[aria-pressed=true],:root[data-theme="dark"] .component-chip[aria-pressed=true]{background:var(--green-wash);border-color:var(--ink);color:var(--ink)}
:root[data-theme="dark"] .component-chip{color:var(--component-color)}
:root[data-theme="dark"] .component-chip[aria-pressed=true]{color:var(--component-color);border-color:var(--component-color)}
:root[data-theme="dark"] .study-practice button,:root[data-theme="dark"] .lesson-cards,:root[data-theme="dark"] .flash-controls button:last-child,:root[data-theme="dark"] .section-switch button[aria-pressed=true],:root[data-theme="dark"] .empty-state button,:root[data-theme="dark"] .skip-link{background:#b8d8b7;border-color:#b8d8b7;color:#16291e}
:root[data-theme="dark"] .study-practice button:hover,:root[data-theme="dark"] .lesson-cards:hover,:root[data-theme="dark"] .flash-controls button:last-child:hover{background:#d1e8c9;color:#16291e}
:root[data-theme="dark"] .flash-controls button,:root[data-theme="dark"] .flash-section,:root[data-theme="dark"] .component-open,:root[data-theme="dark"] .flash-components .component-open{background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .audio-button,:root[data-theme="dark"] .flash-audio .audio-button,:root[data-theme="dark"] .word-detail-actions .audio-button{background:var(--green-wash);border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] .audio-button[aria-pressed=true]{background:#b8d8b7;color:#16291e;border-color:#b8d8b7}
:root[data-theme="dark"] .audio-button:disabled,:root[data-theme="dark"] .flash-controls button:disabled,:root[data-theme="dark"] .flash-shuffle:disabled{opacity:1;color:var(--muted);background:var(--surface);border-color:var(--line)}
:root[data-theme="dark"] .audio-status{color:#ffb4a5}
:root[data-theme="dark"] .switch-track{background:#657567;border:1px solid var(--line)}
:root[data-theme="dark"] .switch-track:after{background:var(--ink)}
:root[data-theme="dark"] .unique-control input:checked+.switch-track{background:#b8d8b7}
:root[data-theme="dark"] .unique-control input:checked+.switch-track:after{background:#16291e}
:root[data-theme="dark"] .flash-dialog::backdrop,:root[data-theme="dark"] .word-detail-dialog::backdrop,:root[data-theme="dark"] .component-dialog::backdrop{background:#050a07bf}
:root[data-theme="dark"] .component-stroke-group:hover,:root[data-theme="dark"] .component-stroke-group:focus{filter:brightness(1.15)}
:root[data-theme="dark"] .component-stroke-group:focus path{stroke:var(--ink);stroke-width:6}
}
/* Dark preference must never turn printed vocabulary into dark sheets. */
@media print{:root{color-scheme:light}body{background:white;color:black}}
