/* The same scientific layers in both themes; no changes to magnitude scaling. */
:root[data-demo-theme="dark"] {
  --theme-bg:#08090c;--theme-surface:#0e1015;--theme-raised:#191c23;
  --theme-ink:#efeff2;--theme-muted:#adb2bf;--theme-rule:#454a55;
  --theme-accent:#80c8ef;--theme-accent-ink:#0c2333;--theme-selected:#192d40;--theme-selected-ink:#c2e5ff;
  --plot-bg:#08090c;--plot-axis:#a4a9b3;--plot-grid:#2b2e36;--plot-row:#101219;
  --blob-top:#8cceee;--blob-middle:#58a6e7;--blob-bottom:#32628e;--blob-selected:#d9edff;
}
:root[data-demo-theme] {
  color-scheme:dark;color:var(--theme-ink);background:var(--theme-bg);
  --ink:var(--theme-ink);--muted:var(--theme-muted);--rule:var(--theme-rule);--rule-dark:var(--theme-rule);
  --paper:var(--theme-surface);--soft:var(--theme-raised);--navy:var(--theme-accent);--navy-dark:var(--theme-selected-ink);
  --blue:var(--theme-accent);--blue-pale:var(--theme-selected);--accent:var(--theme-accent);--accent-pale:var(--theme-selected);
  --mint:var(--theme-accent);--line:var(--theme-rule);
}
:root[data-demo-theme] body.unified-demo {color:var(--theme-ink);background:var(--theme-bg);}
:root[data-demo-theme] .unified-demo :is(h1,h2,.site-nav__brand) {color:var(--theme-ink);}
:root[data-demo-theme] .unified-demo :is(.unified-heading p,.demo-jumps>span,.request-label,.paper-header,.paper-subtitle,.authors,.affiliations,.abstract-section>p,footer,.unified-note-time,.region-readout,.unavailable-reference) {color:var(--theme-muted);}
:root[data-demo-theme] .unified-demo :is(.control-label,.recording-picker,.demo-jumps a,.unified-research>summary,.site-nav__links a) {color:var(--theme-accent);}
:root[data-demo-theme] .unified-demo :is(.demo-shell,.unified-research) {background:var(--theme-surface);border-color:var(--theme-rule);}
:root[data-demo-theme] .unified-demo :is(.source-button,.instrument-demo-shell .source-button,.button,.viewer-switch button,.recording-picker select,.paper-links a) {background:var(--theme-raised);color:var(--theme-ink);border-color:var(--theme-rule);}
:root[data-demo-theme] .unified-demo :is(.source-button,.button,.viewer-switch button,.paper-links a):hover {background:var(--theme-selected);color:var(--theme-selected-ink);}
:root[data-demo-theme] .unified-demo :is(.source-button[aria-pressed=true],.instrument-demo-shell .source-button[aria-pressed=true],.viewer-switch button[aria-pressed=true],.paper-links a:first-child) {background:var(--theme-selected);color:var(--theme-selected-ink);border-color:var(--theme-accent);}
:root[data-demo-theme] .unified-demo .button--primary {background:var(--theme-accent);color:var(--theme-accent-ink);border-color:var(--theme-accent);}
:root[data-demo-theme] .unified-demo .source-button small {color:var(--theme-muted);}
:root[data-demo-theme] .unified-demo .instrument-icon {background:var(--theme-accent)!important;}
:root[data-demo-theme] #instrument-parts {border-color:var(--theme-rule);}
:root[data-demo-theme] .unified-demo :is(.unified-viewer,.score-section,.spectrogram-card,.instrument-note-lane-panel) {color:var(--theme-ink);background:var(--theme-surface);border-color:var(--theme-rule);}
:root[data-demo-theme] .unified-demo :is(.score-heading .control-label,.viewer-heading,.demo-heading .section-label,.unified-heading .section-label) {color:var(--theme-muted);}
:root[data-demo-theme] .unified-demo .paper-header h1 {font-size:clamp(25px,3vw,34px);}
:root[data-demo-theme] .unified-demo :is(button,a,select,input,summary):focus-visible {outline:2px solid var(--theme-accent);outline-offset:3px;}

