:root {
 color-scheme: dark;
 --bg: #060706;
 --surface: rgba(19, 20, 18, 0.9);
 --surface-strong: #151612;
 --surface-soft: rgba(237, 230, 209, 0.055);
 --line: rgba(238, 231, 207, 0.16);
 --line-strong: rgba(238, 231, 207, 0.28);
 --text: #f3eedf;
 --muted: #aaa392;
 --quiet: #756f63;
 --amber: #d9b56c;
 --ember: #ee7358;
 --mint: #93d8b6;
 --analysis-color: #93d8b6;
 --analysis-rgb: 147 216 182;
 --analysis-energy: 0;
 --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
 --radius: 8px;
 --font:
  "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
 box-sizing: border-box;
}

html {
 min-height: 100%;
 background: var(--bg);
 overflow-x: hidden;
}

body {
 min-height: 100%;
 margin: 0;
 color: var(--text);
 font-family: var(--font);
 background:
  linear-gradient(rgba(238, 231, 207, 0.032) 1px, transparent 1px),
  linear-gradient(90deg, rgba(238, 231, 207, 0.028) 1px, transparent 1px),
  #060706;
 background-size:
  44px 44px,
  44px 44px,
  auto;
 letter-spacing: 0;
 overflow-x: hidden;
}

button,
input,
select {
 font: inherit;
}

button,
select,
input[type="range"],
.dropzone {
 outline: none;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.dropzone:focus-visible,
.back-link:focus-visible {
 box-shadow: 0 0 0 3px rgba(var(--analysis-rgb) / 0.28);
 border-color: rgb(var(--analysis-rgb));
}

button {
 min-height: 42px;
 border: 1px solid var(--line);
 border-radius: 6px;
 color: var(--text);
 background: rgba(239, 232, 209, 0.06);
 cursor: pointer;
 transition:
  border-color 160ms ease,
  background 160ms ease,
  color 160ms ease,
  transform 160ms ease;
}

button:hover:not(:disabled) {
 border-color: rgb(var(--analysis-rgb));
 background: rgba(var(--analysis-rgb) / 0.12);
}

button:active:not(:disabled) {
 transform: translateY(1px);
}

button:disabled {
 cursor: not-allowed;
 color: var(--quiet);
 background: rgba(239, 232, 209, 0.025);
}

button.primary {
 color: #08110d;
 border-color: transparent;
 background: var(--analysis-color);
 font-weight: 800;
}

.secondary-action {
 width: 100%;
 margin-top: 16px;
 color: var(--text);
 font-weight: 800;
}

[hidden] {
 display: none !important;
}

.app-shell {
 width: min(1680px, 100%);
 min-height: 100svh;
 margin: 0 auto;
 padding: clamp(14px, 2vw, 24px);
}

.masthead {
 display: grid;
 grid-template-columns: auto minmax(220px, max-content) minmax(280px, 680px);
 gap: clamp(16px, 2vw, 30px);
 align-items: center;
 margin-bottom: clamp(28px, 1.8vh, 20px);
}

.back-link {
 align-self: center;
 width: fit-content;
 color: var(--muted);
 text-decoration: none;
 border: 1px solid var(--line);
 border-radius: 6px;
 padding: 9px 12px;
}

.back-link:hover {
 color: var(--text);
 border-color: var(--line-strong);
}

.masthead-title {
 min-width: 0;
}

.eyebrow {
 margin: 0 0 8px;
 color: var(--amber);
 font-size: 0.72rem;
 font-weight: 800;
 letter-spacing: 0.08em;
 text-transform: uppercase;
}

h1,
h2,
p {
 margin-top: 0;
}

h1 {
 margin-bottom: 0;
 font-size: clamp(2.8rem, 5.6vw, 5.9rem);
 line-height: 0.92;
 letter-spacing: 0;
}

h2 {
 margin-bottom: 0;
 font-size: 1rem;
 line-height: 1.15;
}

.masthead-copy,
.project-notes p,
.source-panels p {
 color: var(--muted);
 line-height: 1.6;
}

.masthead-copy {
 margin-bottom: 0;
 max-width: 680px;
 font-size: clamp(0.95rem, 1.1vw, 1.12rem);
}

.instrument-layout {
 display: grid;
 grid-template-columns: minmax(220px, 310px) minmax(0, 1fr) minmax(250px, 330px);
 grid-template-areas: "controls stage analysis";
 gap: 14px;
 align-items: stretch;
 min-width: 0;
}

.stage-panel,
.control-panel,
.analysis-panel,
.project-notes {
 min-width: 0;
 border: 1px solid var(--line);
 border-radius: var(--radius);
 background: var(--surface);
 box-shadow: var(--shadow);
}

.stage-panel {
 grid-area: stage;
 position: relative;
 min-height: clamp(440px, 66vh, 760px);
 overflow: hidden;
 background: #050605;
}

#chroma-canvas {
 display: block;
 width: 100%;
 height: 100%;
 min-height: inherit;
}

