/* Device preference is the source of truth, including changes while open. */
:root {
  color-scheme: light;
  --paper:#f4f5f7;
  --ink:#171a20;
  --muted:#596473;
  --line:#d8dfe7;
  --surface:#ffffff;
  --surface-soft:#f7f8fa;
  --surface-hover:#eaf0f6;
  --surface-selected:#e3edf7;
  --text:#171a20;
  --text-muted:#596473;
  --link:#285982;
  --text-on-selected:#ffffff;
  --nav-selected:#222222;
  --nav-background:#ffffff;
  --field-border:#8797a8;
  --logo-filter:brightness(0);
  --crest-filter:brightness(0);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme:dark;
    --paper:#10151c;
    --ink:#f1f4f8;
    --muted:#adb9c8;
    --line:#354251;
    --surface:#1b2430;
    --surface-soft:#151d27;
    --surface-hover:#253448;
    --surface-selected:#263f58;
    --text:#f1f4f8;
    --text-muted:#adb9c8;
    --link:#9dcefa;
    --nav-selected:#e3edf7;
    --text-on-selected:#162433;
    --nav-background:#151d27;
    --field-border:#718297;
    --logo-filter:brightness(0) invert(1);
    --crest-filter:brightness(0) invert(1);
  }
}
html,body{background:var(--paper);color:var(--text)}
:focus-visible,.ux-feature:focus-visible{outline-color:var(--link)}
/* Original white PNG is retained, with identical desktop/mobile treatment. */
aside{background:var(--nav-background);color:var(--text);border:1px solid var(--line)}
.real-brand{border-bottom-color:var(--line)}
.real-brand .wordmark,.mobile-brand img{filter:var(--logo-filter)}
.real-brand .crest{filter:var(--crest-filter)}
nav button{color:var(--text-muted)}
nav button:hover{background:var(--surface-hover);color:var(--text)}
nav button.active{background:var(--nav-selected);color:var(--text-on-selected)}
.topbar .eyebrow,.ux-heading>.eyebrow,.ux-day>span:first-child,.ux-legend,.ux-storage-note,.ux-resource-foot,.ux-stat-grid span,.ux-log small,.ux-tool-list span,.wp-import-summary span{color:var(--text-muted)}
.ux-profile{background:var(--nav-selected);color:var(--text-on-selected)}
.ux-circle,.ux-day>b{background:var(--surface);color:var(--text)}
.ux-day.is-today>b{background:var(--nav-selected);color:var(--text-on-selected)}
.section-head{border-color:var(--line)}
.ux-resource,.ux-log,.ux-stat-grid>div,.ux-tool-list>button,.card,.empty,.notification,.collection-button,.wp-source-card,.wp-import-summary>div,.exercise-list-row,.exercise-candidates,.exercise-review-row,.duplicate-card,.wod-history-entry,.wod-video-link{background:var(--surface);color:var(--text);border-color:var(--line)}
.ux-resource strong,.ux-resource-foot b,.card h3,.drawer h2,.drawer h3,.drawer h4{color:var(--text)}
.card p,.smallbody p,.heading p,.meta,.collection-button small,.exercise-list-row small,.wod-video-link small,.wod-schedule-date{color:var(--text-muted)}
.ux-resource>.tag,.tag.green,.drawer header .eyebrow,.ux-step,.text-btn,.original-content a,.exercise-candidate a,.wod-exercise-video{color:var(--link)}
.tag.orange{color:#ad490d}
@media(prefers-color-scheme:dark){.tag.orange{color:#ffae75}}
.text-btn:hover,.wod-exercise-video:hover{color:var(--text)}
.ux-tabs{background:var(--surface-hover)}
.ux-tabs button{color:var(--text-muted)}
.ux-tabs .selected{background:var(--nav-selected);color:var(--text-on-selected)}
.drawer,.drawer header,.archive-reader-actions,.wod-sticky,.exercise-edit-actions{background:var(--surface-soft);color:var(--text);border-color:var(--line)}
.drawer p,.drawer li,.original-content{color:var(--text)}
.hint,.drawer .hint{color:var(--text-muted)!important}
.drawer blockquote,.drawer .daily-scripture,.daily-scripture,.wod-clock{background:var(--surface);color:var(--text);border-color:var(--line);border-left-color:var(--link)}
.drawer .daily-scripture p{color:var(--text)}
.daily-scripture cite,.ux-reading-plan>span,.ux-reading-plan small{color:var(--text-muted)}
.ux-reading-plan{border-color:var(--line)}
.drawer .ux-pause{background:var(--surface-selected);color:var(--text)}
.close{background:var(--surface-hover);color:var(--text)}
.drawer textarea,.search,.archive-controls select,.exercise-field input,.exercise-field select,.exercise-review-row select,#ctVisual,input:not([type=checkbox]):not([type=radio]),select,textarea{background:var(--surface);color:var(--text);border-color:var(--field-border)}
textarea::placeholder,input::placeholder,.search::placeholder{color:var(--text-muted);opacity:1}
input[type=checkbox],input[type=radio]{accent-color:var(--link)}
.btn.outline,.filters .filter,.program-tab-buttons [role=tab],.pill{background:var(--surface);color:var(--link);border-color:var(--field-border)}
.btn.outline:hover,.filters .filter:hover,.drawer .collection-button:hover,.wod-video-link:hover{background:var(--surface-hover);color:var(--text)}
.filters .filter.active,.program-tab-buttons [aria-selected=true]{background:var(--brand-blue);color:#fff;border-color:var(--brand-blue)}
.wod-checklist li{background:var(--surface);color:var(--text);border-color:var(--line);border-left-color:var(--link)}
.wod-checklist li:has(input:checked){background:var(--surface-selected)}
.wod-checklist li:has(input:checked)>label{color:var(--text-muted)}
.wod-clock .timer{color:var(--link)}
.wod-actions,.wod-sticky,.original-content td,.original-content th,.duplicate-side+.duplicate-side,.exercise-candidate{border-color:var(--line)}
.exercise-badges span{color:var(--text-muted);border-color:var(--field-border)}
.wp-program-family,.exercise-photo{background:var(--surface-hover);border-color:var(--line)}
.workout-video-dialog,.scripture-chapter-dialog{background:var(--surface-soft);color:var(--text);border-color:var(--line)}
.scripture-chapter-head,.scripture-chapter-dialog footer{border-color:var(--line)}
/* The Bible/YouTube frames retain their providers' own rendering. */
pre{background:var(--surface);color:var(--text)}
@media(max-width:760px){
  aside{background:var(--nav-background);border-color:var(--line)}
  nav button,nav button.active{color:var(--text-muted)}
  nav button.active{background:var(--nav-selected);color:var(--text-on-selected)}
  nav button:hover{background:var(--surface-hover);color:var(--text)}
}
.ux-dots .faith-done,.ux-legend i{background:var(--link)}
.ux-dots .train-done,.ux-legend span+span i{background:#c25510}
@media(prefers-color-scheme:dark){
  .ux-dots i{background:#4a5a6d}
  .ux-dots .faith-done{background:var(--link)}
  .ux-dots .train-done,.ux-legend span+span i{background:#ff8a3d}
  /* Adapt the embedded text-only WEB chapter without changing its content. */
  .scripture-chapter-dialog iframe{color-scheme:light;filter:invert(.92) hue-rotate(180deg)}
}
