/* Shared interface palette. Mathematical marks keep their own semantic colors. */
html#maths-interface.modern-site[data-ui-palette="light"]{color-scheme:light!important;background:#f5f5f0!important;--ui-bg:#f5f5f0;--ui-surface:#fff;--ui-ink:#203d35;--ui-muted:#5f7669;--ui-line:#cbdcd0;--ui-green:#23674f;--ui-green-hover:#174b39;--ui-mint:#edf5ef;--ui-yellow:#ffe6a8;--ui-yellow-ink:#4d4026;--site-ink:var(--ui-ink);--site-accent:var(--ui-green);--site-wash:var(--ui-mint);--site-border:var(--ui-line);--modern-accent:var(--ui-green);--modern-wash:var(--ui-mint)}
html#maths-interface.modern-site[data-ui-palette="light"] body:not(.site-home){background:var(--ui-bg)!important;background-image:none!important;color:var(--ui-ink)!important;--domain-accent:var(--ui-green);--domain-tint:var(--ui-mint);--domain-soft:var(--ui-bg);--domain-header:var(--ui-mint);--domain-border:var(--ui-line);--site-accent:var(--ui-green);--site-ink:var(--ui-ink);--modern-accent:var(--ui-green);--control-accent:var(--ui-green);--control-tint:var(--ui-mint)}
/* Safari must paint each element with its actual text color, rather than an inherited white fill. */
html#maths-interface.modern-site[data-ui-palette="light"] body *{-webkit-text-fill-color:currentColor}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(h1,h2,h3,h4){color:var(--ui-ink)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.intro,.hint,.muted,.subtitle,.site-intro>p,.student-main>p,.student-hint,.settings-note,.student-crumb,.eyebrow,small){color:var(--ui-muted)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(header,.atelier-header,.rk-header,.student-top,.site-top,.toolbar,.readout){background:var(--ui-surface)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.site-top,.student-top,.atelier-header,.rk-header)>a,html#maths-interface.modern-site[data-ui-palette="light"] .student-crumb a{background:var(--ui-surface)!important;color:var(--ui-green)!important;border-color:var(--ui-line)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body:not(.site-home) :is(.site-intro,.student-main,.tool-canvas,.activity-sidebar,.rc-piece-drawer,.options-dialog,.number-workbench){color:var(--ui-ink)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.panel,.card,.sheet,.board,.exercise,.exercise-board,.phrase-panel,.formula-final,.activity-card,.path,.correction,.review,.student-activity,.settings-panel,.control-panel,.settings,.controls,.tool-menu-panel,.menu-panel,.options-dialog,.number-workbench,.rc-piece-drawer,.activity-sidebar,.site-sidebar,.workspace){background-color:var(--ui-surface)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.panel,.controls,.settings,.control-panel,.settings-panel,.tool-settings,.tool-menu-panel,.menu-panel,.activity-sidebar,.site-sidebar,.rc-piece-drawer,.options-dialog) :is(label,legend,summary){color:var(--ui-ink)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body label{color:var(--ui-ink)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),select,textarea,option){background:#fff!important;color:var(--ui-ink)!important;-webkit-text-fill-color:var(--ui-ink)!important;border-color:#9ab6a5!important;caret-color:var(--ui-ink);color-scheme:light!important;opacity:1}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(input,textarea)::placeholder{color:#637c6e!important;-webkit-text-fill-color:#637c6e!important;opacity:1}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(input[type=checkbox],input[type=radio],input[type=range]){accent-color:var(--ui-green)}
/* Neutral commands and consistent active states. Palette pieces are not command buttons. */
html#maths-interface.modern-site[data-ui-palette="light"] body button:not(.pos):not(.neg):not(.tile):not(.factor-piece):not(.factor-choice):not(.table-factor):not(.term-family):not(.viz-tile):not(.selected-common):not(.selected){background-color:#fff;color:var(--ui-ink);border-color:var(--ui-line);-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tabs,.unit-nav,.triangle-activities,.pyth-activities,.relative-tools,.chapter-nav,.mode-switch,.modes,.student-tabs,.atelier-tabs,.dl-tabs,.rc-tabs,.subnav){background:var(--ui-mint)!important;border-color:var(--ui-line)!important;color:var(--ui-ink)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tabs,.unit-nav,.triangle-activities,.pyth-activities,.relative-tools,.chapter-nav,.mode-switch,.modes,.student-tabs,.atelier-tabs,.dl-tabs,.rc-tabs,.subnav)>:is(button,a){background:#fff!important;color:var(--ui-green)!important;border-color:var(--ui-line)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tabs,.unit-nav,.triangle-activities,.pyth-activities,.relative-tools,.chapter-nav,.mode-switch,.modes,.student-tabs,.atelier-tabs,.dl-tabs,.rc-tabs,.subnav)>:is(button,a):is(.active,.selected,[aria-selected=true],[aria-pressed=true],[aria-current=page]),html#maths-interface.modern-site[data-ui-palette="light"] body :is(button.primary,button.main,button.accent,button.rc-main,a.primary,.student-actions a.primary,.geometry .student-actions a.primary,.site-nav-link[aria-current=page],.pathway.student>b){background:var(--ui-green)!important;border-color:var(--ui-green)!important;color:#fff!important;-webkit-text-fill-color:#fff!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tabs,.unit-nav,.triangle-activities,.pyth-activities,.relative-tools,.chapter-nav,.mode-switch,.modes,.student-tabs,.atelier-tabs,.dl-tabs,.rc-tabs,.subnav)>:is(button,a):is(.active,.selected,[aria-selected=true],[aria-pressed=true],[aria-current=page]) *,html#maths-interface.modern-site[data-ui-palette="light"] body :is(button.primary,button.main,button.accent,a.primary,.site-nav-link[aria-current=page]) *{color:inherit!important;-webkit-text-fill-color:inherit!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.student-actions a:not(.primary),.site-nav-link:not([aria-current=page]),.student-shortcut,.back-link,.back){background:#fff!important;color:var(--ui-green)!important;-webkit-text-fill-color:currentColor!important;border-color:var(--ui-line)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tool-settings,.settings-panel,#fb-settings)>summary,html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tool-menu,.rc-option-menu)>summary,html#maths-interface.modern-site[data-ui-palette="light"] body :is(.projection-dock>button,.rk-header .options-open,.modern-primary-actions button){background:var(--ui-yellow)!important;color:var(--ui-yellow-ink)!important;-webkit-text-fill-color:currentColor!important;border-color:#dfc178!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.activity-choice,details.chapter){background:#fff!important;border-color:var(--ui-line)!important;color:var(--ui-ink)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.activity-choice,details.chapter)>summary{background:var(--ui-mint)!important;color:var(--ui-green)!important;-webkit-text-fill-color:currentColor!important;border-color:var(--ui-line)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body[data-modern-page=eleves] :is(.student-main,.student-chapters){background:transparent!important;color:var(--ui-ink)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body[data-modern-page=eleves] :is(details.chapter,.student-numbers,.student-activity){background:#fff!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body[data-modern-page=eleves] .chapter>summary{background:var(--ui-mint)!important;color:var(--ui-green)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body[data-modern-page=eleves] .student-activity :is(h2,p){color:var(--ui-ink)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body[data-modern-page=eleves] .student-hint{background:var(--ui-mint)!important;color:var(--ui-muted)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body[data-modern-page=eleves] .student-domain-icon{background:#e2efe6!important}
/* Keep mathematical colors independent from the UI palette. */
html#maths-interface.modern-site[data-ui-palette="light"] #world :is(.tile,.factor-tile),html#maths-interface.modern-site[data-ui-palette="light"] #palette button{color:#203248!important;-webkit-text-fill-color:#203248!important}
html#maths-interface.modern-site[data-ui-palette="light"] #world :is(.tile.neg,.factor-tile.neg),html#maths-interface.modern-site[data-ui-palette="light"] #palette button.neg{color:#7e2228!important;-webkit-text-fill-color:#7e2228!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.site-tools-toggle,.site-sidebar>summary){background:#fff!important;color:var(--ui-green)!important;-webkit-text-fill-color:currentColor!important;border-color:var(--ui-line)!important}
html#maths-interface.modern-site[data-ui-palette="light"] body .site-sidebar .site-nav-group>span{color:#536f60!important;-webkit-text-fill-color:currentColor!important}
/* The learner's difficulty selector remains deliberately yellow. */
html#maths-interface.modern-site[data-ui-palette="light"] #practice-literal .settings{background:#ffe17a!important;color:#3f300d!important;border-color:#d3a016!important}
html#maths-interface.modern-site[data-ui-palette="light"] #practice-literal .settings .level-heading{color:#3f300d!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] #literal-preview #nav button.active{background:var(--ui-green)!important;color:white!important;-webkit-text-fill-color:white!important;border-color:var(--ui-green)!important}
@media print{html#maths-interface.modern-site[data-ui-palette="light"] body{background:#fff!important}}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(button#projection,button#project,button#pb-projection,button.projection-button,button.reset-button,button[title*="projection" i],button[aria-label*="projection" i]){background:var(--ui-yellow)!important;color:var(--ui-yellow-ink)!important;-webkit-text-fill-color:currentColor!important;border-color:#dfc178!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tabs,.unit-nav,.triangle-activities,.pyth-activities,.relative-tools,.chapter-nav,.mode-switch,.modes,.student-tabs,.atelier-tabs,.dl-tabs,.rc-tabs,.subnav)>:is(button,a):hover{background:#dfeee4!important;color:var(--ui-green)!important;-webkit-text-fill-color:currentColor!important}
html#maths-interface.modern-site[data-ui-palette="light"] body :is(.tabs,.unit-nav,.triangle-activities,.pyth-activities,.relative-tools,.chapter-nav,.mode-switch,.modes,.student-tabs,.atelier-tabs,.dl-tabs,.rc-tabs,.subnav)>:is(button,a):is(.active,.selected,[aria-selected=true],[aria-pressed=true],[aria-current=page]):hover{background:var(--ui-green-hover)!important;color:#fff!important;-webkit-text-fill-color:#fff!important}
