/* One reusable chrome across every musical adventure; stage art keeps its own colors. */
html[data-theme]{--ui-bg:#f4f7fa;--ui-panel:#fff;--ui-soft:#edf2f7;--ui-text:#293b50;--ui-muted:#61758b;--ui-border:#d6e1eb;--ui-accent:#227c69;--ui-selected:#dcf4e9;--ui-shadow:0 8px 25px #1a3a5510;color-scheme:light;background:var(--ui-bg)}
html[data-theme=dark]{--ui-bg:#0c0f14;--ui-panel:#171c24;--ui-soft:#222a35;--ui-text:#edf2f7;--ui-muted:#abbacb;--ui-border:#364252;--ui-accent:#8de4c2;--ui-selected:#223e36;--ui-shadow:0 8px 25px #0003;color-scheme:dark}
html[data-theme] body{background:var(--ui-bg)!important;color:var(--ui-text)!important}html[data-theme] .space-backdrop{display:none!important}html[data-theme] :is(.brand,.gem-bank,.top-button,#section-nav,.creative-title,.adventure-intro,.adventure-card,.creative-log,.creation-library,.ensemble-console,.body-console,.body-phrase,.story-journey,.conductor,.cue-rehearsal,.class-adventures,.student-adventure,.discovery-room,.learning-feedback,.piano-console,.piano-missions,.piano-song-guide,.live-shell,.live-entry article,.live-challenge,.live-concepts article,.project-intro,.project-explore,.project-teacher,.bits-lab,.game-console,.mission-side,.repair-panel,dialog,.studio-sidebar,.student-card,.score-toolbar,.observation-bar,.manager-info,.history-list article,.empty-state,.studio-metrics>div){background:var(--ui-panel)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;box-shadow:var(--ui-shadow)!important}
html[data-theme] :is(h1,h2,h3,h4,.brand-title,.creative-title h1,.ensemble-console strong,.part-selector>span,.project-tag,.bits-selected-title h2,.studio-title h1){color:var(--ui-text)!important;text-shadow:none!important}html[data-theme] :is(.eyebrow,.brand-title em,.brand-symbol,.activity-log-row strong,.save-state,.live-room-code,.live-feedback){color:var(--ui-accent)!important}html[data-theme] :is(.creative-title p,.map-intro p,.map-footer,.creative-log p,.creation-library p,.live-entry p,.live-concepts p,.live-host-controls span,.live-room-code small,.project-hint,.project-accuracy,.bits-description,.bits-head p,.bits-head .eyebrow,.bits-selected-title small,.bits-control,.bits-foot,.bits-foot a,.bits-status small,.piano-help,.piano-missions>p,.piano-song-guide p,.small-note,.activity-log-row small,.world-topic,.world-number,.studio-title p){color:var(--ui-muted)!important}
html[data-theme] :is(.secondary,.subtle,.top-button,.round-button,.part-selector button,.character-selector button,.phrase-choices button,.story-catalog button,.cue-navigation button,.editor-cue-tabs button,.visual-choices button,.bits-lab button,.project-toolbar button,.project-mode-switch button,.project-photo-tools button,.project-photo-tools a,.project-photo-thumbs button,.project-picker button,.piano-level,.saved-creation,.live-answers button,.student-quick button,.level-button,.pilot-card){background:var(--ui-soft)!important;color:var(--ui-text)!important;border:1px solid var(--ui-border)!important;border-radius:14px;box-shadow:none!important}
html[data-theme] :is(.primary,.bits-lab .bits-run){background:#9de9d0!important;color:#163f37!important;border-color:#80d5b8!important;box-shadow:0 3px 0 #5aab96!important}html[data-theme] :is(button[aria-pressed=true],#section-nav button[aria-current=page],.piano-level.selected,.ensemble-track.chosen,.level-button.current,.student-card.selected){background:var(--ui-selected)!important;color:var(--ui-accent)!important;border-color:var(--ui-accent)!important}html[data-theme] :is(input:not([type=range]):not([type=checkbox]),select,textarea){background:var(--ui-panel)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;border-radius:10px}html[data-theme] :is(.bits-tools,.bits-library,.bits-inspector,.bits-status,.bits-foot,.bits-guide,.ensemble-track,.journey-scene,.journey-cue,.body-beat,.body-avatar,.visual-choices,.preference-music,.creation-cover,.learning-badges span,.live-me,.live-rescue,.live-racetrack,.project-part,.stats,.reward-news,.skin-card,.lesson-notes,.mapping-grid,th){background:var(--ui-soft)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}html[data-theme] .bits-control output{color:var(--ui-accent)}html[data-theme] .bits-hold{background:#efd695!important;color:#473917!important}html[data-theme] .bits-lab .bits-run.running{background:#ad493f!important;color:white!important}html[data-theme] .ensemble-track>strong{background:var(--ui-panel)!important;color:var(--ui-accent)!important}html[data-theme] .s-note{fill:var(--ui-text);stroke:var(--ui-text)}html[data-theme] .s-beam{stroke:var(--ui-text)}html[data-theme] .story-caption{background:var(--ui-panel)!important;border-color:var(--ui-border)}html[data-theme] .story-caption :is(h2,p,span){color:var(--ui-text)!important}html[data-theme] .story-caption small{color:var(--ui-accent)}html[data-theme] .body-rhythm-choice{background:var(--ui-panel)!important;color:var(--ui-text)!important}html[data-theme] .piano-level :is(strong,small){color:var(--ui-text)!important}html[data-theme] footer{color:var(--ui-muted)!important}html[data-theme] .text-button{color:var(--ui-accent)}html[data-theme] button:focus-visible{outline:3px solid var(--ui-accent);outline-offset:3px}html[data-theme] dialog::backdrop{background:#0a101b99}html[data-theme] .live-me small{color:var(--ui-text)}html[data-theme] .project-photo-viewport>span{color:white}html[data-theme] .piano-white{color:#213c51!important}html[data-theme] .fall-note>strong{color:#16394a!important}html[data-theme] .bits-name-tag{background:var(--ui-panel)!important;color:var(--ui-text)!important}html[data-theme] .bits-name-tag.selected{background:var(--ui-selected)!important;color:var(--ui-accent)!important}html[data-theme] :is(.piano-hands>div,.piano-how-rules){background:var(--ui-soft)!important}html[data-theme] .piano-hands svg text{fill:var(--ui-text)}html[data-theme=dark] .piano-hands svg circle{fill:#283340}html[data-theme=dark] .piano-hands svg>text{fill:#edf2f7}html[data-theme] .piano-hands svg rect{stroke:var(--ui-border)}html[data-theme] #theme-toggle{white-space:nowrap;min-height:44px}html[data-theme=dark] :is(.dashboard-hero,.dashboard-teacher-strip,.dashboard-module,.dashboard-log,.dashboard-group-label,.dashboard-profile,.dashboard-module-copy,.dashboard-module-tag,.dashboard-art-label){background:var(--ui-panel)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}html[data-theme=dark] :is(.dashboard-hero-copy p,.dashboard-module-copy>span,.dashboard-module-copy small,.dashboard-teacher-strip p,.dashboard-log p,.dashboard-profile){color:var(--ui-muted)!important}html[data-theme=dark] .dashboard-module-copy>b{background:var(--ui-selected)!important;color:var(--ui-accent)!important}html[data-theme=dark] :is(.dashboard-orbit,.dashboard-hero-art){border-color:var(--ui-border)}html[data-theme] .studio-head{background:var(--ui-panel);color:var(--ui-text)}html[data-theme] table{background:var(--ui-panel);color:var(--ui-text)}html[data-theme] td{border-color:var(--ui-border)}
@media print{html[data-theme=dark]{--ui-bg:white;--ui-panel:white;--ui-soft:#eee;--ui-text:black;--ui-muted:#333;--ui-border:#999;--ui-accent:#235c4c;--ui-selected:#eee}#theme-toggle,[data-theme-toggle]{display:none!important}}

html[data-theme] :is(.planet-stop,.rhythm-arcade .arcade-game){background:var(--ui-panel)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}html[data-theme] :is(.piano-hud strong,.piano-hud small,#piano-status,#piano-message,.conductor p,.body-phrase p,.cue-rehearsal p){color:var(--ui-text)!important}html[data-theme=dark] .piano-hands svg text:not(:last-child){fill:#304864}html[data-theme=dark] .piano-hands svg circle+text{fill:#edf2f7}

html[data-theme] .planet-stop summary{background:var(--ui-soft)!important;color:var(--ui-text)!important}html[data-theme] .studio-shell button:not(.primary){background:var(--ui-soft)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}html[data-theme] .demo-banner{background:var(--ui-soft)!important;color:var(--ui-muted)!important}
/* Complete the dashboard's night palette, including its workshop wrapper. */
html[data-theme=dark] .music-dashboard{--dash-ink:var(--ui-text);--dash-muted:var(--ui-muted)}
html[data-theme=dark] .dashboard-workshop{background:var(--ui-soft)!important;border-color:var(--ui-border)!important;color:var(--ui-text)!important}
html[data-theme=dark] :is(.dashboard-module-copy>strong,.dashboard-hero h1,.dashboard-group-heading h2,.dashboard-teacher-strip h2,.dashboard-home .class-adventures h2,.dashboard-log h3,.student-adventure strong){color:var(--ui-text)!important}
html[data-theme=dark] :is(.dashboard-group-label,.brand-subtitle,.student-adventure small,.class-adventures p){color:var(--ui-muted)!important}
html[data-theme=dark] .dashboard-group-label{background:transparent!important}
html[data-theme=dark] :is(.dashboard-module-mark,.dashboard-teacher-icon){background:var(--ui-soft)!important;color:var(--ui-accent)!important;border:1px solid var(--ui-border)}
html[data-theme=dark] .dashboard-orbit{background:var(--ui-soft)!important}
html[data-theme=dark] .dashboard-orbit:before{background:var(--ui-selected)!important}
/* Navigation feedback stays visible on both light and night surfaces. */
html[data-theme] #section-nav button{color:var(--ui-muted)!important;transition:background-color .15s ease,color .15s ease,box-shadow .15s ease}
html[data-theme] #section-nav button[aria-current=page]{color:var(--ui-accent)!important}
html[data-theme] #section-nav button:focus-visible{background:var(--ui-selected)!important;color:var(--ui-accent)!important;box-shadow:0 0 12px color-mix(in srgb,var(--ui-accent),transparent 75%)!important}
@media(hover:hover){html[data-theme] #section-nav button:hover:not(:disabled){background:var(--ui-selected)!important;color:var(--ui-accent)!important;box-shadow:inset 0 0 0 1px var(--ui-accent),0 0 12px color-mix(in srgb,var(--ui-accent),transparent 75%)!important}html[data-theme] .dashboard-module:hover:not(:disabled){border-color:var(--ui-accent)!important;box-shadow:0 0 0 1px var(--ui-accent),0 6px 18px color-mix(in srgb,var(--ui-accent),transparent 83%)!important}}
@media(prefers-reduced-motion:reduce){html[data-theme] #section-nav button{transition:none}}
/* Photograph thumbnails must not multiply against the night background. */
html[data-theme=dark] :is(.bits-library img,.bits-selected-title img){mix-blend-mode:normal!important;filter:none!important;opacity:1;background:#f5f6f8;border:1px solid #aab7c4;border-radius:9px;padding:3px;flex-shrink:0}
html[data-theme=dark] .bits-library small{opacity:1;color:var(--ui-muted)}
html[data-theme=dark] .bits-library .bits-plus{color:var(--ui-accent)!important;opacity:1}
/* Shared mobile access: finger-sized controls and readable form text. */
@media(pointer:coarse){
 :is(.top-button,#section-nav button,.secondary,.primary,.project-toolbar button,.live-shell button){min-height:48px}
 :is(button,a,input,select){-webkit-tap-highlight-color:transparent}
 :is(input,select,textarea){font-size:16px}
 #section-nav{gap:8px;overflow-x:auto;touch-action:pan-x;scroll-padding:12px}
 .top-actions{gap:8px;flex-wrap:wrap}
}
@media(max-width:600px){
 .topbar{flex-wrap:wrap;gap:12px;padding:12px}.top-actions{width:100%;justify-content:flex-start}
 .top-actions .top-button{flex:1;white-space:nowrap}.brand{max-width:100%}
 body{padding-bottom:env(safe-area-inset-bottom,12px)}
}
html[data-theme=dark] .bits-example-tip{background:var(--ui-soft);color:var(--ui-text)}
html[data-theme] .bits-control output{color:var(--ui-accent)}