/* Paper first, open by default, while the fold remains available for listening. */
.unified-demo .unified-research {margin:0 0 34px;padding:20px 24px;border:1px solid var(--rule);border-radius:16px;scroll-margin-top:20px;}
.unified-research>summary {font-size:12px;font-weight:600;cursor:pointer;}
.research-content {display:grid;grid-template-columns:minmax(0,.95fr) minmax(0,1.2fr);gap:32px;margin-top:20px;}
.research-content>.paper-header,.research-content>.abstract-section {padding:0;margin:0;min-width:0;}
.research-content .paper-header__inner {padding:0;}
.research-content .paper-subtitle {line-height:1.55;}
.research-content .authors {line-height:1.7;margin-bottom:9px;}
.research-content .abstract-section>p {font-size:13px;line-height:1.75;}
.research-content .abstract-section h2 {font-size:16px;margin:0 0 10px;}
/* Matching iframe chrome and plot/score stage. */
:root[data-demo-theme] body.embedded-station {background:var(--theme-surface);color:var(--theme-ink);}
:root[data-demo-theme] .embedded-station :is(.lab,.note-mode .inspector,.note-mode .scene-pane,.note-mode .transport) {background:var(--theme-surface);border-color:var(--theme-rule);}
:root[data-demo-theme] .embedded-station .listening-context::before,
:root[data-demo-theme] .embedded-station :is(.listening-context,.seek-labels,.score-footer>span,.guided-score-heading span) {color:var(--theme-muted);}
:root[data-demo-theme] .embedded-station .guided-score-heading h3 {color:var(--theme-ink);}
:root[data-demo-theme] .embedded-station :is(.compare,.quiet,.score-footer button,.view-switch button) {background:var(--theme-raised);border-color:var(--theme-rule);color:var(--theme-ink);}
:root[data-demo-theme] .embedded-station :is(#guided-method,.solo-actions,.compare[aria-pressed=true]) {background:var(--theme-selected);color:var(--theme-selected-ink);border-color:var(--theme-rule);}
:root[data-demo-theme] .embedded-station .solo-actions button {color:var(--theme-selected-ink);border-color:var(--theme-accent);}
:root[data-demo-theme] .embedded-station .note-mode .play {background:var(--theme-accent);color:var(--theme-accent-ink);}
:root[data-demo-theme] :is(.note-spatial,.note-mode .viewport,#note-roll,.piano-roll,.instrument-note-lane,.instrument-spatial-frame) {background:var(--plot-bg);border-color:var(--theme-rule);}
:root[data-demo-theme] :is(.spatial-label,.axis-tag,.roll-label,.score-footer,.instrument-note-lane-meta) {color:var(--plot-axis);fill:var(--plot-axis);text-shadow:none;}
:root[data-demo-theme] :is(.spatial-note-label,.note-mode .layer-tag) {background:var(--theme-surface);color:var(--theme-ink);border:1px solid var(--theme-rule);box-shadow:none;}
:root[data-demo-theme] :is(.roll-grid,.roll-key) {stroke:var(--plot-grid);}
:root[data-demo-theme] .roll-note {stroke:var(--blob-middle);}
:root[data-demo-theme] :is(.roll-note--selected,.roll-note--hovered) {stroke:var(--blob-selected);filter:none;}
:root[data-demo-theme] .piano-roll :is(.roll-note:hover,.roll-note:focus,.roll-note--hovered) {fill:var(--blob-top);}
:root[data-demo-theme] #note-roll svg>line {stroke:var(--plot-grid);}
:root[data-demo-theme] #roll-note-gradient stop:nth-child(1) {stop-color:var(--blob-top);}
:root[data-demo-theme] #roll-note-gradient stop:nth-child(2) {stop-color:var(--blob-middle);}
:root[data-demo-theme] #roll-note-gradient stop:nth-child(3) {stop-color:var(--blob-bottom);}
:root[data-demo-theme] #roll-note-selected-gradient stop:nth-child(1) {stop-color:var(--blob-top);}
:root[data-demo-theme] #roll-note-selected-gradient stop:nth-child(2) {stop-color:var(--blob-middle);}
:root[data-demo-theme] #roll-note-selected-gradient stop:nth-child(3) {stop-color:var(--blob-bottom);}
:root[data-demo-theme] #note-roll svg>rect {fill:var(--plot-row);}
:root[data-demo-theme] #note-roll svg>rect:nth-of-type(even) {fill:var(--plot-bg);}
:root[data-demo-theme] #note-roll svg>text {fill:var(--plot-axis);}
:root[data-demo-theme] #note-roll .roll-note path:not(.note-hit) {fill:var(--voice-color,var(--blob-middle));stroke:var(--blob-bottom);filter:none;}
:root[data-demo-theme] #note-roll :is(.roll-note.sounding,.roll-note[aria-pressed=true],.roll-note:hover) path:not(.note-hit) {stroke:var(--blob-selected);}
:root[data-demo-theme] #note-roll .roll-note text {fill:var(--theme-ink);}
:root[data-demo-theme] .unified-demo :is(.spectrogram-meta,.spectrogram-card .hint) {background:var(--theme-raised);color:var(--theme-muted);}
:root[data-demo-theme] .unified-demo .spectrogram-axis {color:var(--plot-axis);}
:root[data-demo-theme] :is(input[type=range],input[type=checkbox]) {accent-color:var(--theme-accent);}
:root[data-demo-theme] .demo-shell {box-shadow:none;}
.spectrum-legend {padding:9px 3px 0;color:var(--theme-muted,#aab2bf);font:10px/1.5 system-ui,sans-serif;overflow-wrap:anywhere;}
.spectrum-legend::before {content:'';display:inline-block;width:14px;border-top:2px solid var(--plot-axis,#aab2bf);margin-right:7px;vertical-align:middle;}
.workspace>.spectrum-legend {padding:9px 16px;}
.note-spatial[data-projection=spectrum],.note-mode .viewport[data-projection=spectrum] {height:370px!important;max-height:none;}
.spectrum-legend[data-projection=spectrum] {display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;}
.spectrum-legend[data-projection=spectrum]::before {display:none;}
.flat-spectrum-labels {position:absolute;inset:0;pointer-events:none;overflow:hidden;}
.flat-spectrum-labels>* {position:absolute;white-space:nowrap;font:10px/1.3 system-ui,sans-serif;color:var(--plot-axis,#aab2bf);}
.spectrum-legend .flat-spectrum-title {background:none;border:0;border-left:3px solid var(--spectrum-color);border-radius:0;padding:5px 8px;font:inherit;font-weight:600;color:var(--theme-ink,#efeff2);white-space:normal;text-align:left;cursor:pointer;}
.flat-spectrum-title:is(button):hover {text-decoration:underline;text-underline-offset:3px;}
.flat-frequency {transform:translateY(-50%);width:34px;text-align:right;font-size:9px;}
.flat-time {font-size:9px;}
.shared-score-navigation {display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-top:12px;}
.score-navigation-buttons {display:flex;gap:5px;}
.shared-score-navigation .quiet {display:inline-flex;align-items:center;justify-content:center;min-width:30px;min-height:30px;padding:5px;background:var(--theme-raised);color:var(--theme-ink);border:1px solid var(--theme-rule);border-radius:5px;font:14px/1 system-ui;cursor:pointer;}
.shared-score-navigation .quiet:hover {background:var(--theme-selected);border-color:var(--theme-accent);}
@media(max-width:800px){.research-content{grid-template-columns:minmax(0,1fr);gap:22px;}.unified-demo .unified-research{padding:18px;}}
