:root {
  color-scheme: dark;
  --ink: #0e0d12;
  --surface: #16151c;
  --well: #1e1d26;
  --text: #f3ede2;
  --muted: #9a96a6;
  --accent: #ff7a3d;
  --ok: #c6f45e;
  --pink: var(--accent); /* Read by the existing waveform renderer. */
  --border: #34313e;
  --control-border: #726d80;
  --accent-quiet: #302019;
  --radius: 16px;
  --card-padding: 24px;
  --shadow: 0 8px 24px #07060b38;
  --heading: Bahnschrift, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  --topbar: 72px;
  --anchor: 232px;
  --level: 0;
  --pos: 0;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 .9375rem/1.5 var(--body);
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1, h2, h3 { font-family: var(--heading); font-weight: 600; }
h2 { font-size: 1.375rem; line-height: 1.15; letter-spacing: -.025em; }
h3 { font-size: 1.0625rem; line-height: 1.25; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
:is(a, button, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[id^="stage-"] { scroll-margin-top: var(--anchor); }
.step-body :is(button, input, select) { scroll-margin-top: var(--anchor); }

.shell { width: min(1040px, calc(100% - 64px)); margin-inline: auto; }
.card {
  padding: var(--card-padding);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.icon {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  min-height: calc(var(--topbar) - 1px);
  display: grid;
  grid-template-columns: 1fr minmax(320px, 430px) 1fr;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font: 650 1.4375rem/1 var(--heading);
  letter-spacing: -.045em;
}
.brand .icon { width: 26px; height: 26px; color: var(--accent); }
.privacy {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .75rem;
  white-space: nowrap;
}
.privacy .icon { width: 14px; height: 14px; }
#stageNav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
#stageNav a {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 3px;
}
#stageNav a::after {
  content: "";
  height: 3px;
  border-radius: 2px;
  background: var(--border);
}
#stageNav a:hover, #stageNav a.is-current { color: var(--text); }
#stageNav a.is-current::after { background: var(--accent); }
body:is([data-stage="treat"], [data-stage="norm"], [data-stage="remix"], [data-stage="export"]) [data-stage-link="load"]::after,
body:is([data-stage="norm"], [data-stage="remix"], [data-stage="export"]) [data-stage-link="treat"]::after,
body:is([data-stage="remix"], [data-stage="export"]) [data-stage-link="norm"]::after,
body[data-stage="export"] [data-stage-link="remix"]::after { background: var(--ok); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 9fr) minmax(0, 11fr);
  align-items: center;
  gap: 32px;
  padding-block: 48px 32px;
}
.hero-copy h1 {
  font-size: clamp(2.875rem, 5.4vw, 4.875rem);
  line-height: .96;
  letter-spacing: -.065em;
}
.hero-copy em { color: var(--accent); font-style: normal; }
.hero-copy p { margin-top: 16px; color: var(--muted); font-size: 1rem; }
.drop-wrap { position: relative; min-width: 0; }
.dropzone {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 248px;
  cursor: pointer;
  text-align: center;
  border-color: #825139;
  background-color: var(--surface);
  background-image:
    radial-gradient(ellipse at 50% 55%, #3b241d 0%, transparent 76%),
    linear-gradient(#f3ede209 1px, transparent 1px),
    linear-gradient(90deg, #f3ede209 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
  background-position: center;
}
.drop-art {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #0002 8%, #0009 56%, transparent 97%);
}
.art-axis { opacity: .3; }
.art-signal { opacity: .78; animation: breathe 7s ease-in-out infinite alternate; transform-origin: center; }
.art-echo {
  opacity: .25;
  transform-origin: center;
  animation: breathe-echo 8s ease-in-out infinite alternate;
}
@keyframes breathe { from { transform: scaleY(.83); opacity: .5; } to { transform: scaleY(1.13); opacity: .9; } }
@keyframes breathe-echo { from { transform: scale(-1, .64); opacity: .22; } to { transform: scale(-1, 1.11); opacity: .47; } }
.drop-content { display: grid; justify-items: center; gap: 12px; }
.drop-title { font: 600 1.5rem/1.1 var(--heading); letter-spacing: -.02em; }
.drop-formats { color: var(--muted); font-size: .8125rem; }
.dropzone:is(:hover, .is-dragging), .stem-slot:is(:hover, .is-dragging) {
  border-color: var(--accent);
}
.dropzone.is-dragging, .stem-slot.is-dragging { box-shadow: 0 0 0 3px #ff7a3d44; }
.sr-only:focus-visible + :is(.dropzone, .stem-slot) { outline: 2px solid var(--accent); outline-offset: 4px; }

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--well);
  color: var(--text);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}
.button:not(:disabled):hover { border-color: var(--muted); background: #2b2935; }
.button.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--ink);
}
.button.primary:not(:disabled):hover,
.dropzone:hover .button.primary { background: #ff925e; border-color: transparent; }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button:disabled { background: var(--well); border-color: var(--border); color: var(--muted); }
.button.is-ready::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  border-radius: inherit;
  pointer-events: none;
  animation: ready 3s ease-out infinite;
}
@keyframes ready {
  0%, 62% { transform: scale(1, 1); opacity: 0; }
  69% { opacity: .55; }
  100% { transform: scale(1.035, 1.22); opacity: 0; }
}

.dock {
  position: sticky;
  top: var(--topbar);
  z-index: 10;
  display: grid;
  gap: 8px;
  padding-block: 8px;
  margin-top: -8px;
  background: linear-gradient(var(--ink) 88%, transparent);
}
.player {
  display: grid;
  grid-template-columns: minmax(144px, 1.1fr) minmax(120px, 1.5fr) auto;
  align-items: center;
  gap: 16px;
}
.player-track, .player-controls, .player-volume, .segment {
  display: flex;
  align-items: center;
  min-width: 0;
}
.player-track, .player-controls { gap: 16px; }
.play {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--control-border);
  background: var(--well);
  color: var(--text);
}
.play:hover { border-color: var(--accent); }
.play .pause-icon, body[data-playing="true"] .play .play-icon { display: none; }
body[data-playing="true"] .play .pause-icon { display: block; }
body[data-has-file="true"] .play { border-color: var(--accent); color: var(--accent); background: var(--accent-quiet); }
.play::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid var(--accent);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}
body[data-playing="true"] .play::after {
  opacity: calc(.15 + var(--level) * .5);
  transform: scale(calc(1 + .14 * var(--level)));
}
.track-detail { min-width: 0; }
.track-detail > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-detail strong { font-weight: 600; }
#fileMeta, .time, output, .readouts dd, .step-badge, .guide-step, .loudness-options span {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
#fileMeta { color: var(--muted); font-size: .75rem; }
.wave-panel {
  position: relative;
  min-width: 0;
  padding: 0 8px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ink);
}
#wave { display: block; width: 100%; height: 32px; }
body[data-has-file="true"] #wave { cursor: crosshair; }
.time { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .6875rem; }
.segment {
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ink);
}
.segment button {
  min-height: 44px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: .8125rem;
}
.segment .is-active { color: var(--text); background: var(--well); border-color: var(--border); }
.segment button:not(:disabled):hover { color: var(--text); }
.segment button:disabled { color: var(--muted); }
.player-volume { gap: 8px; color: var(--muted); }
.player-volume label { display: inline-flex; cursor: pointer; }
.player-volume input { width: 80px; }

