/* Appearance presets: the control preview is pastel; rainbow applied UI is intentionally vivid. */
:root{
 --theme-primary-gradient:linear-gradient(180deg,#4568df,#3b5ddd);
 --theme-primary-hover:linear-gradient(180deg,#5677ef,#4161db);
 --theme-rainbow:linear-gradient(105deg,#ff2b6d 0%,#ff8327 17%,#ffe235 33%,#20d58c 50%,#00b8ff 67%,#8051ff 84%,#ed36dd 100%);
 --theme-rainbow-pastel:linear-gradient(105deg,#f4bbd0,#f9d7bd,#f8eabd,#c4ebd5,#c4dff7,#e4cef2);
 --theme-focus:var(--accent);
 --theme-card-border:var(--line);
 --home-ring-blue:var(--accent);
 --home-ring-light:#aabcea;
 --home-festival-navy:var(--accent-ink);--home-ring-empty:#e7ebf2;
 --theme-accent-rgb:69 104 223;--theme-owned-bg:#eef6ff;--theme-owned-border:#d9e7fa;
 --theme-owned-highlight:#e4f0ff;--theme-owned-hover:#e8f2ff;--theme-owned-ink:#173251;
 --theme-hover-surface:#f9fbff;--theme-surface-soft:#f6f8fc;--ui-focus:var(--accent);
}
:root[data-theme-color="orange"]{--theme-accent-rgb:183 82 32;--theme-owned-bg:#fff0e5;--theme-owned-border:#f1d6c5;--theme-owned-highlight:#ffe7d7;--theme-owned-hover:#fff5ef;--theme-owned-ink:var(--ink);--home-ring-empty:#f6e6d8;--accent:#b75220;--accent-ink:#a84615;--accent-soft:#fff0e5;--ui-accent:#b75220;--ui-accent-pressed:#9a441c;--ui-accent-wash:#fff0e5;--theme-primary-gradient:linear-gradient(180deg,#d36c2c,#b75220);--theme-primary-hover:linear-gradient(180deg,#dc7c40,#a84615);--home-ring-light:#eebc95}
:root[data-theme-color="pink"]{--theme-accent-rgb:179 56 120;--theme-owned-bg:#fcecf5;--theme-owned-border:#efd4e2;--theme-owned-highlight:#fbe5f1;--theme-owned-hover:#fff4fa;--theme-owned-ink:var(--ink);--home-ring-empty:#f5e5ef;--accent:#b33878;--accent-ink:#a52d6d;--accent-soft:#fcecf5;--ui-accent:#b33878;--ui-accent-pressed:#9d2e68;--ui-accent-wash:#fcecf5;--theme-primary-gradient:linear-gradient(180deg,#cf508e,#b33878);--theme-primary-hover:linear-gradient(180deg,#da62a0,#a52d6d);--home-ring-light:#eab0cd}
:root[data-theme-color="green"]{--theme-accent-rgb:19 121 94;--theme-owned-bg:#e6f6ef;--theme-owned-border:#cfe9dd;--theme-owned-highlight:#d9f4e6;--theme-owned-hover:#f0fcf6;--theme-owned-ink:var(--ink);--home-ring-empty:#dcefe5;--accent:#13795e;--accent-ink:#0a6b51;--accent-soft:#e6f6ef;--ui-accent:#13795e;--ui-accent-pressed:#086b50;--ui-accent-wash:#e6f6ef;--theme-primary-gradient:linear-gradient(180deg,#209675,#13795e);--theme-primary-hover:linear-gradient(180deg,#2aa887,#086b50);--home-ring-light:#93d3bd}
:root[data-theme-color="purple"]{--theme-accent-rgb:119 80 185;--theme-owned-bg:#f1ecfb;--theme-owned-border:#e5d7f5;--theme-owned-highlight:#eae2fa;--theme-owned-hover:#f7f2ff;--theme-owned-ink:var(--ink);--home-ring-empty:#ece5f6;--accent:#7750b9;--accent-ink:#6640aa;--accent-soft:#f1ecfb;--ui-accent:#7750b9;--ui-accent-pressed:#6640aa;--ui-accent-wash:#f1ecfb;--theme-primary-gradient:linear-gradient(180deg,#9168d2,#7750b9);--theme-primary-hover:linear-gradient(180deg,#9f7bdb,#6640aa);--home-ring-light:#c6b4ea}
:root[data-theme-color="rainbow"]{--theme-accent-rgb:133 82 213;--theme-owned-bg:#f6eefe;--theme-owned-border:#e7d6f3;--theme-owned-highlight:#f5e9fe;--theme-owned-hover:#faf3ff;--theme-owned-ink:var(--ink);--home-ring-empty:#efe0f2;--accent:#8552d5;--accent-ink:#6b40b4;--accent-soft:#f6eefe;--ui-accent:#8552d5;--ui-accent-pressed:#6b40b4;--ui-accent-wash:#f6eefe;--theme-primary-gradient:var(--theme-rainbow);--theme-primary-hover:var(--theme-rainbow);--home-ring-light:#f4a5d0}
:root[data-theme-mode="dark"]{
 color-scheme:dark;
 --bg:#111722;--paper:#1d2533;--ink:#edf2fb;--muted:#a8b6c9;--line:#364357;
 --ui-canvas:#111722;--ui-surface:#1d2533;--ui-surface-raised:#273246;
 --ui-text:#edf2fb;--ui-text-secondary:#a8b6c9;--ui-text-tertiary:#9eafc4;
 --ui-line:#364357;--ui-focus:#a4b8ff;--ui-success:#71cfaa;--ui-review:#edb574;
 --ui-shadow-1:0 3px 12px rgba(0,0,0,.18);--ui-shadow-2:0 10px 26px rgba(0,0,0,.25);
 --ui-shadow-3:0 16px 45px rgba(0,0,0,.4);
 --ui-specular:inset 0 1px 0 rgba(255,255,255,.075);
 --accent-soft:#283b5c;--accent-ink:#b4c5ff;--accent:#8fa9ff;
 --home-ring-empty:#364155;--home-ring-light:#7b91c4;
 --home-festival-navy:var(--accent-ink);
 --theme-accent-rgb:143 169 255;--theme-owned-bg:#293a53;--theme-owned-border:#4a5d78;
 --theme-owned-highlight:#2e415c;--theme-owned-hover:#30435f;--theme-owned-ink:var(--ink);
 --theme-hover-surface:#293449;--theme-surface-soft:#273246;--ui-focus:var(--accent);
 --theme-primary-gradient:linear-gradient(180deg,#7991f1,#536fd5);
 --theme-primary-hover:linear-gradient(180deg,#91a4fa,#607ce2);
}
:root[data-theme-mode="dark"][data-theme-color="orange"]{--theme-accent-rgb:241 165 116;--home-ring-empty:#46342c;--home-ring-light:#d99d6d;--theme-owned-bg:var(--accent-soft);--theme-owned-border:var(--line);--theme-owned-highlight:var(--accent-soft);--theme-owned-hover:var(--accent-soft);--accent:#f1a574;--accent-ink:#ffbd8f;--accent-soft:#473127;--ui-accent:#f1a574;--ui-accent-pressed:#f5ba94;--ui-accent-wash:#473127;--theme-primary-gradient:linear-gradient(180deg,#c96d36,#a95124);--theme-primary-hover:linear-gradient(180deg,#d77c40,#b55b27);--home-ring-light:#c88c60}
:root[data-theme-mode="dark"][data-theme-color="pink"]{--theme-accent-rgb:242 160 207;--home-ring-empty:#483044;--home-ring-light:#dd90c0;--theme-owned-bg:var(--accent-soft);--theme-owned-border:var(--line);--theme-owned-highlight:var(--accent-soft);--theme-owned-hover:var(--accent-soft);--accent:#f2a0cf;--accent-ink:#f6b2d9;--accent-soft:#482e46;--ui-accent:#f2a0cf;--ui-accent-pressed:#fac0e0;--ui-accent-wash:#482e46;--theme-primary-gradient:linear-gradient(180deg,#cf569b,#ad3478);--theme-primary-hover:linear-gradient(180deg,#d96da9,#ba4387);--home-ring-light:#c981ab}
:root[data-theme-mode="dark"][data-theme-color="green"]{--theme-accent-rgb:118 213 181;--home-ring-empty:#273e39;--home-ring-light:#78c5aa;--theme-owned-bg:var(--accent-soft);--theme-owned-border:var(--line);--theme-owned-highlight:var(--accent-soft);--theme-owned-hover:var(--accent-soft);--accent:#76d5b5;--accent-ink:#91ebcb;--accent-soft:#24433d;--ui-accent:#76d5b5;--ui-accent-pressed:#a5f0d6;--ui-accent-wash:#24433d;--theme-primary-gradient:linear-gradient(180deg,#249777,#146f57);--theme-primary-hover:linear-gradient(180deg,#32aa89,#197c62);--home-ring-light:#5ca88e}
:root[data-theme-mode="dark"][data-theme-color="purple"]{--theme-accent-rgb:192 160 246;--home-ring-empty:#3a3051;--home-ring-light:#b4a0e0;--theme-owned-bg:var(--accent-soft);--theme-owned-border:var(--line);--theme-owned-highlight:var(--accent-soft);--theme-owned-hover:var(--accent-soft);--accent:#c0a0f6;--accent-ink:#cfb5fb;--accent-soft:#3d3157;--ui-accent:#c0a0f6;--ui-accent-pressed:#dac4ff;--ui-accent-wash:#3d3157;--theme-primary-gradient:linear-gradient(180deg,#8c5bc5,#6540a9);--theme-primary-hover:linear-gradient(180deg,#9a6bd1,#7551b9);--home-ring-light:#a087d0}
:root[data-theme-mode="dark"][data-theme-color="rainbow"]{--theme-accent-rgb:222 165 255;--home-ring-empty:#433052;--home-ring-light:#dba5ef;--theme-owned-bg:var(--accent-soft);--theme-owned-border:var(--line);--theme-owned-highlight:var(--accent-soft);--theme-owned-hover:var(--accent-soft);--accent:#dea5ff;--accent-ink:#eed0ff;--accent-soft:#41294e;--ui-accent:#dea5ff;--ui-accent-pressed:#eed0ff;--ui-accent-wash:#41294e;--home-ring-light:#dc93de}
:root[data-theme-mode="dark"] .primary{background:var(--theme-primary-gradient);border-color:transparent}
:root[data-theme-mode="dark"] .primary:hover{background:var(--theme-primary-hover)}
:root[data-theme-mode="dark"] .nav-item[aria-current="page"]{color:var(--accent-ink)}
:root[data-theme-color]:not([data-theme-color="blue"]) .primary,
:root[data-theme-color]:not([data-theme-color="blue"]) .home-app-action.is-install{background:var(--theme-primary-gradient);border-color:transparent}
:root[data-theme-color]:not([data-theme-color="blue"]) .primary:hover,
:root[data-theme-color]:not([data-theme-color="blue"]) .home-app-action.is-install:hover{background:var(--theme-primary-hover)}
:root[data-theme-color]:not([data-theme-color="blue"]) .speech.mine .speaker,
:root[data-theme-color]:not([data-theme-color="blue"]) .reader-scroll .speech.mine .speaker{color:var(--accent-ink)}
:root[data-theme-color]:not([data-theme-color="blue"]) .speech.mine,
:root[data-theme-color]:not([data-theme-color="blue"]) .reader-scroll .speech.mine{box-shadow:inset 3px 0 0 var(--accent)}
:root[data-theme-color]:not([data-theme-color="blue"]) .speech.highlight,
:root[data-theme-color]:not([data-theme-color="blue"]) .rehearsal .speech.current{background:var(--accent-soft)}
:root[data-theme-color]:not([data-theme-color="blue"]) .reader-scroll .speech.mine{background:var(--accent-soft)}
:root[data-theme-color]:not([data-theme-color="blue"]) .reader-scroll .speech.mine.highlight{background:var(--accent-soft)}
:root[data-theme-color]:not([data-theme-color="blue"]) .speech-bookmark[aria-pressed="true"],
:root[data-theme-color]:not([data-theme-color="blue"]) .role-menu-option[aria-selected="true"]{color:var(--accent-ink);background:var(--accent-soft)}
:root[data-theme-mode="dark"] body,
:root[data-theme-mode="dark"] .page-scroll{background:var(--bg);color:var(--ink)}
:root[data-theme-mode="dark"] .sidebar,
:root[data-theme-mode="dark"] .topbar,
:root[data-theme-mode="dark"] .reader-top,
:root[data-theme-mode="dark"] .reader-filter,
:root[data-theme-mode="dark"] .bottom-nav,
:root[data-theme-mode="dark"] .session-controls,
:root[data-theme-mode="dark"] .quick-memory-header,
:root[data-theme-mode="dark"] .quick-memory-footer{background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-theme-mode="dark"] .app-layout[data-route="home"] .page-scroll{background:radial-gradient(circle at 88% 4%,rgba(91,114,195,.14),transparent 40%),var(--bg)}
:root[data-theme-mode="dark"] .secondary,
:root[data-theme-mode="dark"] .continue-panel,
:root[data-theme-mode="dark"] .home-progress-dashboard,
:root[data-theme-mode="dark"] .quick-memory-home,
:root[data-theme-mode="dark"] .audio-stage,
:root[data-theme-mode="dark"] .sheet,
:root[data-theme-mode="dark"] .app-choice,
:root[data-theme-mode="dark"] .app-select-trigger{background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-theme-mode="dark"] .app-select-trigger{background:linear-gradient(180deg,#283245,#1d2533)}
:root[data-theme-mode="dark"] .app-select-trigger:active,
:root[data-theme-mode="dark"] .app-choice:hover,
:root[data-theme-mode="dark"] .app-choice:focus-visible,
:root[data-theme-mode="dark"] .secondary:hover,
:root[data-theme-mode="dark"] .icon-button:hover,
:root[data-theme-mode="dark"] .nav-item:hover,
:root[data-theme-mode="dark"] .scene-link:hover,
:root[data-theme-mode="dark"] .role-menu-option:hover,
:root[data-theme-mode="dark"] .role-menu-option:focus-visible{background:#2a3547}
:root[data-theme-mode="dark"] input,
:root[data-theme-mode="dark"] select,
:root[data-theme-mode="dark"] textarea{background:#273246;color:var(--ink);border-color:var(--line)}
:root[data-theme-mode="dark"] .nav-item[aria-current="page"],
:root[data-theme-mode="dark"] .role-menu-option[aria-selected="true"],
:root[data-theme-mode="dark"] .app-select-trigger[aria-expanded="true"]{background:var(--accent-soft);color:var(--accent-ink)}
:root[data-theme-mode="dark"] .reader-scroll .speech,
:root[data-theme-mode="dark"] .rehearsal .speech{background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-theme-mode="dark"] .reader-scroll .speech.mine{background:var(--theme-owned-bg);color:var(--ink);box-shadow:inset 3px 0 0 var(--accent)}
:root[data-theme-mode="dark"] .reader-scroll .speech.mine.highlight,
:root[data-theme-mode="dark"] .rehearsal .speech.current{background:var(--theme-owned-highlight)}
:root[data-theme-mode="dark"] .reader-scroll .speech.mine .speech-text,
:root[data-theme-mode="dark"] .speech:not(.mine) .speech-text,
:root[data-theme-mode="dark"] .rehearsal .speech.future .speech-text{color:var(--ink)}
:root[data-theme-mode="dark"] .reader-scroll .speech.mine .speaker{color:var(--accent-ink)}
:root[data-theme-mode="dark"] .speech-head .line-number,
:root[data-theme-mode="dark"] .speech-tools button,
:root[data-theme-mode="dark"] .notification-date{color:var(--muted)}
:root[data-theme-mode="dark"] .quick-memory-scroll,
:root[data-theme-mode="dark"] .quick-memory-speech{background:var(--paper);color:var(--ink)}
:root[data-theme-mode="dark"] .quick-memory-speech:hover{background:var(--theme-hover-surface)}
:root[data-theme-mode="dark"] .quick-memory-speech.is-target{background:var(--theme-owned-bg);border-color:var(--theme-owned-border)}
:root[data-theme-mode="dark"] .quick-memory-context{background:var(--theme-surface-soft);border-color:var(--line)}
:root[data-theme-mode="dark"] .quick-memory-more:hover{background:var(--accent-soft)}
:root[data-theme-mode="dark"] .quick-memory-sheet-footer{background:var(--paper);border-color:var(--line)}
:root[data-theme-mode="dark"] .session-progress,
:root[data-theme-mode="dark"] .progress-track{background:#35445a}
:root[data-theme-mode="dark"] .home-ring-base-inner{stroke:var(--home-ring-empty)}
:root[data-theme-mode="dark"] .home-festival-prefix,
:root[data-theme-mode="dark"] .home-festival-unit{fill:var(--muted)}
:root[data-theme-mode="dark"] .home-festival-days{fill:var(--ink)}
:root[data-theme-mode="dark"] .notification-entry.is-new{background:#293a55}
:root[data-theme-mode="dark"] .notification-new-label{background:#394c72;color:#c8d6ff}
:root[data-theme-mode="dark"] .notification-script-quote:hover{background:#293b5b;border-color:#6175a1}
:root[data-theme-mode="dark"] .speech-tools button[data-level="1"],
:root[data-theme-mode="dark"] .speech-tools .is-review{background:#4d3b30;color:#f5bf82}
:root[data-theme-mode="dark"] .speech-tools button[data-level="2"]{background:#284b3d;color:#8ed9b6}
:root[data-theme-mode="dark"] .word:hover,
:root[data-theme-mode="dark"] .word:focus-visible{color:var(--accent-ink);background:var(--accent-soft)}
:root[data-theme-mode="dark"] .role-menu-option,
:root[data-theme-mode="dark"] .notification-entry,
:root[data-theme-mode="dark"] .setting-row{border-color:var(--line)}
:root[data-theme-mode="dark"] .home-app-action.is-audio{background:var(--accent-soft);color:var(--accent-ink);border-color:var(--line)}
:root[data-theme-mode="dark"] #toast{background:rgba(26,37,55,.9);color:#edf2fb}
:root[data-theme-mode="dark"] .sheet::backdrop{background:rgba(0,0,0,.6)}
/* Small, accessible controls: only two settings fields; no hex picker or free-form colors. */
.theme-settings{padding:6px 0 15px;display:grid;gap:17px}
.theme-fieldset{padding:0;border:0;min-width:0;margin:0}
.theme-fieldset legend{padding:0;margin:0 0 10px;font-weight:600;font-size:13px;color:var(--ink)}
.theme-mode-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.theme-mode-choice,.theme-color-choice{position:relative;cursor:pointer;min-width:0}
.theme-mode-choice input,.theme-color-choice input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;z-index:1}
.theme-mode-choice span{display:flex;align-items:center;justify-content:center;min-height:44px;border:1px solid var(--line);border-radius:11px;background:var(--paper);font-size:13px;font-weight:550;color:var(--muted);transition:border-color .15s ease,background .15s ease}
.theme-mode-choice input:checked+span{background:var(--accent-soft);border-color:var(--accent);color:var(--accent-ink);font-weight:700}
.theme-mode-choice:focus-within span,.theme-color-choice:focus-within .theme-swatch{outline:3px solid var(--theme-focus);outline-offset:3px}
.theme-color-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.theme-color-choice{display:grid;gap:6px;text-align:center;align-content:start}
.theme-swatch{height:51px;border-radius:12px;background:var(--swatch);border:2px solid transparent;box-shadow:inset 0 1px rgba(255,255,255,.18);display:grid;place-items:center;transition:box-shadow .15s ease,transform .15s ease}
.theme-color-choice input:checked+.theme-swatch{box-shadow:0 0 0 2px var(--ink),inset 0 1px rgba(255,255,255,.2)}
.theme-color-choice input:checked+.theme-swatch::after{content:'✓';font-size:19px;font-weight:700;color:#fff;text-shadow:0 1px 3px #0006}
.theme-color-choice[data-color="rainbow"] input:checked+.theme-swatch::after{color:#655685;text-shadow:0 1px #fff}
.theme-color-choice:active .theme-swatch{transform:scale(.97)}
.theme-choice-label{font-size:12px;color:var(--muted);line-height:1.4}
.theme-color-choice input:checked~.theme-choice-label{font-weight:700;color:var(--ink)}
.theme-color-choice[data-color="blue"]{--swatch:#7998e8}
.theme-color-choice[data-color="orange"]{--swatch:#e6a177}
.theme-color-choice[data-color="pink"]{--swatch:#e49bbd}
.theme-color-choice[data-color="green"]{--swatch:#78b9a1}
.theme-color-choice[data-color="purple"]{--swatch:#a898d7}
.theme-color-choice[data-color="rainbow"]{--swatch:var(--theme-rainbow-pastel)}
/* Rainbow is restrained in the picker, but decidedly NOT in the applied UI. */
:root[data-theme-color="rainbow"] .primary,
:root[data-theme-color="rainbow"] .home-app-action.is-install{background:var(--theme-rainbow);background-size:260% 100%;color:#fff;text-shadow:0 1px 3px #17223f;box-shadow:0 5px 17px rgba(202,60,209,.24)}
:root[data-theme-color="rainbow"] .primary:hover,
:root[data-theme-color="rainbow"] .home-app-action.is-install:hover{background:var(--theme-rainbow);background-size:260% 100%;filter:saturate(1.15)}
:root[data-theme-color="rainbow"] .topbar{background:linear-gradient(95deg,rgba(255,90,155,.18),rgba(255,212,68,.17),rgba(77,230,174,.16),rgba(82,169,255,.2),rgba(194,93,255,.2)),var(--paper);border-bottom:2px solid #bd89ea}
:root[data-theme-color="rainbow"] .sidebar{background:linear-gradient(165deg,rgba(255,106,154,.13),rgba(255,209,91,.12),rgba(88,221,179,.13),rgba(139,111,253,.14)),var(--paper)}
:root[data-theme-color="rainbow"] .nav-item[aria-current="page"]{background:var(--theme-rainbow-pastel);color:#32264a;box-shadow:0 3px 13px rgba(163,76,216,.13)}
:root[data-theme-color="rainbow"] .home-progress-dashboard,
:root[data-theme-color="rainbow"] .quick-memory-home{border:2px solid transparent;background:linear-gradient(var(--paper),var(--paper)) padding-box,var(--theme-rainbow) border-box;box-shadow:0 9px 28px rgba(213,80,191,.15),0 5px 23px rgba(64,171,226,.12)}
:root[data-theme-color="rainbow"] .home-app-action.is-audio{background:var(--theme-rainbow-pastel);color:#543f77}
:root[data-theme-color="rainbow"] .progress-track span,
:root[data-theme-color="rainbow"] .session-progress span{background:var(--theme-rainbow)}
:root[data-theme-color="rainbow"] .home-ring-completed{stroke:url(#mt-progress-rainbow)}
:root[data-theme-color="rainbow"] .home-ring-practicing{stroke:url(#mt-practicing-rainbow)}
:root[data-theme-color="rainbow"] .home-festival-ring{stroke:url(#mt-festival-rainbow)}
:root[data-theme-color="rainbow"] .home-ring-base{stroke:url(#mt-progress-rainbow);stroke-opacity:.25}
:root[data-theme-color="rainbow"] .home-progress-dot-practicing{background:linear-gradient(90deg,#0fd7a8,#129fff,#b348ff)}
:root[data-theme-color="rainbow"] .home-progress-dot-festival{background:linear-gradient(90deg,#ff8a16,#ff3b87,#9c39ed)}
:root[data-theme-color="rainbow"] .home-progress-key .home-progress-main-value{background:var(--theme-rainbow);background-clip:text;-webkit-background-clip:text;color:transparent}
:root[data-theme-color="rainbow"] .speech.mine .speaker,
:root[data-theme-color="rainbow"] .reader-scroll .speech.mine .speaker{color:var(--accent-ink)}
:root[data-theme-color="rainbow"] .app-layout[data-route="home"] .page-scroll{background:radial-gradient(ellipse at 92% 8%,rgba(245,70,151,.16),transparent 40%),radial-gradient(ellipse at 10% 75%,rgba(67,211,181,.13),transparent 45%),var(--bg)}
:root[data-theme-mode="dark"][data-theme-color="rainbow"] .topbar{background:linear-gradient(95deg,#50233f,#4c3a20,#214b45,#262c65,#422158)}
:root[data-theme-mode="dark"][data-theme-color="rainbow"] .sidebar{background:linear-gradient(155deg,#302135,#303422,#1d3f43,#282b47)}
:root[data-theme-mode="dark"][data-theme-color="rainbow"] .nav-item[aria-current="page"]{background:linear-gradient(95deg,#6d2351,#855a22,#21665e,#413c91);color:#fff}
@media(prefers-reduced-motion:no-preference){
 :root[data-theme-color="rainbow"] .primary,
 :root[data-theme-color="rainbow"] .home-app-action.is-install{animation:theme-rainbow-shift 5s linear infinite}
}
@keyframes theme-rainbow-shift{0%{background-position:0% center}100%{background-position:200% center}}
@media(prefers-reduced-motion:reduce){.theme-swatch,.theme-mode-choice span{transition:none!important}}

/* Preserve saved dark mode on the boot screen. */
:root[data-theme-mode="dark"] .boot-screen{background:var(--bg);color:var(--ink)}
:root[data-theme-mode="dark"] .boot-emblem{background:var(--paper);border-color:var(--line)}
:root[data-theme-mode="dark"] .boot-subtitle,:root[data-theme-mode="dark"] .boot-status{color:var(--muted)}
:root[data-theme-mode="dark"] .boot-track{background:#35445a}
:root[data-theme-mode="dark"] .boot-track span{background:var(--accent)}

/* Shared accent rules for controls whose former blue or amber shades were hard-coded. */
:root[data-theme-color] .role-trigger{border-color:var(--line);background:var(--accent-soft)}
:root[data-theme-color] .role-choice:has(input:checked){border-color:var(--accent)}
:root[data-theme-color] .line-audio-button[data-audio-state="playing"]{background:var(--accent-soft);color:var(--accent-ink)}
:root[data-theme-color] .role-menu-option[aria-selected="true"]{background:var(--accent-soft);color:var(--accent-ink)}
:root[data-theme-color] .notification-script-quote:hover{border-color:var(--accent);background:var(--accent-soft)}
:root[data-theme-color] .notification-script-quote:focus-visible{outline-color:var(--accent)}
:root[data-theme-mode="dark"] .notification-script-quote{background:var(--paper);border-color:var(--line)}
:root[data-theme-mode="dark"] .quick-memory-speech.is-target .quick-memory-text{color:var(--ink)}
:root[data-theme-mode="dark"] .audio-stage{color:var(--ink)}

/* Rainbow highlights retain a clear text surface while showing the full spectrum. */
:root[data-theme-color="rainbow"]{
 --theme-rainbow-wash:linear-gradient(100deg,rgba(255,43,109,.085),rgba(255,131,39,.085),rgba(255,226,53,.085),rgba(32,213,140,.085),rgba(0,184,255,.085),rgba(128,81,255,.085),rgba(237,54,221,.085));
 --theme-rainbow-highlight:linear-gradient(100deg,rgba(255,43,109,.18),rgba(255,131,39,.15),rgba(255,226,53,.17),rgba(32,213,140,.15),rgba(0,184,255,.17),rgba(128,81,255,.17),rgba(237,54,221,.18));
}
:root[data-theme-mode="dark"][data-theme-color="rainbow"]{
 --theme-rainbow-wash:linear-gradient(100deg,rgba(255,73,132,.14),rgba(255,153,60,.12),rgba(255,226,53,.12),rgba(45,222,159,.13),rgba(37,184,255,.14),rgba(146,103,255,.15),rgba(237,77,219,.14));
 --theme-rainbow-highlight:linear-gradient(100deg,rgba(255,73,132,.24),rgba(255,153,60,.21),rgba(255,226,53,.21),rgba(45,222,159,.22),rgba(37,184,255,.23),rgba(146,103,255,.25),rgba(237,77,219,.24));
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .reader-scroll .speech.mine{
 background:var(--theme-rainbow-wash),var(--paper);box-shadow:none
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .reader-scroll .speech.mine:hover{
 background:var(--theme-rainbow-highlight),var(--paper)
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .speech.highlight,
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .reader-scroll .speech.mine.highlight,
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .rehearsal .speech.current{
 background:var(--theme-rainbow-highlight),var(--paper);box-shadow:none
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .speech.highlight .speech-inner{box-shadow:none}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .reader-scroll .speech.mine::before,
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .speech.highlight::before,
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .rehearsal .speech.current::before{
 content:"";position:absolute;inset:0 auto 0 0;width:3px;pointer-events:none;background:linear-gradient(180deg,#ff2b6d,#ff8327,#ffe235,#20d58c,#00b8ff,#8051ff,#ed36dd)
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .speech.highlight::before,
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .rehearsal .speech.current::before{width:4px}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .quick-memory-speech.is-target,
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .quick-memory-speech.is-target:hover{
 border-color:transparent;
 background:var(--theme-rainbow-highlight) padding-box,linear-gradient(var(--paper),var(--paper)) padding-box,var(--theme-rainbow) border-box
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .role-menu-option[aria-selected="true"]{
 background:var(--theme-rainbow-wash),var(--paper)
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .notification-entry.is-new{
 position:relative;overflow:hidden;background:var(--theme-rainbow-wash),var(--paper);border-left-color:transparent
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .notification-entry.is-new::before{
 content:"";position:absolute;inset:0 auto 0 0;width:3px;pointer-events:none;background:linear-gradient(180deg,#ff2b6d,#ff8327,#ffe235,#20d58c,#00b8ff,#8051ff,#ed36dd)
}
:root[data-theme-color="rainbow"]:not([data-theme-color="blue"]) .boot-track span{background:var(--theme-rainbow)}


/* Swipe action underlay uses semantic surfaces in every mode and accent. */
:root[data-theme-mode="dark"] .reader-scroll .speech .swipe-hint{
 background:color-mix(in srgb,var(--accent) 16%,var(--paper));
 color:var(--accent-ink);
}
:root[data-theme-mode="dark"] .reader-scroll .speech .swipe-hint.left{
 background:color-mix(in srgb,var(--ui-review) 16%,var(--paper));
 color:var(--ui-review);
}
:root[data-theme-mode="dark"] .rehearsal-free .reveal-mask{
 border-bottom-color:var(--line);
 background:transparent;
}
