/* One colour switch for all public pages and the admin panel. */
:root { --field-background: rgba(248, 248, 252, 0.85); }
html[data-theme="dark"] {
  color-scheme: dark;
  --background: #11101a;
  --surface: #1b1927;
  --surface-2: #242035;
  --surface-soft: rgba(244, 240, 255, 0.06);
  --soft: rgba(244, 240, 255, 0.06);
  --line: rgba(244, 240, 255, 0.14);
  --line-strong: rgba(244, 240, 255, 0.28);
  --text: #f4f0ff;
  --muted: #b1a8c6;
  --accent: #b39aff;
  --accent-2: #d293ff;
  --accent-3: #68d5ff;
  --success: #83d7a5;
  --danger: #ff99a3;
  --field-background: rgba(244, 240, 255, 0.04);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.theme-toggle:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
.topbar .account, .theme-header-actions { display: flex; align-items: center; gap: 8px; }
.theme-header-actions { flex-shrink: 0; }

@media (max-width: 700px) {
  .topbar:has(.account) .brand { flex: 1 1 120px; min-width: 0; }
  .topbar .account { flex: 0 0 auto; }
  .topbar .brand-mark { flex-shrink: 0; }
  body > header:not(.topbar) .wrap { height: auto; min-height: 64px; flex-wrap: wrap; padding-block: 12px; }
  body > header:not(.topbar) .theme-header-actions { margin-left: auto; }
}

/* The phone and natural instruments keep their own illustrative colours. */
html[data-theme="dark"] .topbar,
html[data-theme="dark"] body > header { background: rgba(17, 16, 26, 0.85); border-color: var(--line); }
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input.field,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .song-search-field,
html[data-theme="dark"] #golos-voice { background: var(--field-background); color-scheme: dark; }
html[data-theme="dark"] input[type="text"]:focus,
html[data-theme="dark"] input[type="email"]:focus,
html[data-theme="dark"] input[type="url"]:focus,
html[data-theme="dark"] input[type="password"]:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] .song-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
html[data-theme="dark"] ::placeholder { color: var(--muted); }
html[data-theme="dark"] .modal,
html[data-theme="dark"] .vinyl-tip { background: var(--surface); }
html[data-theme="dark"] .dock { background: rgba(27, 25, 39, 0.96); }
html[data-theme="dark"] .wave-bar { background: var(--line-strong); }
html[data-theme="dark"] .wave-bar.is-preview:not(.is-played) { background: rgba(244, 240, 255, 0.5); }
html[data-theme="dark"] .track:not(.is-locked):hover,
html[data-theme="dark"] .gi-answer:hover { background: var(--surface-soft); }
html[data-theme="dark"] .player.is-broken .player-toggle,
html[data-theme="dark"] .search-hit,
html[data-theme="dark"] .dock-line { background: var(--surface-soft); }
html[data-theme="dark"] .dock-level input::-webkit-slider-runnable-track { background: var(--line-strong); }
html[data-theme="dark"] .dock-level input::-moz-range-track { background: var(--line-strong); }
html[data-theme="dark"] .hero-accent {
  background-image: linear-gradient(110deg, var(--accent), var(--accent-2));
}
/* Keep white labels on saturated controls, with brighter accents for dark-page text. */
html[data-theme="dark"] body:not(.partners-page) .primary,
html[data-theme="dark"] .section-link[aria-current="page"],
html[data-theme="dark"] .nav-item.active,
html[data-theme="dark"] .tabs-thumb,
html[data-theme="dark"] .switch input:checked + i { background: linear-gradient(110deg, #471aff, #9500ff); }
html[data-theme="dark"] .primary.is-danger { background: #b03e47; }
html[data-theme="dark"] .console {
  --field-background: rgba(244, 240, 255, 0.04);
  --warning: #efbc74;
  --warning-soft: rgba(239, 188, 116, 0.1);
}
html[data-theme="dark"] .console select { color-scheme: dark; }

/* The partner constructor still previews its chosen saturated brand colours. */
html[data-theme="dark"]:has(.partners-page) {
  --accent: #471aff;
  --accent-2: #9500ff;
  --accent-3: #00bfff;
}
html[data-theme="dark"] .partners-page .grad {
  background-image: linear-gradient(100deg,
    color-mix(in srgb, var(--accent) 55%, white),
    color-mix(in srgb, var(--accent-2) 65%, white));
}
