/* v42: one visual language across the existing student experience. */
:root{--page:#090e20;--surface:#121b30;--surface-raised:#1b2d43;--ink:#f3f5ff;--muted:#bdcbe0;--accent:#6ee5e8;--accent-ink:#073341;--edge:#328da2;--subject-tint:#0d4459;--good:#74e5a2;--bad:#ff9cae}
body[data-subject="math"]{--accent:#ffc36b;--accent-ink:#472408;--edge:#ae6b35;--subject-tint:#512c1d;--surface-raised:#35262b}
/* Compatibility selectors for existing lesson structure. Final v42 tokens below. */
:root{color-scheme:dark;background:var(--page)!important;color:#fff!important}
body{background:var(--page)!important;color:#fff!important}
body .topbar,body .bar,body .lesson-nav{background:var(--surface)!important;border-color:#ffffff60!important}
body .brand,body .brand span,body .brand b,body .eyebrow,body .skill-label,body .card-kicker,body .math-lesson-meta,body .math-other-heading,body .mission-subtitle{color:#fff!important}
body :is(.hero,.question-card,.progress-head,.lesson-card,.math-card,.math-schedule details,.math-lesson-item,.progress-card,.review-card,.result-panel,.panel,.winds-game .card,.scoreboard,.monthly-card){background:var(--surface)!important;color:var(--ink)!important;border:2px solid var(--edge)!important;box-shadow:0 5px 0 #29104e!important}
body :is(.hero h1,.question-card h1,.progress-head h1,.review-head h1,.panel h2,.lesson-card strong,.math-card h2,.progress-card h2,.math-featured h3,.winds-game .q,.winds-game .big){color:var(--ink)!important}
body :is(.hero p,.question-card p,.panel p,.progress-head p,.math-card p,.math-schedule p,.progress-card p,.review-card p,.result-panel p,.small,.muted,.mission-prompt,.part-prompt,.mission-summary span,.card-meta,.card-best,.math-lesson-item>span:last-child,.scoreboard-note){color:var(--muted)!important}
body :is(.footer,footer,.progress-row,.scoreboard-bottom span){color:#fff!important}
body :is(.home-link,.lesson-home,.primary,.progress-primary,.math-launch,.progress-secondary,.math-assessment-row a,.winds-game .start button,.winds-game .restart,.winds-game .next){background:var(--accent)!important;color:#fff!important;border:2px solid var(--accent)!important;box-shadow:0 4px 0 var(--edge)!important}
body :is(.primary,.home-link,.lesson-home):hover{background:var(--accent)!important}
body :is(.secondary,.pause-button,.hint-button,.unsure,.round-control,.mission-control){background:var(--surface)!important;color:var(--page)!important;border:2px solid var(--page)!important;box-shadow:none!important}
body :is(.secondary,.pause-button,.hint-button,.unsure,.round-control,.mission-control):hover{background:var(--surface-raised)!important}
body .lesson-card.featured,body .math-featured{background:var(--surface)!important;color:var(--ink)!important;border:3px solid var(--edge)!important}
body .lesson-card.featured :is(.card-kicker,.card-meta,.card-best,.card-progress,.card-arrow,strong),body .math-featured :is(h3,p,span){color:var(--ink)!important}
body .math-featured-action{background:var(--accent)!important;color:#fff!important;border:2px solid var(--accent)!important;box-shadow:0 4px 0 var(--edge)!important}
body .math-assessment-row a{background:var(--accent)!important;border-color:var(--accent)!important;box-shadow:0 4px 0 var(--edge)!important}
body .math-assessment-row a span{color:#fff!important}
body :is(.math-lesson-item,.lesson-card){text-decoration:none}
body .lesson-card:nth-child(4n+1){border-color:#e21b3c!important}body .lesson-card:nth-child(4n+2){border-color:var(--accent)!important}body .lesson-card:nth-child(4n+3){border-color:#ffc36b!important}body .lesson-card:nth-child(4n+4){border-color:var(--accent)!important}
body .math-lesson-item:nth-child(4n+1){border-color:#e21b3c!important}body .math-lesson-item:nth-child(4n+2){border-color:var(--accent)!important}body .math-lesson-item:nth-child(4n+3){border-color:#ffc36b!important}body .math-lesson-item:nth-child(4n+4){border-color:var(--accent)!important}
body .math-assessment-row small{color:#fff!important}
body :is(.choice,.answer,.winds-game .a){color:#fff!important;border:2px solid transparent!important;box-shadow:0 4px 0 #0003!important}
body .choices .choice:nth-child(4n+1),body .answers .answer:nth-child(4n+1),body.winds-game .answers .a:nth-child(4n+1){background:#e21b3c!important;color:#fff!important}
body .choices .choice:nth-child(4n+2),body .answers .answer:nth-child(4n+2),body.winds-game .answers .a:nth-child(4n+2){background:var(--accent)!important;color:#fff!important}
body .choices .choice:nth-child(4n+3),body .answers .answer:nth-child(4n+3),body.winds-game .answers .a:nth-child(4n+3){background:#ffc36b!important;color:#171717!important}
body .choices .choice:nth-child(4n+4),body .answers .answer:nth-child(4n+4),body.winds-game .answers .a:nth-child(4n+4){background:var(--accent)!important;color:#fff!important}
body .choice.selected,body .answer.correct,body.winds-game .a.correct{outline:4px solid var(--ink)!important;outline-offset:-7px!important;border-color:#fff!important;opacity:1!important}
body .answer.wrong,body.winds-game .a.wrong{outline:4px dashed var(--ink)!important;outline-offset:-7px!important;border-color:#fff!important}
/* Legacy specificity compatibility; semantic states are finalized below. */
body .answers .answer:is(.correct,.wrong):nth-child(4n+1),body.winds-game .answers .a:is(.correct,.wrong):nth-child(4n+1){background:#e21b3c!important;color:#fff!important}
body .answers .answer:is(.correct,.wrong):nth-child(4n+2),body.winds-game .answers .a:is(.correct,.wrong):nth-child(4n+2){background:var(--accent)!important;color:#fff!important}
body .answers .answer:is(.correct,.wrong):nth-child(4n+3),body.winds-game .answers .a:is(.correct,.wrong):nth-child(4n+3){background:#ffc36b!important;color:#171717!important}
body .answers .answer:is(.correct,.wrong):nth-child(4n+4),body.winds-game .answers .a:is(.correct,.wrong):nth-child(4n+4){background:var(--accent)!important;color:#fff!important}
body .answers .answer.correct:nth-child(n),body.winds-game .answers .a.correct:nth-child(n){border:2px solid #fff!important;outline:4px solid var(--ink)!important;outline-offset:-7px!important;opacity:1!important}
body .answers .answer.wrong:nth-child(n),body.winds-game .answers .a.wrong:nth-child(n){border:2px dashed #fff!important;outline:4px dashed var(--ink)!important;outline-offset:-7px!important}
body .answer.dim,body.winds-game .a:disabled:not(.correct):not(.wrong){opacity:.6!important}
body .answer .symbol{background:#ffffff33!important;color:inherit!important}
body :is(.feedback.good,.mission-feedback){background:#ddf3d8!important;border:2px solid var(--accent)!important;color:#164d0d!important}
body :is(.feedback.bad,.mission-feedback.missed){background:#ffe4e9!important;border:2px dashed #e21b3c!important;color:#761125!important}
body :is(.feedback.good strong,.mission-feedback strong){color:#164d0d!important}body :is(.feedback.bad strong,.mission-feedback.missed strong){color:#761125!important}
body :is(.hint,.worked-line){background:#edf4ff!important;color:#173e74!important;border-left:5px solid var(--accent)!important}
body :is(.summary strong,.scorebig,.mission-summary strong){color:var(--ink)!important}
body :is(.stats,.points-badge){color:#fff!important}
body .summary div{background:var(--surface-raised)!important;border:1px solid var(--edge)!important}
body :is(.progress-dots span,.track i,.winds-game .bar){background:var(--edge)!important}
body :is(.progress-dots span.done,.track i.done,.winds-game .bar>div){background:var(--accent)!important}
body :is(.progress-dots span.current,.track i.now){background:#ffc36b!important}
body .numeric{background:var(--surface)!important;color:var(--ink)!important;border:2px solid var(--page)!important}
body .scoreboard :is(h2,strong,.scoreboard-note,.scoreboard-bottom span,.scoreboard-week small){color:var(--ink)!important}
body .scoreboard button,body .scoreboard-goal-form button{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important}
body .scoreboard-goal-track{background:var(--edge)!important}body .scoreboard-goal-track span{background:var(--accent)!important}
body .save-failure-banner{background:#ffe4e9!important;color:#761125!important;border-bottom-color:#e21b3c!important}
body :is(button,a,input,textarea,summary,select):focus-visible{outline:3px solid var(--ink)!important;outline-offset:3px!important}
body .topbar :is(a,button):focus-visible,body .bar :is(a,button):focus-visible,body .lesson-nav :is(a,button):focus-visible{outline-color:#fff!important}
@media print{body,body :is(.progress-head,.progress-card,.device-card){background:var(--surface)!important;color:#111!important;box-shadow:none!important}}
body .mission-save-status{color:var(--ink)!important}
body .numeric-wrap button{background:var(--accent)!important;color:#fff!important;border:2px solid var(--accent)!important}
/* Remaining study states inherited from the former black/yellow theme. */
html{background:var(--page)!important}
body :is(.top-chip,.count,.chip,.coming-soon,.winds-game .pill,.pills span,.tags span){background:var(--surface)!important;color:#fff!important;border-color:var(--edge)!important}
body :is(.hero h1 em,.progress-head h1 em,.hero p em,.math-schedule .maybe-now,.review-card .label){color:var(--accent)!important}
body .lesson-card .card-icon.science-icon{background:var(--ink)!important}
body :is(.card-icon,.hero .icon,.medal,.empty-illustration,.focus-icon,.math-icon){filter:none!important}
body .device-card{background:var(--surface)!important;color:var(--ink)!important;border:2px solid var(--edge)!important}
body .device-card :is(h4,.meta,p,li){color:var(--ink)!important}
body .monthly-hero{background:var(--surface)!important;border:2px solid var(--edge)!important}
body .monthly-warning{background:#ffe4e9!important;color:#761125!important;border:2px solid #e21b3c!important}
body .monthly-warning button{background:#e21b3c!important;color:#fff!important}
body :is(.monthly-history-row,.monthly-skill-row){border-top-color:var(--edge)!important}
body :is(.monthly-history-row strong,.monthly-skill-row strong){color:var(--ink)!important}
body .monthly-history-row small{color:var(--muted)!important}
body .monthly-choices button{background:var(--surface)!important;color:var(--ink)!important;border:2px solid var(--edge)!important}
body .monthly-choices button.selected,body .monthly-choice-picked,body .monthly-action-selected,body .unsure.monthly-action-selected{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important;outline:3px solid var(--ink)!important}
body .monthly-signed .minus-button{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important}
body :is(.progress-dots span.current,.track i.now){background:#ffc36b!important;outline-color:var(--ink)!important}
body :is(.report-picker select,.compare-controls select,.scoreboard-goal-form input){background:var(--surface)!important;color:var(--ink)!important;border-color:var(--edge)!important}
body :is(.study-home .topbar .parent-return,.save-failure-banner button){background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important}
body .save-failure-banner :is(span,strong){color:#761125!important}
::selection{background:#ffc36b;color:var(--ink)}
input,textarea,select{accent-color:var(--accent)}
.round-controls{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}.round-control{min-height:50px;border-radius:13px;font:inherit;font-weight:900}.round-status{min-height:20px;color:#fff!important;font-size:14px}.pause-panel{text-align:center}.pause-panel .secondary,.round-home{display:block;width:100%;min-height:50px;margin-top:13px;padding:15px;border-radius:13px;text-decoration:none;text-align:center;font:inherit;font-weight:900}.pause-panel .secondary{background:var(--accent)!important;color:#fff!important;border:2px solid var(--accent)!important}.pause-panel .round-home{background:var(--surface)!important;color:var(--page)!important;border:2px solid var(--page)!important}@media(max-width:390px){.round-controls{grid-template-columns:1fr}}

/* Science question text compatibility. */
body .panel .question,body.winds-game .card .q{color:var(--ink)!important;background:transparent!important;text-shadow:none!important}
body .stats,body .stats span{color:#fff!important}
body.winds-game .top .pill{background:var(--surface)!important;color:#fff!important}

/* Keep earlier score history discoverable. */
body .scoreboard .scoreboard-xp-history summary,body .scoreboard .scoreboard-xp-row>span,body .scoreboard .scoreboard-xp-row strong,body .scoreboard .scoreboard-xp-goal small{color:var(--ink)!important}

/* Deliberately after compatibility rules: no legacy purple, white cards or rainbow navigation. */
html,body{background:var(--page)!important;color:var(--ink)!important;color-scheme:dark}
body{background:radial-gradient(ellipse at 100% 0%,#26175b55,transparent 36%),radial-gradient(ellipse at 0 45%,#10334444,transparent 45%),var(--page)!important}
body :is(.topbar,.bar,.lesson-nav){background:#090e20ed!important;border-color:#35415e!important}
body :is(.brand,.brand span,.brand b){color:var(--ink)!important}
body .brand{display:inline-flex;align-items:center;gap:3px;text-decoration:none}
body .brand img{width:32px;height:32px;margin-right:5px;flex:none}
body .brand :is(span,b){color:#ffcd50!important}
body :is(.hero,.question-card,.progress-head,.lesson-card,.math-card,.math-schedule details,.math-lesson-item,.progress-card,.review-card,.result-panel,.panel,.winds-game .card,.monthly-card,.monthly-hero,.device-card){background:linear-gradient(145deg,var(--subject-tint),var(--surface) 60%)!important;color:var(--ink)!important;border:1px solid var(--edge)!important;border-radius:22px;box-shadow:0 12px 28px #0003!important}
body :is(h1,h2,h3,.panel .question,.winds-game .card .q,.summary strong,.scorebig,.mission-summary strong){color:var(--ink)!important}
body :is(.eyebrow,.skill-label,.hero h1 em,.progress-head h1 em,.hero p em,.mission-subtitle,.review-card .label){color:var(--accent)!important}
body :is(.small,.muted,.mission-prompt,.part-prompt,.mission-summary span,.mission-save-status,.round-status,.footer,footer){color:var(--muted)!important}
body :is(.primary,.home-link,.lesson-home,.progress-primary,.math-launch,.progress-secondary,.math-assessment-row a,.winds-game .start button,.winds-game .restart,.winds-game .next,.math-featured-action,.numeric-wrap button,.monthly-signed .minus-button){background:var(--accent)!important;color:var(--accent-ink)!important;border:2px solid var(--accent)!important;box-shadow:none!important;text-decoration:none}
body :is(.secondary,.pause-button,.hint-button,.unsure,.round-control,.mission-control,.round-home),body .pause-panel :is(.secondary,.round-home){background:var(--surface)!important;color:var(--ink)!important;border:1px solid var(--edge)!important;box-shadow:none!important}
body :is(.primary,.home-link,.lesson-home):hover{background:var(--accent)!important;filter:brightness(1.08)}
body :is(.secondary,.pause-button,.hint-button,.unsure,.round-control,.mission-control):hover{background:var(--surface-raised)!important}
body :is(.choice,.answer,.winds-game .a,.monthly-choices button):nth-child(n){background:var(--surface-raised)!important;color:var(--ink)!important;border:2px solid var(--edge)!important;box-shadow:none!important}
body :is(.choice.selected,.monthly-choices button.selected,.monthly-choice-picked,.monthly-action-selected,.unsure.monthly-action-selected){background:var(--accent)!important;color:var(--accent-ink)!important;border-color:var(--accent)!important;outline:2px solid var(--ink)!important;outline-offset:2px!important}
body .answers .answer.correct:nth-child(n),body.winds-game .answers .a.correct:nth-child(n){background:#123e35!important;color:#d9ffeb!important;border:2px solid var(--good)!important;outline:2px solid var(--good)!important;outline-offset:2px!important;opacity:1!important}
body .answers .answer.wrong:nth-child(n),body.winds-game .answers .a.wrong:nth-child(n){background:#492333!important;color:#ffe5eb!important;border:2px dashed var(--bad)!important;outline:2px dashed var(--bad)!important;outline-offset:2px!important;opacity:1!important}
body :is(.feedback.good,.mission-feedback){background:#123e35!important;border:2px solid var(--good)!important;color:#d9ffeb!important}
body :is(.feedback.bad,.mission-feedback.missed){background:#492333!important;border:2px dashed var(--bad)!important;color:#ffe5eb!important}
body :is(.feedback.good,.mission-feedback) :is(strong,p){color:#d9ffeb!important}
body :is(.feedback.bad,.mission-feedback.missed) :is(strong,p){color:#ffe5eb!important}
body :is(.hint,.worked-line){background:var(--surface-raised)!important;color:var(--ink)!important;border-left:4px solid var(--accent)!important}
body :is(.summary div,.tags span,.pills span,.chip,.top-chip,.count,.coming-soon,.winds-game .pill){background:var(--surface-raised)!important;color:var(--ink)!important;border-color:var(--edge)!important}
body :is(.numeric,input,textarea,select){background:var(--page)!important;color:var(--ink)!important;border-color:var(--edge)!important;accent-color:var(--accent)}
body :is(.progress-dots span.done,.track i.done,.winds-game .bar>div){background:var(--accent)!important}
body :is(button,a,input,textarea,summary,select):focus-visible{outline:3px solid #ffe093!important;outline-offset:4px!important}
body :is(.monthly-warning,.save-failure-banner){background:#492333!important;color:#ffe5eb!important;border-color:var(--bad)!important}
body .save-failure-banner :is(span,strong){color:#ffe5eb!important}
body .save-failure-banner button{background:#ffe5eb!important;color:#492333!important;border-color:#ffe5eb!important}
body .device-card :is(h4,.meta,p,li){color:var(--ink)!important}
::selection{background:#ffc36b;color:#472408}
@media print{html,body,body :is(.progress-head,.progress-card,.device-card){background:#fff!important;color:#111!important;box-shadow:none!important}body :is(.progress-head,.progress-card,.device-card) *{color:#111!important}}

body .practice{background:linear-gradient(145deg,var(--subject-tint),var(--surface) 60%)!important;color:var(--ink)!important;border:1px solid var(--edge);box-shadow:0 12px 28px #0003}
body .practice button{background:var(--surface-raised)!important;color:var(--ink)!important;border-color:var(--edge)!important}
body .practice button[aria-pressed=true],body .practice #check,body .practice #next{background:var(--accent)!important;color:var(--accent-ink)!important;border-color:var(--accent)!important}
