/* Explicit UI palettes. Canvas, GIFs and gameplay artwork retain their own colors. */
html[data-eco-theme=dark]{--ct-bg:#0a1220;--ct-panel:#142638;--ct-soft:#20394a;--ct-ink:#f0f7ff;--ct-muted:#bdcfdb;--ct-line:#486779;--ct-accent:#95f1d0;--ct-button:#254a52;--ct-selected:#9beed4;--ct-on-selected:#123e34;color-scheme:dark}
html[data-eco-theme=white]{--ct-bg:#f6f8fc;--ct-panel:#fff;--ct-soft:#edf3f6;--ct-ink:#173b38;--ct-muted:#46646e;--ct-line:#738f89;--ct-accent:#12654e;--ct-button:#e5f1ec;--ct-selected:#176a54;--ct-on-selected:#fff;color-scheme:light}
html[data-eco-theme],html[data-eco-theme] body{background:var(--ct-bg)!important;color:var(--ct-ink)!important}
html[data-eco-theme] main:has(.english-portal){background:var(--ct-bg)!important}
html[data-eco-theme] :is(.english-family-heading h1,.english-family-heading h2,.english-family-copy h3,.english-spotlight h2,.en-hero h1,.en-heading h1){color:var(--ct-ink)!important}
html[data-eco-theme] :is(.english-family-heading p,.english-family-copy p,.english-spotlight p,.english-filter-count,.eco-radio>div>span,.en-hero p){color:var(--ct-muted)!important}
html[data-eco-theme] :is(.english-family-card,.english-spotlight,.eco-radio,.eco-platform-mission,.eco-platform-summary,.en-card,.en-vocabulary article,.en-hero){background:var(--ct-panel)!important;color:var(--ct-ink);border-color:var(--ct-line)!important;box-shadow:none}
html[data-eco-theme] :is(.english-eyebrow,.english-family-heading a,.english-family-copy b,.english-spotlight h2 em,.english-spotlight small,.eco-radio small){color:var(--ct-accent)!important}
html[data-eco-theme] :is(.english-category button,.english-recent,.english-hero-actions a,.english-hero-actions button,.eco-radio button){background:var(--ct-button)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.english-category button[aria-pressed=true],.english-hero-actions .english-primary){background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] :is(.eco-experience-panel,.game-modal,.game-modal-head,.eco-screen-options,.eco-guide-dialog,.eco-guide-continue,.eco-rights-notice){background:var(--ct-panel)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.eco-experience-panel button,.eco-experience-panel label,.eco-screen-options button,.eco-guide-help-button,.eco-guide-skip,.eco-guide-close){background:var(--ct-button)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.eco-experience-panel summary,.eco-experience-panel small,.eco-experience-panel .eco-voice-status,.eco-experience-panel .eco-music-status,.eco-rights-notice p,.eco-rights-notice a){color:var(--ct-muted)!important}
html[data-eco-theme] .eco-experience-panel .eco-music-status{background:var(--ct-soft)!important}
html[data-eco-theme] .eco-experience-panel[data-voice-warning=true] .eco-voice-status{color:var(--ct-accent)!important}
.eco-theme-picker{min-width:0;border:1px solid var(--ct-line,#75998e);border-radius:12px;padding:8px 10px;margin:2px 0;color:var(--ct-ink,#173b38);background:var(--ct-panel,#fff);width:100%;box-sizing:border-box}
.eco-theme-picker legend{font-size:16px;font-weight:800;padding:0 5px}.eco-theme-choices{display:flex;gap:8px}.eco-theme-choices button{flex:1;min-height:46px;font:700 17px/1.3 system-ui;cursor:pointer}
html[data-eco-theme] .eco-theme-choices button{border:1px solid var(--ct-line);border-radius:9px;background:var(--ct-button)!important;color:var(--ct-ink)!important;padding:9px}
html[data-eco-theme] .eco-theme-choices button[aria-pressed=true]{background:var(--ct-selected)!important;color:var(--ct-on-selected)!important;border:2px solid var(--ct-accent)}
.eco-theme-picker .eco-theme-note{font-size:13px!important;line-height:1.45!important;margin:7px 0 0;color:var(--ct-muted)!important}
html[data-eco-theme] :is(.eco-play-guide,.eco-play-guide h2,.eco-play-guide h3,.eco-play-guide .eco-guide-goal,.eco-play-guide .eco-guide-eyebrow,.eco-guide-pause){color:var(--ct-ink)!important}
html[data-eco-theme] :is(.eco-guide-inputs>section,.eco-guide-inputs kbd,.eco-guide-tip,.wb-horizontal-example){background:var(--ct-soft)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.eco-guide-continue button,.eco-screen-options button[aria-pressed=true]){background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] .wb-horizontal-example>span{background:var(--ct-panel);color:var(--ct-ink)}
/* DOM-based game surrounds and question surfaces; board art is intentionally untouched. */
html[data-eco-theme] :is(.sky-game,.wb-game,.safari-study,.sentence-game,.energy-mole){color:var(--ct-ink)}
html[data-eco-theme] :is(.wb-quiz,.wb-heading,.wb-metrics,.safari-study-stats,.safari-study-guide,.sentence-prompt,.sentence-board,.em-mission,.em-stats,.eco-match-check){background:var(--ct-soft)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] .game-modal .sky-game .sky-quiz>h3.sky-question-title{color:var(--ct-ink)!important;text-shadow:none}
html[data-eco-theme] .game-modal .wb-game .wb-quiz h3,html[data-eco-theme] :is(.wb-quiz p,.wb-quiz small,.wb-quiz-label,.wb-live,.wb-metrics *,.safari-study-guide,.safari-study-stats *,.safari-mode-row,.sentence-prompt strong,.sentence-prompt small,.em-mission h3,.em-mission small,.em-stats *){color:var(--ct-ink)!important}
html[data-eco-theme] :is(.sky-word b,.wb-answer-slots span,.em-word>span,.safari-study-actions button,.wb-actions button,.sky-actions button,.sky-controls button,.sentence-actions button,.token-pool button,.sentence-board button,.em-actions button,.eco-match-check button){background:var(--ct-button)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.sky-word .collected b,.em-word>span.done){background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] .sky-word .hinted:not(.collected) b{background:#fbe8a9!important;color:#503b12!important}
html[data-eco-theme] :is(.wb-controls button,.safari-study-paused,.safari-study-finale,.em-overlay,.eco-english-game){background:var(--ct-panel)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.em-overlay h3,.em-overlay p,.em-overlay small,.safari-study-feedback,.sentence-hint,.sentence-board>span,.eco-study-feedback,.eco-study-listen-note){color:var(--ct-ink)!important}
html[data-eco-theme] :is(.safari-study-feedback,.eco-study-mode-tabs button,.eco-study-choices button,.eco-study-letters button){background:var(--ct-soft)!important;border-color:var(--ct-line)!important;color:var(--ct-ink)!important}
html[data-eco-theme=dark] :is(.safari-card-front,.safari-card-back){background:var(--ct-soft)!important;color:var(--ct-ink)!important}
html[data-eco-theme=dark] .game-modal .safari-study .safari-card-front b,html[data-eco-theme=dark] :is(.safari-card-back small,.safari-card-back b){color:var(--ct-ink)!important}
html[data-eco-theme=dark] .safari-study-card{border-color:var(--ct-line)!important}
html[data-eco-theme=dark] .safari-study-card.matched .safari-card-front{background:#214f40!important}
/* Same-origin arcade iframe and stand-alone arcade. */
html[data-eco-theme] :is(.arcade-home,.game-shell,.panel){color:var(--ct-ink);background:var(--ct-bg)}
html[data-eco-theme] :is(.arcade-card,.journey,.panel-card,.daily-box,.game-shell .game-overlay,.game-shell .settings,.game-shell .eco-guide-dialog){background:var(--ct-panel)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] .game-shell :is(.hud small,.hud strong,.play-status,.ocean-mission,.muted,.eyebrow,.game-overlay p,.intro-best,.intro-best b,.intro-daily,.intro-daily span,.intro-daily b,.intro-daily small,.guide-steps li,.result-insights small,.result-insights strong,.result-ep,.result-medal,.game-sidebar p,.daily-box p){color:var(--ct-ink)!important}
html[data-eco-theme] .game-shell :is(button,select,.settings label){background:var(--ct-button);color:var(--ct-ink);border-color:var(--ct-line)}
html[data-eco-theme] .game-shell .primary{background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] .game-shell .mobile-controls small{color:var(--ct-muted)!important}
html[data-eco-theme] .game-shell .settings .eco-play-guide{color:var(--ct-ink)}
/* Informational/English pages inherit the preference without changing content. */
html[data-eco-theme] :is(.en-panel,.en-lesson,.en-word-card,.cards article,.audio-panel,.production,.license pre){background:var(--ct-panel);color:var(--ct-ink);border-color:var(--ct-line)}
html[data-eco-theme] :is(.cards p,.intro,.license p,.audio-panel p,.production p,.hero>p,.site-head .back,.topics a){color:var(--ct-muted)}
html[data-eco-theme] :is(.site-head,.site-foot,.en-header){color:var(--ct-ink)}
html[data-eco-theme] :is(.en-vocabulary article p,.en-vocabulary article small){color:var(--ct-muted)}
html[data-eco-theme] button:focus-visible{outline:3px solid var(--ct-accent);outline-offset:2px}
html[data-eco-theme] :is(.wb-live,.wb-tier,.wb-piece-preview){background:var(--ct-soft)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] .game-shell .play-status>span:first-child{color:var(--ct-accent)!important}
html[data-eco-theme] .eco-screen-toggle{background:var(--ct-button)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme=dark] .wb-metrics>b:first-child{background:var(--ct-button)!important;color:var(--ct-ink)!important}
/* White-mode contrast audit: pair foreground AND surface, including secondary pages. */
html[data-eco-theme=white] :is(.eco-platform-mission,.eco-platform-summary,.about,.eco-rights-notice){background:var(--ct-panel)!important;color:var(--ct-ink)!important}
html[data-eco-theme=white] :is(.eco-platform-mission,.eco-platform-summary,.about,.eco-rights-notice) :is(h2,h3,strong,b,em){color:var(--ct-ink)!important;-webkit-text-fill-color:currentColor!important;text-shadow:none!important}
html[data-eco-theme=white] :is(.eco-platform-mission,.eco-platform-summary,.about,.eco-rights-notice) :is(p,small){color:var(--ct-muted)!important}
html[data-eco-theme=white] :is(.eco-platform-mission,.eco-platform-summary,.about) a,html[data-eco-theme=white] .eco-game-directory{color:var(--ct-accent)!important;border-color:var(--ct-line)!important}
html[data-eco-theme=white] .english-spotlight .english-eyebrow{background:#e6f2ec!important;border-color:#799b90!important;color:#174d40!important}
html[data-eco-theme=white] .eco-map-caption{color:#40576b!important}
html[data-eco-theme=white] .english-flight-art b{color:#245f5b;text-shadow:0 5px 0 #9ecfc4}
html[data-eco-theme=white] :is(.english-family-copy small,.safari-study-note){color:var(--ct-muted)!important}
html[data-eco-theme=white] .eco-match-steps li:not(.active){color:#3d5746;background:#edf3e9;border-color:#829884}
html[data-eco-theme=white] .eco-match-steps li:not(.active) span{color:#324c3d;background:#d8e5d3}
html[data-eco-theme=white] .sky-primary{background:#176a54!important;color:white!important;text-shadow:none!important}
html[data-eco-theme=white] .ewr-word{color:#125345;background:#fffffff2;border-radius:10px;padding:2px 8px;text-shadow:0 1px 0 white,0 0 5px white,0 0 18px #69bca6;-webkit-text-stroke:.4px #fff}
html[data-eco-theme=white] body footer{background:var(--ct-panel)!important;color:var(--ct-muted)!important;border-color:var(--ct-line)!important}
html[data-eco-theme=white] body footer :is(p,small,span:not([class^=eco-brand])){color:var(--ct-muted)!important}
html[data-eco-theme=white] body footer a:not(.eco-brand){color:var(--ct-accent)!important}
/* Light header/footer wordmarks remain readable without altering the dark navbar mark. */
html[data-eco-theme=white] :is(.site-head,.en-header,footer) .eco-brand :is(.eco-brand-eco,.eco-brand-games,.eco-brand-word),html[data-eco-theme=white]:has(link[rel=canonical][href*="/games/"]) .eco-brand :is(.eco-brand-eco,.eco-brand-games,.eco-brand-word){color:#174e40!important;-webkit-text-fill-color:currentColor!important;background:none!important;text-shadow:none!important}
html[data-eco-theme=white] :is(.site-head,.en-header,footer) .eco-brand-tag,html[data-eco-theme=white]:has(link[rel=canonical][href*="/games/"]) .eco-brand-tag{color:#45665c!important}
/* English learning surfaces and their secondary labels. */
html[data-eco-theme] :is(.en-launch,.en-question,.en-result,.en-games>a,.en-metrics>div,.en-empty){background:var(--ct-panel)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.en-main,.en-header) :is(button,input,select){background:var(--ct-button)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] :is(.en-breadcrumb,.en-muted,.en-games p,.en-footer,.en-footer p,.en-vocabulary article>div,.en-word-filter span){color:var(--ct-muted)!important}
html[data-eco-theme] :is(.en-hero .en-quiet,.en-header nav a,.en-main a,.en-footer a){color:var(--ct-accent)!important}
html[data-eco-theme] .en-main :is(.english-primary,button[aria-pressed=true]){background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] .en-alert{background:#fff1cc;color:#563f15;border-color:#a27c27}
html[data-eco-theme] .en-feedback{background:var(--ct-soft);color:var(--ct-ink)}
/* Korean content/license guide: dark cards cannot remain under newly dark text. */
html[data-eco-theme] body:has(.site-head) :is(.license,.closing){background:var(--ct-panel)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] body:has(.site-head) :is(a:not(.button):not(.eco-brand),summary,.eyebrow,.number,.symbol,.hero h1 em,.license h3 span){color:var(--ct-accent)!important}
html[data-eco-theme] body:has(.site-head) :is(.muted,.closing p){color:var(--ct-muted)!important}
html[data-eco-theme] body:has(.site-head) :is(.section,.number,.production,.topics a,details){border-color:var(--ct-line)!important}
/* All game-directory and per-game guide pages share the same bright card palette. */
html[data-eco-theme]:has(link[rel=canonical][href*="/games/"]) :is(.hero,.card){background:var(--ct-panel)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme]:has(link[rel=canonical][href*="/games/"]) :is(p,small){color:var(--ct-muted)!important}
html[data-eco-theme]:has(link[rel=canonical][href*="/games/"]) a:not(.eco-brand){color:var(--ct-accent)!important}
html[data-eco-theme]:has(link[rel=canonical][href*="/games/"]) .tag{color:var(--ct-ink)!important;background:var(--ct-soft);border-color:var(--ct-line)!important}
html[data-eco-theme]:has(link[rel=canonical][href*="/games/"]) .actions :is(a,button){background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] :is(.game-modal-head small,.auth-note,.auth-form label>span){color:var(--ct-muted)!important}
html[data-eco-theme] :is(.auth-tabs,.auth-form input){background:var(--ct-soft)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme] .auth-tabs button{color:var(--ct-muted)!important}
html[data-eco-theme] .auth-tabs button.active{background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme] :is(.auth-form,.en-main) input::placeholder{color:var(--ct-muted);opacity:1}
/* Stand-alone arcade navigation, ranking, missions and account panels. */
html[data-eco-theme=white] .arcade-home :is(.account,.eyebrow,p,small,.muted,.card-number,.card-bottom,.card-traits span,.journey-meters span,.earth-stats span){color:var(--ct-muted)!important}
html[data-eco-theme=white] .arcade-home :is(.lobby-title em,.journey-meters strong,.earth-stats strong,.rank-row>b,.card-bottom b){color:var(--ct-ink)!important}
html[data-eco-theme=white] .arcade-home a:not(.eco-brand){color:var(--ct-accent)!important}
html[data-eco-theme=white] .arcade-home :is(button:not(.arcade-card),select){background:var(--ct-button)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme=white] .arcade-home :is(.portal-nav .active,.primary){background:var(--ct-selected)!important;color:var(--ct-on-selected)!important}
html[data-eco-theme=white] .arcade-home :is(.weekly-grid article,.earth-stats>div){background:var(--ct-soft)!important;color:var(--ct-ink)!important;border-color:var(--ct-line)!important}
html[data-eco-theme=white] .arcade-home .weekly-grid article>span{color:var(--ct-accent)!important}
html[data-eco-theme=white] :is(.portal-head,.en-header,.site-head) .eco-brand :is(.eco-brand-eco,.eco-brand-games,.eco-brand-word){color:#174e40!important;-webkit-text-fill-color:currentColor!important;background:none!important;text-shadow:none!important}
html[data-eco-theme=white] .portal-head .eco-brand-tag{color:#45665c!important}
html[data-eco-theme=white] :is(.live-heading,.live-journey,.result-insights) :is(strong,small,span,p){color:var(--ct-ink)!important}
html[data-eco-theme=white] :is(.notice,.panel-error){background:#fff1cc!important;color:#563f15!important;border-color:#a27c27!important}
html[data-eco-theme=white] :is(.arcade-home,.game-shell) progress{accent-color:#176a54;background:#c7d8cf}
html[data-eco-theme=white] :is(.arcade-home,.game-shell) progress::-webkit-progress-value{background:#176a54}
html[data-eco-theme=white] :is(.arcade-home,.game-shell) progress::-webkit-progress-bar{background:#c7d8cf}
html[data-eco-theme] .eco-match-check button[aria-pressed=true]{background:var(--ct-selected)!important;color:var(--ct-on-selected)!important;border-color:var(--ct-accent)!important}
