/* Theme-aware UI. Media labels retain a fixed dark backing over photographs. */
:root[data-theme] body,:root[data-theme] .shell{background:var(--bg);color:var(--ink)}
:root[data-theme] :is(.panel,.workoutCard,.libraryCard,.stat,.historyItem,.techCard,.weekPanel,.checkPanel,.sharePanel,.historyDialog,.focusedExercise,.finishSession){background:var(--surface);color:var(--ink);border-color:var(--border)}
:root[data-theme] :is(.field input,.field select,.field textarea,.logRow input,.noteBox textarea,.checkPanel select,.appearancePanel input,.appearancePanel select,.headerLanguage,.themeQuick,.closeBtn){background:var(--surface2);color:var(--ink);border-color:var(--control-border)}
:root[data-theme] :is(input,select,textarea){accent-color:var(--accent-text);caret-color:var(--accent-text)}
:root[data-theme] input[type="color"]{padding:5px;cursor:pointer;min-width:0}
:root[data-theme] select option{background:var(--surface);color:var(--ink)}
:root[data-theme] :is(input,textarea)::placeholder{color:var(--muted);opacity:1}
:root[data-theme] :is(.field label,.label,.infoBox strong,.infoBox li,.infoBox ul,.demoFrame .t,.noteBox label){color:var(--ink)}
:root[data-theme] :is(.caption,.hint,.note,.sub,.muted,.smallStat,.mediaNote,.demoFrame .s,.noteBox p,.exerciseMeta p,.workoutCard p,.listItem small,.v9Welcome p,.v9Welcome .caption,.v10Credit p,.v10FootageAlert span){color:var(--muted)}
:root[data-theme] :is(.secondary,.tag:not(.active),.chip:not(.active),.mediaSeg button,.mediaPlay,.restControls button){background:var(--surface2);border-color:var(--control-border);color:var(--ink)}
:root[data-theme] :is(.primary,.brand .mark,.chip.active,.tag.active,.mediaSeg button.active,.exerciseTab.current,.logRow button,.toast){background:var(--accent);color:var(--limeInk);border:1px solid var(--accent-border)}
:root[data-theme] :is(.miniButton,.avatar,.eyebrow,.index,.v9External){color:var(--accent-text)}
:root[data-theme] :is(.demoFrame .n,.v10Credit a,.historyDetails summary){color:var(--accent-text)}
:root[data-theme] .exerciseTab.complete:not(.current){color:var(--accent-text)}
:root[data-theme] :is(.miniButton,.avatar){border-color:var(--control-border)}
:root[data-theme] :is(.muscleChip,.workoutMeta span,.infoBox,.demoFrame,.noteBox,.notice,.adjustment,.scrollbox,.progressFlag,.recoveryResult,.v10Credit,.v10FootageAlert){background:var(--surface2);color:var(--ink);border-color:var(--border)}
:root[data-theme] .pill{background:var(--accent-soft);color:var(--accent-soft-text)}
:root[data-theme] .v9Welcome{background:linear-gradient(145deg,var(--surface2),var(--surface));border-color:var(--border);color:var(--ink)}
:root[data-theme] .hero:after{border-color:var(--accent-soft)}
:root[data-theme] .v10FootageAlert strong{color:var(--accent-text)}
:root[data-theme] .v10Primary{background:var(--accent-soft);color:var(--accent-soft-text);border-color:var(--accent-border)}
:root[data-theme] .favoriteButton{color:var(--accent-text)!important;border-color:var(--control-border)!important}
:root[data-theme] .favoriteButton.selected{background:var(--accent-soft);color:var(--accent-soft-text)!important;border-color:var(--accent-border)!important}
:root[data-theme] .v10Badge{background:var(--accent)!important;color:var(--limeInk)!important}
:root[data-theme] :is(.warning,.v10Warn,.storageWarning){background:var(--warning-bg);color:var(--warning-text);border-color:var(--warning-border)}
:root[data-theme] .dangerButton{background:var(--danger-bg);color:var(--danger-text);border-color:var(--danger-border)}
:root[data-theme] .editorError{color:var(--danger-text)}
:root[data-theme] .registered{color:var(--success-text)}
:root[data-theme] .weekDay.available{border-color:var(--accent-border)}
:root[data-theme] .weekDay.done{background:var(--success-bg);color:var(--success-text);border-color:var(--success-border)}
:root[data-theme] .weekDay.missed{border-color:var(--warning-border)}
:root[data-theme] .weekPick label:has(input:checked){border-color:var(--accent-border);box-shadow:inset 0 0 0 1px var(--accent-border);background:var(--accent-soft);color:var(--accent-soft-text)}
:root[data-theme] :is(.restDock,.restDock.finished){background:var(--accent-soft);border-color:var(--accent-border)}
:root[data-theme] :is(.restInfo span,.restInfo strong,.restDock.finished .restInfo strong){color:var(--accent-soft-text)}
:root[data-theme] .restControls button{border-color:var(--accent-border)}
:root[data-theme] .progressbar{background:var(--surface2)}
:root[data-theme] :is(.progressbar>div,.trend>div,.trend>div:last-child){background:var(--accent-text)}
:root[data-theme] :is(.sep,.listItem){border-color:var(--border)}
:root[data-theme] .sep{background:var(--border)}
:root[data-theme] .empty{border-color:var(--control-border);color:var(--muted)}
:root[data-theme] .techOverlay,:root[data-theme] .historyDialog::backdrop{background:var(--overlay)}
:root[data-theme] :is(.techMedia,.v9Video,.exerciseThumb){background:var(--media-bg);border-color:var(--border)}
:root[data-theme] :is(.mediaPreview .badge,.mediaPreview .mediaBadge:not(.v10Badge),.exerciseThumb .cap){background:#102022eb;color:var(--media-ink);border-color:#ffffff40}
:root[data-theme] .bottom{background:var(--surface);border-color:var(--border);box-shadow:0 -8px 24px #0000000a}
:root[data-theme] .navButton{color:var(--muted);min-height:48px;border-radius:12px}
:root[data-theme] .navButton.active{color:var(--accent-text);background:var(--accent-soft)}
:root[data-theme] :is(.themeQuick,.avatar,.headerLanguage,.miniButton){min-height:44px}
:root[data-theme] :is(.themeQuick,.avatar){min-width:44px}
:root[data-theme] :is(.caption,.hint,.note,.mediaNote){font-size:15px;line-height:1.6}
:root[data-theme] .appearancePanel{grid-template-columns:1fr 1fr;gap:12px}
:root[data-theme] .appearancePanel .accentControl{grid-column:1/-1}
:root[data-theme] .accentControl input{height:48px;width:100%}
:root[data-theme] .appearanceHelp{grid-column:1/-1;margin:0;font-size:15px;line-height:1.6;color:var(--muted)}
:root[data-theme] :is(button,a,input,select,textarea,summary):focus-visible{outline:3px solid var(--accent-text);outline-offset:3px}
:root[data-theme] .restDock{bottom:calc(82px + env(safe-area-inset-bottom))}
:root[data-theme="light"] .restDock{box-shadow:0 8px 24px #10202126}
@media(min-width:461px){:root[data-theme] .restDock{bottom:calc(100px + env(safe-area-inset-bottom))}}
@media(max-width:390px){header{gap:8px}.brand{display:flex;align-items:center;gap:7px;font-size:17px;line-height:1.2}.brand .mark{flex:0 0 30px;margin-right:0}.headerControls{flex-shrink:0;gap:5px}}
@media(hover:hover){:root[data-theme] button:not(:disabled):hover{filter:brightness(.96)}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
