/* Device preference is resolved before paint by theme.js. */
:root {
 color-scheme:light;
 --surface:#fff;--surface-soft:#eff4f9;--surface-raised:#fff;
 --button-ink:#fff;--topic:#2861aa;--topic-soft:#edf3ff;--topic-line:#b8cff1;
 --success:#17674d;--success-bg:#e8f7ef;--success-line:#8fcbb0;
 --danger:#943348;--danger-bg:#fff0f2;--danger-line:#dfa2af;
 --warning:#87580d;--warning-bg:#fff5de;--warning-line:#e4c782;
}
.theme-toggle {
 display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;
 min-width:96px;min-height:44px;padding:9px 12px;border:1px solid var(--rule);
 border-radius:10px;background:var(--surface);color:var(--ink);font-size:12px;font-weight:600;
}
.theme-toggle>span{align-items:center;gap:8px;white-space:nowrap}
.theme-to-dark{display:inline-flex}.theme-toggle .theme-to-light{display:none}
.theme-toggle:hover{border-color:var(--accent);background:var(--pale)}
.ux-topline .theme-toggle{min-width:89px;font-size:11px;padding:8px 10px;margin-left:auto}
.ux-topline>.theme-toggle+span{margin-left:0}
[data-tone="blue"]{--topic:#285fa7;--topic-soft:#edf3ff;--topic-line:#b7cbeb}
[data-tone="teal"]{--topic:#08788a;--topic-soft:#e6f7f8;--topic-line:#9bd2d7}
[data-tone="violet"]{--topic:#7450ac;--topic-soft:#f3edfd;--topic-line:#cbb6e8}
[data-tone="rose"]{--topic:#ad3473;--topic-soft:#fcecf4;--topic-line:#e6b1cd}
[data-tone="amber"]{--topic:#94601b;--topic-soft:#fff5e3;--topic-line:#e5c58e}
.module-card[data-tone],.catalog-course[data-tone]{border-top:4px solid var(--topic);background:linear-gradient(145deg,var(--topic-soft),var(--surface) 50%)}
.module-card[data-tone] .module-icon{background:var(--topic-soft);color:var(--topic)}
.module-card[data-tone] .card-category,.catalog-course[data-tone]>strong{color:var(--topic)}
.module-card[data-tone]:hover,.catalog-course[data-tone]:hover{border-color:var(--topic)}
.module-card[data-tone] progress::-webkit-progress-value{background:var(--topic)}
.module-card[data-tone] progress::-moz-progress-bar{background:var(--topic)}
.quick-practice[data-tone]{border-top:4px solid var(--topic)}
.track-page[data-tone] .track-header .eyebrow,.course-detail[data-tone]>.page-heading .eyebrow{color:var(--topic)}
.track-page[data-tone] .track-next,.course-detail[data-tone] .catalog-start{border-left-color:var(--topic);background:linear-gradient(110deg,var(--topic-soft),var(--surface) 65%)}
.course-detail[data-tone] .catalog-lesson-number{background:var(--topic-soft);color:var(--topic)}
.ux-mission[data-tone] .ux-progress i{background:var(--topic)}
.ux-mission[data-tone] .next-instruction{background:var(--topic-soft);color:var(--topic)}
.access-badge.free{background:#e8f7f4;color:#176656}.access-badge.owned{background:var(--success-bg);color:var(--success)}
.access-badge.premium{background:var(--warning-bg);color:var(--warning)}
.option.selected .letter{background:var(--accent);color:var(--button-ink)}
.option.correct,.ux-mission .option.correct{background:var(--success-bg);border-color:var(--success-line);color:var(--success)}
.option.correct .letter{background:var(--success-line);color:#124431}
.option.wrong,.ux-mission .option.wrong{background:var(--danger-bg);border-color:var(--danger-line);color:var(--danger)}
.option.wrong .letter{background:var(--danger-line);color:#542032}
.ux-mission .answer-feedback{background:var(--success-bg);border-color:var(--success-line);color:var(--success)}
.ux-mission .answer-feedback.bad{background:var(--danger-bg);border-color:var(--danger-line);color:var(--danger)}
.ux-mission .answer-feedback .short-explanation p{color:inherit}
.question-step.correct,.question-step.studied,.result-status.correct,.result-status.studied{background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
.question-step.wrong,.result-status.wrong{background:var(--danger-bg);color:var(--danger);border-color:var(--danger-line)}
.question-step.skipped,.result-status.skipped{background:var(--warning-bg);color:var(--warning);border-color:var(--warning-line)}

html[data-theme="dark"] {
 color-scheme:dark;
 --paper:#0c1524;--white:#152235;--surface:#152235;--surface-soft:#1c2d44;--surface-raised:#1b2b41;
 --ink:#e5edf7;--muted:#a9b9cd;--rule:#30435b;--accent:#5bd2df;--pale:#173943;--green:#83dcb5;
 --button-ink:#082d35;--topic:#91b9ff;--topic-soft:#1c2e49;--topic-line:#415e89;
 --success:#a0e5c1;--success-bg:#17382f;--success-line:#3d785e;
 --danger:#ffc0d0;--danger-bg:#452534;--danger-line:#9b5368;
 --warning:#f1cf88;--warning-bg:#3c311f;--warning-line:#8a6f3d;
}
html[data-theme="dark"] [data-tone="blue"]{--topic:#91b9ff;--topic-soft:#1c2e49;--topic-line:#415e89}
html[data-theme="dark"] [data-tone="teal"]{--topic:#68d9df;--topic-soft:#173740;--topic-line:#3b737b}
html[data-theme="dark"] [data-tone="violet"]{--topic:#c5a5ff;--topic-soft:#302344;--topic-line:#6d548b}
html[data-theme="dark"] [data-tone="rose"]{--topic:#f5a2cb;--topic-soft:#40263b;--topic-line:#8c5274}
html[data-theme="dark"] [data-tone="amber"]{--topic:#f1cd86;--topic-soft:#3b3022;--topic-line:#8b7043}
html[data-theme="dark"] .theme-toggle .theme-to-dark{display:none}
html[data-theme="dark"] .theme-toggle .theme-to-light{display:inline-flex}
html[data-theme="dark"] :is(.sidebar,.topbar,.mobile-nav,.panel,.today,.stat,.level-card,.track-overview,.course-item,.practice-panel,.lesson-article,.option,.unfold details,.mission-map,.next-step-card,.track-next,.result-next,.all-results,.optional-reflection,.attempt-card,.home-shortcuts>a,.catalog-header,.catalog-start,.catalog-method,.catalog-syllabus>li,.data-table){background:var(--surface);color:var(--ink);border-color:var(--rule)}
html[data-theme="dark"] .module-card[data-tone],html[data-theme="dark"] .catalog-course[data-tone]{background:linear-gradient(145deg,var(--topic-soft),var(--surface) 58%);border-color:var(--rule);border-top-color:var(--topic)}
html[data-theme="dark"] .track-page[data-tone] .track-next,html[data-theme="dark"] .course-detail[data-tone] .catalog-start{background:linear-gradient(110deg,var(--topic-soft),var(--surface) 65%);border-left-color:var(--topic)}
html[data-theme="dark"] .quick-practice[data-tone]{border-top-color:var(--topic)}
html[data-theme="dark"] :is(.sidebar nav a,.sidebar-access,.sidebar-bottom a,.sidebar-bottom>span,.edition,.brand-context small,.preview-label,.choice-status,.skip-answer,.exit-practice,.quiet-details>summary,.track-extra>summary,.question-info>summary,.test-notice,.source-note,.screen-only,.course-copy p,.quiz-meta,.card-category,.catalog-intro,.catalog-course-meta,.catalog-breadcrumb,.catalog-footer p,.catalog-syllabus ul li,.catalog-method p,.catalog-method li){color:var(--muted)}
html[data-theme="dark"] :is(.brand,.brand-context strong,.catalog-brand,.catalog-method li strong,.catalog-footer .footer-brand){color:var(--ink)}
html[data-theme="dark"] .sidebar nav a:hover{background:var(--surface-soft)}
html[data-theme="dark"] :is(.sidebar nav a.active,.mobile-nav a.active,.filter.active){background:var(--pale);color:var(--accent);border-color:#397584}
html[data-theme="dark"] :is(.edition,.sidebar-access,footer,.catalog-footer,.track-extra,.quiet-details,.section-head,.result-item,.source-row,.lesson-navigation,.chapter-row,.stage-section){border-color:var(--rule)}
/* The logo keeps one dark surface across page types and theme preferences. */
.official-logo{background:#0c1524;border-radius:9px;box-shadow:inset 0 0 0 1px #26384d}
.footer-brand img{background:#0c1524;border-radius:8px;padding:4px;object-fit:contain}
.auth-brand{display:inline-flex;align-items:center;justify-content:center;background:#0c1524;border:1px solid #26384d;border-radius:18px;padding:8px;line-height:0}
html[data-theme="dark"] .btn{background:var(--accent);color:var(--button-ink)}
html[data-theme="dark"] :is(.btn.outline,.btn.light,.filter,.question-step,.stage-button,.day,.notes,input,select,textarea){background:var(--surface);color:var(--ink);border-color:var(--rule)}
html[data-theme="dark"] :is(input,select,textarea):focus{border-color:var(--accent)}
html[data-theme="dark"] ::placeholder{color:#8fa2b9;opacity:1}
html[data-theme="dark"] :is(.stage-button.available,.filter.active,.option.selected){background:var(--pale);border-color:var(--accent);color:var(--ink)}
html[data-theme="dark"] :is(.option .letter,.course-number,.stage-number,.simple-steps li>span,.stat-symbol,.avatar,.attempt-kind,.unfold summary>span,.module-icon){background:var(--surface-soft);color:var(--accent)}
html[data-theme="dark"] .option.selected .letter{background:var(--accent);color:var(--button-ink)}
html[data-theme="dark"] :is(.access-badge.free,.access-badge.owned,.lesson-completed){background:var(--success-bg);color:var(--success)}
html[data-theme="dark"] .access-badge.premium{background:var(--warning-bg);color:var(--warning)}
html[data-theme="dark"] .course-item.is-complete .course-number{background:var(--success-bg);color:var(--success)}
html[data-theme="dark"] :is(.notice,.paywall,.lesson-article .callout,.method-banner,.mode-description,.level-legend){background:var(--surface-soft);color:var(--ink);border-color:var(--rule)}
html[data-theme="dark"] .lesson-article .callout{border-left-color:var(--accent)}
html[data-theme="dark"] :is(.lesson-article .lead,.lesson-article p,.lesson-article li,.unfold>p,.unfold-content,.short-explanation p,.transfer-result){color:var(--ink)}
html[data-theme="dark"] :is(.bank-row:hover,.data-table th){background:var(--surface-soft)}
html[data-theme="dark"] :is(.data-table td,.data-table th){border-color:var(--rule)}
html[data-theme="dark"] .visual-sequence>div,html[data-theme="dark"] .visual-choices>div{background:#f3f6fa;border-color:#aab7ca;color:#152b45}
html[data-theme="dark"] :is(.ux-progress,progress,progress::-webkit-progress-bar){background:var(--surface-soft)}
html[data-theme="dark"] .ux-mission .answer-feedback{background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
html[data-theme="dark"] .ux-mission .answer-feedback.bad{background:var(--danger-bg);color:var(--danger);border-color:var(--danger-line)}
html[data-theme="dark"] .ux-mission .answer-feedback .short-explanation p{color:inherit}
html[data-theme="dark"] .ux-mission .answer-feedback .notice{background:var(--surface);color:var(--ink);border-color:var(--rule)}
html[data-theme="dark"] .ux-mission .option.correct{background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
html[data-theme="dark"] .ux-mission .option.wrong{background:var(--danger-bg);color:var(--danger);border-color:var(--danger-line)}
html[data-theme="dark"] .option.correct .letter{background:#32624c;color:#c9f3db}
html[data-theme="dark"] .option.wrong .letter{background:#703c50;color:#ffd3df}
html[data-theme="dark"] :is(.question-step.correct,.question-step.studied,.result-status.correct,.result-status.studied){background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
html[data-theme="dark"] :is(.question-step.wrong,.result-status.wrong){background:var(--danger-bg);color:var(--danger);border-color:var(--danger-line)}
html[data-theme="dark"] :is(.question-step.skipped,.result-status.skipped){background:var(--warning-bg);color:var(--warning);border-color:var(--warning-line)}
html[data-theme="dark"] :is(.question-step.saved,.question-step.reflected,.result-status:not(.correct):not(.wrong):not(.skipped):not(.studied)){background:var(--surface-soft);color:var(--ink)}
html[data-theme="dark"] :is(.question-picker>summary,.question-picker #next-question,.quiet-details>summary:after){color:var(--accent)}
html[data-theme="dark"] body[data-quiz="active"] .quiz-controls{background:var(--surface);border-color:var(--rule)}
html[data-theme="dark"] body[data-quiz="active"] #previous-question{background:transparent;color:var(--muted)}
html[data-theme="dark"] body[data-quiz="active"] #submit-answer:disabled{background:var(--surface-soft);color:var(--muted)}
html[data-theme="dark"] #toast{background:var(--surface-raised);color:var(--ink);border-color:var(--rule)}
html[data-theme="dark"] :is(.practice-access-line,.next-step-card .eyebrow){color:var(--muted)!important}
html[data-theme="dark"] :is(a,button,summary,input,select,textarea):focus-visible{outline-color:#f49ccb}
@media(max-width:560px){
 .topbar .preview-label{display:none}.topbar .top-actions{gap:0}.theme-toggle{min-width:87px;font-size:11px;padding:9px 10px}
 .ux-topline{gap:9px}.ux-topline .theme-toggle{min-width:42px;padding:8px;font-size:0}.ux-topline .theme-toggle>span{gap:0}
 .catalog-header nav{gap:9px}.catalog-header nav>.btn{font-size:11px;padding:10px}.catalog-header .theme-toggle{min-width:42px;font-size:0;padding:9px}.catalog-header .theme-toggle>span{gap:0}
}
html[data-theme="dark"] .eyebrow{color:#b4c7dc}
html[data-theme="dark"] .module-card[data-tone] .module-icon{background:var(--topic-soft);color:var(--topic)}
html[data-theme="dark"] :is(.empty,.bank-list){background:var(--surface);color:var(--ink);border-color:var(--rule)}
html[data-theme="dark"] :is(.setup-hint,.level-road li>span,.tag){background:var(--surface-soft);color:var(--muted)}
html[data-theme="dark"] .level-road .current>span{background:var(--accent);color:var(--button-ink)}
html[data-theme="dark"] :is(.level-road .passed>span,.tag.free){background:var(--success-bg);color:var(--success)}
html[data-theme="dark"] .level-road li:not(:last-child):after{background:var(--rule)}
html[data-theme="dark"] .answer-feedback{background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
html[data-theme="dark"] .answer-feedback.bad{background:var(--danger-bg);color:var(--danger);border-color:var(--danger-line)}
html[data-theme="dark"] .visual-choices small{color:#425974}
html[data-theme="dark"] .visual-sequence .missing-visual{color:#285fa7}
/* Diagram ink must keep its light-canvas contrast in either site theme. */
html[data-theme="dark"] :is(.visual-sequence>div,.visual-choices>div){--accent:#08788a;--muted:#425974}

/* Full tests: one clear free start, one fixed-price pack. */
.exam-intro{display:grid;grid-template-columns:minmax(0,1fr) 220px;gap:32px;padding:32px;border:1px solid var(--rule);border-radius:20px;background:var(--surface);margin-bottom:24px}.exam-intro h2{font-size:30px;margin:18px 0 12px}.exam-intro p{max-width:720px}.exam-count{display:flex;flex-direction:column;justify-content:center;text-align:center;gap:10px;background:var(--paper);border-radius:16px;padding:20px}.exam-count strong{font-size:64px;line-height:1.1;color:var(--accent)}.exam-count small{line-height:1.7}.exam-offer{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:32px;align-items:center;margin-bottom:32px}.exam-offer h2{margin:12px 0}.exam-price{display:flex;flex-direction:column;gap:12px}.exam-price>strong{font-size:42px}.exam-price>span,.exam-price>small{color:var(--muted)}.exam-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.exam-card h3{margin:16px 0 8px}.exam-card .btn{width:100%}.exam-number{font-size:28px;font-weight:750;color:var(--accent)}.exam-breakdown{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:24px 0}.exam-breakdown .panel{padding:18px;display:flex;flex-direction:column;gap:8px}.exam-breakdown strong{font-size:28px}.exam-breakdown span{font-size:13px}@media(max-width:1000px){.exam-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.exam-intro{grid-template-columns:minmax(0,1fr) 160px}.exam-offer{grid-template-columns:minmax(0,1fr)}}@media(max-width:600px){.exam-intro{padding:22px;grid-template-columns:1fr;gap:18px}.exam-intro h2{font-size:25px}.exam-count{display:none}.exam-offer{gap:16px}.exam-grid{grid-template-columns:1fr}.exam-breakdown{gap:8px}.exam-breakdown .panel{padding:12px}.exam-breakdown strong{font-size:22px}.exam-price .btn{width:100%}}

.receipt-list{display:grid;gap:16px;margin-top:22px}.receipt-card>summary{cursor:pointer;display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px;min-height:44px;align-items:center}.receipt-card>summary span{font-size:13px;color:var(--muted)}.receipt-card form{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:20px}.receipt-card .field{margin:0}.receipt-card form>.field:last-of-type,.receipt-card form>.receipt-status{grid-column:1/-1}.receipt-card input{width:100%;min-height:44px;padding:10px;border:1px solid var(--rule);border-radius:9px;background:var(--surface);color:var(--ink)}.receipt-card .notes{min-height:90px}@media(max-width:600px){.receipt-card form{grid-template-columns:1fr}.catalog-header nav{gap:10px}.catalog-header nav>a:not(.btn){font-size:12px}}

@media(max-width:560px){.catalog-header{flex-wrap:wrap;gap:8px}.catalog-header nav{width:100%;justify-content:space-between;gap:8px;flex-wrap:wrap}.catalog-header nav>a:first-child{display:inline-flex}.catalog-header .theme-toggle{min-width:42px;padding:8px}}

.public-lesson{max-width:850px}.public-lesson section{margin:32px 0}.public-lesson p,.public-lesson li{line-height:1.85}.public-lesson h2{margin-bottom:16px}.catalog-footer nav{display:flex;gap:20px;flex-wrap:wrap}.catalog-syllabus a{text-decoration:underline;text-underline-offset:3px}