.stage-overlay {
 position: absolute;
 inset: auto 18px 18px;
 display: grid;
 grid-template-columns: repeat(4, minmax(0, 1fr));
 gap: 8px;
 color: rgba(243, 238, 223, 0.72);
 font-size: 0.72rem;
 font-weight: 800;
 letter-spacing: 0.08em;
 text-transform: uppercase;
 pointer-events: none;
}

.stage-overlay span {
 min-width: 0;
 border-top: 1px solid rgba(243, 238, 223, 0.22);
 padding-top: 8px;
 overflow-wrap: anywhere;
}

.control-panel {
 grid-area: controls;
}

.analysis-panel {
 grid-area: analysis;
}

.control-panel,
.analysis-panel {
 scrollbar-color: rgba(var(--analysis-rgb) / 0.42) rgba(0, 0, 0, 0.16);
}

.panel-section {
 padding: 16px;
 border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
 border-bottom: 0;
}

.section-heading {
 display: flex;
 justify-content: space-between;
 gap: 16px;
 align-items: end;
 margin-bottom: 14px;
}

.source-selector {
 display: grid;
 grid-template-columns: repeat(2, minmax(0, 1fr));
 gap: 8px;
}

.source-selector button {
 min-width: 0;
 padding: 10px 8px;
 color: var(--muted);
 font-weight: 800;
}

.source-selector button.is-active {
 color: #08110d;
 border-color: transparent;
 background: var(--analysis-color);
}

.source-panels {
 min-height: 132px;
 margin-top: 14px;
 padding: 14px;
 border: 1px solid var(--line);
 border-radius: 6px;
 background: var(--surface-soft);
}

.source-panels p {
 margin-bottom: 0;
 font-size: 0.9rem;
}

.dropzone {
 position: relative;
 display: grid;
 gap: 8px;
 min-height: 118px;
 padding: 16px;
 border: 1px dashed var(--line-strong);
 border-radius: 6px;
 background: rgba(0, 0, 0, 0.18);
 cursor: pointer;
}

.dropzone:hover,
.dropzone.is-dragging {
 border-color: rgb(var(--analysis-rgb));
 background: rgba(var(--analysis-rgb) / 0.09);
}

.dropzone strong {
 color: var(--text);
}

.dropzone span {
 color: var(--muted);
 font-size: 0.86rem;
 line-height: 1.45;
}

.dropzone input {
 position: absolute;
 width: 1px;
 height: 1px;
 opacity: 0;
 pointer-events: none;
}

.track-strip {
 display: grid;
 gap: 5px;
 padding: 14px;
 border: 1px solid var(--line);
 border-radius: 6px;
 background: rgba(0, 0, 0, 0.18);
}

.track-strip strong {
 overflow-wrap: anywhere;
}

