:root {
  color-scheme: dark;
  color: #f7eee1;
  background: #171512;
  --serif: Baskerville, 'Iowan Old Style', Georgia, serif;
  --muted: #d6c5b4;
  --line: #5a4a3f;
  --stage-accent: #edb477;
  font: 16px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(ellipse at 24% -15%, #473125, transparent 52%);
}
[hidden] { display: none !important; }
:where(h1, p) { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .7; }
:focus-visible { outline: 2px solid #fbd4a1; outline-offset: 3px; }

.lab-header, .stage-lab { width: min(90%, 86rem); margin-inline: auto; }
.lab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: clamp(14px, 2.4vw, 32px);
  color: var(--muted);
}
.lab-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #f7eee1;
  font: italic 400 clamp(1.04rem, 1.55vw, 1.4rem)/1.15 var(--serif);
  text-decoration: none;
}
.lab-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.stage-lab { padding-block: clamp(16px, 3vw, 44px) clamp(32px, 4vw, 64px); }
.lab-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.25rem 3rem;
  margin-bottom: clamp(20px, 3vw, 36px);
}
.lab-intro h1 { font: 400 clamp(3rem, 6.35vw, 7rem)/.91 var(--serif); letter-spacing: -.04em; }
.lab-intro h1 em { color: #e9c49d; }
.lab-intro p { max-width: 36ch; color: var(--muted); }

.stage-aim, .stage-controls {
  border: 1px solid var(--line);
  background: #211b17;
}
.stage-aim {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 12px 24px;
  padding: 14px clamp(12px, 2.4vw, 28px);
  border-bottom: 0;
}
.stage-directions, .cue-group, .motion-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.stage-lab button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: .875rem;
}
.stage-lab button:not(:disabled):hover { border-color: var(--stage-accent); }
.stage-directions button[aria-pressed="true"], .cue-group button[aria-pressed="true"] {
  border-color: var(--stage-accent);
  color: #fdf1e3;
  background: #fff1de14;
}
.lab-help { margin-top: 7px; color: var(--muted); font-size: .875rem; }
.stage-reveal-info { align-self: center; min-width: 0; padding-left: 1rem; border-left: 1px solid var(--line); }
.lab-label { color: var(--stage-accent); font-size: .875rem; }
.stage-reveal-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--stage-accent); text-underline-offset: 3px; }

.stage-viewport { background: #0c0e10; border: 1px solid var(--line); }
.stage-viewport canvas { display: block; width: 100%; height: clamp(20rem, 49vh, 35rem); touch-action: pan-y pinch-zoom; }
.stage-viewport canvas:focus-visible { outline-offset: -3px; }

.stage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px clamp(12px, 2.4vw, 28px);
  border-top: 0;
}
.cue-swatch { width: .55rem; height: .55rem; flex: none; border-radius: 50%; }
.cue-swatch.amber { background: #edb477; }
.cue-swatch.blue { background: #9ebee7; }
.cue-swatch.rose { background: #dfa1b3; }
.intensity { flex: 0 1 12rem; max-width: 100%; }
.intensity label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .875rem; }
.intensity input { display: block; width: 100%; min-height: 28px; margin: 0; accent-color: var(--stage-accent); cursor: pointer; }

@media (max-width: 700px) {
  .lab-intro { display: grid; }
  .stage-aim { grid-template-columns: minmax(0, 1fr); }
  .stage-viewport canvas { height: clamp(14rem, 57vw, 24rem); }
  .cue-group { flex: 1 1 100%; }
  .intensity { flex: 0 1 9rem; }
}
