/* The theme control stays available even when the playback engine is offline. */
.theme-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

:root[data-theme="dark"] {
  --ink: #e0e9df;
  --green: #9bcea9;
  --accent: #83bd94;
  --paper: #1d2822;
  --muted: #afbaab;
  --line: #3b4b40;
  --light: #28372d;
  color-scheme: dark;
  background: #151d19;
}
:root[data-theme="dark"] button:hover { background: var(--light); }
:root[data-theme="dark"] :is(button, a, select, input, summary, #score-scroll):focus-visible {
  outline-color: var(--green);
}
:root[data-theme="dark"] :is(
  .collection-label span, .eyebrow,
  .work-heading p, .status, .location, #time-now span,
  .transport #last-jump, .transport #restart, .jump-row form,
  .tempo-value strong span, #bpm, .range-captions, .saved-label,
  .modes button, .hint, .bookmark .bookmark-go small, .bookmark .bookmark-edit,
  .more-settings, .sidebar-footer, .sidebar-footer a, .edition-label,
  .score-actions, .score-actions output, .score-context, .interaction-hint,
  #score-loading, .score-bottom, .dialog-note
) { color: var(--muted); }
:root[data-theme="dark"] .status.error { color: #ffab97; }
:root[data-theme="dark"] :is(.play-button, .primary-button) {
  color: #14251b;
  background: var(--green);
}
:root[data-theme="dark"] :is(.play-button, .primary-button):hover { background: #b1dfbd; }
:root[data-theme="dark"] .modes { background: #151f19; border-color: var(--line); }
:root[data-theme="dark"] .modes button.selected { color: var(--green); }
:root[data-theme="dark"] .bookmark .bookmark-go span:first-child { color: var(--green); }
:root[data-theme="dark"] :is(.score-toolbar, .score-bottom) {
  background: #202c24;
  border-color: var(--line);
}
:root[data-theme="dark"] .edition-label { border-color: var(--line); }
:root[data-theme="dark"] .divider { background: var(--line); }
:root[data-theme="dark"] #score-scroll { scrollbar-color: #4c6050 transparent; }
:root[data-theme="dark"] .loading-mark { color: var(--green); }
:root[data-theme="dark"] .score-page {
  background: #cbbd9e;
  border-color: var(--line);
  box-shadow: 0 3px 20px #0004;
}
/* Keep black notation on dim sepia paper, including SVGs with white backgrounds.
   Blend only the printed image, leaving the interactive overlay untouched. */
:root[data-theme="dark"] .score-page img { filter: none; mix-blend-mode: multiply; }
:root[data-theme="dark"] .measure-hit:hover { fill: #35664d20; }
:root[data-theme="dark"] .measure-hit:focus { fill: #35664d28; stroke: #35664d; }
:root[data-theme="dark"] .active-measure { fill: #35664d0c; }
:root[data-theme="dark"] .playback-line { stroke: #35664d; }
:root[data-theme="dark"] .cursor-handle { fill: #35664d; }
:root[data-theme="dark"] .cursor-target:focus { stroke: #35664d45; }
:root[data-theme="dark"] :is(.legend-note, .legend-cursor) { background: var(--green); }
:root[data-theme="dark"] #input-value { background: #151f19; }
/* The legacy player's document keeps its own original colors. */
#engine { color-scheme: light; }