.guide {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
}
.guide-step { position: relative; flex: none; color: var(--accent); font-size: .6875rem; letter-spacing: .025em; }
.guide-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: .8125rem; }
.guide-copy > span { color: var(--muted); }
.guide.pop .guide-copy { animation: guide-in 240ms ease-out both; }
.guide.is-busy .guide-step { animation: working 1.35s ease-in-out infinite alternate; }
@keyframes guide-in { from { transform: translateY(3px); opacity: .55; } to { transform: translateY(0); opacity: 1; } }
@keyframes working { from { opacity: 1; } to { opacity: .72; } }

.workflow { display: grid; gap: 16px; margin-top: 16px; }
.step.is-active { border-color: #9f5938; box-shadow: 0 0 0 2px #ff7a3d24, var(--shadow); }
.step-header { display: flex; align-items: center; gap: 16px; }
.step-heading { min-width: 0; flex: 1; }
.step-heading p { margin-top: 4px; color: var(--muted); font-size: .875rem; }
.step-badge {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--well);
  color: var(--muted);
  font-size: .8125rem;
}
.step.is-active .step-badge { border-color: #9f5938; background: var(--accent-quiet); color: var(--accent); }
.step-check { display: none; }
.step.is-done .step-badge { color: var(--ok); }
.step.is-done .step-badge > span, .step.is-locked .step-description { display: none; }
.step.is-done .step-check, .stem-slot.has-file > .step-check { display: block; }
.step-locked, .optional {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .75rem;
}
.step-locked .icon { width: 14px; height: 14px; }
.step.is-locked .step-locked, .optional { display: inline-flex; }
.step-expand { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 300ms ease; }
.step-clip {
  min-height: 0;
  overflow: clip;
  visibility: visible;
  transition: visibility 0s;
}
.step.is-locked .step-expand { grid-template-rows: 0fr; }
.step.is-locked .step-clip { visibility: hidden; transition-delay: 300ms; pointer-events: none; }
.step-body {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 16px 4px 4px;
  border-top: 1px solid var(--border);
}
.inline-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
.actions, .export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status { color: var(--muted); font-size: .875rem; }
.status:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
body[data-leveled="true"] #lufsAfter { color: var(--ok); }

.loudness-options, .preset-grid, .control-grid, .readouts, .trim-fields, .stem-grid, .moves {
  display: grid;
  gap: 8px;
}
.loudness-options, .readouts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--well);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
}
.choice:not(:disabled):hover { border-color: var(--text); }
.choice.is-active { border-color: var(--accent); background: var(--accent-quiet); color: var(--accent); }
.choice:disabled { color: var(--muted); }
.choice.pop { animation: press-pop 250ms ease-out; }
@keyframes press-pop { 0% { transform: scale(.96); } 65% { transform: scale(1.025); } 100% { transform: scale(1); } }
.loudness-options span { color: var(--muted); font-size: .75rem; }
.readouts {
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.readouts dt { color: var(--muted); font-size: .75rem; }
.readouts dd { margin-top: 4px; font-size: .8125rem; }
.preset-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.preset { min-height: 72px; gap: 8px; }
.preset .icon { color: var(--muted); }
.preset.is-active .icon { color: var(--accent); }
.preset-info {
  padding: 8px 12px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: .875rem;
}
.preset-info b { color: var(--text); margin-inline-end: 4px; }
.control-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.control {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}
.control h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.control h3 .icon { color: var(--accent); }

.slider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  min-width: 0;
}
.slider label, .field label, .switch-row label { font-size: .875rem; }
.slider output { color: var(--muted); font-size: .75rem; }
.slider input { grid-column: 1 / -1; width: 100%; }
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  --range-track: linear-gradient(to right, var(--accent) 0 var(--p, 0%), var(--control-border) var(--p, 0%) 100%);
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--range-track); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--range-track); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
.field { display: grid; gap: 6px; min-width: 0; }
.field :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--well);
  color: var(--text);
  font-size: .875rem;
}
.field input::placeholder { color: var(--muted); }
.field input[type="number"] { font-family: var(--mono); }
.trim-fields, .stem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.switch-row, .save-row { display: flex; align-items: center; gap: 8px; }
.switch-row { justify-content: space-between; }
.switch {
  flex: none;
  display: grid;
  align-items: center;
  width: 48px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.switch > span {
  position: relative;
  height: 24px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--well);
}
.switch > span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  transition: transform 160ms ease;
}
.switch[aria-checked="true"] { color: var(--accent); }
.switch[aria-checked="true"] > span { border-color: var(--accent); background: var(--accent-quiet); }
.switch[aria-checked="true"] > span::after { transform: translateX(24px); }
#myPresets { display: grid; gap: 8px; list-style: none; padding: 0; }
#myPresets:empty, #myPresets:not(:empty) + #myEmpty { display: none; }
#myPresets li { display: flex; align-items: center; gap: 8px; }
#myPresets button {
  min-height: 44px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  color: var(--text);
  background: var(--well);
}
#myPresets .mine { flex: 1; min-width: 0; padding: 8px 12px; text-align: left; overflow-wrap: anywhere; }
#myPresets .del { flex: none; width: 44px; color: var(--muted); }
.export-actions { gap: 12px 16px; }
.export-button { min-height: 48px; padding-inline: 24px; }

