html[data-theme=dark]{color-scheme:dark}html[data-theme=dark] body{background:#111318!important;color:#eceef4!important}html[data-theme=dark] :is(.paper-container,.paper,.wrap,.passage-column,.questions-column,.question-card,.question-item,.paper-section,.nav,.toolbar,.section-toolbar){background:#1b1d22!important;color:#eceef4!important;border-color:#373b45!important}html[data-theme=dark] :is(h1,h2,h3,h4,p,.passage,.passage-text,.question-stem,.option-item,.source-doc){color:inherit!important}html[data-theme=dark] :is(input,textarea,select,.option-item,.source,td,th){background:#24272e!important;color:#eceef4!important;border-color:#474b55!important}html[data-theme=dark] :is(.translation,.translation-box,.analysis,.answer-explanation){background:#26302c!important;color:#e4f2e9!important}html[data-theme=dark] button{background:#30343d;color:#eef0f5;border-color:#474b55}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/* V52: pair foregrounds with all legacy paper surfaces. */
html[data-theme=dark]{--canvas:#111724;--surface:#1b2437;--surface-soft:#242e45;--ink:#f0f3ff;--muted:#b7c2d8;--line:#35415c;--v51-blue-soft:#223b55;--v51-blue:#8bc6ff;--tone-ok:#9ae1c4;--tone-ok-bg:#213c35;--tone-error:#ffb5c1;--tone-error-bg:#452c38;--tone-warn:#ffd09d;--tone-warn-bg:#403229}

html[data-theme=dark] body{background:var(--canvas)!important;color:var(--ink)!important}
html[data-theme=dark] body :is(.question-item,.question,.question-column,.question-column h4,.question-card,.paper-container,.paper-section,.passage-column,.option-popup,.writing-prompt,.source-box,.audio-player,.cloze-option-bank,.kx-course-result,.kx-reading-path,.writing-feedback-card,.reading-translation-controls,.mini-box,.translation-tooltip){background:var(--surface)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme=dark] body :is(.option-item,.cloze-bank-choice,.popup-option,.grammar-input,.writing-input,th,td){background:var(--surface-soft)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme=dark] body :is(.subtitle,.source-tag,.question-meta,.translation-help,.writing-feedback-card span){color:var(--muted)!important}
html[data-theme=dark] body :is(.question-type-tag,.cloze-clickable,.mini-action,.source-box summary,.passage-subtitle,.cloze-option-row>strong,.writing-feedback-card strong){background:var(--v51-blue-soft)!important;color:var(--v51-blue)!important}
html[data-theme=dark] body :is(.question-item.is-correct,.option-item.is-correct,.cloze-bank-choice.is-correct,.grammar-input.is-correct,.question-feedback.correct,.grammar-feedback.correct,.grade-badge.correct,.writing-good,.cloze-clickable.answered){background:var(--tone-ok-bg)!important;color:var(--tone-ok)!important;border-color:var(--tone-ok)!important}
html[data-theme=dark] body :is(.question-item.is-wrong,.option-item.is-wrong,.cloze-bank-choice.is-wrong,.grammar-input.is-wrong,.question-feedback.wrong,.grammar-feedback.wrong,.grade-badge.wrong,.writing-issue){background:var(--tone-error-bg)!important;color:var(--tone-error)!important;border-color:var(--tone-error)!important}
html[data-theme=dark] body :is(.grade-badge.ungraded,.question-feedback.ungraded){background:var(--surface-soft)!important;color:var(--muted)!important}
html[data-theme=dark] body .notice{background:var(--tone-warn-bg)!important;color:var(--tone-warn)!important}
html:not([data-theme=dark]) :is(.question-meta,.source-tag,.subtitle,.translation-help){color:#526782!important}
html:not([data-theme=dark]) .grade-badge.correct{color:#216e55!important}
html:not([data-theme=dark]) :is(.grade-badge.ungraded,.question-feedback.ungraded){color:#526782!important}
