/** Canonical semantic colour contract for every design-shell route. */
.site-scene {
  --page-bg:#f4f7fb;--page-bg-gradient:linear-gradient(135deg,#f8fbff,#edf3fb,#e7f0fa);--page-glow:rgba(49,95,204,.16);
  --surface-1:#fff;--surface-2:#f7faff;--surface-3:#edf3fb;--surface-inset:#e8f0f8;--surface-glass:rgba(255,255,255,.86);
  --text-primary:#102736;--text-secondary:#385061;--text-muted:#5d7180;--text-disabled:#7b8b96;
  --border-default:#cbd9e4;--border-soft:#dce6ee;--border-strong:#9fb6c8;
  --action-primary-bg:#1769e0;--action-primary-text:#fff;--action-primary-border:#0f57be;--action-primary-hover:#0f57be;
  --action-secondary-bg:#fff;--action-secondary-text:#102736;--action-secondary-border:#a9bfd0;
  --input-bg:#fff;--input-text:#102736;--input-placeholder:#667b89;--input-border:#a9bfd0;--input-focus:#1769e0;
  --success-bg:#e8f8ed;--success-text:#176a39;--success-border:#69b77e;--error-bg:#fff0f1;--error-text:#9a1f2c;--error-border:#dd7180;--warning-bg:#fff5e5;--warning-text:#87520b;--warning-border:#d8a04a;--info-bg:#eaf2ff;--info-text:#174e9d;--info-border:#6d9fe6;
}
html[data-palette="poisoned"] .site-scene,.site-scene[data-theme="poisoned"] {--page-bg:#170b2d;--page-bg-gradient:linear-gradient(135deg,#170b2d,#10051f,#241044);--page-glow:rgba(164,101,255,.25);--surface-1:#22103b;--surface-2:#2b1548;--surface-3:#351b59;--surface-inset:#150827;--surface-glass:rgba(28,12,52,.8);--text-primary:#f8f3ff;--text-secondary:#d8cce8;--text-muted:#b1a0c6;--text-disabled:#857797;--border-default:#63458d;--border-soft:#4d3670;--border-strong:#8a62bd;--action-primary-bg:#c3f44d;--action-primary-text:#16120d;--action-primary-border:#d6ff68;--action-primary-hover:#d0fa5b;--action-secondary-bg:#2b1548;--action-secondary-text:#f8f3ff;--action-secondary-border:#7653a4;--input-bg:#1d0d35;--input-text:#f8f3ff;--input-placeholder:#ad9cc0;--input-border:#7653a4;--input-focus:#c3f44d;--success-bg:#173c2a;--success-text:#b9f5c8;--success-border:#4aa66a;--error-bg:#4a1f34;--error-text:#ffb7c5;--error-border:#c96880;--warning-bg:#493516;--warning-text:#ffe09a;--warning-border:#b88c34;--info-bg:#282052;--info-text:#c7c5ff;--info-border:#7673d6;}
html[data-palette="immolated"] .site-scene,.site-scene[data-theme="immolated"] {--page-bg:#250b08;--page-bg-gradient:linear-gradient(135deg,#250b08,#160504,#3a1208);--page-glow:rgba(255,119,42,.26);--surface-1:#36130d;--surface-2:#471a0e;--surface-3:#592210;--surface-inset:#210806;--surface-glass:rgba(50,16,10,.8);--text-primary:#fff7ef;--text-secondary:#f0d2bc;--text-muted:#caa48a;--text-disabled:#956f5c;--border-default:#8d4a30;--border-soft:#6f3929;--border-strong:#bf6840;--action-primary-bg:#ffb02e;--action-primary-text:#281306;--action-primary-border:#ffc55c;--action-primary-hover:#ffc04a;--action-secondary-bg:#471a0e;--action-secondary-text:#fff7ef;--action-secondary-border:#9c5535;--input-bg:#30100a;--input-text:#fff7ef;--input-placeholder:#c59b80;--input-border:#9c5535;--input-focus:#ffb02e;--success-bg:#1e4026;--success-text:#c2f4ca;--success-border:#5ba06a;--error-bg:#521e1b;--error-text:#ffc2bb;--error-border:#d36d60;--warning-bg:#51300d;--warning-text:#ffe1a1;--warning-border:#c18a33;--info-bg:#3a2a21;--info-text:#ffd2a2;--info-border:#bf7b47;}
html[data-palette="flayed"] .site-scene,.site-scene[data-theme="flayed"] {--page-bg:#06150f;--page-bg-gradient:linear-gradient(135deg,#06150f,#020b07,#052019);--page-glow:rgba(147,242,63,.22);--surface-1:#0a2419;--surface-2:#0d2e21;--surface-3:#113a29;--surface-inset:#071a12;--surface-glass:rgba(7,34,24,.76);--text-primary:#f4faf5;--text-secondary:#b7c6bc;--text-muted:#879a8e;--text-disabled:#65766c;--border-default:#2d7048;--border-soft:rgba(84,177,111,.3);--border-strong:#4a9b5d;--action-primary-bg:#93f23f;--action-primary-text:#07110a;--action-primary-border:#b8ff45;--action-primary-hover:#b8ff45;--action-secondary-bg:#0d2e21;--action-secondary-text:#f4faf5;--action-secondary-border:#4a9b5d;--input-bg:#071a12;--input-text:#f4faf5;--input-placeholder:#879a8e;--input-border:#4a9b5d;--input-focus:#b1ff58;--success-bg:rgba(47,201,87,.16);--success-text:#8dffa7;--success-border:#3fa85d;--error-bg:rgba(255,92,92,.15);--error-text:#ffaaaa;--error-border:#c64a4a;--warning-bg:rgba(255,193,7,.14);--warning-text:#ffd875;--warning-border:#a97a11;--info-bg:rgba(45,225,178,.14);--info-text:#7cf3d1;--info-border:#249c7d;}
/* Compatibility aliases allow legacy route sheets to consume the one contract. */
.site-scene {--page-a:var(--page-bg);--page-b:var(--surface-inset);--page-c:var(--surface-2);--page-ink:var(--text-primary);--page-muted:var(--text-secondary);--panel-a:var(--surface-1);--panel-b:var(--surface-inset);--panel-ink:var(--text-primary);--panel-muted:var(--text-secondary);--panel-dim:var(--text-muted);--work-ink:var(--text-primary);--work-muted:var(--text-secondary);--work-surface:var(--surface-1);--work-border:var(--border-default);--route-bg:var(--surface-glass);--route-ink:var(--text-primary);--status-success-bg:var(--success-bg);--status-success-text:var(--success-text);--status-warning-bg:var(--warning-bg);--status-warning-text:var(--warning-text);--status-error-bg:var(--error-bg);--status-error-text:var(--error-text);}
/* P0 token migrations; no geometry/layout properties are changed. */
.site-scene .mobile-menu-panel{background:var(--surface-glass);box-shadow:-26px 0 80px color-mix(in srgb,var(--page-bg) 48%,transparent)}.site-scene .mobile-menu-panel>a,.site-scene .mobile-menu-panel>button.mobile-logout-link{color:var(--text-primary);border-color:var(--border-soft);background:var(--surface-1)}.site-scene .mobile-menu-panel>a:hover,.site-scene .mobile-menu-panel>a:focus-visible,.site-scene .mobile-menu-panel>button.mobile-logout-link:hover,.site-scene .mobile-menu-panel>button.mobile-logout-link:focus-visible{color:var(--action-secondary-text);border-color:var(--action-secondary-border);background:var(--surface-2)}
.site-scene .product-intro,.site-scene .product-panel,.site-scene .product-card{color:var(--text-primary);border-color:var(--border-default);background:var(--surface-1)}.site-scene .product-intro,.site-scene .product-card p{color:var(--text-secondary)}
.site-scene .product-btn,.site-scene .product-page .open-task-btn,.site-scene .product-page .login-btn,.site-scene .product-page button[type="submit"],.site-scene .product-page .exam-actions>button,.site-scene .product-page .funnel-offer-card__btn--primary,.site-scene .number-intro-page .training-start-btn{color:var(--action-primary-text)!important;-webkit-text-fill-color:var(--action-primary-text)!important;border-color:var(--action-primary-border);background:var(--action-primary-bg)!important}.site-scene .product-btn-secondary,.site-scene .product-page .back-btn,.site-scene .product-page .login-links a,.site-scene .product-page a.training-back-btn{color:var(--action-secondary-text)!important;-webkit-text-fill-color:var(--action-secondary-text)!important;border-color:var(--action-secondary-border);background:var(--action-secondary-bg)}
.site-scene .product-page input,.site-scene .product-page select,.site-scene .product-page textarea{color:var(--input-text);border-color:var(--input-border);background:var(--input-bg)}.site-scene .product-page input::placeholder,.site-scene .product-page textarea::placeholder{color:var(--input-placeholder)}
.site-scene .number-intro-page .back-btn{color:var(--action-secondary-text)!important;-webkit-text-fill-color:var(--action-secondary-text)!important;border-color:var(--action-secondary-border);background:var(--action-secondary-bg)}.site-scene .number-intro-page .number-intro-card,.site-scene .number-intro-page .number-task-bank{color:var(--text-primary);border-color:var(--border-default);background:var(--surface-1)}.site-scene .number-intro-page .number-intro-card .page-title,.site-scene .number-intro-page .number-task-bank h2,.site-scene .number-intro-page .number-task-card-title,.site-scene .number-intro-page .number-task-card-title h3{color:var(--text-primary)!important;-webkit-text-fill-color:var(--text-primary)!important}.site-scene .number-intro-page .training-start-text,.site-scene .number-intro-page .number-task-bank-head p,.site-scene .number-intro-page .number-task-bank-empty{color:var(--text-secondary)}.site-scene .number-intro-page .number-task-bank-filters button,.site-scene .number-intro-page .number-task-stat-chip,.site-scene .number-intro-page a.number-task-card{color:var(--text-primary);border-color:var(--border-default);background:var(--surface-2)}.site-scene .number-intro-page .number-task-bank-filters button.is-active{color:var(--action-primary-text);border-color:var(--action-primary-border);background:var(--action-primary-bg)}.site-scene .number-intro-page .number-task-bank-filters .number-task-filter-toggle.is-on{color:var(--action-secondary-text);border-color:var(--action-secondary-border);background:var(--surface-3)}
/* Legacy sheets use !important on these P0 selectors; retain token ownership explicitly. */
.site-scene .number-intro-page .back-btn{color:var(--action-secondary-text)!important;-webkit-text-fill-color:var(--action-secondary-text)!important;border-color:var(--action-secondary-border)!important;background:var(--action-secondary-bg)!important}.site-scene .number-intro-page .number-task-bank-filters button{color:var(--text-primary)!important;border-color:var(--border-default)!important;background:var(--surface-2)!important}.site-scene .number-intro-page .number-task-bank-filters button.is-active{color:var(--action-primary-text)!important;border-color:var(--action-primary-border)!important;background:var(--action-primary-bg)!important}.site-scene .catalog-task-card{color:var(--text-primary);border-color:var(--border-default);background:var(--surface-1)}.site-scene .catalog-task-card h2{color:var(--text-primary)!important;-webkit-text-fill-color:var(--text-primary)!important}.site-scene .catalog-task-card p,.site-scene .catalog-task-card .task-status{color:var(--text-secondary)!important;-webkit-text-fill-color:var(--text-secondary)!important}
html[data-palette] .site-scene .number-intro-page .back-btn{color:var(--action-secondary-text)!important;-webkit-text-fill-color:var(--action-secondary-text)!important;border-color:var(--action-secondary-border)!important;background:var(--action-secondary-bg)!important}html[data-palette] .site-scene .number-intro-page .number-task-bank-filters button{color:var(--text-primary)!important;-webkit-text-fill-color:var(--text-primary)!important;border-color:var(--border-default)!important;background:var(--surface-2)!important}html[data-palette] .site-scene .number-intro-page .number-task-bank-filters button.is-active{color:var(--action-primary-text)!important;-webkit-text-fill-color:var(--action-primary-text)!important;border-color:var(--action-primary-border)!important;background:var(--action-primary-bg)!important}
html[data-palette] .site-scene.task-training-scene .number-intro-page .back-btn{color:var(--action-secondary-text)!important;-webkit-text-fill-color:var(--action-secondary-text)!important;border-color:var(--action-secondary-border)!important;background:var(--action-secondary-bg)!important}html[data-palette] .site-scene.task-training-scene .number-intro-page .number-task-bank-filters button{color:var(--text-primary)!important;-webkit-text-fill-color:var(--text-primary)!important;border-color:var(--border-default)!important;background:var(--surface-2)!important}html[data-palette] .site-scene.task-training-scene .number-intro-page .number-task-bank-filters button.is-active{color:var(--action-primary-text)!important;-webkit-text-fill-color:var(--action-primary-text)!important;border-color:var(--action-primary-border)!important;background:var(--action-primary-bg)!important}

/* -------------------------------------------------------------------------- */
/* Final semantic ownership: route sheets may define geometry, never colours. */
/* -------------------------------------------------------------------------- */

.site-scene {
  --action-primary-hover-bg: #0847a8;
  --locked-bg: #edf2f6;
  --locked-text: #405665;
  --locked-border: #91a8b8;
}

html[data-palette="classic"] .site-scene,
.site-scene[data-theme="classic"] {
  --text-muted: #4b6170;
  --text-disabled: #607482;
  --border-default: #748c9d;
  --border-soft: #8098a8;
  --border-strong: #5f788b;
  --action-primary-bg: #0b57c7;
  --action-primary-text: #ffffff;
  --action-primary-border: #0847a8;
  --action-primary-hover-bg: #0847a8;
  --action-secondary-border: #748c9d;
  --input-placeholder: #607482;
  --input-border: #748c9d;
  --locked-bg: #e7eef4;
  --locked-text: #354d5d;
  --locked-border: #6f8798;
}

html[data-palette="poisoned"] .site-scene,
.site-scene[data-theme="poisoned"] {
  --text-muted: #c4b5d6;
  --text-disabled: #ad9abd;
  --action-primary-bg: #c3f44d;
  --action-primary-text: #16120d;
  --action-primary-border: #d6ff68;
  --action-primary-hover-bg: #d0fa5b;
  --locked-bg: #2a1743;
  --locked-text: #e1d6ed;
  --locked-border: #7653a4;
}

html[data-palette="immolated"] .site-scene,
.site-scene[data-theme="immolated"] {
  --text-muted: #d5b39c;
  --text-disabled: #bd957d;
  --action-primary-bg: #ffb02e;
  --action-primary-text: #281306;
  --action-primary-border: #ffc55c;
  --action-primary-hover-bg: #ffc04a;
  --locked-bg: #43190f;
  --locked-text: #f5d9c7;
  --locked-border: #a65b38;
}

html[data-palette="flayed"] .site-scene,
.site-scene[data-theme="flayed"] {
  --text-muted: #afc1b5;
  --text-disabled: #91a49a;
  --action-primary-bg: #93f23f;
  --action-primary-text: #07110a;
  --action-primary-border: #b8ff45;
  --action-primary-hover-bg: #b8ff45;
  --locked-bg: #0d2e21;
  --locked-text: #d5e2d9;
  --locked-border: #4a9b5d;
}

/* Landing page: semantic body text and action ink, including the demo state. */
html[data-palette] .site-scene :is(
  .hero-lead,
  .diagnostic-note,
  .diagnostic-note > span,
  .proof-row span,
  .live-label span
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene :is(
  .task-body > p,
  .answer-field span,
  .sync-status,
  .product-topbar nav button,
  .feedback-items span,
  .skills > div
) {
  color: var(--panel-muted) !important;
  -webkit-text-fill-color: var(--panel-muted) !important;
}

html[data-palette] .site-scene :is(.primary-cta, .check-button) {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  border-color: var(--action-primary-border) !important;
  background: var(--action-primary-bg) !important;
}

html[data-palette] .site-scene :is(.primary-cta, .check-button):hover {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-hover-bg) !important;
}

html[data-palette] .site-scene .check-button:disabled {
  color: var(--text-disabled) !important;
  -webkit-text-fill-color: var(--text-disabled) !important;
  border: 1px solid var(--border-default) !important;
  background: var(--surface-3) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .transition-core {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  background: var(--surface-glass) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .transition-core .transition-copy small {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

html[data-palette] .site-scene .transition-core .transition-copy strong {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

/* Mobile navigation consumes the same surfaces as the page. */
html[data-palette] .site-scene .mobile-menu-panel {
  color: var(--text-primary) !important;
  background: var(--surface-1) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .mobile-menu-panel > a,
html[data-palette] .site-scene .mobile-menu-panel > button.mobile-logout-link {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  background: var(--surface-2) !important;
  border-color: var(--border-soft) !important;
}

html[data-palette] .site-scene .mobile-menu-panel > a > b,
html[data-palette] .site-scene .mobile-menu-panel > button.mobile-logout-link > b {
  color: var(--text-secondary) !important;
  -webkit-text-fill-color: var(--text-secondary) !important;
}

html[data-palette] .site-scene .mobile-menu-panel > button.mobile-logout-link > span {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  font-variant-numeric: tabular-nums;
}

/* Task catalogue: tasks.css owns shape; semantic tokens own every surface. */
html[data-palette="poisoned"] .task-catalog-scene,
html[data-palette="immolated"] .task-catalog-scene,
html[data-palette="flayed"] .task-catalog-scene {
  --task-card-surface-top: var(--surface-2) !important;
  --task-card-surface-bottom: var(--surface-1) !important;
  --task-card-border: var(--border-strong) !important;
  --task-card-footer-line: var(--border-default) !important;
  --card-text: var(--text-primary) !important;
  --card-muted: var(--text-muted) !important;
  --card-neutral-border: var(--border-default) !important;
}

html[data-palette] .task-catalog-scene :is(
  .catalog-intro,
  .next-step-card,
  .catalog-controls
) {
  color: var(--text-primary) !important;
  background: var(--surface-glass) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .task-catalog-scene :is(
  .catalog-intro h1,
  .continue-learning-card__title
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-palette] .task-catalog-scene {
  --tasks-ui-text: var(--text-primary);
  --tasks-ui-secondary: var(--text-secondary);
  --tasks-ui-muted: var(--text-muted);
  --tasks-ui-surface: var(--surface-glass);
  --tasks-ui-surface-strong: var(--surface-1);
  --tasks-ui-border: var(--border-default);
  --tasks-ui-border-strong: var(--border-strong);
}

html[data-palette] .task-catalog-scene :is(
  .catalog-heading > p,
  .next-step-card > p,
  .next-step-meta span,
  .catalog-result-line,
  .task-card-copy p,
  .task-skill em
) {
  color: var(--text-secondary) !important;
  -webkit-text-fill-color: var(--text-secondary) !important;
}

html[data-palette] .task-catalog-scene :is(
  .catalog-kicker,
  .catalog-kicker > span,
  .next-step-top > span,
  .next-step-top > b,
  .task-card-copy > span,
  .task-skill
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

html[data-palette] .task-catalog-scene :is(
  .next-step-card h2,
  .next-step-meta strong,
  .catalog-result-line strong,
  .catalog-search input,
  .task-card-copy h2,
  .task-card-bottom
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-palette] .task-catalog-scene .catalog-search input::placeholder {
  color: var(--input-placeholder) !important;
  -webkit-text-fill-color: var(--input-placeholder) !important;
  opacity: 1 !important;
}

html[data-palette] .task-catalog-scene .continue-learning-card {
  --clc-bg: var(--surface-1);
  --clc-border: var(--border-default);
  --clc-ink: var(--text-primary);
  --clc-muted: var(--text-secondary);
  --clc-accent: var(--action-primary-bg);
  --clc-soft: color-mix(in srgb, var(--action-primary-bg) 10%, transparent);
}

html[data-palette] .task-catalog-scene .next-step-card > a {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border-color: var(--action-primary-border) !important;
}

html[data-palette] .task-catalog-scene :is(
  .task-filters button,
  .catalog-search,
  .catalog-search input,
  .task-status
) {
  color: var(--text-secondary) !important;
  -webkit-text-fill-color: var(--text-secondary) !important;
  background: var(--surface-2) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .task-catalog-scene .catalog-search input {
  background: transparent !important;
  border-color: transparent !important;
}

html[data-palette] .task-catalog-scene .task-filters button.is-active {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border-color: var(--action-primary-border) !important;
}

html[data-palette] .task-catalog-scene .task-card-grid::before {
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--page-glow) 46%, transparent),
    transparent 70%
  ) !important;
}

html[data-palette] .task-catalog-scene .catalog-task-card::after {
  background: linear-gradient(
    180deg,
    var(--task-card-surface-top),
    var(--task-card-surface-bottom)
  ) !important;
}

html[data-palette] .task-catalog-scene .task-card-copy :is(span, h2, p),
html[data-palette] .task-catalog-scene .task-card-bottom,
html[data-palette] .task-catalog-scene .task-skill,
html[data-palette] .task-catalog-scene .task-skill em {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-palette] .task-catalog-scene .task-card-copy p,
html[data-palette] .task-catalog-scene .task-skill em {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

/* Number page: keep the passing geometry, replace legacy low-contrast ink. */
html[data-palette] .site-scene .number-intro-page :is(
  .number-task-meta,
  .number-task-topic,
  .number-task-card-footer,
  .number-task-index
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .number-intro-page :is(
  .number-task-id,
  .number-task-difficulty,
  .number-task-stat-chip
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  background: var(--surface-3) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .number-intro-page .seo-info-card {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  background: var(--surface-1) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .number-intro-page .seo-info-card :is(p, li, small) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

/* Exam: the route sheet may lay out the state, but cannot force a light skin. */
html[data-palette] .site-scene .exam-nextgen {
  --exn-ink: var(--text-primary);
  --exn-muted: var(--text-secondary);
  --exn-surface: var(--surface-1);
  --exn-soft: var(--surface-2);
  --exn-border: var(--border-default);
  --exn-success: var(--success-text);
  --exn-success-bg: var(--success-bg);
  --exn-error: var(--error-text);
  --exn-error-bg: var(--error-bg);
  color: var(--text-primary) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(
  .exn-state,
  .exn-header,
  .exn-progress-block,
  .exn-nav,
  .exn-condition,
  .exn-condition-body,
  .exn-answer,
  .exn-bottom-nav,
  .exn-result-card,
  .exn-self-check-card
) {
  color: var(--text-primary) !important;
  background: var(--surface-1) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(
  .exn-header h1,
  .exn-condition h2,
  .exn-answer-label,
  .exn-rich,
  .exn-rich-content,
  .exn-rich-content p,
  .exn-rich-content span,
  .exn-rich-content li,
  .exn-rich-content strong,
  .exn-rich-content em
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(
  .exn-header-copy p,
  .exn-enter-hint,
  .exn-manual-note,
  .exn-status,
  .exn-answer-status,
  figcaption
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(
  .exn-answer-input,
  .exn-secondary-btn,
  .exn-nav-step,
  .exn-nav-btn,
  .exn-rich-content pre,
  .exn-rich-content code,
  .exn-rich-content table,
  .exn-rich-content th,
  .exn-rich-content td,
  .exn-file-btn,
  .exn-status,
  .exn-manual-note
) {
  color: var(--input-text) !important;
  -webkit-text-fill-color: var(--input-text) !important;
  background: var(--surface-2) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-nav-btn.is-current {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border-color: var(--action-primary-border) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--action-primary-border) 38%, transparent) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-nav-btn.is-current .exn-nav-dot {
  color: var(--action-primary-text) !important;
  background: var(--action-primary-text) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-nav-btn.is-current .exn-manual-icon {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: transparent !important;
  fill: none !important;
  stroke: currentColor !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-nav-btn.is-saved:not(.is-current) {
  color: var(--success-text) !important;
  -webkit-text-fill-color: var(--success-text) !important;
  background: var(--success-bg) !important;
  border-color: var(--success-border) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-nav-btn.is-manual:not(.is-current) {
  color: var(--locked-text) !important;
  -webkit-text-fill-color: var(--locked-text) !important;
  background: var(--locked-bg) !important;
  border-color: var(--locked-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-answer-input::placeholder {
  color: var(--input-placeholder) !important;
  -webkit-text-fill-color: var(--input-placeholder) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen :is(
  .exn-finish-btn,
  .exn-primary-btn
) {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border-color: var(--action-primary-border) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(
  .exn-finish-btn,
  .exn-primary-btn
):disabled {
  color: var(--text-disabled) !important;
  -webkit-text-fill-color: var(--text-disabled) !important;
  background: var(--surface-3) !important;
  border-color: var(--border-default) !important;
  opacity: 1 !important;
}

/* Course dashboard and lesson: one token mapping for regular and locked states. */
html[data-palette] .site-scene.product-scene .product-page .course-system-page {
  color: var(--text-primary) !important;
  background: var(--page-bg-gradient), var(--page-bg) !important;
}

html[data-palette] .site-scene.product-scene .product-page .course-system-page :is(
  .course-system-hero,
  .course-card,
  .course-locked-card
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  background: var(--surface-1) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene.product-scene .product-page .course-system-page :is(
  .course-system-lead,
  .course-system-note,
  .course-card p
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene.product-scene .product-page .course-system-page :is(
  .course-system-btn--primary,
  a.course-system-btn--primary
) {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border: 1px solid var(--action-primary-border) !important;
}

html[data-palette] .site-scene.product-scene .product-page .course-system-page :is(
  .course-system-btn--secondary,
  a.course-system-btn--secondary
) {
  color: var(--action-secondary-text) !important;
  -webkit-text-fill-color: var(--action-secondary-text) !important;
  background: var(--action-secondary-bg) !important;
  border: 1px solid var(--action-secondary-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene.product-scene .product-page .course-system-page .course-locked-card {
  color: var(--locked-text) !important;
  -webkit-text-fill-color: var(--locked-text) !important;
  background: var(--locked-bg) !important;
  border-color: var(--locked-border) !important;
}

html[data-palette] .site-scene.product-scene .product-page .course-system-page .course-locked-card :is(
  h1,
  h2,
  h3,
  strong
) {
  color: var(--locked-text) !important;
  -webkit-text-fill-color: var(--locked-text) !important;
}

html[data-palette] .site-scene .course-lms-premium {
  --lms-card-bg: var(--surface-1);
  --lms-card-bg-soft: var(--surface-2);
  --lms-card-border: var(--border-default);
  --lms-ink: var(--text-primary);
  --lms-text: var(--text-primary);
  --lms-muted: var(--text-muted);
  --lms-heading: var(--text-primary);
  --lms-hero-bg: linear-gradient(145deg, var(--surface-2), var(--surface-1));
  --lms-hero-ink: var(--text-primary);
  --lms-hero-muted: var(--text-secondary);
  --lms-panel-bg: var(--surface-1);
  --lms-lesson-bg: var(--surface-2);
  --lms-lesson-hover: var(--surface-3);
  --lms-lesson-current: var(--info-bg);
}

html[data-palette] .site-scene .course-lms-premium :is(
  .course-dashboard-hero,
  .course-dashboard-step-card,
  .course-dashboard-continue-card,
  .course-dashboard-today,
  .course-dashboard-path,
  .course-dashboard-kpi-card,
  .course-dashboard-module,
  .course-dashboard-lesson__link,
  .course-card,
  .course-locked-card,
  .course-lesson-header,
  .course-breadcrumb
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  background: var(--surface-1) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .course-lms-premium :is(
  h1,
  h2,
  h3,
  .course-dashboard-step-card__title,
  .course-dashboard-module__title,
  .course-dashboard-lesson__title
) {
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

html[data-palette] .site-scene .course-lms-premium :is(
  .course-system-lead,
  .course-system-meta,
  .course-system-note,
  .course-dashboard-meta,
  .course-dashboard-continue-card__meta,
  .course-dashboard-module__description,
  .course-dashboard-module__meta,
  .course-dashboard-lesson__sub,
  .course-dashboard-lesson__duration
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .course-lms-premium :is(
  .course-system-btn--primary,
  a.course-system-btn--primary
) {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border: 1px solid var(--action-primary-border) !important;
}

html[data-palette] .site-scene .course-lms-premium :is(
  .course-system-btn--secondary,
  a.course-system-btn--secondary
) {
  color: var(--action-secondary-text) !important;
  -webkit-text-fill-color: var(--action-secondary-text) !important;
  background: var(--action-secondary-bg) !important;
  border-color: var(--action-secondary-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .course-lms-premium :is(
  .course-dashboard-module--locked,
  .course-dashboard-module--scheduled,
  .course-locked-card,
  .course-dashboard-badge--locked,
  .course-dashboard-badge--scheduled
) {
  color: var(--locked-text) !important;
  -webkit-text-fill-color: var(--locked-text) !important;
  background: var(--locked-bg) !important;
  border-color: var(--locked-border) !important;
  opacity: 1 !important;
}

/* Offer: legacy #fff declarations are mapped back to semantic surfaces. */
html[data-palette] .site-scene .course-offer-nextgen {
  --con-surface-text: var(--text-primary);
  --con-surface-muted: var(--text-muted);
  --con-page-heading: var(--text-primary);
  --con-page-muted: var(--text-secondary);
  --con-border: var(--border-default);
  --con-accent: var(--action-primary-bg);
  --con-focus: var(--input-focus);
  --con-surface: var(--surface-1);
  --con-soft: var(--surface-2);
}

html[data-palette] .site-scene .course-offer-nextgen :is(
  .con-panel,
  .con-hero,
  .con-card,
  .con-format-card,
  .con-faq-item
) {
  color: var(--text-primary) !important;
  background: var(--surface-1) !important;
  border-color: var(--border-default) !important;
}

html[data-palette] .site-scene .course-offer-nextgen :is(
  .con-ladder-steps li,
  .con-roadmap-step,
  .con-compare-item,
  .con-audience-grid article,
  .con-format-badge,
  .con-audience-label
) {
  color: var(--text-primary) !important;
  background: var(--surface-2) !important;
  border-color: var(--border-soft) !important;
}

html[data-palette] .site-scene .course-offer-nextgen :is(
  .con-lead,
  .con-subtitle,
  .con-section-lead,
  .con-format-lead,
  .con-format-note,
  .con-roadmap-step p,
  .con-compare-item p,
  .con-faq-item p,
  .con-cta > p
) {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
}

html[data-palette] .site-scene .course-offer-nextgen :is(
  .con-btn-primary,
  button.con-btn-primary,
  a.con-btn-primary
) {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  background: var(--action-primary-bg) !important;
  border-color: var(--action-primary-border) !important;
}

html[data-palette] .site-scene .course-offer-nextgen :is(
  .con-btn-secondary,
  button.con-btn-secondary,
  a.con-btn-secondary
) {
  color: var(--action-secondary-text) !important;
  -webkit-text-fill-color: var(--action-secondary-text) !important;
  background: var(--action-secondary-bg) !important;
  border-color: var(--action-secondary-border) !important;
  opacity: 1 !important;
}

/* Visual readability pass: light, palette-tinted work surfaces retain the dark page shell. */
.site-scene {
  --work-surface: #f7fafe;
  --work-surface-raised: #eef4fa;
  --work-surface-inset: #e7f0f8;
  --work-text-primary: #102736;
  --work-text-secondary: #385061;
  --work-text-muted: #526978;
  --work-border: #9eb4c6;
  --work-accent: #0b57c7;
  --work-accent-text: #ffffff;
  --work-table-bg: #eef4fa;
  --work-table-header-bg: #dcebf6;
  --work-table-header-text: #102736;
  --work-table-cell-text: #102736;
  --work-table-border: #8babc4;
  --work-table-accent-row-bg: #dceefb;
  --work-table-accent-row-text: #102736;
  --work-table-alt-row-bg: #f7fafe;
  --work-table-row-header-bg: #e3eff8;
  --work-table-row-header-text: #102736;
  --work-table-scrollbar-track: #dcebf6;
  --work-table-scrollbar-thumb: #5d8ab5;
  --status-solved-bg: #e1f6e9;
  --status-solved-text: #0c6239;
  --status-solved-border: #5dae7a;
  --status-unsolved-bg: #eef3f6;
  --status-unsolved-text: #354d5d;
  --status-unsolved-border: #6f8798;
  --course-route-card-bg: var(--surface-2);
  --course-route-card-hover-bg: var(--surface-3);
  --course-route-card-border: var(--border-strong);
  --course-route-title: var(--text-primary);
  --course-route-muted: var(--text-secondary);
  --course-route-badge-bg: var(--action-primary-bg);
  --course-route-badge-text: var(--action-primary-text);
  --course-route-badge-border: var(--action-primary-border);
  --exam-manual-banner-bg: var(--surface-inset);
  --exam-manual-banner-text: var(--text-primary);
  --exam-manual-banner-muted: var(--text-secondary);
  --exam-manual-banner-border: var(--border-strong);
  --exam-manual-banner-icon: var(--action-primary-bg);
}

html[data-palette="poisoned"] .site-scene,
.site-scene[data-theme="poisoned"] {
  --work-surface: #fbf8ff;
  --work-surface-raised: #f3ecff;
  --work-surface-inset: #ebe0ff;
  --work-text-primary: #2c2140;
  --work-text-secondary: #4c3c64;
  --work-text-muted: #675579;
  --work-border: #bba6da;
  --work-accent: #6b3faf;
  --work-accent-text: #ffffff;
  --work-table-bg: #f3ecff;
  --work-table-header-bg: #e7dcf7;
  --work-table-header-text: #2c2140;
  --work-table-cell-text: #2c2140;
  --work-table-border: #b59acb;
  --work-table-accent-row-bg: #e9def8;
  --work-table-accent-row-text: #2c2140;
  --work-table-alt-row-bg: #fbf8ff;
  --work-table-row-header-bg: #e9dff6;
  --work-table-row-header-text: #2c2140;
  --work-table-scrollbar-track: #e7dcf7;
  --work-table-scrollbar-thumb: #7d5aa9;
  --status-solved-bg: #e8f8ed;
  --status-solved-text: #0d6238;
  --status-solved-border: #5aab78;
  --status-unsolved-bg: #f2ecfb;
  --status-unsolved-text: #413252;
  --status-unsolved-border: #aa97c5;
}

html[data-palette="immolated"] .site-scene,
.site-scene[data-theme="immolated"] {
  --work-surface: #fff9f4;
  --work-surface-raised: #fff0e6;
  --work-surface-inset: #fee4d3;
  --work-text-primary: #3b2217;
  --work-text-secondary: #5d4438;
  --work-text-muted: #735a4c;
  --work-border: #e7bca7;
  --work-accent: #b64821;
  --work-accent-text: #ffffff;
  --work-table-bg: #fff0e6;
  --work-table-header-bg: #f8dfcf;
  --work-table-header-text: #3b2217;
  --work-table-cell-text: #3b2217;
  --work-table-border: #d9a98f;
  --work-table-accent-row-bg: #f9dfcf;
  --work-table-accent-row-text: #3b2217;
  --work-table-alt-row-bg: #fff9f4;
  --work-table-row-header-bg: #f8e1d3;
  --work-table-row-header-text: #3b2217;
  --work-table-scrollbar-track: #f8dfcf;
  --work-table-scrollbar-thumb: #b66a3d;
  --status-solved-bg: #e8f7eb;
  --status-solved-text: #155b30;
  --status-solved-border: #5b9d67;
  --status-unsolved-bg: #fff0e6;
  --status-unsolved-text: #5e3525;
  --status-unsolved-border: #c58d70;
}

html[data-palette="flayed"] .site-scene,
.site-scene[data-theme="flayed"] {
  --work-surface: #f3fbf5;
  --work-surface-raised: #e8f6ec;
  --work-surface-inset: #dcefe3;
  --work-text-primary: #163c2b;
  --work-text-secondary: #315943;
  --work-text-muted: #516e5e;
  --work-border: #a5cdb2;
  --work-accent: #178052;
  --work-accent-text: #ffffff;
  --work-table-bg: #e8f6ec;
  --work-table-header-bg: #cfe8d8;
  --work-table-header-text: #163c2b;
  --work-table-cell-text: #163c2b;
  --work-table-border: #86b998;
  --work-table-accent-row-bg: #d2efdc;
  --work-table-accent-row-text: #163c2b;
  --work-table-alt-row-bg: #f3fbf5;
  --work-table-row-header-bg: #d9efdf;
  --work-table-row-header-text: #163c2b;
  --work-table-scrollbar-track: #cfe8d8;
  --work-table-scrollbar-thumb: #3f8b61;
  --status-solved-bg: #e2f6e8;
  --status-solved-text: #0c603b;
  --status-solved-border: #4ca96b;
  --status-unsolved-bg: #e8f6ec;
  --status-unsolved-text: #214c38;
  --status-unsolved-border: #73a985;
}

/* Task-bank status labels are semantic pills, not inherited muted copy. */
html[data-palette] .site-scene .number-intro-page .number-task-solved {
  color: var(--status-solved-text) !important;
  -webkit-text-fill-color: var(--status-solved-text) !important;
  background: var(--status-solved-bg) !important;
  border: 1px solid var(--status-solved-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .number-intro-page .number-task-open-label {
  color: var(--status-unsolved-text) !important;
  -webkit-text-fill-color: var(--status-unsolved-text) !important;
  background: var(--status-unsolved-bg) !important;
  border: 1px solid var(--status-unsolved-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .number-intro-page :is(.number-task-solved, .number-task-open-label):hover {
  filter: brightness(.98);
}

html[data-palette] .site-scene .number-intro-page a.number-task-card:focus-visible :is(.number-task-solved, .number-task-open-label) {
  outline: 2px solid var(--work-accent);
  outline-offset: 2px;
}

/* Task detail: only the task workspace switches to a light tinted work surface. */
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen :is(.tdn-condition, .tdn-answer, .tdn-nav) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  border-color: var(--work-border) !important;
  box-shadow: 0 14px 32px color-mix(in srgb, var(--work-text-primary) 8%, transparent) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition {
  background: var(--work-surface) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen :is(.tdn-answer, .tdn-nav) {
  background: var(--work-surface-raised) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition :is(.task-question, .task-question :where(p, span, li, td, th, strong, em, a, code)) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question figure.table,
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table {
  background: var(--work-surface-raised) !important;
  border-color: var(--work-border) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question :is(th, td) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface-raised) !important;
  border-color: var(--work-border) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question tr:first-child :is(th, td) {
  background: var(--work-surface-inset) !important;
}

/* Native task-content tables have four visual columns. Keep their local scroll
   container, explicit geometry and row variants inside the light work surface. */
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question figure.table {
  width: min(100%, 620px) !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  overscroll-behavior-inline: contain;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question figure.table > table,
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question > table,
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table {
  width: 600px !important;
  min-width: 600px !important;
  max-width: none !important;
  table-layout: fixed !important;
  box-sizing: border-box !important;
  background: var(--work-table-bg) !important;
  border-color: var(--work-table-border) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table :is(th, td) {
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 9px 10px !important;
  color: var(--work-table-cell-text) !important;
  -webkit-text-fill-color: var(--work-table-cell-text) !important;
  background: var(--work-table-bg) !important;
  border-color: var(--work-table-border) !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  hyphens: auto;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table :is(th, td):nth-child(1) { width: 12% !important; }
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table :is(th, td):nth-child(2) { width: 28% !important; }
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table :is(th, td):nth-child(3) { width: 35% !important; }
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table :is(th, td):nth-child(4) { width: 25% !important; }

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table thead tr:first-child :is(th, td) {
  color: var(--work-table-header-text) !important;
  -webkit-text-fill-color: var(--work-table-header-text) !important;
  background: var(--work-table-header-bg) !important;
  border-color: var(--work-table-border) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table thead tr:nth-child(2) :is(th, td) {
  color: var(--work-table-header-text) !important;
  -webkit-text-fill-color: var(--work-table-header-text) !important;
  background: var(--work-table-bg) !important;
  border-color: var(--work-table-border) !important;
  font-weight: 800 !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table tbody tr:first-child :is(th, td),
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table tbody tr[aria-selected="true"] :is(th, td),
html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table tbody tr.is-selected :is(th, td) {
  color: var(--work-table-accent-row-text) !important;
  -webkit-text-fill-color: var(--work-table-accent-row-text) !important;
  background: var(--work-table-accent-row-bg) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table tbody tr:nth-child(even) :is(th, td) {
  background: var(--work-table-alt-row-bg) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question table tbody tr:hover :is(th, td) {
  background: var(--work-table-header-bg) !important;
}

/* Course offer route: the base sheet draws a pale badge with a bright accent
   glyph. Keep every stage inside the active palette and give its number a
   full contrast pair instead. */
html[data-palette] .site-scene .course-offer-nextgen .con-roadmap-step {
  color: var(--course-route-title) !important;
  background: var(--course-route-card-bg) !important;
  border-color: var(--course-route-card-border) !important;
}

html[data-palette] .site-scene .course-offer-nextgen .con-roadmap-step:hover {
  background: var(--course-route-card-hover-bg) !important;
  border-color: var(--action-primary-border) !important;
}

html[data-palette] .site-scene .course-offer-nextgen .con-roadmap-step span {
  color: var(--course-route-badge-text) !important;
  -webkit-text-fill-color: var(--course-route-badge-text) !important;
  background: var(--course-route-badge-bg) !important;
  border: 1px solid var(--course-route-badge-border) !important;
}

html[data-palette] .site-scene .course-offer-nextgen .con-roadmap-step strong {
  color: var(--course-route-title) !important;
  -webkit-text-fill-color: var(--course-route-title) !important;
}

html[data-palette] .site-scene .course-offer-nextgen .con-roadmap-step p {
  color: var(--course-route-muted) !important;
  -webkit-text-fill-color: var(--course-route-muted) !important;
}

@media (max-width: 640px) {
  html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition .task-question figure.table::after {
    content: "← Прокрутите таблицу →";
    display: block;
    width: max-content;
    margin: 8px 10px 2px;
    color: var(--work-text-secondary);
    -webkit-text-fill-color: var(--work-text-secondary);
    font-size: 12px;
    font-weight: 750;
  }
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-condition-label {
  color: var(--work-accent-text) !important;
  -webkit-text-fill-color: var(--work-accent-text) !important;
  background: var(--work-accent) !important;
  border-color: var(--work-accent) !important;
  box-shadow: none !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen :is(.download-file-btn, .show-solution-btn, .tdn-secondary-btn, .tdn-nav-btn, .task-error-report-form button) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .download-file-btn {
  color: var(--work-accent) !important;
  -webkit-text-fill-color: var(--work-accent) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen :is(.file-check-note, .tdn-answer .explanation, .tdn-answer .tdn-answer-accepted, .tdn-nav-btn.is-disabled) {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
  background: var(--work-surface-inset) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-answer :is(label, input, input::placeholder) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-answer input {
  background: var(--work-surface) !important;
  border-color: var(--work-border) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-answer input::placeholder {
  color: var(--work-text-muted) !important;
  -webkit-text-fill-color: var(--work-text-muted) !important;
}

html[data-palette] .site-scene.task-detail-scene .task-detail-nextgen .tdn-answer .answer-form button[type="submit"]:disabled {
  color: var(--work-text-muted) !important;
  -webkit-text-fill-color: var(--work-text-muted) !important;
  background: var(--work-surface-inset) !important;
  border: 1px solid var(--work-border) !important;
  opacity: 1 !important;
}

/* Exam keeps its dark shell and number navigation; only the working cards are light. */
html[data-palette] .site-scene .exam-nextgen :is(.exn-condition, .exn-condition-body, .exn-answer, .exn-result-card, .exn-self-check-card) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface) !important;
  border-color: var(--work-border) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(.exn-condition, .exn-condition-body, .exn-answer) :is(h1, h2, h3, p, span, li, strong, em, label, small) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen :is(.exn-answer-input, .exn-secondary-btn) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface-raised) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-answer-input::placeholder {
  color: var(--work-text-muted) !important;
  -webkit-text-fill-color: var(--work-text-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-status {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
  background: var(--work-surface-inset) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-chips span {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface-inset) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-condition-label {
  color: var(--work-accent-text) !important;
  -webkit-text-fill-color: var(--work-accent-text) !important;
  background: var(--work-accent) !important;
  border-color: var(--work-accent) !important;
  opacity: 1 !important;
}

/* Offer remains dark; its light number tiles receive dark palette-specific ink. */
html[data-palette] .site-scene .course-offer-nextgen .con-ladder-steps li::before {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface-raised) !important;
  border: 1px solid var(--work-border) !important;
  opacity: 1 !important;
}

/* flayed-theme.css owns input/status with !important; this intentionally wins only inside Exam work cards. */
html[data-palette] .site-scene[data-theme] .product-page .exam-nextgen .exn-answer-input {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface-raised) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene[data-theme] .product-page .exam-nextgen .exn-answer-input::placeholder {
  color: var(--work-text-muted) !important;
  -webkit-text-fill-color: var(--work-text-muted) !important;
}

html[data-palette] .site-scene[data-theme] .product-page .exam-nextgen .exn-status {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
  background: var(--work-surface-inset) !important;
  border-color: var(--work-border) !important;
  opacity: 1 !important;
}

/* Exam tables share the light work-table semantics. The older Exam mapping above
   deliberately keeps its dark outer shell, so these rules are limited to rich
   content inside the light condition card. */
html[data-palette] .site-scene.product-scene .product-page:has(.exam-nextgen) {
  width: min(1240px, calc(100% - 48px)) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px) !important;
  gap: 24px !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-condition {
  min-width: 0 !important;
  padding: 28px 30px !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-condition-body {
  overflow-x: visible !important;
  background: var(--work-surface-raised) !important;
  border-color: var(--work-border) !important;
}

html[data-palette] .site-scene .exam-nextgen :is(.exn-rich, .exn-rich-content) {
  max-width: none !important;
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content :is(figure.table, .exn-table-wrap) {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  border-color: var(--work-table-border) !important;
  background: var(--work-table-bg) !important;
  scrollbar-color: var(--work-table-scrollbar-thumb) var(--work-table-scrollbar-track);
  scrollbar-width: thin;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  box-sizing: border-box !important;
  color: var(--work-table-cell-text) !important;
  -webkit-text-fill-color: var(--work-table-cell-text) !important;
  background: var(--work-table-bg) !important;
  border-color: var(--work-table-border) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table :is(th, td) {
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 9px 10px !important;
  color: var(--work-table-cell-text) !important;
  -webkit-text-fill-color: var(--work-table-cell-text) !important;
  background: var(--work-table-bg) !important;
  border-color: var(--work-table-border) !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  hyphens: auto;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table thead :is(th, td),
html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody th {
  color: var(--work-table-header-text) !important;
  -webkit-text-fill-color: var(--work-table-header-text) !important;
  background: var(--work-table-header-bg) !important;
  border-color: var(--work-table-border) !important;
  font-weight: 800 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody th {
  color: var(--work-table-row-header-text) !important;
  -webkit-text-fill-color: var(--work-table-row-header-text) !important;
  background: var(--work-table-row-header-bg) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody tr:first-child :is(th, td),
html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody tr[aria-selected="true"] :is(th, td),
html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody tr.is-selected :is(th, td) {
  color: var(--work-table-accent-row-text) !important;
  -webkit-text-fill-color: var(--work-table-accent-row-text) !important;
  background: var(--work-table-accent-row-bg) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody tr:nth-child(even) :is(th, td) {
  background: var(--work-table-alt-row-bg) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content table tbody tr:hover :is(th, td) {
  background: var(--work-table-header-bg) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content :is(figure.table, .exn-table-wrap)::-webkit-scrollbar {
  height: 8px;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content :is(figure.table, .exn-table-wrap)::-webkit-scrollbar-track {
  background: var(--work-table-scrollbar-track);
  border-radius: 999px;
}

html[data-palette] .site-scene .exam-nextgen .exn-rich-content :is(figure.table, .exn-table-wrap)::-webkit-scrollbar-thumb {
  background: var(--work-table-scrollbar-thumb);
  border: 2px solid var(--work-table-scrollbar-track);
  border-radius: 999px;
}

@media (max-width: 900px) {
  html[data-palette] .site-scene .exam-nextgen .exn-workspace {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 720px) {
  html[data-palette] .site-scene.product-scene .product-page:has(.exam-nextgen) {
    width: calc(100% - 32px) !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-condition {
    padding: 20px 18px !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-condition-body {
    overflow-x: auto !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-rich-content :is(figure.table, .exn-table-wrap) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-rich-content table {
    min-width: 560px !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-rich-content figure.table::after {
    content: "← Прокрутите таблицу →";
    display: block;
    width: max-content;
    margin: 8px 10px 2px;
    color: var(--work-text-secondary);
    -webkit-text-fill-color: var(--work-text-secondary);
    font-size: 12px;
    font-weight: 750;
  }
}

/* Exam mobile guardrail: the desktop shell may never leak into 320–640px. */
html[data-palette] .site-scene.product-scene:has(.exam-nextgen) {
  min-height: 100dvh;
  background: var(--page-bg-gradient) !important;
}

html[data-palette="classic"] body:has(.exam-nextgen) { background: #f4f7fb !important; }
html[data-palette="poisoned"] body:has(.exam-nextgen) { background: #170b2d !important; }
html[data-palette="immolated"] body:has(.exam-nextgen) { background: #250b08 !important; }
html[data-palette="flayed"] body:has(.exam-nextgen) { background: #06150f !important; }

html[data-palette] .site-scene .mobile-menu-panel > .mobile-staff-console-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-1);
  font: inherit;
  font-weight: 850;
  text-align: left;
}

html[data-palette] .site-scene .mobile-menu-panel > .mobile-staff-console-link > span {
  color: var(--text-muted) !important;
  -webkit-text-fill-color: var(--text-muted) !important;
  font-variant-numeric: tabular-nums;
}

html[data-palette] .site-scene .mobile-menu-panel > .mobile-staff-console-link > strong {
  min-width: 0;
  flex: 1;
}

html[data-palette] .site-scene .mobile-menu-panel > .mobile-staff-console-link > b::after {
  content: "↗";
  color: var(--action-primary-bg) !important;
}

@media (max-width: 640px) {
  html[data-palette] .site-scene.product-scene .product-page:has(.exam-nextgen) {
    width: calc(100% - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    min-width: 0 !important;
  }

  html[data-palette] .site-scene .exam-nextgen,
  html[data-palette] .site-scene .exam-nextgen .exn-form,
  html[data-palette] .site-scene .exam-nextgen .exn-header,
  html[data-palette] .site-scene .exam-nextgen .exn-header-copy,
  html[data-palette] .site-scene .exam-nextgen .exn-header-aside,
  html[data-palette] .site-scene .exam-nextgen .exn-workspace,
  html[data-palette] .site-scene .exam-nextgen .exn-condition,
  html[data-palette] .site-scene .exam-nextgen .exn-answer,
  html[data-palette] .site-scene .exam-nextgen .exn-bottom-nav {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-header,
  html[data-palette] .site-scene .exam-nextgen .exn-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    min-width: 0 !important;
    padding: 12px !important;
  }

  html[data-palette] .site-scene .exam-nextgen .exn-nav-btn {
    min-width: 0 !important;
  }
}

/* Final ownership: work-card content is dark ink, while the manual-task notice
   intentionally lives on a dark shell surface and therefore uses shell ink. */
html[data-palette] .site-scene .exam-nextgen .exn-manual-banner {
  color: var(--exam-manual-banner-muted) !important;
  -webkit-text-fill-color: var(--exam-manual-banner-muted) !important;
  background: var(--exam-manual-banner-bg) !important;
  border-color: var(--exam-manual-banner-border) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-manual-banner strong {
  color: var(--exam-manual-banner-text) !important;
  -webkit-text-fill-color: var(--exam-manual-banner-text) !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-manual-banner :is(p, small, em, a, button) {
  color: var(--exam-manual-banner-muted) !important;
  -webkit-text-fill-color: var(--exam-manual-banner-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .exam-nextgen .exn-manual-banner .exn-manual-icon {
  color: var(--exam-manual-banner-icon) !important;
  -webkit-text-fill-color: var(--exam-manual-banner-icon) !important;
  fill: none !important;
  stroke: currentColor !important;
  opacity: 1 !important;
}

/* Premium storefront: its legacy sheet was authored for a permanently dark
   page. The product page intentionally combines light themed section shells
   with dark inset cards, so each surface gets its own explicit semantic ink. */
.site-scene {
  --premium-page-heading: var(--text-primary);
  --premium-page-text: var(--text-secondary);
  --premium-page-muted: var(--text-muted);
  --premium-page-link: var(--work-accent);
  --premium-light-surface: var(--work-surface);
  --premium-light-surface-raised: var(--work-surface-raised);
  --premium-light-heading: var(--work-text-primary);
  --premium-light-text: var(--work-text-secondary);
  --premium-light-muted: var(--work-text-muted);
  --premium-light-border: var(--work-border);
  --premium-dark-surface: #102b43;
  --premium-dark-surface-raised: #173a58;
  --premium-dark-heading: #f7fbff;
  --premium-dark-text: #d9e8f5;
  --premium-dark-muted: #b7ccdc;
  --premium-dark-border: #416986;
  --premium-accent: var(--action-primary-bg);
  --premium-on-accent: #ffffff;
  --premium-accent-hover: var(--action-primary-hover);
  --premium-disabled-bg: var(--work-surface-inset);
  --premium-disabled-text: var(--work-text-muted);
  --premium-disabled-border: var(--work-border);
  --premium-info-bg: var(--work-surface-inset);
  --premium-info-text: var(--work-text-secondary);
  --premium-info-border: var(--work-border);
  --premium-section-description: var(--work-text-secondary);
  --premium-audience-surface: var(--premium-dark-surface-raised);
  --premium-audience-heading: var(--premium-dark-heading);
  --premium-audience-text: var(--premium-dark-text);
  --premium-audience-muted: var(--premium-dark-muted);
  --premium-audience-badge-bg: var(--premium-accent);
  --premium-audience-badge-text: var(--premium-on-accent);
  --premium-teacher-card-surface: var(--work-surface-raised);
  --premium-teacher-card-heading: var(--work-text-primary);
  --premium-teacher-card-text: var(--work-text-secondary);
  --premium-light-link: #0758b8;
  --premium-light-link-hover: #073e8e;
}

html[data-palette="poisoned"] .site-scene,
.site-scene[data-theme="poisoned"] {
  --premium-dark-surface: #1d0d35;
  --premium-dark-surface-raised: #2b1548;
  --premium-dark-heading: #f8f3ff;
  --premium-dark-text: #dccfeb;
  --premium-dark-muted: #bcaed0;
  --premium-dark-border: #7653a4;
  --premium-on-accent: #24103e;
  --premium-light-link: #6f3aa8;
  --premium-light-link-hover: #4e207d;
}

html[data-palette="immolated"] .site-scene,
.site-scene[data-theme="immolated"] {
  --premium-dark-surface: #30100a;
  --premium-dark-surface-raised: #471a0e;
  --premium-dark-heading: #fff7ef;
  --premium-dark-text: #f0d2bc;
  --premium-dark-muted: #d4ad92;
  --premium-dark-border: #9c5535;
  --premium-on-accent: #35140b;
  --premium-light-link: #a84910;
  --premium-light-link-hover: #79300a;
}

html[data-palette="flayed"] .site-scene,
.site-scene[data-theme="flayed"] {
  --premium-dark-surface: #071a12;
  --premium-dark-surface-raised: #0d2e21;
  --premium-dark-heading: #f4faf5;
  --premium-dark-text: #c6d7cc;
  --premium-dark-muted: #a1b7a9;
  --premium-dark-border: #4a9b5d;
  --premium-on-accent: #0c281a;
  --premium-light-link: #167548;
  --premium-light-link-hover: #0d5332;
}

html[data-palette] .site-scene .premium-page {
  color: var(--premium-page-text);
}

html[data-palette] .site-scene .premium-page :is(
  .premium-hero,
  .premium-plan-offer,
  .premium-card
) {
  color: var(--premium-light-text) !important;
  background: var(--premium-light-surface) !important;
  border-color: var(--premium-light-border) !important;
  box-shadow: 0 18px 42px color-mix(in srgb, var(--work-text-primary) 9%, transparent) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-hero,
  .premium-plan-offer,
  .premium-card
)::before,
html[data-palette] .site-scene .premium-page :is(
  .premium-hero,
  .premium-plan-offer,
  .premium-card
)::after {
  opacity: 0 !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-title,
  .premium-card h2,
  .premium-card h3
) {
  color: var(--premium-light-heading) !important;
  -webkit-text-fill-color: var(--premium-light-heading) !important;
  background: none !important;
  filter: none !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-subtitle,
  .premium-hero__helper,
  .premium-section-lead,
  .premium-platform-note,
  .premium-course-discovery,
  .premium-ai-packs__subtitle,
  .premium-storefront__subtitle,
  .premium-storefront__path,
  .premium-storefront__note,
  .premium-contact-note
) {
  color: var(--premium-light-muted) !important;
  -webkit-text-fill-color: var(--premium-light-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-plan-stat,
  .premium-outcome,
  .premium-ai-how-step,
  .premium-ai-pack-card,
  .premium-storefront-card,
  .premium-faq-item,
  .premium-legal-note
) {
  color: var(--premium-dark-text) !important;
  background: var(--premium-dark-surface) !important;
  border-color: var(--premium-dark-border) !important;
  box-shadow: none !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-plan-stat--accent,
  .premium-ai-pack-card--recommended,
  .premium-storefront-card--live
) {
  background: var(--premium-dark-surface-raised) !important;
  border-color: var(--premium-accent) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-plan-stat span,
  .premium-platform-note,
  .premium-outcome p,
  .premium-ai-how-step p,
  .premium-ai-pack-card p,
  .premium-storefront-card p,
  .premium-storefront-card__points,
  .premium-storefront-card__meta,
  .premium-storefront-card__lead,
  .premium-legal-note,
  .premium-faq-item p
) {
  color: var(--premium-dark-muted) !important;
  -webkit-text-fill-color: var(--premium-dark-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-plan-stat strong,
  .premium-outcome strong,
  .premium-ai-how-step strong,
  .premium-ai-pack-card strong,
  .premium-storefront-card h3,
  .premium-faq-item summary,
  .premium-legal-note strong
) {
  color: var(--premium-dark-heading) !important;
  -webkit-text-fill-color: var(--premium-dark-heading) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-price,
  .premium-ai-pack-card__price,
  .premium-storefront-card__price
) {
  color: var(--premium-light-heading) !important;
  -webkit-text-fill-color: var(--premium-light-heading) !important;
  background: none !important;
  filter: none !important;
}

html[data-palette] .site-scene .premium-page .premium-ai-how-step > span,
html[data-palette] .site-scene .premium-page :is(.premium-badge, .premium-ai-pack-card__badge) {
  color: var(--premium-on-accent) !important;
  -webkit-text-fill-color: var(--premium-on-accent) !important;
  background: var(--premium-accent) !important;
  border-color: var(--premium-accent) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-primary-btn,
  .premium-storefront-card__btn--individual
) {
  color: var(--premium-on-accent) !important;
  -webkit-text-fill-color: var(--premium-on-accent) !important;
  background: var(--premium-accent) !important;
  border-color: var(--premium-accent) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-secondary-btn,
  .premium-ai-pack-card__btn,
  .premium-storefront-card__btn:not(.premium-storefront-card__btn--individual)
) {
  color: var(--premium-light-heading) !important;
  -webkit-text-fill-color: var(--premium-light-heading) !important;
  background: var(--premium-dark-surface-raised) !important;
  border-color: var(--premium-dark-border) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-primary-btn,
  .premium-secondary-btn,
  .premium-ai-pack-card__btn,
  .premium-storefront-card__btn
):is(:hover, :focus-visible) {
  border-color: var(--premium-accent) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-primary-btn,
  .premium-secondary-btn,
  .premium-ai-pack-card__btn,
  .premium-storefront-card__btn
):focus-visible {
  outline: 2px solid var(--premium-accent) !important;
  outline-offset: 3px;
}

html[data-palette] .site-scene .premium-page :is(button, a)[aria-disabled="true"],
html[data-palette] .site-scene .premium-page :is(button, a):disabled {
  color: var(--premium-disabled-text) !important;
  -webkit-text-fill-color: var(--premium-disabled-text) !important;
  background: var(--premium-disabled-bg) !important;
  border-color: var(--premium-disabled-border) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-balance-empty,
  .premium-storefront__guide,
  .premium-contact-format
) {
  color: var(--premium-info-text) !important;
  background: var(--premium-info-bg) !important;
  border-color: var(--premium-info-border) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-balance-empty strong,
  .premium-audience-item,
  .premium-contact-format__title
) {
  color: var(--premium-light-heading) !important;
  -webkit-text-fill-color: var(--premium-light-heading) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-balance-empty p,
  .premium-audience-item p,
  .premium-contact-format__text
) {
  color: var(--premium-light-text) !important;
  -webkit-text-fill-color: var(--premium-light-text) !important;
}

html[data-palette] .site-scene .premium-page :is(
  .premium-legal-note a,
  .premium-small-note a,
  .premium-course-discovery a,
  .premium-contact-format a
) {
  color: var(--premium-accent) !important;
  -webkit-text-fill-color: var(--premium-accent) !important;
  border-color: color-mix(in srgb, var(--premium-accent) 55%, transparent) !important;
}

html[data-palette] .site-scene .premium-page .premium-teacher-block {
  color: var(--premium-dark-text) !important;
  background: var(--premium-dark-surface) !important;
  border-color: var(--premium-dark-border) !important;
  box-shadow: none !important;
}

html[data-palette] .site-scene .premium-page .premium-teacher-block h2 {
  color: var(--premium-dark-heading) !important;
  -webkit-text-fill-color: var(--premium-dark-heading) !important;
}

html[data-palette] .site-scene .premium-page .premium-teacher-block p {
  color: var(--premium-dark-text) !important;
  -webkit-text-fill-color: var(--premium-dark-text) !important;
}

/* Premium: retain ownership of light-card copy and of the nested dark controls. */
html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-platform-note,
  .premium-price-note,
  .premium-small-note
) {
  color: var(--premium-light-muted) !important;
  -webkit-text-fill-color: var(--premium-light-muted) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-ai-pack-card__price,
  .premium-storefront-card__price
) {
  color: var(--premium-dark-heading) !important;
  -webkit-text-fill-color: var(--premium-dark-heading) !important;
}

html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-secondary-btn,
  .premium-ai-pack-card__btn,
  .premium-storefront-card__btn:not(.premium-storefront-card__btn--individual)
):not(:disabled):not([aria-disabled="true"]) {
  color: var(--premium-dark-heading) !important;
  -webkit-text-fill-color: var(--premium-dark-heading) !important;
  background: var(--premium-dark-surface-raised) !important;
  border-color: var(--premium-dark-border) !important;
}

html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-primary-btn,
  .premium-storefront-card__btn--individual
):not(:disabled):not([aria-disabled="true"]) {
  color: var(--premium-on-accent) !important;
  -webkit-text-fill-color: var(--premium-on-accent) !important;
}

html[data-palette] .site-scene .product-page .premium-page :is(button, a):is(
  :disabled,
  [aria-disabled="true"]
) {
  color: var(--premium-disabled-text) !important;
  -webkit-text-fill-color: var(--premium-disabled-text) !important;
  background: var(--premium-disabled-bg) !important;
  border-color: var(--premium-disabled-border) !important;
  opacity: 1 !important;
}

/* The product wrapper is a single-column grid. Its implicit min-content track
   could exceed a 320px viewport and clip the hero without producing document
   overflow; keep that one track shrinkable. */
html[data-palette] .site-scene .product-page .premium-page {
  grid-template-columns: minmax(0, 1fr);
}

html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-hero,
  .premium-card,
  .premium-teacher-block
) {
  inline-size: 100%;
  min-width: 0;
}

@media (max-width: 360px) {
  html[data-palette] .site-scene .product-page .premium-page .premium-title {
    font-size: 33px;
    letter-spacing: -1.1px;
    overflow-wrap: anywhere;
  }
}

/* Premium residual readability: nested audience cards are dark insets, while
   teacher-format cards and their inline links live on light themed surfaces. */
html[data-palette] .site-scene .product-page .premium-page .premium-pro-cta-card > p {
  color: var(--premium-section-description) !important;
  -webkit-text-fill-color: var(--premium-section-description) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .product-page .premium-page .premium-audience-item {
  color: var(--premium-audience-text) !important;
  background: var(--premium-audience-surface) !important;
  border-color: var(--premium-dark-border) !important;
}

html[data-palette] .site-scene .product-page .premium-page .premium-audience-item p {
  color: var(--premium-audience-text) !important;
  -webkit-text-fill-color: var(--premium-audience-text) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .product-page .premium-page .premium-audience-label {
  color: var(--premium-audience-badge-text) !important;
  -webkit-text-fill-color: var(--premium-audience-badge-text) !important;
  background: var(--premium-audience-badge-bg) !important;
  border-color: var(--premium-audience-badge-bg) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .product-page .premium-page .premium-contact-format {
  color: var(--premium-teacher-card-text) !important;
  background: var(--premium-teacher-card-surface) !important;
  border-color: var(--premium-light-border) !important;
}

html[data-palette] .site-scene .product-page .premium-page .premium-contact-format__title {
  color: var(--premium-teacher-card-heading) !important;
  -webkit-text-fill-color: var(--premium-teacher-card-heading) !important;
}

html[data-palette] .site-scene .product-page .premium-page .premium-contact-format__text {
  color: var(--premium-teacher-card-text) !important;
  -webkit-text-fill-color: var(--premium-teacher-card-text) !important;
  opacity: 1 !important;
}

html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-course-discovery a,
  .premium-small-note a,
  .premium-storefront__subtitle a,
  .premium-contact-format a
) {
  color: var(--premium-light-link) !important;
  -webkit-text-fill-color: var(--premium-light-link) !important;
  border-color: color-mix(in srgb, var(--premium-light-link) 58%, transparent) !important;
}

html[data-palette] .site-scene .product-page .premium-page :is(
  .premium-course-discovery a,
  .premium-small-note a,
  .premium-storefront__subtitle a,
  .premium-contact-format a
):is(:hover, :focus-visible) {
  color: var(--premium-light-link-hover) !important;
  -webkit-text-fill-color: var(--premium-light-link-hover) !important;
  border-color: var(--premium-light-link-hover) !important;
}
html[data-palette="classic"] { --task-error-dialog-bg:#f7fafe;--task-error-dialog-inset:#e8f0f8;--task-error-dialog-text:#102736;--task-error-dialog-muted:#465f70;--task-error-dialog-border:#7e9bb0;--task-error-dialog-action:#174b9b;--task-error-dialog-action-text:#fff; }
html[data-palette="poisoned"] { --task-error-dialog-bg:#fbf8ff;--task-error-dialog-inset:#f3ecff;--task-error-dialog-text:#27183b;--task-error-dialog-muted:#59476f;--task-error-dialog-border:#8a62bd;--task-error-dialog-action:#c3f44d;--task-error-dialog-action-text:#16120d; }
html[data-palette="immolated"] { --task-error-dialog-bg:#fff9f4;--task-error-dialog-inset:#fff0e6;--task-error-dialog-text:#321b13;--task-error-dialog-muted:#6f4b3c;--task-error-dialog-border:#bf6840;--task-error-dialog-action:#ffb02e;--task-error-dialog-action-text:#281306; }
html[data-palette="flayed"] { --task-error-dialog-bg:#f3fbf5;--task-error-dialog-inset:#e8f6ec;--task-error-dialog-text:#102a1d;--task-error-dialog-muted:#3d604b;--task-error-dialog-border:#4a9b5d;--task-error-dialog-action:#79d82e;--task-error-dialog-action-text:#07110a; }
/* Training uses the same light work-surface hierarchy as OGE task detail. */
html[data-palette] .site-scene .training-page :is(
  .training-toolbar,
  .training-condition,
  .training-answer-panel,
  .training-solution-panel,
  .training-finish-confirm,
  .training-final
) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  border-color: var(--work-border) !important;
  background: var(--work-surface) !important;
  background-image: none !important;
}

html[data-palette] .site-scene .training-page :is(
  .training-toolbar > p,
  .training-solution-body,
  .training-finish-confirm > p
) {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
}

html[data-palette] .site-scene .training-page .training-stat-chip {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
  border-color: var(--work-border) !important;
  background: var(--work-surface-inset) !important;
}

html[data-palette] .site-scene .training-page .training-stat-chip strong,
html[data-palette] .site-scene .training-page .training-condition h2,
html[data-palette] .site-scene .training-page .training-solution-head h3,
html[data-palette] .site-scene .training-page .training-final h2 {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
}

html[data-palette] .site-scene .training-page .training-condition-body {
  color: var(--work-text-secondary) !important;
  border-color: var(--work-border) !important;
  background: var(--work-surface-inset) !important;
}

html[data-palette] .site-scene .training-page :is(.training-condition-label, .training-answer-label) {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
  border-color: var(--work-border) !important;
  background: var(--work-surface-raised) !important;
}

html[data-palette] .site-scene .training-page .training-condition :is(.task-question, .task-question *, .programs-table, .programs-table *) {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
}

html[data-palette] .site-scene .training-page .exam-answer-input {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  border-color: var(--work-border) !important;
  background: var(--work-surface-inset) !important;
}

html[data-palette] .site-scene .training-page .exam-answer-input::placeholder {
  color: var(--work-text-muted) !important;
  -webkit-text-fill-color: var(--work-text-muted) !important;
  opacity: 1;
}

html[data-palette] .site-scene .training-page :is(
  .training-check-actions button,
  .training-next-btn-primary,
  .training-repeat-btn
) {
  color: var(--action-primary-text) !important;
  -webkit-text-fill-color: var(--action-primary-text) !important;
  border: 1px solid var(--action-primary-border) !important;
  background: var(--action-primary-bg) !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-palette] .site-scene .training-page :is(
  .training-next-btn-secondary,
  .training-solution-toggle,
  .training-finish-btn,
  .training-back-btn
) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  border: 1px solid var(--work-border) !important;
  background: var(--work-surface-raised) !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-palette] .site-scene .training-page .task-error-action {
  width: 100%;
  margin-top: 2px;
}

html[data-palette] .site-scene .training-page .task-error-report-link {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
  border: 1px solid var(--work-border) !important;
  border-radius: 14px;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  font-size: 13px;
  font-weight: 700;
}

html[data-palette] .site-scene .training-page .task-error-report-link:hover {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
  background: var(--work-surface-inset) !important;
}

/* Legal documents use the light, theme-tinted work surface in every palette. */
html[data-palette] .site-scene .product-page .legal-page > :is(h2, h3) {
  color: var(--work-text-primary) !important;
  -webkit-text-fill-color: var(--work-text-primary) !important;
}

html[data-palette] .site-scene .product-page .legal-page > p {
  color: var(--work-text-secondary) !important;
  -webkit-text-fill-color: var(--work-text-secondary) !important;
}

html[data-palette] .site-scene .product-page .legal-page > .product-intro p {
  color: var(--text-secondary) !important;
  -webkit-text-fill-color: var(--text-secondary) !important;
}