.stems { display: grid; gap: 16px; }
.stem-grid { gap: 16px; }
.stem-grid > div { position: relative; min-width: 0; }
.stem-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 16px;
  border: 1px dashed var(--control-border);
  border-radius: 8px;
  background: var(--well);
  color: var(--muted);
  cursor: pointer;
}
.stem-slot > span { display: grid; flex: 1; min-width: 0; font-size: .8125rem; overflow-wrap: anywhere; }
.stem-slot b { color: var(--text); font-weight: 600; }
.stem-slot > .step-check { color: var(--ok); }
#driftCurve {
  display: block;
  width: 100%;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ink);
}

.howto { margin-block: 48px 32px; }
.moves {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  padding: 0;
  list-style: none;
}
.moves .icon { margin-bottom: 16px; color: var(--accent); }
.moves p { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-block: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .8125rem;
}
.footer > span:first-child { display: flex; align-items: center; gap: 8px; }
#toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  transform: translate(-50%, 8px);
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--well);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  text-align: center;
  font-size: .875rem;
}
#toast:not(:empty) { opacity: 1; transform: translate(-50%, 0); }
.reveal { opacity: 0; transform: translateY(8px); transition: opacity 320ms ease, transform 320ms ease; transition-delay: var(--d, 0ms); }
.reveal.in, .reveal:focus-within { opacity: 1; transform: none; }

