body #appearance-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;padding:8px 12px;border:1px solid #697b89;border-radius:9px;background:#edf0f4;color:#243a4d;font:600 14px/1.4 system-ui,sans-serif;white-space:nowrap;cursor:pointer;box-shadow:0 2px 0 #697b89;flex-shrink:0}
body #appearance-toggle:focus-visible{outline:3px solid #d7ad53;outline-offset:3px}
html[data-appearance="dark"]{background:#141c24!important;color:#eef3f7!important}
html[data-appearance="dark"] body{background:#141c24!important;color:#eef3f7!important}
html[data-appearance="dark"] main{color:#eef3f7}
html[data-appearance="dark"] :is(dialog,.panel,.resource-card,.overview-frame,.overview-point,.overview-path li,.topic-button,.teacher-unit-card,.student-unit-card,.voice-settings,#resource-window,#autopilot,#pdf-reader,#dictionary-window,#translate-help,.translate-help-actions,.resource-topbar,.pdf-reader-bar,.explainer-toolbar,.explainer-copy,.autopilot-toolbar,.resource-window-actions,.quiz-presentation,.flash-presentation){background:#202c38!important;color:#eef3f7!important;border-color:#586977!important}
html[data-appearance="dark"] :is(h1,h2,h3,h4,.muted,.unit-code,footer,.resource-card a,.topic-button small,.overview-lead,#overview-intro,#overview-number,#resource-video-total,#result-count,#speech-voice-note,.translate-help-note,#autopilot-progress,#autopilot-explanation){color:#e0e9f1!important}
html[data-appearance="dark"] :is(input,select,textarea){background:#17212b!important;color:#f1f5f8!important;border-color:#8294a4!important}
html[data-appearance="dark"] input::placeholder,html[data-appearance="dark"] textarea::placeholder{color:#bbc8d2}
html[data-appearance="dark"] :is(.review,.autopilot-status,#autopilot-notice,#last-opened-resource){background:#354034!important;color:#fff1c8!important;border-color:#a38b55!important}
html[data-appearance="dark"] :is(.autopilot-answer,.study-feedback,.quiz-review){background:#263e30!important;color:#f0fff4!important}
html[data-appearance="dark"] :is(.autopilot-answer strong,.study-feedback p){color:#d7f2dd!important}
html[data-appearance="dark"] #autopilot-text .autopilot-options li{background:#202c38!important;color:#eef3f7!important;border-color:#8294a4!important}
html[data-appearance="dark"] #appearance-toggle{background:#354859;color:#fff;border-color:#8195a5}
html[data-appearance="dark"] #resource-window-content{background:#141c24!important}
html[data-appearance="dark"] .quiz-options button{background:#253443;color:#f4f7fa;border-color:#8294a4}
html[data-appearance="dark"] .quiz-options button.correct{background:#244d32;color:white}html[data-appearance="dark"] .quiz-options button.incorrect{background:#612e33;color:white}
html[data-appearance="dark"] .board-canvas,html[data-appearance="dark"] #board{background:#fff;color:#111}
html[data-appearance="dark"] .flashcard{color:#17333b}
html[data-appearance="dark"] a:not(.button):not(.button-link){color:#9fd8ff}
/* Softer control palette only in dark mode; preserve each tool's colour identity. */
html[data-appearance="dark"] body :is(button,a.button,.button-link,summary){background:#30414d!important;color:#f1f4f7!important;border-color:#748491!important;box-shadow:0 2px 0 #566875!important}
html[data-appearance="dark"] body .section-tabs :is(button,a.button){background:#c78a7e!important;color:#17232e!important;border-color:#986158!important;box-shadow:0 2px 0 #986158!important}
html[data-appearance="dark"] body .section-tabs :is(button,a.button):hover:not(:disabled){background:#d39a8e!important}
html[data-appearance="dark"] body button.read-aloud{background:#594677!important;color:#fff!important;border-color:#8e7baa!important;box-shadow:0 2px 0 #403157!important}
html[data-appearance="dark"] body button.read-aloud:hover:not(:disabled){background:#675486!important}
html[data-appearance="dark"] body .dc-listen{background:#355c83!important;color:#fff!important;border-color:#7491ae!important;box-shadow:0 2px 0 #29445e!important}
html[data-appearance="dark"] body .dc-listen.dc-on{background:#704257!important;border-color:#ad7c91!important;box-shadow:0 2px 0 #51313f!important}
html[data-appearance="dark"] body .dc-listen:hover:not(:disabled){background:#406c95!important}
html[data-appearance="dark"] body .dc-listen.dc-on:hover:not(:disabled){background:#805367!important}
html[data-appearance="dark"] body .dc-unit-return{background:#76523b!important;color:#fff!important;border-color:#b28b6e!important;box-shadow:0 2px 0 #513828!important}
html[data-appearance="dark"] body .dc-unit-return:hover:not(:disabled){background:#876149!important}
html[data-appearance="dark"] body .dc-tool-audio{background:#493e60!important;color:#fff!important;border-color:#9988b2!important}
html[data-appearance="dark"] body :is(#teacher-autopilot,#student-autopilot,#quiz-autopilot,#flash-autopilot,.dc-tool-auto){background:#7c9053!important;color:#101910!important;border-color:#a8b883!important;box-shadow:0 2px 0 #59683c!important}
html[data-appearance="dark"] body :is(#teacher-autopilot,#student-autopilot,#quiz-autopilot,#flash-autopilot,.dc-tool-auto):hover:not(:disabled){background:#8c9f64!important}
html[data-appearance="dark"] body .dc-tool-attention{background:#af9654!important;color:#17232e!important;border-color:#d1ba81!important}
html[data-appearance="dark"] body .dc-tool-responses{background:#724560!important;color:#fff!important;border-color:#ab819a!important}
html[data-appearance="dark"] body .dc-tool-share{background:#365b61!important;color:#fff!important;border-color:#83a2a7!important}
html[data-appearance="dark"] body .dc-tool-student{background:#36534f!important;color:#fff!important;border-color:#80a29b!important}
html[data-appearance="dark"] body .dc-tool-whiteboard{background:#c6ccd1!important;color:#17232e!important;border-color:#919da6!important}
html[data-appearance="dark"] body .dc-tool-timer{background:#292b2f!important;color:#fff!important;border-color:#74808a!important}
html[data-appearance="dark"] body :is(#overview-previous,#overview-next,#pdf-previous,#pdf-next){background:#375f51!important;color:#fff!important;border-color:#82a493!important;box-shadow:0 2px 0 #294537!important}
html[data-appearance="dark"] body :is(#overview-previous,#overview-next,#pdf-previous,#pdf-next):hover:not(:disabled){background:#446f60!important}
html[data-appearance="dark"] body .dc-tool-colour:hover:not(:disabled){filter:brightness(1.08)}
html[data-appearance="dark"] body .dc-tool-audio{--dc-tool-hover:#574b70}
html[data-appearance="dark"] body .dc-tool-auto{--dc-tool-hover:#8c9f64}
html[data-appearance="dark"] body .dc-tool-attention{--dc-tool-hover:#bca362}
html[data-appearance="dark"] body .dc-tool-responses{--dc-tool-hover:#80546d}
html[data-appearance="dark"] body .dc-tool-share{--dc-tool-hover:#446c72}
html[data-appearance="dark"] body .dc-tool-student{--dc-tool-hover:#44665f}
html[data-appearance="dark"] body .dc-tool-whiteboard{--dc-tool-hover:#d2d6da}
/* Keep branding recognisable on charcoal surfaces. */
html[data-appearance="dark"] body :is(.student-site-label,.teacher-site-label,.site-label){color:#f1f5f8!important}
html[data-appearance="dark"] body .site-role-icon{stroke:#a6d6ca!important}
html[data-appearance="dark"] body .site-role-icon .role-gold{stroke:#e2c785!important}
html[data-appearance="dark"] body :is(header img[alt*="Discaperio"],img[src*="discaperio-logo"],.home-logo){background:#fffdf5!important;border-radius:9px;padding:7px;box-sizing:content-box;max-width:calc(100% - 14px)}
body #accessibility-open{font:600 14px/1.4 system-ui,sans-serif;min-height:40px;padding:8px 12px;border:1px solid #697b89;border-radius:9px;background:#edf0f4;color:#243a4d;white-space:nowrap;flex-shrink:0;cursor:pointer}
#reading-settings{box-sizing:border-box;width:min(560px,calc(100% - 32px));max-height:90dvh;overflow:auto;padding:24px;border-radius:14px;background:#fff;color:#17333b;border:2px solid #8a9b98}
#reading-settings h2{margin:0 0 22px}#reading-settings p{font-size:1rem;line-height:1.6}
.reading-settings-fields{display:grid;gap:20px}.reading-settings-fields>label{display:flex;flex-wrap:wrap;align-items:center;gap:12px;font-weight:650}.reading-settings-fields select{width:100%;padding:10px;min-height:44px;font:inherit}.reading-check input{flex:none;width:22px;height:22px;min-width:22px;margin:0}.reading-settings-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:12px;margin-top:22px}
html[data-reading-size="large"]{--reading-font:1.2rem}html[data-reading-size="very-large"]{--reading-font:1.4rem}
html:not([data-reading-size="standard"]) body :is(.panel p,.panel li,.resource-card p,.resource-card h3,.topic-button,.overview-lead,.overview-point,#topic-intro,#topic-points,#topic-details,#overview-intro,#overview-points,#results,.translate-browser-guide,#reading-settings p,.teacher-unit-card,.student-unit-card,main>p){font-size:var(--reading-font)!important}
html:not([data-reading-size="standard"]) body :is(#autopilot-text,.flash-meaning){font-size:clamp(30px,3vw,44px)!important}
html:not([data-reading-size="standard"]) body #quiz-question{font-size:clamp(30px,3vw,44px)!important}
html:not([data-reading-size="standard"]) body .quiz-options button{font-size:var(--reading-font)!important}
html[data-reading-spacing="comfortable"] body :is(p,li,.resource-card,.topic-button,.overview-point,.flash-meaning,#autopilot-text){line-height:1.9!important;letter-spacing:.015em}
html[data-reading-motion="reduced"] *,html[data-reading-motion="reduced"] *::before,html[data-reading-motion="reduced"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
html[data-reading-contrast="high"] body,html[data-reading-contrast="high"] main{background:#fff!important;color:#000!important}
html[data-reading-contrast="high"][data-appearance="dark"] body,html[data-reading-contrast="high"][data-appearance="dark"] main{background:#000!important;color:#fff!important}
html[data-reading-contrast="high"] body :is(dialog,.panel,.resource-card,.overview-frame,.overview-point,.overview-path li,.topic-button,.teacher-unit-card,.student-unit-card,#resource-window,#autopilot,#pdf-reader,.resource-topbar,.pdf-reader-bar,.autopilot-toolbar,.voice-settings,.translate-help-actions){background:#fff!important;color:#000!important;border-color:#000!important}
html[data-reading-contrast="high"][data-appearance="dark"] body :is(dialog,.panel,.resource-card,.overview-frame,.overview-point,.overview-path li,.topic-button,.teacher-unit-card,.student-unit-card,#resource-window,#autopilot,#pdf-reader,.resource-topbar,.pdf-reader-bar,.autopilot-toolbar,.voice-settings,.translate-help-actions){background:#000!important;color:#fff!important;border-color:#fff!important}
html[data-reading-contrast="high"] body :is(h1,h2,h3,h4,p,li,.muted,.unit-code,.overview-lead,.student-site-label,.teacher-site-label){color:#000!important}
html[data-reading-contrast="high"][data-appearance="dark"] body :is(h1,h2,h3,h4,p,li,.muted,.unit-code,.overview-lead,.student-site-label,.teacher-site-label){color:#fff!important}
html[data-reading-contrast="high"] body :is(button,a,input,select,summary):focus-visible{outline:4px solid #005bd1!important;outline-offset:4px}
html[data-reading-contrast="high"][data-appearance="dark"] body :is(button,a,input,select,summary):focus-visible{outline-color:#ffe16d!important}
html[data-reading-contrast="high"] body :is(.resource-card,.panel,.topic-button,.teacher-unit-card){border-width:2px!important}
html[data-reading-contrast="high"] #autopilot-explanation,html[data-reading-contrast="high"] #resource-window-content{background:#fff!important;color:#000!important}
html[data-reading-contrast="high"][data-appearance="dark"] #autopilot-explanation,html[data-reading-contrast="high"][data-appearance="dark"] #resource-window-content{background:#000!important;color:#fff!important}

html[data-reading-theme="cream"][data-appearance="light"]:not([data-reading-contrast="high"]),html[data-reading-theme="cream"][data-appearance="light"]:not([data-reading-contrast="high"]) body,html[data-reading-theme="cream"][data-appearance="light"]:not([data-reading-contrast="high"]) :is(#resource-window,#resource-window-content,#autopilot,#pdf-reader,#unit-explainer){background:#f8f1df!important}

html[data-reading-theme="blue"][data-appearance="light"]:not([data-reading-contrast="high"]),html[data-reading-theme="blue"][data-appearance="light"]:not([data-reading-contrast="high"]) body,html[data-reading-theme="blue"][data-appearance="light"]:not([data-reading-contrast="high"]) :is(#resource-window,#resource-window-content,#autopilot,#pdf-reader,#unit-explainer){background:#edf4fb!important}

html[data-reading-theme="sage"][data-appearance="light"]:not([data-reading-contrast="high"]),html[data-reading-theme="sage"][data-appearance="light"]:not([data-reading-contrast="high"]) body,html[data-reading-theme="sage"][data-appearance="light"]:not([data-reading-contrast="high"]) :is(#resource-window,#resource-window-content,#autopilot,#pdf-reader,#unit-explainer){background:#edf4e9!important}

html[data-reading-theme="lavender"][data-appearance="light"]:not([data-reading-contrast="high"]),html[data-reading-theme="lavender"][data-appearance="light"]:not([data-reading-contrast="high"]) body,html[data-reading-theme="lavender"][data-appearance="light"]:not([data-reading-contrast="high"]) :is(#resource-window,#resource-window-content,#autopilot,#pdf-reader,#unit-explainer){background:#f2edfa!important}

/* Unit landing pages offer resources; speech is controlled inside each resource. */
body #listen-page,body #speech-pause,body #speech-stop{display:none!important}
body #voice-settings-panel{display:none!important}
body #reading-settings #voice-settings-panel{display:block!important;width:100%;margin:0}
#reading-settings #voice-settings-trigger{display:inline-flex;align-items:center;min-height:44px;padding:9px 14px;border:1px solid #8aa9a1;border-radius:9px;cursor:pointer;background:#eee5fa;color:#4e2874}
#reading-settings .voice-settings{position:static!important;right:auto!important;left:auto!important;top:auto!important;box-sizing:border-box;width:100%;min-width:0;max-width:100%;max-height:none;margin-top:14px;padding:16px;box-shadow:none}
#reading-settings .voice-settings-actions{display:flex;flex-wrap:wrap;gap:10px}

/* Settings offers visible choices rather than dropdowns. */
#reading-settings fieldset{border:0;padding:0;margin:0 0 18px;min-width:0}
#reading-settings legend{font-weight:700;margin-bottom:8px}
#reading-settings .settings-choice-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
#reading-settings .settings-choice-buttons button{font:600 15px/1.4 system-ui;padding:9px 12px;border:1px solid #9aadb5;border-radius:9px;background:#f2f6f7;color:#17333b;cursor:pointer}
#reading-settings .settings-choice-buttons button[aria-pressed="true"]{background:#176b61;color:#fff;border-color:#10544c;box-shadow:inset 0 0 0 2px #ffffff40}
#reading-settings .settings-choice-buttons button[aria-pressed="true"]::after{content:' ✓';font-weight:800}
#reading-settings select[hidden]{display:none!important}
#reading-settings .settings-voice-choices{max-height:260px;overflow:auto;padding:3px}
#reading-settings .settings-voice-choices button{white-space:normal;text-align:left;max-width:100%;overflow-wrap:anywhere}
html[data-appearance="dark"] #reading-settings .settings-choice-buttons button{background:#2d3b49;color:#f3f7fa;border-color:#74899a}
html[data-appearance="dark"] #reading-settings .settings-choice-buttons button[aria-pressed="true"]{background:#375f51;color:#fff}
html[data-reading-contrast="high"] #reading-settings .settings-choice-buttons button{background:#fff!important;color:#000!important;border:2px solid #000!important}
html[data-reading-contrast="high"] #reading-settings .settings-choice-buttons button[aria-pressed="true"]{background:#000!important;color:#fff!important}

/* The footer stays outside the scroll area, including on small phone screens. */
#reading-settings{padding:0;overflow:hidden;max-height:90vh;max-height:90dvh}
#reading-settings[open]{display:flex;flex-direction:column}
#reading-settings .reading-settings-content{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:24px;flex:1 1 auto}
#reading-settings .reading-settings-actions{flex:0 0 auto;margin:0;padding:14px 24px;border-top:1px solid #b9c8c7;background:inherit;align-items:center}
#reading-settings #reading-close{min-height:44px;padding:9px 16px}
@media(max-width:500px){#reading-settings .reading-settings-content{padding:18px}#reading-settings .reading-settings-actions{padding:12px 18px}}
