/* Shared theme. Photos, illustrations, game scenery and exported certificates keep their colors. */
:root{color-scheme:light;--chrome-bg:#fafbf8;--chrome-ink:#132850;--chrome-muted:#5d6c87;--chrome-line:#dbe1ed;--surface:#fff;--surface-raised:#f2f5fb;--theme-accent:#204bc5}
:root[data-theme="dark"]{color-scheme:dark;--chrome-bg:#111827;--chrome-ink:#edf2fb;--chrome-muted:#bbc8dd;--chrome-line:#3b4960;--surface:#1b2638;--surface-raised:#253247;--theme-accent:#adc6ff}
html[data-theme] body .header{background:var(--chrome-bg);color:var(--chrome-ink);border-color:var(--chrome-line);box-shadow:0 6px 20px #12203408}
html[data-theme] body .nav-wrap{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:20px}
html[data-theme] body .header .brand{grid-column:1;grid-row:1;color:var(--chrome-ink)}
html[data-theme] body .header :is(.brand strong,.brand-mark){color:var(--theme-accent)}
html[data-theme] body .header .nav-scroller{grid-column:2;grid-row:1;width:100%;min-width:0;margin:0}
html[data-theme] body .header nav{background:transparent}
html[data-theme] body .header nav a{color:#fff;background:#204bc5;border-color:#204bc5}
html[data-theme] body .header nav a:hover{background:#173da2}
html[data-theme] body .header nav a.active{color:#fff;background:#173da2;border-color:#173da2;box-shadow:inset 0 -4px 0 #ffd34b}
html[data-theme] body .nav-scroll-arrow{color:#fff;background:#204bc5;border-color:#204bc5;box-shadow:0 0 12px 5px var(--chrome-bg)}
html[data-theme] body .header :focus-visible{outline:3px solid var(--theme-accent);outline-offset:3px}
.theme-toggle{grid-column:3;grid-row:1;display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:44px;padding:10px 13px;border:1px solid var(--chrome-line);border-radius:8px;background:var(--surface);color:var(--chrome-ink);font:700 12px/1.4 SiteSans,Arial,sans-serif;white-space:nowrap;cursor:pointer;box-shadow:0 2px 5px #15244808}
.theme-toggle:hover{background:var(--surface-raised);border-color:var(--theme-accent)}
.theme-toggle svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.theme-toggle .theme-sun{display:none}
:root[data-theme="dark"] .theme-toggle .theme-sun{display:block}
:root[data-theme="dark"] .theme-toggle .theme-moon{display:none}
html[data-theme] body .footer{background:var(--chrome-bg);color:var(--chrome-ink);border-color:var(--chrome-line);margin-top:0}
html[data-theme] body .footer .footer-brand{color:var(--chrome-ink)}
html[data-theme] body .footer .footer-brand strong{color:var(--theme-accent)}
html[data-theme] body .footer :is(p,a:not(.footer-brand),.footer-bottom){color:var(--chrome-muted)}
html[data-theme] body .footer-bottom{border-color:var(--chrome-line)}
@media(max-width:1100px){
  html[data-theme] body .header{height:auto}
  html[data-theme] body .nav-wrap{grid-template-columns:minmax(0,1fr) auto;height:auto;padding:12px 0 9px;gap:10px 15px}
  .theme-toggle{grid-column:2;grid-row:1}
  html[data-theme] body .header .nav-scroller{grid-column:1/-1;grid-row:2}
  html[data-theme] body .header nav{display:flex;position:static;inset:auto;flex-wrap:nowrap;align-items:stretch;width:100%;margin:0;border:0;box-shadow:none;gap:7px}
}
@media(max-width:420px){.theme-toggle{font-size:11px;padding:9px 10px;gap:7px}.theme-toggle svg{width:18px;height:18px}}

/* Home: light margins and editorial labels around the existing photographic covers. */
:root:not([data-theme="dark"]) body.catalog-surface{background:#fafbf8;color:#132850}
:root:not([data-theme="dark"]) #page-inicio{background:transparent;color:#132850}
:root:not([data-theme="dark"]) .catalog-hero{border-color:#e0e5ed;box-shadow:0 12px 28px #192e4914}
:root:not([data-theme="dark"]) :is(.catalog-section-top,.catalog-closing) .catalog-eyebrow{color:#5a6d89}
:root:not([data-theme="dark"]) :is(.catalog-section-top h2,.catalog-topic h3,.catalog-closing h2){color:#172c4d}
:root:not([data-theme="dark"]) :is(.catalog-section-top p,.catalog-topic p,.catalog-path-note,.catalog-closing p){color:#566782}
:root:not([data-theme="dark"]) .catalog-rail-controls button{background:white;border-color:#cbd5e5;color:#24416e}
:root:not([data-theme="dark"]) .catalog-rail-controls button:hover:not(:disabled){background:#e9effb}
:root:not([data-theme="dark"]) .catalog-rail{scrollbar-color:#b6c2d4 transparent}
:root:not([data-theme="dark"]) .catalog-poster{border-color:white;box-shadow:0 6px 18px #1830511c}
:root:not([data-theme="dark"]) .catalog-poster:hover{border-color:#5175bc;box-shadow:0 10px 22px #18305126}
:root:not([data-theme="dark"]) .catalog-topic-art{border-color:#e3e7ee;box-shadow:0 5px 15px #18305112}
:root:not([data-theme="dark"]) .catalog-topic:hover .catalog-topic-art{border-color:#5175bc}
:root:not([data-theme="dark"]) .catalog-closing{border-color:#dce2ec}
:root:not([data-theme="dark"]) .catalog-closing>a{background:white;border-color:#dce2ec}
:root:not([data-theme="dark"]) .catalog-closing>a:hover{background:#f3f6fc;border-color:#9eb3d9}
:root:not([data-theme="dark"]) .catalog-closing-link{color:#204bc5;border-color:#dce2ec}
:root:not([data-theme="dark"]) #page-inicio :focus-visible{outline-color:#204bc5}

/* Dark reading surfaces and controls throughout the public site. */
@media screen{
:root[data-theme="dark"] body{--ink:#edf2fb;--muted:#b5c2d8;--line:#3b4960;--bg:#111827;--pale:#253650;--blue:#9dbbff;background:#111827;color:var(--ink)}
:root[data-theme="dark"] body.catalog-surface{background:#11141f}
:root[data-theme="dark"] :is(.lab-main,.chart-panel,.lesson-visual,.explore-card:not(.blue-card):not(.yellow-card),.book-card,.news-card:not(.featured),.quiz-card,.quiz-complete,.quiz-reset-confirm,.evaluation-card,.rating-card,.admin-entry,.admin-panel,.obs-chart-card,.obs-stat-card,.obs-modes,.obs-map-status){background:var(--surface);border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.lab-head,.stat,.formula,.quote-card,.concept-intro,.reading-stamp,.method-card,.principle-strip,.book-art,.outcome,.payout-sample span,th){background:var(--surface-raised);border-color:var(--line)}
:root[data-theme="dark"] :is(.field select,.field input[type=number],.lab-rating-card select,.suggestion-field textarea,.certificate-name,.obs-field select,.choice-row button,.fraction-controls button,.lesson-index a,.lab-help-button,.obs-topic-nav a,.obs-donut-legend button,.obs-reset,.obs-map-status button,.quiz-choice,.quiz-letter,.rating-choice>span,.reveal-answer,.scale-house,.scale-player){background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] :is(.lab-sidebar nav a:hover,.lab-sidebar nav a.active,.lesson-index a:hover,.quiz-choice:not(:disabled):hover,.obs-chart-row[aria-pressed=true],.obs-donut-legend button[aria-pressed=true]){background:var(--pale);border-color:#7895c8}
:root[data-theme="dark"] .page:not(#page-jogo) :is(.primary,.lesson-cta,.choice-row button.selected,.fraction-controls button.active,.obs-topic-nav a[aria-current=page],.obs-modes button[aria-pressed=true],.book-filters button.active,.news-filters button.active,.evaluation-steps li[aria-current]>span,.rating-choice input:checked+span){background:#3156b3;color:#fff;border-color:#7394e5}
:root[data-theme="dark"] .page:not(#page-jogo) :is(.secondary,.light){background:var(--surface);color:#afcaff;border-color:var(--line)}
:root[data-theme="dark"] .page:not(#page-jogo) :is(.primary,.lesson-cta):hover{background:#3d63c5}
:root[data-theme="dark"] .page:not(#page-jogo) .choice-row button.selected.incorrect{background:#3c3424;color:#f1e1b9;border-color:#85713d}
:root[data-theme="dark"] .page:not(#page-jogo) .choice-row button.selected.correct{background:#213e31;color:#d2efd8;border-color:#6c9879}
:root[data-theme="dark"] .page:not(#page-jogo) :is(.yellow-button,.skip){color:#182b49}
:root[data-theme="dark"] :is(.blue-card,.insight-banner,.news-card.featured){--blue:#9dbbff;background:#173c83;color:#f4f7ff;border-color:#456cb4}
:root[data-theme="dark"] :is(.mini-chart,.probability-ring>div,.lesson-coins>span){background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .mini-chart{box-shadow:0 10px 22px #0003}
:root[data-theme="dark"] .mini-chart :is(text,path[stroke="#dbe3f1"]){fill:#b5c2d8}
:root[data-theme="dark"] .hero-art{background-image:radial-gradient(#536786 .7px,transparent .7px)}
:root[data-theme="dark"] .orbit{border-color:#405577}
:root[data-theme="dark"] .orbit-one{background:radial-gradient(ellipse,#2f4664,#1d304e80 62%,transparent 63%)}
:root[data-theme="dark"] .hero h1>span:after{background:#70591f}
:root[data-theme="dark"] .owl-bubble{color:#182b49}
:root[data-theme="dark"] :is(.note.yellow,.yellow-card,.stat.highlight,.lesson-copy .owl-takeaway,.math-note,.fallacy-visual,.payoff-example,.owl-dialogue,.conditional-equation,.fraction-explanation,.news-context,.evaluation-review,.obs-reading-note,.obs-sample-alert,.quiz-feedback.is-review,.quiz-correct-answer,.quiz-result-grid>div:last-child,.quiz-choice.incorrect,.feedback.is-review,.choice-row button.selected.incorrect){background:#3c3424;color:#f1e1b9;border-color:#85713d;--ink:#f1e1b9;--muted:#d7c59c}
:root[data-theme="dark"] .featured .news-context{background:#ffffff0d;color:#e4ecff}
:root[data-theme="dark"] :is(.house-account>div:last-child,.payout-sample .outlier,.data20 span:last-child,.data20 span.changed,.doubling-steps span:last-child,.obs-meta .obs-date,.obs-selected-swatch,.quiz-sticker,.quiz-owl p){color:#172b49}
:root[data-theme="dark"] .quiz-owl-left p{color:var(--ink)}
:root[data-theme="dark"] .quiz-owl-perched p{color:white}
:root[data-theme="dark"] :is(.feedback.is-correct,.choice-row button.selected.correct,.quiz-choice.correct,.quiz-feedback.is-correct,.quiz-perfect){background:#213e31;color:#d2efd8;border-color:#6c9879}
:root[data-theme="dark"] .quiz-choice:disabled:not(.correct){background:#283142;color:#bbc5d7}
:root[data-theme="dark"] .quiz-choice:disabled.incorrect{background:#3c3424;color:#f1e1b9}
:root[data-theme="dark"] .quiz-choice.correct .quiz-letter{background:#34764a;color:white}
:root[data-theme="dark"] :is(.quiz-next-row button:disabled,.evaluation-steps li>span){background:#344057;color:#b6c4d8}
:root[data-theme="dark"] .outcome.excluded{background:#222938;color:#b4becd}
:root[data-theme="dark"] .outcome.excluded small{color:#b4becd}
:root[data-theme="dark"] :is(.payout-sample .paid,.lesson-coins>b){background:#3156b3;color:#fff}
:root[data-theme="dark"] .outcome.next-heads{background:var(--pale);border-color:#708ec4}
:root[data-theme="dark"] .chart-tooltip{background:#e5ecfa;color:#172b49}
:root[data-theme="dark"] .method-card td{background:#23344b}
:root[data-theme="dark"] .obs-chart-track{background:repeating-linear-gradient(90deg,#253247 0,#253247 calc(25% - 1px),#46556c calc(25% - 1px),#46556c 25%)}
:root[data-theme="dark"] .obs-mini-track{background:#34445e}
:root[data-theme="dark"] .obs-table tr.is-selected{background:#3c3424}
:root[data-theme="dark"] .obs-map .obs-state-tooltip{background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .obs-map-frame{background:var(--surface-raised)}
:root[data-theme="dark"] .obs-map-status button{border:1px solid var(--line)}
:root[data-theme="dark"] .lab-help-close{background:var(--surface-raised);color:var(--ink)}
:root[data-theme="dark"] .note:not(.yellow){background:var(--pale);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .note:not(.yellow) p{color:var(--muted)}
:root[data-theme="dark"] :is(#evaluation-error,#admin-error):not(:empty){background:#3c3424;color:#f1e1b9}

/* Learning illustrations keep their blue/yellow encoding and the owl's light halo. */
:root[data-theme="dark"] #page-descobertas .discovery-card{background:linear-gradient(145deg,#283751,#202c40);border-color:#526583;color:#edf2fb}
:root[data-theme="dark"] #page-descobertas :is(.discovery-ratio,.discovery-die-rule,.discovery-sample-row,.discovery-rare-results>div,.discovery-association,.discovery-card .reveal-answer,.discovery-probability-ring>div){background:#172437;border-color:#526583}
:root[data-theme="dark"] #page-descobertas :is(.discovery-ratio,.discovery-die-rule strong,.discovery-sample-row>strong,.discovery-probability-ring>div,.discovery-rare-results dd,.discovery-association strong){color:#afc7ff}
:root[data-theme="dark"] #page-descobertas :is(.discovery-book-key,.discovery-ratio div>span,.discovery-die-rule span,.discovery-die-rule p,.discovery-sample-row span,.discovery-sample-row p,.discovery-reference,.discovery-probability-ring span,.discovery-rare-results dt,.discovery-weather-labels,.discovery-association span){color:#c1cde1}
:root[data-theme="dark"] #page-descobertas .discovery-sample-row h5{color:#edf2fb}
:root[data-theme="dark"] #page-descobertas :is(.discovery-note,.discovery-ratio-result){background:#3c3424;color:#f1e1b9}
:root[data-theme="dark"] #page-descobertas .discovery-frequency{background:#435574}
:root[data-theme="dark"] #page-descobertas .discovery-frequency>i{background:#a9c2ff}

/* Profession scenes retain their authored scenery; reading/editing surfaces adapt. */
:root[data-theme="dark"] :is(.profession-card,.nr-section,.ast-section,.fb-section,.sty-section,.profession-certificate,.certificate-preview){--blue:#204bc5;--navy:#102d77}
:root[data-theme="dark"] .profession-nav a{color:#c3d5f3;border-color:#657b9e}
:root[data-theme="dark"] .profession-nav a.active{background:#2d405b;color:#fff;border-color:#8aa2cd}
:root[data-theme="dark"] body.stylist-surface:before{background:linear-gradient(#111827df,#151b28f2),url('assets/atelier-aurora.png') center/cover no-repeat}
:root[data-theme="dark"] .stylist-mode{color:#edf2fb}
:root[data-theme="dark"] .stylist-mode :is(.sty-onboarding,.sty-atelier,.sty-steps,.sty-paper,.sty-action,.sty-complete,.sty-reset-box){background:#252838;color:#eee5da;border-color:#696271}
:root[data-theme="dark"] .stylist-mode :is(.sty-data,.sty-choice,.sty-owl details,.sty-edit-instruction,.sty-live-preview,.sty-transfer,.sty-swatch,.sty-order li,.sty-quantity-row>span,.sty-fit-groups>div,.sty-survey-card,.sty-draws>div,.sty-pair,.sty-campaign>div){background:#303344;color:#e9e1d9;border-color:#777184}
:root[data-theme="dark"] .stylist-mode #sty-revision{background:#1b2030;color:#f1f3fa;border-color:#8b8a9b}
:root[data-theme="dark"] .stylist-mode :is(.sty-paper h3,.sty-action h3,.sty-report,.sty-order strong,.sty-data h4,.sty-small,.sty-fiction,.sty-progress,.sty-bottom,.sty-archive,.sty-onboarding p,.sty-quantity-row>span,.sty-fit-groups p,.sty-survey-card span,.sty-campaign p){color:#d6d5df}
:root[data-theme="dark"] .stylist-mode :is(.sty-choice.is-review,.sty-feedback.is-review,.sty-quantity-row .is-changed){background:#443923;color:#f5e2b8}
:root[data-theme="dark"] .stylist-mode .sty-inspect{background:#34445e;color:#dce7fb}
:root[data-theme="dark"] .stylist-mode .sty-choice:hover{background:#3e4359}
:root[data-theme="dark"] .newsroom-mode :is(.nr-redaction .nr-paper,.nr-redaction .nr-paper-top,.nr-redaction .nr-paper-footer,.nr-source-content,.nr-redaction .nr-owl details,.nr-print-sheet,.nr-complete,.nr-result-grid>div,.nr-archive){background:#243640;color:#e8e2d3;border-color:#7b7c6c}
:root[data-theme="dark"] .newsroom-mode :is(.nr-console-content .nr-choice,.nr-console-content textarea,.nr-source-values li){background:#304652;color:#f0ecdf;border-color:#81949b}
:root[data-theme="dark"] .newsroom-mode :is(.nr-paper-title,.nr-paper-deck,.nr-paper-body,.nr-paper-byline,.nr-source-content h4,.nr-source-content p,.nr-paper-footer,.nr-archive-story p,.nr-complete p){color:#deded6}
:root[data-theme="dark"] .newsroom-mode .nr-console-content .nr-choice:hover{background:#415864}
:root[data-theme="dark"] .newsroom-mode .nr-console-content .nr-choice.nr-review{background:#4a4028;color:#f5e2b8}
:root[data-theme="dark"] .stylist-mode :is(.page-intro h1,.sty-onboarding b,.sty-report p,.sty-paper>h3,.sty-action>h3,.sty-data h4,.sty-complete-body>h3,.sty-archive summary,.sty-archive details>div>p:first-child){color:#f1eaf0}
:root[data-theme="dark"] .stylist-mode :is(.page-intro p,.page-intro .eyebrow,.sty-eyebrow,.sty-fiction,.sty-storage-welcome,.sty-panel-label,.sty-briefing,.sty-data-caption,.sty-report>span,.sty-report del,.sty-panel-intro,.sty-owl summary,.sty-owl summary>span,.sty-owl details p,.sty-explanation,.sty-connection,.sty-edit-instruction>span,.sty-edit-instruction q,.sty-label,.sty-live-preview>span,.sty-live-preview p,.sty-match,.sty-debrief,.sty-debrief>.sty-eyebrow,.sty-text-button,.sty-order span,.sty-order small,.sty-quantity-row b,.sty-fit-groups strong small,.sty-survey>div>p,.sty-draws small,.sty-draw-pending>span,.sty-pair-number,.sty-pair.is-excluded>b,.sty-frequency-axis,.sty-campaign>div>span,.sty-campaign strong small,.sty-campaign ul,.sty-ledger>div,.sty-ledger p,.sty-results strong small,.sty-results span,.sty-archive summary>span,.sty-archive details>div){color:#c8bed0}
:root[data-theme="dark"] .stylist-mode :is(.sty-secondary,.sty-choice>span,.sty-explanation summary,.sty-connection summary,.sty-connection a,.sty-edit-instruction strong,.sty-fit-groups strong,.sty-survey-card b,.sty-convergence strong,.sty-campaign strong,.sty-ledger strong,.sty-results strong,.sty-archive details>div>strong,.sty-archive a){color:#b8ceff}
:root[data-theme="dark"] .stylist-mode :is(.sty-pair>b,.sty-match.is-ready){color:#acd5b6}
:root[data-theme="dark"] .stylist-mode .sty-choice.is-review>span{color:#5a4518}
:root[data-theme="dark"] .stylist-mode .sty-case-caption .sty-eyebrow{color:#f0dab1}
:root[data-theme="dark"] .newsroom-mode :is(.nr-redaction,.nr-redaction .nr-steps,.nr-room-onboarding,.nr-source-file){background:#263842;color:#deded6;border-color:#6e7a7e}
:root[data-theme="dark"] .newsroom-mode :is(.nr-redaction .nr-masthead,.nr-redaction .nr-paper-copy h3,.nr-redaction .nr-paper-copy>p,.nr-source-values strong,.nr-source-file>summary,.nr-redaction .nr-owl summary,.nr-archive summary){color:#f0ebde}
:root[data-theme="dark"] .newsroom-mode :is(.nr-room-onboarding p,.nr-redaction .nr-paper-top>span,.nr-redaction .nr-paper-meta,.nr-redaction .nr-byline,.nr-source-content dt,.nr-source-content>p,.nr-source-content>small,.nr-source-values span,.nr-file-label,.nr-redaction .nr-owl p,.nr-print-sheet>b,.nr-redaction>.nr-fiction-note,.nr-archive-story,.nr-source-file>summary small,.nr-file-symbol,.nr-redaction .nr-steps li){color:#c3d0cf}
:root[data-theme="dark"] .newsroom-mode :is(.nr-redaction .nr-steps li.current,.nr-redaction .nr-steps li.done){color:#e8d6ae}
/* Certificate artwork stays print-faithful; theme affects the surrounding interface only. */
:root[data-theme="dark"] .certificate-preview{--ink:#132850;--muted:#5d6c87;--blue:#204bc5;color:#132850;color-scheme:light}
:root[data-theme="dark"] .profession-certificate{color-scheme:light}
:root[data-theme="dark"] .admin-body .button.primary{background:#3156b3;color:#fff;border-color:#7394e5}
}
.admin-header .theme-toggle{margin-left:auto}
@media(max-width:760px){.admin-header{flex-wrap:wrap}.admin-header>span{order:3;width:100%}}
@media print{.theme-toggle{display:none!important}}
