:root {
  --bg: #1c2024;
  --panel: #23292e;
  --line: #343c42;
  --ink: #dce0da;
  --muted: #8a938d;
  --bike: #e8a33d;        /* sodium street lamp */
  --supercon: #5cc0d6;    /* liquid nitrogen */
  --turbofan: #e0664a;    /* exhaust glow */
  --tess: #a68cf2;        /* starlight */
  --ecg: #6fd08c;         /* monitor trace */
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
button, input { font: inherit; color: inherit; }
kbd { font: 500 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.top { display: flex; align-items: baseline; gap: 24px; padding: 18px 24px 10px; flex-wrap: wrap; }
.mark { font: 800 34px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; margin: 0; }
.workspace-mode { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.workspace-mode select { max-width: 150px; }
.meta { margin: 0; color: var(--muted); font: 13px var(--mono); }
.meta .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 5px 0 2px; vertical-align: 1px; }

/* ── Bench layout ───────────────────────────────────────────────────────── */
.bench { flex: 1; display: grid; grid-template-columns: 250px 1fr; gap: 0; border-top: 1px solid var(--line); }
.drawer { border-right: 1px solid var(--line); padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0; }
.roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.role-tab {
  width: 100%; display: grid; grid-template-columns: 1fr 72px; align-items: center; gap: 8px;
  background: none; border: 1px solid transparent; border-radius: 4px; padding: 6px 8px; cursor: pointer; text-align: left;
}
.role-tab:hover { border-color: var(--line); }
.role-tab[aria-current="true"] { background: var(--panel); border-color: var(--line); }
.role-tab .label { font: 800 19px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.role-tab .empty { font: 12px var(--mono); color: var(--muted); text-align: right; }
.role-tab canvas { width: 72px; height: 22px; display: block; }

.taste { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; color: var(--muted); }
.taste h3 { margin: 0 0 6px; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.taste ol { margin: 6px 0 0; padding-left: 18px; font: 12px/1.5 var(--mono); color: var(--ink); }
.taste .bar { height: 3px; background: var(--line); margin-top: 8px; }
.taste .bar i { display: block; height: 100%; background: var(--ink); }

/* ── Field ──────────────────────────────────────────────────────────────── */
.field { padding: 18px 24px 120px; min-width: 0; }
.field-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.role-name { font: 800 clamp(56px, 9vw, 112px)/.8 var(--display); text-transform: uppercase; margin: 0; letter-spacing: .01em; }
.field-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow-x: auto; max-width: 100%; }
.filter button { white-space: nowrap; }
.filter button { background: none; border: 0; padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--muted); }
.filter button[aria-checked="true"] { background: var(--panel); color: var(--ink); }
.filter .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }

.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.btn:hover { border-color: var(--muted); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.btn[aria-pressed="true"] kbd { color: var(--bg); border-color: var(--bg); }

/* ── Editor card: the focused hit, shaped in place ─────────────────────── */
.specimen.editing { grid-column: span 2; cursor: default; gap: 12px; }
.specimen.editing .wave { height: 110px; cursor: pointer; }
.specimen.editing .spec-head { cursor: pointer; }

.knob { display: grid; gap: 2px; min-width: 0; }
.knob .name, .thread.edit .slot, .mini span { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.knob output, .mini output { font: 12px var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit-tools { display: grid; gap: 6px; justify-items: end; }
.specimen input[type="range"] { width: 100%; accent-color: var(--ink); margin: 2px 0; }

.threads.edit { display: grid; gap: 10px; }
.thread.edit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }   /* not the compact 2-column row */
.thread-head { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.thread.edit .slot { flex: none; }
.thread.edit .slot small { font-size: inherit; text-transform: none; letter-spacing: 0; }
.thread.edit .slot::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--c); margin-right: 6px; vertical-align: 1px; }
.thread.edit .curve-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.thread.edit .expr { flex: 0 1 auto; min-width: 0; font: 11px var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* How the curve is made: a ? after its name, the text on hover (or focus, for touch and keys). */
.thread.edit .thread-head { position: relative; }
.curve-info { flex: none; display: inline-grid; place-items: center; width: 15px; height: 15px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--muted); font: 9px/1 var(--mono); cursor: help; }
.curve-info[hidden] { display: none; }
.curve-info:hover, .curve-info:focus-visible { color: var(--ink); border-color: var(--muted); }
.curve-info-text { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: max-content; max-width: min(65ch, 100%); padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 25px #0006; font: 11px/1.6 var(--body); color: var(--muted); text-align: left; white-space: normal; pointer-events: none; }
.curve-info:hover .curve-info-text, .curve-info:focus .curve-info-text { display: block; }

/* Source coordinates: faint data, bright ADSR projection; handles select the original slice. */
.win { position: relative; height: 46px; border-radius: 3px; background: var(--bg); cursor: crosshair; touch-action: none; }
.thread.edit .win canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.win:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.band { position: absolute; top: 0; bottom: 0; border: 1px solid var(--c); border-radius: 3px;
  background: color-mix(in srgb, var(--c) 12%, transparent); cursor: grab; }
.band:active { cursor: grabbing; }
.band .edge { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.band .edge[data-edge="0"] { left: -4px; }
.band .edge[data-edge="1"] { right: -4px; }
.band .edge::after { content: ''; position: absolute; left: 3px; top: 30%; bottom: 30%; width: 2px; border-radius: 1px; background: var(--c); }

.slot-ctl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 12px; align-items: end; }
.mini { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; min-width: 0; }
.mini output { min-width: 2.6em; text-align: right; }

.toggle { background: none; border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.toggle:hover { border-color: var(--muted); color: var(--ink); }
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── Specimen cards ─────────────────────────────────────────────────────── */
.specimens { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.specimen {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 12px 10px;
  display: grid; gap: 8px; cursor: pointer; position: relative; transition: opacity .2s;
}
.specimen[data-focus="true"] { border-color: var(--ink); }
.specimen[data-verdict="skip"] { opacity: .38; }
.specimen[data-verdict="keep"]::after {
  content: 'kept'; position: absolute; top: 10px; right: 12px; font: 500 11px var(--mono);
  text-transform: uppercase; letter-spacing: .12em; background: var(--ink); color: var(--bg); padding: 1px 6px; border-radius: 2px;
}
.spec-head { display: flex; gap: 10px; align-items: baseline; font: 12px var(--mono); color: var(--muted); }
.spec-head .num { font: 800 22px/1 var(--display); color: var(--ink); }
.specimen[data-verdict="keep"] .spec-head { padding-right: 52px; }   /* room for the KEPT badge */
.thread .win canvas { height: 100%; }   /* beat the compact '.thread canvas' height: draw over the whole editor box */
.spec-head .note { font: 500 12px var(--mono); color: var(--ink); }
.thread .flags { display: block; color: var(--ink); font-size: 11px; }
.wave { width: 100%; height: 84px; display: block; }

/* The signature: four data threads under the waveform, one per synthesis slot. */
.threads { display: grid; gap: 3px; margin: 0; }
.thread { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.thread dt { font: 11px var(--mono); color: var(--muted); }
.thread dd { margin: 0; min-width: 0; }
.thread canvas { width: 100%; height: 20px; display: block; }
.thread .expr { display: block; font: 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.specimen:hover .expr, .specimen[data-focus="true"] .expr { color: var(--ink); }

.spec-actions { display: flex; gap: 6px; margin-top: 2px; }
.spec-actions button { flex: 1; background: none; border: 1px solid var(--line); border-radius: 3px; padding: 4px 0; cursor: pointer; font-size: 13px; }
.spec-actions button:hover { border-color: var(--muted); }

/* ── Curve picker ───────────────────────────────────────────────────────── */
.picker { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 16px; }
.picker::backdrop { background: rgb(0 0 0 / .6); }
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; }
.picker-head h3 { margin: 0; font: 800 26px/1 var(--display); text-transform: uppercase; }
.picker-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.picker-tools input { flex: 1; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font: 13px var(--mono); }
.picker-count { color: var(--muted); font: 12px var(--mono); margin: 10px 0; }
.picker-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.tile { width: 100%; display: grid; gap: 4px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px; cursor: pointer; }
.tile:hover { border-color: var(--muted); }
.tile[aria-current="true"] { border-color: var(--ink); }
.tile canvas { width: 100%; height: 40px; display: block; }
.tile .tl { font: 11px var(--mono); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.8em; }
.tile .tm { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }

/* ── Dock ───────────────────────────────────────────────────────────────── */
.keys { margin: 0 0 0 auto; color: var(--muted); font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: 4px; font: 13px var(--mono); opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; }
.toast button { margin-left: 14px; padding: 0; border: 0; background: none; color: inherit; font: 600 13px var(--mono); text-decoration: underline; cursor: pointer; }
.toast.show:has(button) { pointer-events: auto; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .specimens { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hit-tools { grid-column: 1 / -1; display: flex; justify-content: space-between; }
}
@media (max-width: 760px) {
  .top, .field { padding-left: 16px; padding-right: 16px; }
  .bench { grid-template-columns: minmax(0, 1fr); }
  .drawer { border-right: 0; border-bottom: 1px solid var(--line); min-width: 0; }
  .field-tools { min-width: 0; max-width: 100%; }
  .field-tools kbd { display: none; }
  .roles { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .role-tab { grid-template-columns: auto; white-space: nowrap; }
  .role-tab canvas, .role-tab .empty { display: none; }
  .role-tab:has(canvas) .label::after { content: ' ●'; font-size: 12px; vertical-align: 3px; }
  .taste { display: none; }
  .specimens { grid-template-columns: 1fr; }
  .specimen.editing { grid-column: auto; }
  .slot-ctl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .keys { display: none; }
  .field { padding-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── Measurements and history ───────────────────────────────────────────── */
.aud { flex: none; width: 38px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; align-self: center; }
.aud i { display: block; height: 100%; background: var(--c, var(--ink)); }
.tile .aud { width: 100%; --c: var(--muted); }
.hit-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.toggle:disabled { opacity: .35; cursor: default; border-color: var(--line); color: var(--muted); }

/* Picker: sort, similarity banner, audition in context */
.picker-tools .sort { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
#loop-bpm { width: 4.5em; }
.picker-tools select { background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 4px; padding: 5px 8px; font: 12px var(--body); }
.picker-tools select:disabled { opacity: .4; }
.picker-near { margin: 8px 0 0; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.picker-near b { color: var(--ink); font: 12px var(--mono); }
.picker-grid li { position: relative; }
.audition { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 10px; cursor: pointer; }
.audition:hover { border-color: var(--ink); }
.tile .tl { padding-right: 28px; }

/* Keys sheet */
.help { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  width: min(620px, calc(100vw - 32px)); padding: 16px; }
.help::backdrop { background: rgb(0 0 0 / .6); }
.keylist { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.keylist dt { color: var(--muted); white-space: nowrap; }
.keylist dd { margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.linkish:hover { color: var(--ink); }
.role-tab canvas { cursor: pointer; }
@media (max-width: 760px) {
  .thread-head { flex-wrap: wrap; row-gap: 2px; }
  .thread.edit .curve-name { order: 5; flex-basis: 100%; }   /* the curve's name gets its own line */
  .thread.edit .expr { white-space: normal; }
  .thread.edit .slot { margin-right: auto; }
}

/* Exploration state, comparison and envelopes. */
[hidden] { display: none !important; }
button:disabled { opacity: .4; cursor: default; }
.comparison { display: flex; gap: 6px; overflow-x: auto; position: sticky; top: 0; z-index: 3;
  background: var(--bg); padding: 8px 0; margin-bottom: 14px; }
.comparison button { min-width: 66px; flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 6px; cursor: pointer; font: 11px var(--mono); }
.comparison button[aria-current="true"] { border-color: var(--ink); }
.comparison canvas { display: block; width: 100%; height: 25px; }
.specimen.editing { scroll-margin-top: 72px; }
.picker-inspect { background: var(--panel); border: 1px solid var(--line); padding: 10px; margin-top: 10px; border-radius: 4px; }
.picker-inspect canvas { width: 100%; height: 90px; display: block; }
.picker-inspect p { margin: 5px 0 0; font: 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.tile .tm { white-space: normal; overflow-wrap: anywhere; }
#picker-more { margin-top: 12px; }
@media (max-width: 900px) {
  .envelope-controls { gap: 8px; }
  .slot-ctl { grid-template-columns: 1fr 1fr; gap: 6px; }
}

.spec-head .kind { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.spec-head .after { font: 11px var(--mono); color: var(--muted); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#aim-style { max-width: 16em; }
.hit-duration { white-space: nowrap; margin-left: auto; font-size: 11px; }
/* The audible length, a button: click it to type the length you want. */
button.hit-duration { padding: 0; background: none; border: 0; border-bottom: 1px dotted transparent; color: inherit; font: inherit; font-size: 11px; cursor: text; }
button.hit-duration:hover, button.hit-duration:focus-visible { border-bottom-color: var(--muted); }
.spec-head { flex-wrap: wrap; }

.specimen:not(.editing) { align-self: start; }

/* The saved volume ADSR's layer switch */
.amp-mode[hidden] { display: none; }

/* Pitch lane: the pitch path in note space under the editor's waveform */
.pitch-lane { width: 100%; height: 54px; display: block; border-top: 1px dashed var(--line); }

.hit-group { border: 0; margin: 0; padding: 0; min-width: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px 12px; align-items: end; }
.hit-group legend { padding: 0; margin-bottom: 4px; font: 500 11px var(--mono); text-transform: uppercase;
  letter-spacing: .14em; color: var(--ink); }

/* Aim: a target note / length for new batches */
.aim { display: inline-flex; gap: 4px; align-items: center; font: 12px var(--mono); color: var(--muted); margin: 0; }
.aim input { width: 62px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 5px 6px;
  font: 12px var(--mono); color: var(--ink); }
.pitch-lane.mini { height: 22px; border-top: 0; }
.role-tab .facts { display: block; margin-top: 3px; font: 11px var(--mono); letter-spacing: 0; text-transform: none; color: var(--muted); }

/* Tune kit: snap pitched keepers to a scale */

/* ── Graph workspace: audition first, controls at the point of interest ── */
[hidden] { display: none !important; }
.top { padding: 13px 22px; align-items: center; gap: 18px; }
.mark { font-size: 28px; }
.header-help { margin-left: auto; color: var(--muted); font-size: 12px; }
.header-help + .header-help { margin-left: 0; }
.casting-settings { position: relative; }
summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style-position: inside; }
summary:hover { color: var(--ink); }
.bench { grid-template-columns: 180px minmax(0, 1fr); }
.drawer { padding: 20px 12px; }
.role-tab { padding: 10px 8px; grid-template-columns: 1fr 58px; }
.role-tab .label { font-size: 20px; }
.role-tab canvas { width: 58px; }
.taste { font-size: 12px; }
.field { padding: 20px 24px 90px; }
.field-head { align-items: center; }
.role-name { font-size: 42px; line-height: 1; }
.field-tools { gap: 8px; }
.casting-settings > summary { padding: 7px 12px; border: 1px solid var(--line); border-radius: 4px; list-style: none; color: var(--ink); font-size: 13px; }
.casting-panel { position: absolute; top: 42px; right: 0; z-index: 25; width: min(670px, 86vw); padding: 18px 20px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 40px #0008; }
/* Generate from: a label per row (Data, Reference, Variation, Aim for), its control beside it. */
.casting-panel .aim { display: contents; }
.casting-label { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.casting-panel select { justify-self: start; }
#data-label { align-self: start; padding-top: 9px; } /* level with the first row of chips */
.aim-targets { display: flex; gap: 8px; }
.filter button small { margin-left: 3px; font: 10px var(--mono); color: var(--muted); }
.help-meta { margin-top: 14px; font-size: 11px; }
.casting-panel .filter { flex-wrap: wrap; overflow: visible; }
#new-batch { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#new-batch kbd { color: var(--bg); }
.comparison { top: 0; padding: 8px 0; margin-bottom: 12px; background: var(--bg); z-index: 10; }
.comparison button { padding: 6px 8px; min-height: 55px; }
.comparison canvas { height: 24px; }
.specimens { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.specimen.editing { grid-column: 1 / -1; order: -1; padding: 16px; gap: 9px; }
.specimen:not(.editing) { padding: 10px; gap: 5px; }
.specimen:not(.editing) .threads { display: none; }
.specimen:not(.editing) .wave { height: 50px; }
.specimen:not(.editing) .spec-head { gap: 5px; flex-wrap: wrap; }
.specimen:not(.editing) .hit-duration { margin-left: auto; }
.specimen:not(.editing) .spec-actions { margin-top: 3px; }
.specimen:not(.editing) .spec-actions button { font-size: 11px; padding: 4px 2px; }
.spec-head { font-size: 12px; }
.spec-head .note { font-size: 13px; }
.specimen.editing .wave { height: 65px; background: var(--bg); border-radius: 3px; }
.audition-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Undo and Redo: keys on a computer, buttons only where there are no keys (a touch screen). */
.touch-only { display: none; }
@media (pointer: coarse) { .audition-actions .touch-only { display: inline-block; min-width: 40px; } }
.audition-actions button { border: 1px solid var(--line); border-radius: 4px; background: transparent; padding: 6px 10px; cursor: pointer; font-size: 12px; }
.audition-actions button:hover { border-color: var(--muted); }
.audition-actions button:disabled { opacity: .35; cursor: default; }
.audition-actions .primary-action { background: #c8d5b9; color: #1c2024; border-color: #c8d5b9; font-weight: 600; }
.primary-action kbd { color: #36402e; border-color: #93a780; }
.audition-actions .play-hit { padding: 6px 15px; background: var(--ink); color: var(--bg); }
.action-spacer { flex: 1; }
.instrument-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.voice-workspace, .data-workspace { min-width: 0; }
.voice-workspace { --c: #d4dbc9; }
.workspace-head { display: flex; align-items: center; gap: 12px; min-height: 28px; margin-bottom: 10px; }
.workspace-head h3 { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; margin: 0; color: var(--muted); }
.workspace-head > .toggle { margin-left: auto; }
.workspace-caption { font-size: 11px; color: var(--muted); }
.studio-tabs { display: flex; gap: 3px; align-items: center; }
.studio-tabs button { background: none; border: 0; border-radius: 3px; color: var(--muted); padding: 5px 9px; font-size: 12px; cursor: pointer; }
.studio-tabs button[aria-pressed="true"] { color: var(--ink); background: var(--line); }
.studio-tabs button:hover { color: var(--ink); }
.envelope-mode-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-height: 32px; margin-bottom: 5px; }
.envelope-mode-row[hidden] { display: none; }
.amp-mode { margin: 0; }
.data-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.data-tabs button { position: relative; display: grid; text-align: left; gap: 2px; padding: 6px 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--muted); cursor: pointer; min-width: 0; overflow: hidden; }
.data-tabs button[aria-selected="true"] { border-color: var(--c); color: var(--ink); background: color-mix(in srgb, var(--c) 10%, var(--bg)); }
.data-tabs button span { font-size: 12px; text-transform: capitalize; }
.data-tabs button small { font: 10px var(--mono); color: var(--c); }
.data-tabs button i { height: 2px; position: absolute; left: 0; bottom: 0; background: var(--c); opacity: .8; }
.thread-head { gap: 6px; align-items: center; }
.thread-head .slot, .thread-head .aud { display: none; }
.thread-head .expr { font-size: 11px; }
.thread-head .toggle { font-size: 11px; padding: 3px 6px; }
.threads.edit { gap: 0; }
.thread.edit { gap: 7px; }
.graph-key { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.graph-key i, .graph-key b { width: 10px; height: 2px; display: inline-block; background: var(--c); }
.graph-key i { opacity: .3; }
.win { height: 180px; border: 1px solid var(--line); background: #191e21; }
.band { background: color-mix(in srgb, var(--c) 6%, transparent); border-color: color-mix(in srgb, var(--c) 65%, transparent); }
.band .edge { width: 16px; }
.band .edge[data-edge="0"] { left: -8px; }
.band .edge[data-edge="1"] { right: -8px; }
.band .edge::after { left: 7px; top: 42%; bottom: 42%; }
.hit-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hit-group legend { display: none; }
/* Colour: a framed pane the graphs' height (set with theirs), so the three sound views line up. */
.colour-surface { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 24px 14px 8px; border: 1px solid var(--line); border-radius: 4px; background: #191e21; }
.colour-surface[hidden] { display: none; }
.colour-surface .surface-caption { position: absolute; top: 6px; left: 12px; margin: 0; font: 10px var(--mono); color: var(--muted); }
.colour-surface .hit-group { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; }
@media (max-width: 600px) {
  .colour-surface { justify-content: flex-end; padding-bottom: 6px; }
  .colour-surface .hit-group { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
  .colour-surface .knob { gap: 0; }
}
.control-graph { position: relative; height: 180px; border: 1px solid var(--line); border-radius: 4px; background: #191e21; touch-action: none; }
.control-graph svg { width: 100%; height: 100%; display: block; }
.graph-grid { fill: none; stroke: #343c42; stroke-width: .7; vector-effect: non-scaling-stroke; opacity: .5; }
.graph-trace { fill: none; stroke: var(--c, var(--ink)); stroke-width: 1.7; vector-effect: non-scaling-stroke; }
.graph-ghost { fill: none; stroke: var(--c, var(--ink)); stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .25; }
.graph-envelope { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: .5; }
.graph-point { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } /* a long press types, not selects */
.saved-adsr { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.graph-axis { font: 11px var(--mono); fill: var(--muted); }
.graph-outside { fill: #1c2024; opacity: .65; }
.graph-connector { fill: none; stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graph-point { position: absolute; transform: translate(-50%, -50%); width: 28px; height: 24px; border-radius: 4px; border: 1px solid var(--c, var(--ink)); color: var(--ink); background: #23292e; font: 9px var(--mono); cursor: move; touch-action: none; padding: 0; z-index: 2; }
.graph-point[data-axes="x"] { cursor: ew-resize; }
.graph-point[data-axes="y"] { cursor: ns-resize; }
.graph-point:hover, .graph-point:focus-visible { background: var(--c, var(--ink)); color: var(--bg); }
/* Below the plot (which ends at 80% of the height), above the time labels: never over a curve. */
.graph-tip { position: absolute; bottom: 16px; left: 12px; padding: 2px 6px; pointer-events: none; font: 10px var(--mono); color: var(--ink); background: #191e21d9; border-radius: 3px; max-width: calc(100% - 24px); }
.graph-tip:empty { display: none; }
/* A handle's values, typed where it sits (right-click or Enter on it). */
.graph-entry { position: absolute; z-index: 6; display: flex; align-items: center; gap: 5px; padding: 4px 6px; background: var(--panel); border: 1px solid var(--c, var(--ink)); border-radius: 4px; box-shadow: 0 4px 16px #0008; font: 10px var(--mono); color: var(--muted); white-space: nowrap; }
.graph-entry label { display: flex; align-items: baseline; gap: 2px; }
.graph-entry input { width: auto; padding: 1px 4px; font: 11px var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 3px; text-align: right; }
.graph-entry input:focus { outline: none; border-color: var(--c, var(--ink)); }
.graph-entry input[aria-invalid="true"] { border-color: var(--turbofan); }
.graph-entry-name { color: var(--ink); }
/* Reverse and Loop: icon toggles in the top-right corner, above the plot, lit in the slot's colour. */
.graph-tools { position: absolute; top: 5px; right: 8px; z-index: 5; display: flex; gap: 4px; }
.graph-tool { display: grid; place-items: center; width: 24px; height: 20px; padding: 0; }
.graph-tool svg { width: 14px; height: 14px; }
/* Amount (in the corner) and Time (bottom right) on a data curve: drag, click to type. */
.graph-number { height: 20px; padding: 0 6px; font: 10px var(--mono); color: var(--ink); touch-action: none; }
.graph-number[data-number="depth"] { cursor: ns-resize; }
.graph-pass { position: absolute; right: 8px; bottom: 3px; z-index: 5; display: flex; align-items: center; gap: 5px; font: 10px var(--mono); color: var(--muted); }
.graph-pass .graph-number { height: 18px; cursor: ew-resize; }
.graph-tool[aria-pressed="true"] { background: color-mix(in srgb, var(--c, var(--ink)) 22%, transparent); color: var(--c, var(--ink)); border-color: var(--c, var(--ink)); }
@media (max-width: 1100px) {
  .instrument-workspace { gap: 15px; }
  .audition-actions { gap: 4px; }
  .audition-actions button { padding: 5px 7px; }
  .action-spacer { flex-basis: 0; }
  .workspace-head { flex-wrap: wrap; gap: 6px; }
  .workspace-caption { display: none; }
  .specimens { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .bench { grid-template-columns: 135px minmax(0, 1fr); }
  .field { padding: 15px 14px 85px; }
  .role-tab { grid-template-columns: 1fr; }
  .role-tab canvas, .role-tab .empty { display: none; }
  .instrument-workspace { grid-template-columns: 1fr; }
  .voice-workspace { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .studio-tabs { margin-left: 6px; }
}
@media (max-width: 600px) {
  .top { padding: 12px; }
  .bench { display: block; }
  .drawer { padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .drawer > .eyebrow, .taste { display: none; }
  .roles { display: flex; overflow-x: auto; }
  .roles li { flex: 0 0 auto; }
  .role-tab { padding: 8px; }
  .role-tab .label { font-size: 16px; }
  .field { padding-bottom: 110px; }
  .field-tools { gap: 5px; }
  .field-tools button, .casting-settings > summary { padding: 6px 8px; font-size: 11px; }
  .field-head { gap: 12px; }
  .role-name { font-size: 32px; }
  .casting-panel { position: fixed; top: 120px; left: 5vw; right: auto; max-height: 70vh; overflow-y: auto; width: 90vw; }
  .comparison { gap: 4px; }
  .comparison button { padding: 4px; font-size: 9px; min-height: 45px; }
  .specimen.editing { padding: 11px; }
  .audition-actions .action-spacer { display: none; }
  .audition-actions button { font-size: 11px; }
  .control-graph, .win, .colour-surface { height: 190px; }
  .thread.edit .curve-name { order: 0; flex-basis: auto; }
  .thread.edit .expr { white-space: nowrap; }
  .graph-key { font-size: 9px; }
}
.graph-caption, .graph-time-start, .graph-time-end { position: absolute; pointer-events: none; font: 10px var(--mono); color: var(--muted); }
.graph-caption { top: 6px; left: 12px; }
.graph-time-start { left: 12px; bottom: 3px; }
.graph-time-end { right: 12px; bottom: 3px; }
.studio-tabs button:disabled { opacity: .35; cursor: default; }
@media (min-width: 851px) and (max-height: 850px) {
  .top { padding-top: 10px; padding-bottom: 10px; }
  .field { padding-top: 12px; }
  .comparison button { min-height: 45px; }
  .specimen.editing .wave { height: 48px; }
  .control-graph, .win, .colour-surface { height: 145px; }
  .instrument-workspace { padding-top: 10px; }
}
.graph-hit-end { position: absolute; top: 26px; pointer-events: none; font: 10px var(--mono); color: var(--muted); }
.graph-connector { stroke-dasharray: 2 3; opacity: .55; }
.graph-root { fill: var(--c, var(--ink)); }
@media (min-width: 851px) and (max-height: 850px) {
  .data-workspace .workspace-head { min-height: 20px; margin-bottom: 6px; }
  .data-tabs button { display: flex; align-items: center; gap: 5px; }
  .data-tabs button small { min-width: 0; max-width: 35px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .data-tabs button span { font-size: 11px; }
  .control-graph, .win, .colour-surface { height: 132px; }
}
@media (min-width: 851px) and (max-height: 850px) {
  .thread.edit { gap: 4px; }
}
.graph-hit-end { top: auto; bottom: 3px; left: 50%; transform: translateX(-50%); font-size: 9px; }
.graph-point:disabled { opacity: .35; cursor: default; }
/* Source and ADSR share one coordinate system. Handles own envelope gestures;
   the band and its edges own source-window gestures. */
.source-control-graph svg { pointer-events: none; }
.source-control-graph .band { top: 22.2222%; bottom: 20%; z-index: 1; }
.source-control-graph .graph-point { z-index: 3; }
.source-control-graph .graph-tip { z-index: 4; }
.source-control-graph { cursor: crosshair; }
.curve-legend { display: flex; justify-content: end; min-height: 14px; }
.graph-key em { width: 10px; border-top: 1px dashed var(--ink); opacity: .55; }

/* Sample-designer branch: one sound, with its trail outside the edit surface. */
.sample-designer .top { align-items: center; }
.designer-label { color: var(--muted); font: 11px var(--mono); }
.load { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 11px var(--mono); }
.load[hidden] { display: none; }
.load-track { width: 120px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.load-fill { display: block; height: 100%; background: var(--ink); transform: scaleX(.03); transform-origin: left; transition: transform .35s ease-out; }
.load.waiting .load-step { color: var(--ink); }      /* something waits on the tools */
.load.waiting .load-fill { animation: load-pulse 1.2s ease-in-out infinite; }
.load.failed { color: var(--turbofan); }
.load.failed .load-track { display: none; }
@keyframes load-pulse { 50% { opacity: .5; } }
/* Until the page has a sample to show, the load bar is all there is. */
body.booting > :not(.boot, .toast, script) { visibility: hidden; }
body.booting > .toast { z-index: 101; }
.boot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 16px; background: var(--bg); }
body:not(.booting) .boot { display: none; }
.boot-track { width: min(320px, 100%); height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.boot-fill { display: block; height: 100%; background: var(--ink); transform: scaleX(.03); transform-origin: left; transition: transform .35s ease-out; }
.boot-step { margin: 0; min-height: 1.5em; color: var(--muted); font: 12px var(--mono); text-align: center; }
.boot.failed .boot-step { color: var(--turbofan); }
.boot.failed .boot-track { display: none; }
@media (prefers-reduced-motion: reduce) { .load-fill, .boot-fill { transition: none; } .load.waiting .load-fill { animation: none; } }
.sample-designer .bench { grid-template-columns: 210px minmax(0, 1fr); }
.sample-designer .field { padding-bottom: 28px; }
.sample-designer .field-head { align-items: center; margin-bottom: 10px; }
.sample-designer .role-name { font-size: 42px; }
.kit-sound { display: grid; grid-template-columns: minmax(0, 1fr) 62px; align-items: stretch; border: 1px solid transparent; border-radius: 4px; }
.kit-sound:has([aria-current="true"]) { background: var(--panel); border-color: var(--line); }
.sample-designer .role-tab { grid-template-columns: 1fr; min-height: 42px; min-width: 0; padding: 8px 6px; border: 0; }
.sample-designer .role-tab .label { line-height: 1.1; }
.kit-play { display: flex; align-items: center; gap: 5px; min-height: 42px; padding: 5px; background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0 3px 3px 0; cursor: pointer; color: var(--muted); }
.kit-play canvas { display: block; width: 38px; height: 26px; }
.kit-play-icon { font: 9px/1 var(--body); }
.kit-play:hover, .kit-play:focus-visible, .kit-play[data-playing-patch] { color: var(--ink); background: var(--line); }
.kit-play[data-playing-patch] .kit-play-icon { color: var(--ecg); }
.kit-play:disabled { opacity: .25; cursor: default; background: none; }
/* Remove: a small × on hover or focus; without hover, on the current sound only. */
.kit-sound { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sample-designer .kit-sound .role-tab { padding-right: 26px; }
.kit-remove { position: absolute; top: 50%; right: 66px; transform: translateY(-50%); display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted); font: 15px/1 var(--body); cursor: pointer; opacity: 0; transition: opacity .12s; }
.kit-remove[hidden] { display: none; }
.kit-sound:hover .kit-remove, .kit-sound:focus-within .kit-remove { opacity: 1; }
.kit-remove:hover, .kit-remove:focus-visible { color: var(--ink); background: var(--line); }
@media (hover: none) {
  .kit-remove { pointer-events: none; }
  .kit-sound:has([aria-current="true"]) .kit-remove { opacity: 1; pointer-events: auto; }
  .sample-designer .kit-sound:not(:has([aria-current="true"])) .role-tab { padding-right: 6px; }
}
/* Reordering: the sound lifts, a copy follows the pointer, a line marks where it lands. */
.kit-sound.lifted { opacity: .35; }
.kit-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; background: var(--panel); border-color: var(--ink); box-shadow: 0 8px 24px #0008; }
.kit-ghost .kit-remove { display: none; }
.kit-sound.drop-before { box-shadow: 0 -3px 0 var(--ink); }
.kit-sound.drop-after { box-shadow: 0 3px 0 var(--ink); }
.sample-navigation { display: flex; align-items: center; gap: 12px; }
.sample-arrow { width: 42px; height: 36px; padding: 0; justify-content: center; font-size: 23px; }
.sample-arrow:disabled { opacity: .3; cursor: default; }
#sample-position { min-width: 110px; text-align: center; color: var(--ink); font: 12px var(--mono); }
.sample-designer .specimens { display: block; }
.sample-designer .specimen.editing { padding: 18px; }
.sample-designer .specimen.editing .wave { height: 85px; }
.sample-designer .instrument-workspace { padding-top: 18px; }
.sample-designer .control-graph, .sample-designer .win, .sample-designer .colour-surface { height: 210px; }
.designer-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.designer-footer .keys { margin: 0; }
@media (max-width: 850px) {
  .sample-designer .bench { display: flex; flex-direction: column; }
  .sample-designer .drawer { border-right: 0; }
  .sample-designer .field-tools { width: 100%; justify-content: space-between; }
  .sample-designer .role-name { font-size: 36px; }
  .sample-designer .field { padding-bottom: 18px; }
  .sample-designer .specimen.editing { padding: 14px; }
  .sample-designer .control-graph, .sample-designer .win, .sample-designer .colour-surface { height: 200px; }
  .designer-footer { padding: 12px; }
  .sample-designer .roles { display: flex; overflow-x: auto; padding: 3px 3px 5px; }
  .sample-designer .kit-sound { flex: 0 0 auto; }
  .kit-sound.drop-before { box-shadow: -3px 0 0 var(--ink); }
  .kit-sound.drop-after { box-shadow: 3px 0 0 var(--ink); }
  .sample-designer .role-tab { white-space: nowrap; }
}
@media (min-width: 851px) and (max-height: 850px) {
  .sample-designer .control-graph, .sample-designer .win, .sample-designer .colour-surface { height: 175px; }
  .sample-designer .specimen.editing .wave { height: 65px; }
}

.control-graph.extending { border-color: var(--c, var(--ink)); }
.control-graph.extending .graph-time-end { color: var(--ink); }

.add-sound { position: relative; }
.add-sound > summary { border: 1px dashed var(--line); border-radius: 4px; padding: 9px 8px; font-size: 12px; cursor: pointer; list-style: none; color: var(--muted); }
.add-sound > summary::-webkit-details-marker { display: none; }
.add-sound > summary:hover, .add-sound[open] > summary { color: var(--ink); border-color: var(--muted); }
.sound-types { position: absolute; top: calc(100% + 6px); left: 0; width: 230px; max-width: calc(100vw - 32px); max-height: min(430px, 65vh); overflow-y: auto; display: grid; padding: 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); box-shadow: 0 8px 28px #0008; z-index: 30; }
.add-sound[data-menu-side="up"] .sound-types { top: auto; bottom: calc(100% + 6px); }
.sound-types button { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 3px; background: transparent; padding: 9px 10px; cursor: pointer; font-size: 13px; }
.sound-types button:hover, .sound-types button:focus-visible { background: var(--line); }
.sound-menu-head { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; }
.sound-menu-head strong { font-size: 12px; font-weight: 500; color: var(--muted); }
.sound-types .sound-menu-head button { padding: 6px 10px; font-size: 18px; }
.sound-types small { color: var(--muted); font-size: 10px; }
@media (max-width: 850px) {
  /* Add sound ends the kit row; a long kit scrolls and keeps it in view. */
  .sample-designer .drawer { min-width: 0; flex-flow: row wrap; align-items: stretch; column-gap: 6px; }
  .sample-designer .drawer > .eyebrow { flex-basis: 100%; }
  .sample-designer .roles { flex: 0 1 auto; min-width: 0; }
  .add-sound { flex: none; margin: 3px 0 5px; }
  .add-sound > summary { box-sizing: border-box; height: 100%; display: flex; align-items: center; padding: 6px 12px; white-space: nowrap; }
  .sound-types { left: auto; right: 0; }
  .add-sound[data-menu-align="left"] .sound-types { left: 0; right: auto; }
}

/* Playback stays above the slice shading and below its editable handles. */
.graph-playback { position: absolute; left: 3%; width: 94%; top: calc(100% * 40 / 180); height: calc(100% * 104 / 180); pointer-events: none; z-index: 1; }
.graph-playback-fill { position: absolute; top: 0; bottom: 0; left: var(--played-start); width: var(--played-width); background: var(--c, var(--ink)); opacity: .07; }
.graph-playhead { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink); box-shadow: 0 0 3px #0008; }
.graph-playhead::before { content: ''; position: absolute; top: -3px; left: -2px; width: 5px; height: 4px; background: var(--ink); }



/* ── Breeding board ─────────────────────────────────────────────────────────── */
.view-switch { display: inline-flex; gap: 4px; }
.view-switch .toggle { font-size: 13px; padding: 5px 10px; }
.view-switch .toggle[aria-pressed="true"] kbd { color: var(--bg); border-color: var(--bg); }
.board { display: flex; flex-direction: column; gap: 14px; }
.board-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.board-status { margin: 0 auto 0 0; font: 13px var(--mono); color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .4; cursor: default; }
.board ol { list-style: none; margin: 0; padding: 0; }
.board-tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; min-height: 110px; }
.board-card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; cursor: grab;
  touch-action: none; user-select: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.board-card:hover { border-color: var(--muted); }
.board-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.board-card[aria-selected="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.board-card.lifted { opacity: .35; }
.board-card.pending { cursor: progress; opacity: .6; }
/* Playable, but its calibration is still being finished: a quiet marker, not a blocker. */
.board-card.refining .facts::after { content: ' · refining'; opacity: .55; }
.pending-wave { display: block; height: 56px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 12%, transparent), transparent) 0 0 / 200% 100%;
  animation: board-wait 1.2s linear infinite; }
@keyframes board-wait { to { background-position: -200% 0; } }
.board-card canvas { width: 100%; height: 56px; display: block; }
.board-card.small { padding: 5px 6px; gap: 3px; }
.board-card.small canvas { height: 28px; }
.board-card-head { display: flex; gap: 6px; align-items: baseline; font: 11px var(--mono); color: var(--muted); min-width: 0; }
.board-card-head .facts { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-card-head .origin { margin-left: auto; white-space: nowrap; }
.board-empty { grid-column: 1 / -1; color: var(--muted); font: 13px var(--mono); align-self: center; text-align: center; }
.board-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; opacity: .9; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.board-zones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.board-zone { --zone: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 8px; min-height: 140px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .12s, background .12s; }
.board-zone[data-zone="keep"] { --zone: var(--ecg); }
.board-zone[data-zone="breed"] { --zone: var(--bike); }
.board-zone[data-zone="skip"] { --zone: var(--turbofan); }
.board-zone.over { border-style: solid; border-color: var(--zone); background: color-mix(in srgb, var(--zone) 10%, transparent); }
.zone-head { all: unset; cursor: pointer; font: 800 18px/1 var(--display); text-transform: uppercase; letter-spacing: .03em;
  color: var(--zone); display: flex; gap: 8px; align-items: center; }
.zone-head:focus-visible { outline: 2px solid var(--zone); outline-offset: 3px; }
.zone-head .count { margin-left: auto; font: 12px var(--mono); color: var(--muted); }
.zone-help { margin: 0; font-size: 12px; color: var(--muted); }
.board-zone ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.board-zone .board-card { border-color: color-mix(in srgb, var(--zone) 45%, var(--line)); }
.board-parents h3 { margin: 0 0 6px; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.board-parents h3 span { text-transform: none; letter-spacing: 0; margin-left: 8px; }
.board-parents ol { display: flex; gap: 6px; overflow-x: auto; }
.board-parents .board-card { width: 130px; flex: none; border-color: color-mix(in srgb, var(--bike) 45%, var(--line)); cursor: pointer; }
@media (max-width: 850px) {
  .board-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The zones stay pinned at the bottom of the screen, so a card can always be
     dragged (or tapped) into one without scrolling past the tray. */
  .board-zones { position: sticky; bottom: 0; z-index: 5; gap: 6px; background: var(--bg);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .board-zone { min-height: 0; padding: 6px; gap: 4px; }
  .zone-help { display: none; }
  .board-zone ol { display: flex; gap: 4px; overflow-x: auto; }
  .board-zone .board-card.small { width: 64px; flex: none; padding: 3px; }
  .board-zone .board-card.small .board-card-head { display: none; }
  .board-zone .board-card.small canvas { height: 22px; }
}

/* ── Showcase (showcase.html): hand-picked sounds and their measurements ───────── */
.showcase-head { display: grid; justify-items: start; gap: 14px; max-width: 760px; padding: 32px 24px 24px; }
.showcase-pitch { margin: 0; font-size: 17px; line-height: 1.5; }
.showcase-cta { padding: 8px 14px; border-radius: 4px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; text-decoration: none; }
.showcase main { flex: 1; padding: 0 24px 32px; }
.showcase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.showcase-card { display: grid; align-content: start; gap: 10px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 6px; }
.showcase-card.playing { border-color: var(--c); }
.showcase-play { position: relative; height: 72px; padding: 0; border: 0; border-radius: 4px; background: var(--bg); cursor: pointer; }
.showcase-play.failed { opacity: .4; cursor: default; }
.showcase-play canvas { display: block; width: 100%; height: 100%; }
.showcase-key { position: absolute; top: 6px; right: 8px; color: var(--muted); font: 11px var(--mono); }
.showcase-card h2 { margin: 0; font: 800 22px/1.1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.showcase-summary { margin: 0; color: var(--muted); font-size: 13px; }
.showcase-story { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; font-size: 12px; }
.showcase-story dt { padding-top: 1px; color: var(--muted); font: 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.showcase-story dd { margin: 0; padding-left: 8px; border-left: 2px solid var(--c); }
.showcase-story small { display: block; color: var(--muted); }
.showcase-open { justify-self: start; color: var(--ink); font-size: 13px; }
.showcase footer a { color: inherit; }
.header-link { color: var(--muted); font-size: 12px; text-decoration: none; }
.header-link:hover { color: var(--ink); }
