:root {
  color-scheme: dark;
  --bg: #080a0b;
  --panel: #0e1111;
  --fg: #e4e9e7;
  --muted: #798583;
  --line: #26302e;
  --accent: #c8ff00;
  font-family: 'Trebuchet MS', 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.shell { max-width: 1512px; padding: 0 32px; margin: 0 auto; }
.site-header { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 28px 0 22px; border-bottom: 1px solid var(--line); }
.wordmark { font-size: 19px; font-weight: 700; letter-spacing: -.04em; }
.wordmark span { font-size: 14px; font-weight: 400; letter-spacing: .08em; }
.lab-tag, .eyebrow, .stage-top, .stage-bottom, .section-heading > span, .subheading > span, footer { font: 11px/1.4 ui-monospace, 'SFMono-Regular', monospace; letter-spacing: .16em; }
.lab-tag { color: var(--muted); }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding: 48px 0 42px; }
.eyebrow { color: var(--accent); margin: 0 0 14px; }
h1 { font-size: clamp(46px, 6.8vw, 100px); font-weight: 400; letter-spacing: -.075em; line-height: .97; margin: 0; }
.period { color: var(--accent); }
.subtitle { color: var(--muted); margin: 20px 0 0; font-size: 14px; line-height: 1.6; }
.connection { display: flex; align-items: center; gap: 12px; min-width: 190px; padding-bottom: 4px; }
.status-dot { flex: 0 0 9px; height: 9px; border-radius: 50%; background: #b85353; box-shadow: 0 0 0 5px rgba(184,83,83,.09); }
.status-dot.connecting { background: #dca455; box-shadow: 0 0 0 5px rgba(220,164,85,.09); }
.status-dot.connected { background: var(--accent); box-shadow: 0 0 0 5px rgba(200,255,0,.09); }
.connection strong { display: block; font-size: 14px; font-weight: 400; }
.connection small { display: block; color: var(--muted); font: 11px/1.5 ui-monospace, monospace; margin-top: 4px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr); gap: 16px; align-items: start; }
.stage { position: sticky; top: 16px; aspect-ratio: 1/1; min-height: 480px; display: flex; flex-direction: column; border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 45%, #19231c 0, #0d1311 43%, #0a0e0d 77%); overflow: hidden; }
.stage::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(3,10,7,.16) 4px); }
.stage-top, .stage-bottom { position: relative; z-index: 2; display: flex; justify-content: space-between; gap: 16px; padding: 22px 25px; color: var(--muted); }
.stage-top span:last-child, .stage-bottom span:last-child { color: var(--accent); }
.stage-key { white-space: nowrap; }
.stage-key strong { color: var(--accent); font-weight: 500; }
#faceCanvas { display: block; width: 100%; min-height: 0; flex: 1; object-fit: contain; }
.fifths-display { position: absolute; z-index: 2; left: 22px; bottom: 55px; width: 166px; pointer-events: none; }
.fifths-caption { display: block; margin: 0 0 4px; text-align: center; color: var(--muted); font: 9px/1.3 ui-monospace, monospace; letter-spacing: .14em; }
.fifths-wheel { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(12, 20, 15, .82) 0 23%, rgba(12, 20, 15, .65) 54%, rgba(12, 20, 15, .08) 72%); }
.fifths-wheel::before { content: ''; position: absolute; inset: 16%; border: 1px solid rgba(200, 255, 0, .16); border-radius: 50%; }
.fifths-orbit { position: absolute; inset: 4%; border: 1px solid rgba(200, 255, 0, .12); border-radius: 50%; transition: transform .7s cubic-bezier(.2, .7, .18, 1); }
.fifths-orbit::before { content: ''; position: absolute; top: 5%; left: 50%; width: 1px; height: 9%; background: linear-gradient(var(--accent), transparent); transform: translateX(-50%); }
.fifths-orbit i { position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; transform: translateX(-50%); border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(200, 255, 0, .8); }
.fifths-label { position: absolute; color: #839388; font: 10px/1 ui-monospace, monospace; transform: translate(-50%, -50%); transition: color .35s, text-shadow .35s; }
.fifths-label.active { color: var(--accent); text-shadow: 0 0 9px rgba(200, 255, 0, .7); }
.fifths-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--accent); font: 22px/1 ui-monospace, monospace; font-weight: 400; text-shadow: 0 0 18px rgba(200, 255, 0, .45); }
.inspector { display: grid; gap: 16px; }
.panel { border: 1px solid var(--line); background: var(--panel); padding: 24px; }
.section-heading, .subheading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.section-heading { margin-bottom: 24px; }
h2, h3 { margin: 0; font-weight: 400; }
h2 { font-size: 19px; letter-spacing: -.03em; }
h3 { font-size: 13px; }
.section-heading > span, .subheading > span { color: var(--muted); white-space: nowrap; }
.source-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.source-choice button { border: 1px solid var(--line); background: #131918; color: var(--muted); min-height: 42px; font-size: 12px; }
.source-choice button.selected { border-color: var(--accent); color: var(--accent); background: #1b2518; }
.hint, .live-help { color: var(--muted); font-size: 12px; line-height: 1.6; }
.hint { min-height: 20px; margin: 16px 0 24px; }
.simulator { display: grid; gap: 17px; }
.simulator[hidden], .live-help[hidden] { display: none; }
.simulator label { display: grid; grid-template-columns: 1fr auto; gap: 9px; color: #c3ceca; font-size: 12px; }
.simulator output { font: 12px ui-monospace, monospace; color: var(--accent); }
.simulator input { grid-column: 1 / -1; display: block; width: 100%; accent-color: var(--accent); margin: 0; }
.text-button { justify-self: start; margin-top: 9px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; }
.live-help { padding: 12px; border: 1px dashed var(--line); }
.live-help p { margin: 0 0 12px; }
.live-help code { display: block; padding: 10px; background: #080c0b; color: var(--fg); font: 11px/1.6 ui-monospace, monospace; overflow-wrap: anywhere; }
.live-help code + code { margin-top: 8px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.metrics > div { min-height: 70px; padding: 12px; background: #101514; display: flex; flex-direction: column; justify-content: space-between; }
.metrics span { color: var(--muted); font-size: 11px; }
.metrics strong { font: 18px ui-monospace, monospace; font-weight: 400; color: var(--accent); }
.metric-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 12px 0 28px; }
.subheading { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.rotation-readout { color: var(--accent); font: 12px/1.6 ui-monospace, monospace; margin-top: 12px; }
.shapes { display: grid; gap: 10px; margin-top: 16px; max-height: 360px; overflow: auto; scrollbar-color: var(--line) transparent; }
.shape { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; font: 11px/1.4 ui-monospace, monospace; }
.shape-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bfc9c4; }
.shape-value { color: var(--accent); font-variant-numeric: tabular-nums; }
.shape-track { grid-column: 1/-1; height: 3px; background: #27312a; }
.shape-fill { display: block; height: 100%; width: 0; background: var(--accent); }
.empty-shapes { color: var(--muted); font-size: 12px; margin: 0; }
.sound-start { width: 100%; min-height: 52px; border: 1px solid var(--accent); background: #22321a; color: var(--accent); font-size: 14px; }
.sound-start[aria-pressed="true"] { background: var(--accent); color: #152007; }
.sound-start:disabled { opacity: .45; cursor: not-allowed; }
.sound-status { min-height: 18px; margin: 11px 0 0; color: var(--accent); font: 11px/1.5 ui-monospace, monospace; }
.sound-panel .hint { margin: 13px 0 22px; }
.sound-inputs { display: grid; gap: 11px; margin: 21px 0 0; }
.sound-inputs label { display: flex; align-items: flex-start; gap: 10px; color: #d7e1dc; font-size: 12px; cursor: pointer; }
.sound-inputs input { margin: 2px 0 0; accent-color: var(--accent); }
.sound-inputs small { display: block; margin-top: 3px; color: var(--muted); font: 10px/1.5 ui-monospace, monospace; }
.face-mode-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 20px; }
.face-mode-choice button { border: 1px solid var(--line); background: #131918; color: var(--muted); min-height: 38px; font-size: 12px; }
.face-mode-choice button.selected { border-color: var(--accent); color: var(--accent); background: #1b2518; }
.sound-meter { display: grid; grid-template-columns: 82px minmax(0, 1fr) 52px; align-items: center; gap: 9px; margin: 9px 0; font: 10px/1.3 ui-monospace, monospace; color: var(--muted); }
.sound-meter output { text-align: right; color: var(--accent); font-variant-numeric: tabular-nums; }
.expression-meter { grid-template-columns: 104px minmax(0, 1fr) 83px; }
.sound-meter-track { position: relative; height: 6px; background: #26352b; overflow: hidden; }
.sound-meter-track i { display: block; width: 0; height: 100%; background: var(--accent); }
.pan-track { overflow: visible; background: linear-gradient(90deg, #34493b, #1b2a20 50%, #34493b); }
.pan-track::after { content: ''; position: absolute; left: 50%; top: -3px; height: 12px; border-left: 1px solid #627563; }
.pan-track i { position: absolute; top: -3px; left: 50%; width: 4px; height: 12px; transform: translateX(-50%); }
.sound-controls { display: grid; gap: 17px; padding-top: 23px; margin-top: 23px; border-top: 1px solid var(--line); }
.expression-controls { gap: 12px; margin-top: 20px; }
.expression-controls[hidden], #gestureHint[hidden] { display: none; }
.expression-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.control-heading { margin: 0; color: var(--accent); font: 10px/1.2 ui-monospace, monospace; letter-spacing: .14em; }
.sound-controls label:not(.switch-line) { display: grid; grid-template-columns: 1fr auto; gap: 9px; color: #c3ceca; font-size: 12px; }
.sound-controls output { color: var(--accent); font: 12px ui-monospace, monospace; }
.sound-controls input[type="range"] { grid-column: 1 / -1; display: block; width: 100%; margin: 0; accent-color: var(--accent); }
.sound-controls .switch-line { display: flex; align-items: center; gap: 10px; color: #c3ceca; font-size: 12px; }
.switch-line input { accent-color: var(--accent); }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0 36px; color: var(--muted); }
footer span { color: #5f6b67; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .stage { position: relative; top: auto; min-height: 0; aspect-ratio: 1/1; }
  .inspector { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 650px) {
  .shell { padding: 0 18px; }
  .site-header { padding: 22px 0; }
  .lab-tag { font-size: 9px; text-align: right; }
  .intro { padding: 40px 0 28px; flex-direction: column; align-items: start; gap: 20px; }
  h1 { font-size: clamp(48px, 13vw, 68px); }
  .subtitle { margin-top: 12px; }
  .stage-top, .stage-bottom { padding: 16px; font-size: 9px; }
  .fifths-display { left: 10px; bottom: 44px; width: 118px; }
  .fifths-caption { font-size: 7px; }
  .fifths-label { font-size: 8px; }
  .fifths-center { font-size: 17px; }
  .inspector { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  footer { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .fifths-orbit { transition: none; }
}
