/* Shared app appearance. Load after the original app styles and site-theme.css.
   These overrides change UI surfaces only: boards, stones, chess pieces, card
   faces, food illustrations, chart marks and financial red/green retain their
   own semantic palettes. No layout widths or scrolling behavior are changed. */
html[data-site-theme] :is(body.app-unified,body.codebreaker-app){
  --u-bg:var(--theme-bg);--u-paper:var(--theme-surface);--u-paper-soft:var(--theme-surface-alt);
  --u-ink:var(--theme-text);--u-muted:var(--theme-muted);--u-line:var(--theme-border);--u-line-strong:var(--theme-border);
  --u-accent:var(--theme-accent);--u-accent-soft:var(--theme-soft);--u-shadow:var(--theme-shadow);
  --u-radius-xl:var(--theme-radius);--u-radius-lg:var(--theme-radius);--u-radius-md:var(--theme-radius-small);
  --bg:var(--theme-bg);--page:var(--theme-bg);--paper:var(--theme-bg);--paper-soft:var(--theme-surface-alt);
  --panel:var(--theme-surface);--surface:var(--theme-surface);--surface-soft:var(--theme-surface-alt);
  --ink:var(--theme-text);--muted:var(--theme-muted);--subtle:var(--theme-muted);
  --line:var(--theme-border);--line-strong:var(--theme-border);--accent:var(--theme-accent);--accent-soft:var(--theme-soft);
  --shadow:var(--theme-shadow);--radius:var(--theme-radius);
  background:var(--theme-bg)!important;color:var(--theme-text);
}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app,body.card-memory-app,body.eat-today-app,body.codebreaker-app){
  --green:var(--theme-accent);--green-dark:var(--theme-accent-hover);--navy:var(--theme-accent);
  --sage:var(--theme-soft);--cream:var(--theme-surface-alt);--white:var(--theme-surface);
}
html[data-site-theme] body.codebreaker-app{--paper:var(--theme-surface)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.masthead,.page-header,.site-header){background:transparent;border-color:var(--theme-border)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.brand,.intro h1,.page-intro h1){color:var(--theme-text)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.brand small,.brand-text>span,.eyebrow,.header-center,.intro-copy,.intro-meta,.intro-meta small,.intro-mark,.intro-note small,.top-actions,.header-actions,.header-tools,.back-link,.masthead nav,.header-nav,.page-intro p,.field-note,.muted,.text-muted){color:var(--theme-muted)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.intro h1>span,.text-button,.text-btn,.button-text,.link-btn){color:var(--theme-accent)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.board-panel,.panel,.results-panel,.review-card,.review-panel,.history-panel,.stats-row,.play-panel,.side-card,.filter-card,.result-card,.alternatives,.today-strip,.cloud-ribbon,.nutrition-total,.nutrition-meals>section){background:var(--theme-surface);border-color:var(--theme-border)!important;border-radius:var(--theme-radius);box-shadow:var(--theme-shadow);color:var(--theme-text)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(button,select,input,textarea){border-radius:var(--theme-radius-small)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(input:where(:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=file])),select,textarea){background-color:var(--theme-surface);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(input,textarea)::placeholder{color:var(--theme-muted)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(input[readonly],input:disabled,select:disabled,textarea:disabled){background-color:var(--theme-surface-alt);color:var(--theme-muted);border-color:var(--theme-border)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(input[type=checkbox],input[type=radio]){accent-color:var(--theme-accent)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(button,a,input,select,textarea,summary):focus-visible{outline-color:var(--theme-accent)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(input,select,textarea):focus{border-color:var(--theme-accent);box-shadow:0 0 0 3px var(--theme-soft)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.primary,.primary-btn,.new-game.primary,.small-button.primary,.button-primary,.confirm-btn){background:var(--theme-accent)!important;border-color:var(--theme-accent)!important;color:var(--theme-on-accent)!important}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.primary,.primary-btn,.new-game.primary,.small-button.primary,.button-primary,.confirm-btn):hover:not(:disabled){background:var(--theme-accent-hover)!important;border-color:var(--theme-accent-hover)!important;color:var(--theme-on-accent)!important}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.secondary,.secondary-btn,.button-default,.button-soft,.small-button:not(.primary),.close-button,.close-dialog){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.secondary,.secondary-btn,.button-default,.button-soft,.small-button:not(.primary),.close-button,.close-dialog):hover:not(:disabled){background:var(--theme-soft);border-color:var(--theme-accent);color:var(--theme-accent)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) dialog{background:var(--theme-surface);color:var(--theme-text);border:1px solid var(--theme-border);border-radius:var(--theme-radius);box-shadow:var(--theme-shadow)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) dialog::backdrop{background:rgba(12,20,35,.58)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.dialog-content p,.help-steps p,dialog p,.about,footer,.site-footer){color:var(--theme-muted);border-color:var(--theme-border)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.toast,#toast){background:var(--theme-accent);color:var(--theme-on-accent)}
html[data-site-theme] :is(body.app-unified,body.codebreaker-app) :is(.skip,.skip-link){background:var(--theme-accent);color:var(--theme-on-accent)}

/* Chess UI. Board wood and piece selectors are deliberately absent. */
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.segmented,.pending-bar,.hint-note,.book-stats,.history-row.latest,.move-record.latest){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.segmented button,.difficulty-grid button,.record-actions button){background:var(--theme-surface);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.segmented button.selected,.difficulty-grid button.selected,.player.active){background:var(--theme-soft);border-color:var(--theme-accent);color:var(--theme-accent)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.segmented button,.difficulty-grid button,.record-actions button,.tool-button,.sound-button):hover:not(:disabled){background:var(--theme-soft);color:var(--theme-accent);border-color:var(--theme-accent)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.difficulty-grid button.selected strong,.difficulty-grid button.selected small,.difficulty-grid button.selected .level-mark,.turn-label){color:var(--theme-accent)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.player div>span,.player small,.game-status p,.move-counter b,.move-counter span,.section-index,.difficulty-grid small,.level-mark,.level-number,.record-last,.record-head,.record-caption,.empty-record,.empty-record small,.history-row>span:first-child,.move-record .num,.move-record .text,.inline-switch,.sound-button,.versus){color:var(--theme-muted)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) :is(.offline-badge,.local-badge){background:var(--theme-soft);color:var(--theme-accent);border-color:var(--theme-border)}
html[data-site-theme] :is(body.gomoku-app,body.xiangqi-app) .tool-button svg{stroke:currentColor}
html[data-site-theme] body.gomoku-app .brand-mark{background:var(--theme-accent)}
html[data-site-theme="midnight"] body.xiangqi-app .move-record.black .record-piece{color:var(--theme-text)}
html[data-site-theme="midnight"] body.xiangqi-app :is(.move-record .record-piece,.is-check .game-status strong){color:#ff9a96}

/* Card Memory: explicitly retain the dark table and the red/black card faces. */
html[data-site-theme] body.card-memory-app .table{background:radial-gradient(ellipse at 55% 40%,#2b4959 0%,#213747 60%,#1d3040 100%);color:#ebefed;border-radius:var(--theme-radius)}
html[data-site-theme] body.card-memory-app :is(.answers button,.rule-examples,.keyboard-note kbd,th){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.card-memory-app :is(.answers .chosen,.mode-options label:has(input:checked)){background:var(--theme-soft);border-color:var(--theme-accent)}
html[data-site-theme] body.card-memory-app :is(.answers button small,.answers kbd,.answer-icon,.none-icon,.advance-row p,.stats-row span,.stats-row em,.panel-heading>span,.field-title,.settings-grid label,.mode-options small,.check-row small,.rule-equation,.how-panel p,.how-panel p strong,.keyboard-note,.result-heading p:not(.eyebrow),.breakdown span,.rule-examples span,.rule-examples strong,.history-item small,.history-empty,.header-actions a,.header-actions span){color:var(--theme-muted)}
html[data-site-theme] body.card-memory-app :is(.intro p strong,.rule-equation b,.result-heading>strong,.history-item>strong){color:var(--theme-accent)}
html[data-site-theme="midnight"] body.card-memory-app .answers .answer-right{background:#203c32;border-color:#77b79b}
html[data-site-theme="midnight"] body.card-memory-app .answers .answer-wrong{background:#422e32;border-color:#d48784}
html[data-site-theme="midnight"] body.card-memory-app :is(td.good,#saveStatus:not(.error)){color:#9bd4ae}
html[data-site-theme="midnight"] body.card-memory-app :is(td.bad,#saveStatus.error){color:#f2a095}

/* Codebreaker: secret digits stay legible with any chosen palette. */
html[data-site-theme] body.codebreaker-app :is(.round-tag,.mode-tabs,.scoreboard>div,.curtain,.keypad button,.clue-row,.rule-example,.notes button,.revealed-codes>div,.modal-example,.solo-status,.intro-mark span,.vault-code span){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.codebreaker-app :is(.mode-tabs button[aria-pressed=true],.level-options button[aria-pressed=true],.scoreboard>div.current,.feedback-box,.log-row.won,.notes button[data-state=in],.unlock-mark){background:var(--theme-soft);border-color:var(--theme-accent);color:var(--theme-accent)}
html[data-site-theme] body.codebreaker-app :is(.brand-icon,.intro-mark span:nth-child(2),.vault-code span:nth-child(2)){background:var(--theme-accent);color:var(--theme-on-accent)}
html[data-site-theme] body.codebreaker-app :is(.text-btn,.intro h1 span,.curtain-symbol,.thinking,.log-row>span:nth-child(2),.feedback-demo strong,.about h2,.about h3){color:var(--theme-accent)}
html[data-site-theme] body.codebreaker-app :is(.masthead nav,.section-label>small,.check-line span,.welcome-meta,.scoreboard span,.curtain p:not(.eyebrow),.log-head,.empty-log,.ai-log summary,.rule-example>div>span,.solo-status p,.solo-counter span){color:var(--theme-muted)}
html[data-site-theme] body.codebreaker-app .feedback-demo>span{color:var(--theme-muted)!important}
html[data-site-theme] body.codebreaker-app .notes button[data-state=out]{background:var(--theme-bg);color:var(--theme-muted)}
html[data-site-theme] body.codebreaker-app .keypad button:hover{background:var(--theme-soft);border-color:var(--theme-accent)}

/* Eat Today. The drawing/photo layers keep their original artwork colors. */
html[data-site-theme] body.eat-today-app :is(.brand-mark,.top-tabs button.active,.scenario-buttons button.active,.library-types>button.active){background:var(--theme-accent);border-color:var(--theme-accent);color:var(--theme-on-accent)!important}
html[data-site-theme] body.eat-today-app :is(.top-tabs button,.date-block>span,.date-block strong,.outline-badge,.result-kicker,.result-note,.record-controls label,.confirm-row .small,.today-item small,.today-item p,.filter-title .link-btn,.toggle-stack small,.avoid-details summary span,.pool-status p,.pool-status>.icon,.safety-note,.ingredients-line,.history-slot,.history-row p,.history-row>button,.detail-label,.cloud-ribbon span,.nutrition-line,.nutrition-date label,.nutrition-total-heading>span,.nutrition-meal-heading small,.nutrient-stat span,.meal-plan-line small,.intake-row p,.intake-empty,.nutrition-explanation,.nutrition-fields label,.intake-amount label,.recipe-form-link small,.intake-source,.recipe-workspace label,.ingredient-native,.recipe-macros small,.recipe-empty,.meal-component-heading small,.component-nutrients,.meal-extras,.component-ingredients small,.meal-nutrient>span,.meal-nutrient small,.batch-intake-item small,.daily-protein-heading small,.protein-formula,.daily-protein-value span,.protein-gap,.protein-meal-allocation,.shopping-list li small,.swap-choice span,.swap-choice small,.shop-order-heading small,.shop-group-heading small,.order-dish small,.shop-order-total small,.shop-order-total p,.order-snapshot small,.merchant-suggestions button small,.review-record-time,.selected-meal-entry>span,.selected-edit-intro p,.dish-photo figcaption,.dish-photo-loading){color:var(--theme-muted)}
html[data-site-theme] body.eat-today-app :is(.mini-card,.today-grid,.meal-options button,.menu-card,.history-items,.nutrition-total,.nutrition-meal,.meal-component,.swap-choice,.shop-order-line,.shop-draft-row,.merchant-suggestions,.pick-action-bar,.photo-dialog,.review-dialog,.review-save-bar,.selected-save-scope label,.selected-meal-chooser,.meal-intake-modal){background:var(--theme-surface);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.eat-today-app :is(.tag,.scope-tabs,.pool-status,.cloud-pill,.cloud-message,.cloud-inner,.cloud-conflict,.nutrition-privacy,.meal-plan-line,.nutrition-editor,.food-library-entry,.recipe-caution,.state-pill,.recipe-row,.recipe-totals,.meal-nutrient,.recipe-upgrade,.adult-protein-setting,.daily-protein,.daily-vegetables,.vegetable-breakdown,.meal-practical,.merchant-prices,.shop-order,.order-snapshot,.component-note,.selected-edit-controls,.photo-preview,.photo-thumb,.dish-photo-frame){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.eat-today-app :is(.meal-options button.active,.scope-tabs .active,.daily-protein.met,.shop-order-line.selected,.merchant-suggestions button[aria-selected=true],.merchant-suggestions button:hover,.intake-preview,.photo-thumb.is-active,.portion-shortcuts button,.favorite-btn[aria-pressed=true]){background:var(--theme-soft);border-color:var(--theme-accent);color:var(--theme-accent)}
html[data-site-theme] body.eat-today-app :is(.pool-number,.merchant-label,.nutrient-stat strong,.recipe-macros strong,.nutrition-explanation summary,.nutrition-editor summary,.adult-protein-summary,.daily-protein-value strong,.daily-protein-value b,.protein-plan-contribution,.dish-prices,.shop-order-total strong,.menu-body .menu-note,.pick-action-context strong,.review-entry,.photo-thumb-label){color:var(--theme-text)}
html[data-site-theme] body.eat-today-app :is(.pick-action-context span,.selected-meal-chooser small){color:var(--theme-muted)}
html[data-site-theme] body.eat-today-app :is(.food-record a,.recipe-row a,.recipe-provenance a,.recipe-source-card a,.cloud-onboarding summary,.shop-options summary){color:var(--theme-accent)}
html[data-site-theme] body.eat-today-app #guidePersonalTargets{background:var(--theme-soft);color:var(--theme-text)}
html[data-site-theme] body.eat-today-app :is(#editorForm>.dialog-actions,.shop-editor .dialog-actions,#photoDialog>.dialog-heading,#photoDialog .photo-save-bar){background:var(--theme-surface);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.eat-today-app #selectedMealChooserList>button{background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.eat-today-app #selectedMealChooserList small{color:var(--theme-muted)}
/* Photo controls sit on images, with a self-contained high-contrast palette. */
html[data-site-theme] body.eat-today-app #imageLightbox{background:#15211c;color:#f7f6ed}
html[data-site-theme] body.eat-today-app #imageLightbox button{background:#ffffff12;color:#fffaf0}
html[data-site-theme] body.eat-today-app #imageLightbox footer{background:#18281f;color:#d0dace}

/* Options Lab: UI accent is separate from --orange, which is a chart legend key. */
html[data-site-theme] body.options-lab-app :is(.brand-mark,.eyebrow span,.status-dot){background:var(--theme-accent);color:var(--theme-on-accent)}
html[data-site-theme] body.options-lab-app :is(.data-status,.leg-card,.position-card,.position-summary>.metric-card,.position-summary>.summary-item,.timeline-node,.ledger-stat,.ledger-preview table,.clear-cache,.contract-tabs,.desk-region){background:var(--theme-surface);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.options-lab-app :is(.quote-caption,.data-badge,.leg-badge:not(.call):not(.put):not(.buy):not(.sell),.tiny-tag,.view-tabs,.scenario-inspector,th,tfoot td,.table-note,.message,.mode-number,.quote-summary-detail,.quote-inputs .empty-state,.quote-row,.strategy-panel .panel-heading,.history-inputs,.quote-input-card,.timeline-panel,.crypto-units-note,.crypto-exposure,.ledger-import-panel,.ledger-report-status,.layout-switch,.desk-region-heading,.calculation-progress,.analysis-availability,.adjustment-info,.section-tag){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] body.options-lab-app :is(#existingLegs .leg-card,#proposedLegs .leg-card,#existingLegs .empty-state,#proposedLegs .empty-state,.workspace-v6 .position-row.book-existing,.workspace-v6 .position-row.book-proposed){background:var(--theme-surface);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app :is(.product-tabs button,.position-mode-tabs>button,.view-tabs button,.layout-switch button,.contract-tabs button){background:var(--theme-surface-alt);color:var(--theme-muted);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app :is(.product-tabs button.active,.product-tabs button[aria-selected=true],.position-mode-tabs>button.active,.position-mode-tabs>button[aria-selected=true],.view-tabs button.active,.view-tabs button[aria-selected=true],.layout-switch button[aria-pressed=true],.contract-tabs button[aria-selected=true],.position-card.highlight,.timeline-node.is-active,tbody tr.current,tbody tr.highlight,tbody tr.reference){background:var(--theme-soft);border-color:var(--theme-accent);color:var(--theme-accent)}
html[data-site-theme] body.options-lab-app :is(.product-tabs button:hover,.position-mode-tabs>button:hover,.view-tabs button:hover,.button-default:hover,.button-soft:hover,tbody tr:hover){background:var(--theme-soft);border-color:var(--theme-accent);color:var(--theme-text)}
html[data-site-theme] body.options-lab-app :is(.product-tabs button.active .product-name,.product-tabs button[aria-selected=true] .product-name,.position-mode-tabs>button.active strong,.position-mode-tabs>button[aria-selected=true] strong,.position-mode-tabs>button.active .mode-number,.position-mode-tabs>button[aria-selected=true] .mode-number,.metric-card.primary .metric-value,.methodology-content a,.header-nav>a:hover){color:var(--theme-accent)}
html[data-site-theme] body.options-lab-app :is(.header-nav .nav-active){background:transparent;color:var(--theme-accent)}
html[data-site-theme] body.options-lab-app .header-nav .nav-active::after{background:var(--theme-accent)}
html[data-site-theme] body.options-lab-app :is(.data-status small,.section-icon,.micro-label,.field>label,.label-note,.label-unit,.input-affix>span,.field-note,.advanced-settings summary,.leg-note,.leg-meta,.strategy-fee label,.strategy-fee label span,.storage-note,.empty-state,.metric-label,.metric-hint,.volatility-control>label,.volatility-control>label>span,.range-end,.horizon-note,.chart-legend,.scenario-summary,.scenario-summary .summary-label,.analysis-footnote p,.section-description,td small,.method-summary-note,.methodology-content,.method-sources,.mode-description,.position-mode-tabs small,.position-mode-tabs strong>span,.quote-input-heading p,.quote-symbol small,.quote-symbol span,.position-card>span,.position-card .position-label,.position-card>small,.position-card .position-hint,.section-help,.input-help,.quote-input-head small,.position-summary>.summary-item>span,.position-summary>.summary-item>small,.quote-section-toggle>span,.quote-input-section>.quote-input-heading>p,.position-import-toolbar>span,.timeline-title>span,.timeline-help,.timeline-node-heading>span,.timeline-node-note,.timeline-footnote,.crypto-units-note>p,.crypto-units-note .crypto-contract-specs,.crypto-exposure small,.ledger-import-panel>summary,.ledger-import-panel>summary small,.ledger-import-help,.ledger-fee-consent,.ledger-preview,.ledger-stat>span,.ledger-note,.ledger-apply>p,.storage-scope-note,.market-input-toolbar>p,.existing-quote-help,.workspace-v6 .position-row>.leg-note,.workspace-v6 .position-row-footer,.workspace-v6 .position-row .leg-advanced>summary,.workspace-v6 .position-row .quote-advanced>summary,.preset-description,.metric-hint .greek-point-note,.scenario-greek-unit,.desk-region-heading>span,.market-model-help,.page-footer,.footer-brand){color:var(--theme-muted)}
html[data-site-theme] body.options-lab-app :is(td,.scenario-summary .summary-value,.scenario-values>div>strong,.methodology-content h3,.methodology-content h4,.methodology-content strong,.quote-summary strong,.position-mode-tabs strong,.quote-input-heading h3,.quote-symbol,.position-card>strong,.position-card .position-value,.position-summary .summary-value,.position-section-heading h3,.quote-input-head,.quote-input-head strong,.position-summary>.summary-item>strong,.quote-section-toggle>strong,.timeline-title>strong,.timeline-node-heading>strong,.crypto-note-heading,.crypto-note-heading>strong,.crypto-exposure strong,.ledger-import-panel>summary strong,.ledger-stat>strong,.workspace-heading>h2,.analysis-availability strong,.desk-region-heading h2,.adjustment-info strong,.availability-summary){color:var(--theme-text)}
/* Keep readonly/disabled specificity above the ordinary input rule. */
html[data-site-theme] body.options-lab-app :is(.field input[readonly],.workspace-v6 .position-row-grid .quote-cell input[readonly],input:disabled,select:disabled){background-color:var(--theme-surface-alt);color:var(--theme-muted);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app .chart-tooltip{background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app :is(.methodology-content code,.expiry-cell.unlisted){background:var(--theme-surface-alt);color:var(--theme-muted)}
html[data-site-theme] body.options-lab-app #status.status-message{background:var(--theme-surface-alt);color:var(--theme-text);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app .timeline-node:before{background:var(--theme-surface-alt);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app .timeline-node.is-active:before{background:var(--theme-accent);border-color:var(--theme-accent)}
html[data-site-theme="midnight"] body.options-lab-app{--red:#ff8793;--red-soft:#422b38;--green:#6bd4b0;--green-soft:#1c3837}
html[data-site-theme="midnight"] body.options-lab-app :is(.warning,.noscript-message,.status-message.warning,.ledger-report-status.warning){background:#3c3424;color:#f2cc81!important;border-color:#78633c}
html[data-site-theme="midnight"] body.options-lab-app :is(.error,.status-message.error,.ledger-report-status.error,#operationStatus.error,#calculationStatus.error,#timelineStatus.error){background:#422b38;color:#ff9ba7!important;border-color:#80505f}
html[data-site-theme="midnight"] body.options-lab-app :is(.success,.status-message.success,.ledger-report-status.success,#operationStatus.success,#calculationStatus.success,#timelineStatus.success){background:#1c3837;color:#8edabb!important;border-color:#417c69}

/* Embedded tools inherit the same theme without changing playing-card colors. */
html[data-site-theme] #g24{--g24-paper:var(--theme-surface);--g24-ink:var(--theme-text);--g24-muted:var(--theme-muted);--g24-line:var(--theme-border);--g24-green:var(--theme-accent);--g24-soft:var(--theme-soft)}
html[data-site-theme] #g24 :is(.g24-play,.g24-custom-panel,.g24-guide){border-radius:var(--theme-radius);box-shadow:var(--theme-shadow)}
html[data-site-theme] #g24 :is(.g24-card,.g24-secondary,#g24Expression,.g24-operators button,.g24-hint-box,.g24-answer,.g24-custom-inputs input,kbd){background:var(--theme-surface-alt);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] #g24 :is(.g24-card:not(:disabled):hover,.g24-operators button:hover,.g24-feedback,.g24-custom-submit){background:var(--theme-soft);border-color:var(--theme-border);color:var(--theme-text)}
html[data-site-theme] #g24 :is(.g24-next,.g24-primary){background:var(--theme-accent);border-color:var(--theme-accent);color:var(--theme-on-accent)}
html[data-site-theme] #g24 :is(.g24-next:hover,.g24-primary:hover){background:var(--theme-accent-hover);border-color:var(--theme-accent-hover)}
html[data-site-theme] #g24 .g24-text-button{color:var(--theme-accent)}
html[data-site-theme] #poker{--pkr-ink:var(--theme-text);--pkr-muted:var(--theme-muted);--pkr-line:var(--theme-border);--pkr-accent:var(--theme-accent);--pkr-soft:var(--theme-soft)}
html[data-site-theme] #poker .pkr-panel{background:var(--theme-surface);border-color:var(--theme-border);border-radius:var(--theme-radius);box-shadow:var(--theme-shadow)}
html[data-site-theme] #poker select{background-color:var(--theme-surface-alt);color:var(--theme-text);border-color:var(--theme-border)}
html[data-site-theme] #poker :is(.pkr-target.is-active,.pkr-suit-tab[aria-pressed=true]){background:var(--theme-soft);border-color:var(--theme-accent)}
html[data-site-theme] #poker :is(.pkr-storage,.pkr-empty-value){color:var(--theme-muted)}
html[data-site-theme] #poker .pkr-primary{background:var(--theme-accent);border-color:var(--theme-accent);color:var(--theme-on-accent)}
html[data-site-theme] #poker .pkr-primary:not(:disabled):hover{background:var(--theme-accent-hover)}
/* Pale physical card faces remain pale on every surrounding UI theme. */
html[data-site-theme] #poker :is(.card,.pkr-slot.is-filled,.pkr-mini-card){background:#fff;color:#273c32}
html[data-site-theme] #poker :is(.card:hover,.card.selected,.pkr-slot.is-filled:hover){background:#f0f3f6;color:#273c32;border-color:var(--theme-accent)}
html[data-site-theme] #poker :is(.suit-h,.suit-d){color:#b34d4a}
html[data-site-theme] #poker :is(.suit-s,.suit-c){color:#273c32}

/* Explicit night-mode treatments for notices that originally used pale fills. */
html[data-site-theme="midnight"] :is(body.codebreaker-app,body.eat-today-app) :is(.notice,.hint-box,.caution,.account-access-warning,.daily-protein.unknown,.meal-nutrient.low,.meal-nutrient.high,.meal-nutrient.unknown,.noscript){background:#3c3424;color:#f2cc81;border-color:#78633c}
html[data-site-theme="midnight"] body.eat-today-app :is(#editLegacyModes,.selected-prep-check){background:#3c3424;color:#f2cc81}
html[data-site-theme="midnight"] :is(body.codebreaker-app,body.eat-today-app) :is(.error,.cloud-message.error,.toast.error){background:#422b38;color:#ff9ba7;border-color:#80505f}
html[data-site-theme="midnight"] :is(body.codebreaker-app,body.eat-today-app) :is(.danger,.form-error,.required){color:#ff9ba7!important}
html[data-site-theme="midnight"] #g24 :is(.g24-feedback[data-kind=error],.g24-nojs){background:#3c3424;color:#f2cc81;border-color:#78633c}
html[data-site-theme="midnight"] #poker .pkr-notice{background:#3c3424;color:#f2cc81}
html[data-site-theme="midnight"] #poker :is(.pkr-slot:not(.is-filled),.pkr-outcome-bar){background:var(--theme-surface-alt)}
html[data-site-theme="midnight"] #poker progress::-webkit-progress-bar{background:var(--theme-surface-alt)}

/* Final cascade guards for the existing high-specificity workspace rules. */
html[data-site-theme] body.options-lab-app .workspace-v6 :is(input:where(:not([type=range]):not([type=checkbox]):not([type=radio])),select,textarea){background-color:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-border)}
html[data-site-theme] body.options-lab-app .workspace-v6 :is(input[readonly],input:disabled,select:disabled,textarea:disabled){background-color:var(--theme-surface-alt);color:var(--theme-muted)}
html[data-site-theme] body.options-lab-app .metric-card.primary{background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-site-theme] body.options-lab-app .metric-card.primary .metric-value{color:var(--theme-accent)}
html[data-site-theme] body.eat-today-app .toast.error{background:#934b3c;color:#fff}
html[data-site-theme="midnight"] body.eat-today-app .toast.error{background:#422b38;color:#ff9ba7}
/* Visible game descriptions and FAQs share the shell palette. */
html[data-site-theme] .game-seo-guide{background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-border);border-radius:var(--theme-radius);box-shadow:var(--theme-shadow)}
html[data-site-theme] .game-seo-guide :is(.guide-crumbs,p){color:var(--theme-muted)}
html[data-site-theme] .game-seo-guide a{color:var(--theme-accent)}
html[data-site-theme] .game-seo-guide :is(details,.guide-links){border-color:var(--theme-border)}
html[data-site-theme] .game-seo-guide .guide-scope{background:var(--theme-surface-alt)}
html[data-site-theme] .seo-original-tagline{color:var(--theme-muted)}