.track-strip span,
.status-line {
 color: var(--muted);
 font-size: 0.87rem;
 line-height: 1.45;
}

.transport-controls {
 display: grid;
 grid-template-columns: repeat(3, minmax(0, 1fr));
 gap: 8px;
 margin-top: 12px;
}

.range-control,
.select-control {
 display: grid;
 gap: 9px;
 margin-top: 14px;
 color: var(--muted);
 font-size: 0.84rem;
 font-weight: 800;
}

input[type="range"] {
 width: 100%;
 accent-color: var(--analysis-color);
}

select {
 width: 100%;
 min-height: 42px;
 color: var(--text);
 border: 1px solid var(--line);
 border-radius: 6px;
 background: var(--surface-strong);
 padding: 0 10px;
}

.status-line {
 min-height: 42px;
 margin: 14px 0 0;
 padding: 12px;
 border-left: 3px solid var(--analysis-color);
 background: rgba(var(--analysis-rgb) / 0.07);
}

.readout-grid {
 display: grid;
 grid-template-columns: repeat(2, minmax(0, 1fr));
 gap: 8px;
 margin: 0;
}

.readout-grid div {
 min-width: 0;
 padding: 11px;
 border: 1px solid var(--line);
 border-radius: 6px;
 background: rgba(0, 0, 0, 0.17);
}

.readout-grid .wide {
 grid-column: 1 / -1;
}

dt {
 color: var(--quiet);
 font-size: 0.66rem;
 font-weight: 900;
 letter-spacing: 0.06em;
 text-transform: uppercase;
}

dd {
 margin: 6px 0 0;
 color: var(--text);
 font-size: clamp(0.84rem, 1vw, 0.95rem);
 font-weight: 800;
 overflow-wrap: anywhere;
}

[data-readout="color"] {
 color: var(--analysis-color);
}

.project-notes {
 display: grid;
 grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
 gap: 28px;
 margin-top: 14px;
 padding: 20px;
}

.notes-copy {
 display: grid;
 gap: 12px;
}

.project-notes p {
 margin-bottom: 0;
}

code {
 color: var(--text);
 font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
 font-size: 0.92em;
}

@media (min-width: 1181px) {
 .instrument-layout {
  height: clamp(560px, calc(100svh - 174px), 780px);
 }

 .stage-panel {
  min-height: 0;
 }

 #chroma-canvas {
  min-height: 0;
 }

 .control-panel,
 .analysis-panel {
  max-height: 100%;
  overflow-y: auto;
 }
}

@media (max-width: 1320px) and (min-width: 1181px) {
 .instrument-layout {
  grid-template-columns: minmax(210px, 285px) minmax(0, 1fr) minmax(
    240px,
    310px
   );
 }

 .panel-section {
  padding: 14px;
 }

 .source-selector button {
  font-size: 0.86rem;
 }
}

@media (max-width: 1180px) {
 .masthead {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
 }

 .masthead-copy {
  grid-column: 1 / -1;
  max-width: 860px;
 }

 .instrument-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  grid-template-areas:
   "stage stage"
   "controls analysis";
 }

 .stage-panel {
  min-height: clamp(440px, 62vh, 680px);
 }
}

@media (max-width: 760px) {
 .app-shell {
  padding: 14px;
 }

 .masthead,
 .instrument-layout {
  grid-template-columns: 1fr;
 }

 .instrument-layout {
  grid-template-areas:
   "stage"
   "controls"
   "analysis";
 }

 .stage-panel {
  min-height: min(72vh, 520px);
 }

 .stage-overlay {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  inset: auto 14px 14px;
 }

 .source-selector,
 .transport-controls,
 .readout-grid,
 .project-notes {
  grid-template-columns: 1fr;
 }

 .project-notes {
  padding: 18px;
 }
}

@media (prefers-reduced-motion: reduce) {
 *,
 *::before,
 *::after {
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
 }
}