@media (max-width: 960px) {
  :root { --anchor: 264px; }
  .shell { width: calc(100% - 48px); }
  .topbar-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .player { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .wave-panel { grid-column: 1 / -1; grid-row: 2; }
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  :root { --topbar: 97px; --anchor: 322px; --card-padding: 16px; }
  .shell { width: calc(100% - 32px); }
  .topbar-inner { grid-template-columns: 1fr auto; gap: 0 8px; padding-block: 4px; }
  #stageNav { grid-column: 1 / -1; grid-row: 2; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding-block: 32px 24px; }
  .hero-copy h1 { font-size: clamp(2.875rem, 9vw, 3.75rem); }
  .hero-copy p { margin-top: 12px; }
  .dropzone { min-height: 192px; }
  .player { gap: 8px; }
  .player-track, .player-controls { gap: 8px; }
  .player-volume input { width: 56px; }
  .guide { gap: 8px; align-items: baseline; padding-inline: 8px; }
  .guide-copy { font-size: .75rem; }
  .inline-controls { grid-template-columns: 1fr; gap: 8px; }
  .loudness-options, .readouts, .moves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .howto { margin-block: 32px 24px; }
}
@media (max-width: 480px) {
  :root { --anchor: 386px; }
  h2 { font-size: 1.1875rem; }
  .player { grid-template-columns: minmax(0, 1fr); }
  .player-controls { justify-content: space-between; }
  .player-volume input { width: 72px; }
  .wave-panel { grid-row: auto; }
  .step-header { gap: 8px; }
  .step-badge { width: 32px; height: 32px; }
  .step-locked { text-align: right; line-height: 1.25; max-width: 83px; }
  .step-locked .icon { display: none; }
  .step-body { padding-inline: 3px; }
  .control-grid, .stem-grid { grid-template-columns: minmax(0, 1fr); }
  .optional { align-self: flex-start; }
  .export-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
  body[data-playing="true"] .play::after { transform: none; opacity: .5; }
}
@media (forced-colors: active) {
  #stageNav a::after { background: GrayText; forced-color-adjust: none; }
  #stageNav a.is-current::after { background: Highlight; }
  input[type="range"] { forced-color-adjust: none; --range-track: ButtonText; }
  input[type="range"]::-webkit-slider-thumb { background: Highlight; }
  input[type="range"]::-moz-range-thumb { background: Highlight; }
  :is(a, button, input, select):focus-visible { outline-color: Highlight; }
}

/* ===== ocean theme: light, airy, with moving waves ===== */
:root{color-scheme:light;--ink:#eaf9fd;--surface:#ffffff;--well:#e3f4fa;--text:#0c2f40;--muted:#4a6a79;--accent:#0a85b0;--ok:#12a36b;--pink:#0a85b0;--border:#c3e2ed;--control-border:#7fb3c6;--accent-quiet:#d8f1f8;--shadow:0 12px 32px #0a5a7a1f;--wave-rest:#8cc9de;--wave-cut:#cfe8f1;--wave-head:#0c2f40;--curve-before:#e0701f;--curve-after:#12a36b}
body{background:linear-gradient(180deg,#f4fdff 0%,#d6f2fa 42%,#a6dded 100%) fixed;color:var(--text)}
.sea{position:fixed;left:0;right:0;bottom:0;height:170px;pointer-events:none;z-index:0;overflow:hidden}
.sea i{position:absolute;left:0;bottom:0;width:200%;height:100%;background-repeat:repeat-x;background-size:50% 100%;will-change:transform}
.sea i:nth-child(1){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60C200 0 400 120 600 60S1000 0 1200 60V120H0Z' fill='%237fd0e6'/%3E%3C/svg%3E");opacity:.55;height:78%;animation:tide 22s linear infinite}
.sea i:nth-child(2){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60C200 0 400 120 600 60S1000 0 1200 60V120H0Z' fill='%233fb1d3'/%3E%3C/svg%3E");opacity:.5;height:58%;animation:tide 15s linear infinite reverse}
.sea i:nth-child(3){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60C200 0 400 120 600 60S1000 0 1200 60V120H0Z' fill='%230a85b0'/%3E%3C/svg%3E");opacity:.42;height:38%;animation:tide 10s linear infinite}
@keyframes tide{from{transform:translateX(0)}to{transform:translateX(-50%)}}
header,main,footer,.topbar{position:relative;z-index:1}
.topbar{background:#f4fdffeb;border-bottom:1px solid var(--border);position:sticky}
.card,.step,.player-card,.hero-card{background:var(--surface)}
.button:not(:disabled):hover{background:#d8f1f8}
.button.primary{background:linear-gradient(#17a6cf,#0a85b0);color:#fff;border-color:transparent;box-shadow:0 6px 16px #0a85b033}
.button.primary:not(:disabled):hover,.dropzone:hover .button.primary{background:linear-gradient(#27b8e0,#0e93c1);border-color:transparent}
.button:disabled{background:var(--well);color:var(--muted)}
.step.is-active{border-color:#0a85b0;box-shadow:0 0 0 3px #0a85b022,var(--shadow)}
.dropzone,.stem-slot{border-color:#5fb7d3;background-color:#f4fcff;color:var(--accent);background-image:radial-gradient(ellipse at 50% 55%,#c9eef8 0%,transparent 76%),linear-gradient(#0a85b012 1px,transparent 1px),linear-gradient(90deg,#0a85b012 1px,transparent 1px)}
.dropzone:is(:hover,.is-dragging),.stem-slot:is(:hover,.is-dragging){border-color:var(--accent)}
.dropzone.is-dragging,.stem-slot.is-dragging{box-shadow:0 0 0 3px #0a85b044}
.dropzone :is(h2,h3,b,strong){color:var(--text)}
.is-ready::after,.button.is-ready::after{border-color:var(--accent)}
::selection{background:#bfeaf6;color:var(--text)}

/* ===== v6: glass ocean (deep, saturated, translucent, round) ===== */
:root{color-scheme:dark;--ink:#0a6cc4cc;--surface:#ffffff24;--well:#ffffff1f;--text:#ffffff;--muted:#d4ecfa;--accent:#ffc861;--ok:#6dffc8;--pink:#ffe58a;--border:#ffffff57;--control-border:#ffffff8c;--accent-quiet:#ffffff26;--radius:28px;--shadow:0 18px 50px #03285f4d,inset 0 1px 0 #ffffff59;--wave-rest:#ffffff8c;--wave-cut:#ffffff2e;--wave-head:#ffffff;--curve-before:#ffc861;--curve-after:#6dffc8}
body{background:linear-gradient(165deg,#12c4cf 0%,#0b86d6 34%,#2b4fcf 68%,#6a38c2 100%) fixed;color:var(--text)}
.orbs i{position:fixed;border-radius:50%;pointer-events:none;z-index:0;will-change:transform}
.orbs i:nth-child(1){width:46vmax;height:46vmax;left:-14vmax;top:-16vmax;background:radial-gradient(circle at 35% 35%,#ffffff55,#7ff0ff22 45%,transparent 70%);animation:floaty 26s ease-in-out infinite alternate}
.orbs i:nth-child(2){width:38vmax;height:38vmax;right:-12vmax;top:18vh;background:radial-gradient(circle at 60% 40%,#ff8fd144,#ff8fd10f 50%,transparent 70%);animation:floaty 32s ease-in-out infinite alternate-reverse}
.orbs i:nth-child(3){width:30vmax;height:30vmax;left:20vw;bottom:-10vmax;background:radial-gradient(circle,#ffe58a40,transparent 68%);animation:floaty 30s ease-in-out infinite alternate}
@keyframes floaty{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(6vw,5vh,0) scale(1.12)}}
.bubbles b{position:fixed;bottom:-60px;border-radius:50%;pointer-events:none;z-index:0;background:radial-gradient(circle at 30% 28%,#ffffffb3,#ffffff29 40%,#ffffff0f 70%);border:1px solid #ffffff66;animation:rise linear infinite;will-change:transform}
@keyframes rise{0%{transform:translate3d(0,0,0);opacity:0}10%{opacity:.9}100%{transform:translate3d(30px,-112vh,0);opacity:0}}
.bubbles b:nth-child(1){left:6%;width:18px;height:18px;animation-duration:19s;animation-delay:-3s}
.bubbles b:nth-child(2){left:14%;width:34px;height:34px;animation-duration:26s;animation-delay:-11s}
.bubbles b:nth-child(3){left:23%;width:12px;height:12px;animation-duration:17s;animation-delay:-6s}
.bubbles b:nth-child(4){left:33%;width:26px;height:26px;animation-duration:23s;animation-delay:-1s}
.bubbles b:nth-child(5){left:46%;width:16px;height:16px;animation-duration:21s;animation-delay:-14s}
.bubbles b:nth-child(6){left:57%;width:40px;height:40px;animation-duration:29s;animation-delay:-8s}
.bubbles b:nth-child(7){left:68%;width:14px;height:14px;animation-duration:18s;animation-delay:-4s}
.bubbles b:nth-child(8){left:77%;width:28px;height:28px;animation-duration:25s;animation-delay:-16s}
.bubbles b:nth-child(9){left:86%;width:20px;height:20px;animation-duration:22s;animation-delay:-9s}
.bubbles b:nth-child(10){left:94%;width:32px;height:32px;animation-duration:27s;animation-delay:-2s}

.sea{height:190px}
.sea i:nth-child(1){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60C200 0 400 120 600 60S1000 0 1200 60V120H0Z' fill='%23ffffff'/%3E%3C/svg%3E");opacity:.2;height:80%}
.sea i:nth-child(2){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60C200 0 400 120 600 60S1000 0 1200 60V120H0Z' fill='%23ffffff'/%3E%3C/svg%3E");opacity:.16;height:60%}
.sea i:nth-child(3){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60C200 0 400 120 600 60S1000 0 1200 60V120H0Z' fill='%230a3a8a'/%3E%3C/svg%3E");opacity:.5;height:40%}
.topbar{background:#0a6cc473;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);border-bottom:1px solid #ffffff4d}
.card,.step,.player-card,.hero-card,.hero>*[class*="card"]{background:linear-gradient(145deg,#ffffff2e,#ffffff14);border:1px solid #ffffff59;border-radius:var(--radius);box-shadow:var(--shadow)}
.player-card{-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}
.guide,.step-guide{background:#0a6cc47a;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid #ffffff4d;border-radius:999px}
.step.is-active{border-color:#ffffffcc;box-shadow:0 0 0 4px #ffffff26,0 24px 64px #03285f59,inset 0 1px 0 #ffffff80}
.step.is-locked{opacity:.78}
.button,.preset,[data-preset],[data-lufs],select,input[type=number],input[type=text]{border-radius:999px}
.button{background:#ffffff26;border:1px solid #ffffff73;color:#fff}
.button:not(:disabled):hover{background:#ffffff40;border-color:#fff}
.button.primary{background:linear-gradient(135deg,#ffe58a,#ffa766);color:#05305a;border:0;box-shadow:0 10px 26px #ff9a4a59,inset 0 1px 0 #fff9;font-weight:700}
.button.primary:not(:disabled):hover,.dropzone:hover .button.primary{background:linear-gradient(135deg,#fff0a8,#ffb685);border:0;transform:translateY(-2px)}
.button:disabled{background:#ffffff14;color:#ffffff8c;border-color:#ffffff33;box-shadow:none}
[data-preset],[data-lufs]{background:#ffffff1f;border:1px solid #ffffff5c;border-radius:20px;color:#fff;transition:transform .25s cubic-bezier(.2,.8,.2,1),background .2s,border-color .2s}
[data-preset]:hover,[data-lufs]:hover{background:#ffffff38;transform:translateY(-3px)}
[data-preset].is-active,[data-lufs].is-active{background:linear-gradient(145deg,#ffffff59,#ffffff2b);border-color:#fff;box-shadow:0 8px 22px #03285f40,inset 0 1px 0 #fff9}
.dropzone,.stem-slot{background:linear-gradient(145deg,#ffffff2b,#ffffff12);border:1.5px dashed #ffffffa6;color:#fff;border-radius:34px;background-image:none}
.dropzone:is(:hover,.is-dragging),.stem-slot:is(:hover,.is-dragging){border-color:#fff;background:linear-gradient(145deg,#ffffff40,#ffffff1a)}
.dropzone :is(h2,h3,b,strong){color:#fff}
.dropzone .art-signal,.dropzone svg{color:#ffffffcc}
select,input[type=number],input[type=text]{background:#ffffff1f;border:1px solid #ffffff66;color:#fff;padding-inline:14px}
select option{background:#0b4f9e;color:#fff}
.hero h1,h1{font-size:clamp(2.6rem,6vw,4.6rem);letter-spacing:-.035em;text-shadow:0 6px 30px #03285f40}
h1 em,.hero h1 span:last-child{background:linear-gradient(90deg,#fff3a8,#ffb27a,#ff8fd1);-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:none}
canvas#wave{border-radius:18px}
::selection{background:#ffe58a;color:#05305a}
input[type=range]{accent-color:#ffe58a}
@media(prefers-reduced-motion:reduce){.bubbles,.orbs i{display:none}}

.topbar{background:#0b78cff0}
.guide,.step-guide{background:#0b6fc6e6}
