/* ============================================================
   COMPRESSION WORKSHOP — the bench design system
   Two registers (bench porcelain / night session), one accent
   channel, two type pairings. Every token here is exportable
   from the Design Desk. No flat darks: every ground is layered
   (gradient + grain + pooled light). Instruments are dark glass
   in BOTH registers — dark is for scopes.
   ============================================================ */

:root {
  /* register: bench (porcelain instrument enamel) */
  --paper: #EFEAE0;
  --paper-2: #F6F2EA;
  --paper-deep: #E3DCCE;
  --ink: #1F2723;
  --ink-2: #5A655E;
  --line: rgba(31, 39, 35, 0.16);
  --line-soft: rgba(31, 39, 35, 0.09);
  --accent: #1F7A4D;
  --ok: #2E7D54;
  --grain-alpha: 0.05;
  --pool: radial-gradient(120% 70% at 50% -8%, rgba(255,255,255,0.85), rgba(255,255,255,0) 60%);

  /* the scopes: dark glass in both registers */
  --scope-bg: #161B1E;
  --scope-bg-2: #0D1114;
  --scope-grid: rgba(180, 205, 195, 0.08);
  --scope-grid-bold: rgba(180, 205, 195, 0.22);
  --scope-trace: #7EDCA8;
  --scope-trace-2: #E9C36A;
  --scope-ghost: rgba(196, 214, 206, 0.42);
  --scope-label: rgba(203, 219, 211, 0.62);
  --scope-warn: #E8704E;
  --bezel: rgba(15, 20, 18, 0.24);

  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, monospace;

  --ease-snap: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --measure: 66ch;
  --wide: 1240px;
}

:root[data-register='night'] {
  --paper: #17191D;
  --paper-2: #1E2126;
  --paper-deep: #121417;
  --ink: #E7E4DA;
  --ink-2: #9BA29B;
  --line: rgba(231, 228, 218, 0.16);
  --line-soft: rgba(231, 228, 218, 0.08);
  --ok: #63BE8F;
  --pool: radial-gradient(90% 55% at 50% -6%, rgba(255, 214, 170, 0.10), rgba(255, 214, 170, 0) 62%);
  --scope-bg: #101317;
  --scope-bg-2: #0A0D10;
  --bezel: rgba(0, 0, 0, 0.5);
}

:root[data-pairing='b'] {
  --font-display: 'Young Serif', Georgia, serif;
}

/* ---------- ground ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--pool), linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* paper grain — the desk's grain slider drives --grain-alpha */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: var(--grain-alpha);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}
::selection { background: var(--accent); color: var(--paper); }

#app { position: relative; z-index: 1; }
.frame { max-width: var(--wide); margin: 0 auto; padding: 0 24px 120px; }

button { font: inherit; color: inherit; }
:where(button):focus-visible,
:where(input):focus-visible,
:where(summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- type furniture ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 18px;
}
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in oklab, var(--accent) 65%, transparent);
  flex: none;
}

/* ---------- hub ---------- */
.hub { padding-top: clamp(48px, 9vh, 110px); }
.mast-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(46px, 8.5vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
  max-width: 14ch;
}
:root[data-pairing='b'] .mast-title { font-weight: 400; letter-spacing: 0; }
.mast-stand {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--ink-2);
  max-width: 46ch;
  margin: 0 0 34px;
}
.mast-scope {
  position: relative;
  border-radius: 14px;
  background: var(--scope-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 0 0 1px rgba(255,255,255,0.04), 0 24px 60px -24px var(--bezel), 0 2px 6px rgba(0,0,0,0.18);
  overflow: hidden;
  height: clamp(170px, 26vw, 260px);
}
.mast-scope canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.mast-play { position: absolute; right: 14px; bottom: 12px; z-index: 2; }
.mast-note {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--ink-2);
  margin: 12px 2px 0;
}

/* the two doors — a split threshold, not cards */
.doors {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0;
  margin-top: 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper-2);
}
.door {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  text-align: left;
  padding: 34px 34px 30px;
  background: none; border: none; cursor: pointer;
  transition: background 0.35s var(--ease-out);
}
.door + .door { border-left: 1px solid var(--line); }
.door:hover { background: color-mix(in oklab, var(--accent) 5%, var(--paper-2)); }
.door-kicker {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
}
.door-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
:root[data-pairing='b'] .door-title { font-weight: 400; }
.door-sub { color: var(--ink-2); font-size: 15px; max-width: 44ch; }
.door-cta {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 3px;
  transition: transform 0.3s var(--ease-snap);
}
.door:hover .door-cta { transform: translateX(4px); }

/* ---------- the rail: the machine you assemble ---------- */
.home-link {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2);
  padding: 18px 0 0;
}
.home-link:hover { color: var(--accent); }
.rail {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: stretch; gap: 12px;
  padding: 10px 0;
  margin: 8px -24px 40px;
  padding-left: 24px; padding-right: 24px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.rail-inner {
  display: flex; align-items: center; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.rail-inner::-webkit-scrollbar { display: none; }
.rail-io {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-2); letter-spacing: 0.08em; flex: none;
}
.rail-wire {
  height: 2px; flex: 1 1 14px; min-width: 8px;
  background: var(--line);
  transition: background 0.6s;
}
.rail-wire.is-live {
  background: var(--accent);
  box-shadow: 0 0 6px color-mix(in oklab, var(--accent) 55%, transparent);
}
.rail-mod {
  flex: none;
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s var(--ease-snap);
}
.rail-mod:hover { transform: translateY(-1px); border-color: var(--ink-2); }
.rail-lamp {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line);
  transition: background 0.5s, box-shadow 0.5s;
}
.rail-mod.is-done .rail-lamp {
  background: var(--accent);
  box-shadow: 0 0 9px color-mix(in oklab, var(--accent) 75%, transparent);
}
.rail-mod.is-here {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 14px -6px color-mix(in oklab, var(--accent) 40%, transparent);
}
.rail-num {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2);
}
.rail-name { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.rail-mod.just-lit .rail-lamp { animation: lamp-on 1.1s var(--ease-snap); }
@keyframes lamp-on {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 80%, transparent); }
  45% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 9px color-mix(in oklab, var(--accent) 75%, transparent); }
}
.rail-door {
  flex: none;
  font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px dashed var(--line); background: none;
  border-radius: 8px; padding: 6px 12px;
  color: var(--ink-2); cursor: pointer;
}
.rail-door:hover, .rail-door.is-here { color: var(--accent); border-color: var(--accent); }

/* ---------- stage ---------- */
.stage, .plate-page { max-width: var(--wide); }
.stage-head { margin: 26px 0 8px; }
.stage-title {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  max-width: 22ch;
}
:root[data-pairing='b'] .stage-title { font-weight: 400; letter-spacing: 0; }
.stage-lead {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--ink-2);
  max-width: 50ch;
  margin: 0 0 26px;
}
.prose { max-width: var(--measure); margin: 0 0 18px; }
.prose strong { font-weight: 700; color: var(--ink); }
.try-line {
  font-family: var(--font-mono); font-size: 13.5px;
  color: var(--accent);
  margin: 26px 0 14px;
  display: flex; gap: 8px; align-items: baseline;
}

/* animated entry: one orchestrated moment per stage */
.stage-head { animation: rise 0.55s var(--ease-out) backwards; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
:root[data-motion='calm'] .stage-head,
:root[data-motion='calm'] .rail-mod.just-lit .rail-lamp { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .stage-head, .stage-main > *, .rail-mod.just-lit .rail-lamp { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- figures / instruments ---------- */
.fig { margin: 8px 0 34px; }
.scope-stage {
  position: relative;
  border-radius: 14px;
  background: var(--scope-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 0 0 1px rgba(255,255,255,0.04), 0 26px 60px -26px var(--bezel), 0 2px 6px rgba(0,0,0,0.16);
  overflow: hidden;
  height: clamp(260px, 42vw, 420px);
}
.scope-square { height: clamp(320px, 52vw, 480px); }
.scope-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.fig-legend {
  display: flex; flex-wrap: wrap; gap: 18px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
  margin: 12px 2px 0;
}
.fig-legend i {
  display: inline-block; width: 14px; height: 3px; border-radius: 2px;
  margin-right: 7px; vertical-align: middle;
}
.fig-microline {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--ink);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px; margin: 16px 2px 0;
  min-height: 1.4em;
}
.fig-note {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
  margin: 10px 2px 0;
}
.fig-kicker {
  font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); margin: 26px 0 10px;
}
.chatter-canvas { display: block; width: 100%; height: 190px; border-radius: 12px;
  background: var(--scope-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 14px 34px -18px var(--bezel);
}
.chatter { margin-top: 26px; }

/* controls: instrument faders */
.ctl-row { display: grid; gap: 16px 26px; margin: 18px 0 0; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ctl { display: flex; flex-direction: column; gap: 6px; }
.ctl-head { display: flex; justify-content: space-between; align-items: baseline; }
.ctl-name { font-size: 13.5px; font-weight: 650; letter-spacing: 0.01em; }
.ctl-read { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type='range'] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; background: none; cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 0.01%, var(--line) 0.01%);
  background: var(--line);
}
input[type='range']::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 24px; border-radius: 4px;
  background: linear-gradient(90deg, var(--ink) 0 5.5px, var(--accent) 5.5px 9.5px, var(--ink) 9.5px 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.22);
  margin-top: -10.5px;
  transition: transform 0.15s var(--ease-snap);
}
input[type='range']::-webkit-slider-thumb:hover { transform: scaleY(1.1); }
input[type='range']::-moz-range-thumb {
  width: 15px; height: 24px; border-radius: 4px; border: none;
  background: linear-gradient(90deg, var(--ink) 0 5.5px, var(--accent) 5.5px 9.5px, var(--ink) 9.5px 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.22);
}

/* chips + play */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.chip {
  font-family: var(--font-mono); font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); color: var(--ink);
  padding: 7px 14px; cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.2s var(--ease-snap);
}
.chip:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.chip.is-on {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 10%, var(--paper-2));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.chip-lg { font-size: 13.5px; padding: 10px 18px; }
.fig-actions { margin: 20px 0 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.play-btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: 13px;
  padding: 10px 18px 10px 14px; cursor: pointer;
  transition: transform 0.2s var(--ease-snap), box-shadow 0.3s;
}
.play-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(0,0,0,0.5); }
.play-glyph {
  width: 0; height: 0;
  border-left: 9px solid var(--accent);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  transition: all 0.2s;
}
.play-btn.is-playing .play-glyph {
  border-left: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
  border-top: none; border-bottom: none;
  height: 12px; width: 3px;
}
:root[data-register='night'] .play-btn { background: var(--paper-2); color: var(--ink); border-color: var(--line); }

/* ---------- deeper / staff / recap ---------- */
.deeper {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin: 30px 0; max-width: var(--measure);
}
.deeper summary {
  cursor: pointer; list-style: none;
  padding: 15px 2px;
  font-weight: 650; font-size: 15.5px;
  display: flex; align-items: baseline; gap: 12px;
}
.deeper summary::-webkit-details-marker { display: none; }
.deeper summary::after {
  content: '+'; margin-left: auto;
  font-family: var(--font-mono); color: var(--accent); font-size: 17px;
  transition: transform 0.3s var(--ease-snap);
}
.deeper[open] summary::after { transform: rotate(45deg); }
.deeper-kicker {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
}
.deeper-body { padding: 2px 2px 20px; color: var(--ink); max-width: var(--measure); }

.staff {
  background: color-mix(in oklab, var(--accent) 4%, var(--paper-2));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 26px 0;
  max-width: var(--measure);
  font-size: 15px;
}
.staff p { margin: 0 0 10px; }
.staff-kicker {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}

.recap {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  margin: 30px 0;
}
.recap-kicker {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 12px;
}
.recap ul { margin: 0; padding-left: 20px; }
.recap li { margin: 6px 0; font-size: 15.5px; }
.recap li::marker { color: var(--accent); }

/* ---------- the check ---------- */
.check {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--paper-2), color-mix(in srgb, var(--paper-2) 65%, var(--paper)));
  padding: 26px 28px;
  margin: 34px 0 0;
}
.check-kicker {
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
.check-sub { color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }
.q { border: none; padding: 0; margin: 0 0 22px; }
.q-stem { font-weight: 650; font-size: 15.5px; padding: 0 0 10px; }
.q-opt {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper);
  padding: 10px 14px; margin: 7px 0;
  font-size: 14.5px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease-snap);
}
.q-opt:hover { border-color: var(--ink-2); transform: translateX(2px); }
.q-opt.is-right {
  border-color: var(--ok);
  background: color-mix(in oklab, var(--ok) 9%, var(--paper));
  box-shadow: inset 3px 0 0 var(--ok);
}
.q-opt.is-wrong {
  border-color: var(--scope-warn);
  background: color-mix(in oklab, var(--scope-warn) 7%, var(--paper));
  opacity: 0.85;
}
.q-why {
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-2); margin: 8px 2px 0; min-height: 1.3em;
}
.check-skip { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.check-skip-note { font-size: 13px; color: var(--ink-2); }

/* ---------- stage nav + power banner ---------- */
.stage-nav { margin: 30px 0 0; }
.power-banner {
  font-family: var(--font-mono); font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-2);
  margin: 0 0 18px;
}
.power-banner.show { color: var(--ink); }
.power-lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 70%, transparent);
}
.power-lamp.off { background: var(--line); box-shadow: none; }
.stage-nav-row { display: flex; justify-content: space-between; gap: 14px; }
.nav-btn {
  font-family: var(--font-mono); font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper-2); color: var(--ink);
  padding: 12px 18px; cursor: pointer;
  transition: border-color 0.25s, transform 0.2s var(--ease-snap), box-shadow 0.3s;
}
.nav-btn:hover { border-color: var(--ink-2); transform: translateY(-1px); box-shadow: 0 10px 24px -14px rgba(0,0,0,0.35); }
.nav-next { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.stage-source {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-2); margin: 34px 0 0;
  letter-spacing: 0.02em;
}

/* ---------- the rack ---------- */
.rack {
  border-radius: 16px;
  background: var(--scope-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), inset 0 0 0 1px rgba(255,255,255,0.04), 0 30px 70px -28px var(--bezel), 0 2px 8px rgba(0,0,0,0.2);
  padding: 22px;
}
.rack-meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.meter { position: relative; height: 130px; }
.meter canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.meter-name {
  position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--scope-label);
}
.rack-scroll { position: relative; height: 120px; margin-top: 14px; border-radius: 10px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05); }
.rack-scroll canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rack .ctl-row { padding: 6px 2px 0; }
.rack .ctl-name { color: rgba(230, 238, 233, 0.92); }
.rack .ctl-read { color: var(--scope-trace-2); }
.rack input[type='range']::-webkit-slider-runnable-track { background: rgba(200, 215, 208, 0.18); }
.rack input[type='range']::-webkit-slider-thumb {
  background: linear-gradient(90deg, #2A3136 0 5.5px, var(--scope-trace-2) 5.5px 9.5px, #2A3136 9.5px 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.14);
}
.rack input[type='range']::-moz-range-thumb {
  background: linear-gradient(90deg, #2A3136 0 5.5px, var(--scope-trace-2) 5.5px 9.5px, #2A3136 9.5px 100%);
}
.rack .fig-microline { color: var(--scope-label); border-top-color: rgba(255,255,255,0.08); }
.rack-actions .chip { background: rgba(255,255,255,0.04); color: rgba(230,238,233,0.9); border-color: rgba(255,255,255,0.14); }
.rack-actions .chip.is-on { border-color: var(--scope-trace-2); box-shadow: inset 0 0 0 1px var(--scope-trace-2); }
.rack-actions .play-btn { background: var(--scope-trace-2); border-color: var(--scope-trace-2); color: #14181B; }
.rack-actions .play-btn .play-glyph { border-left-color: #14181B; }
.rack-actions .play-btn.is-playing .play-glyph { border-left-color: #14181B; border-right-color: #14181B; }

/* ---------- everything plate ---------- */
.plate, .lens, .reel, .traps { margin: 44px 0; }
.plate-kicker {
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 18px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}
.plate-row {
  display: grid;
  grid-template-columns: 150px 96px 1.5fr 1.2fr;
  gap: 22px; align-items: start;
  padding: 20px 0;
  border-top: 1px solid var(--line-soft);
}
.plate-row:first-of-type { border-top: none; }
.plate-name h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em;
}
:root[data-pairing='b'] .plate-name h3 { font-weight: 400; }
.plate-ess { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); margin: 0; }
.plate-sig .sig {
  width: 96px; height: 96px; display: block;
  background: var(--scope-bg);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 10px 24px -14px var(--bezel);
}
.sig-unity { stroke: var(--scope-ghost); stroke-width: 1; stroke-dasharray: 2 3; }
.sig-thr { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.8; }
.sig-law { stroke: var(--scope-trace); stroke-width: 2; fill: none; }
.sig-ghost { stroke: var(--scope-ghost); stroke-width: 1.2; fill: none; }
.plate-mech { font-size: 14.5px; }
.plate-mech p { margin: 0 0 8px; }
.plate-note { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); }
.plate-verdicts .verdict {
  font-size: 13.5px; margin: 0 0 9px;
  padding-left: 14px; position: relative;
}
.verdict::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.verdict strong {
  display: block;
  font-family: var(--font-mono); font-weight: 600; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}

.lens-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.lens-chip {
  display: inline-block;
  font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; margin: 0 0 14px; color: var(--ink-2);
}
.lens-lane ul { margin: 0; padding-left: 20px; }
.lens-lane li { margin: 7px 0; font-size: 15px; }
.lens-lane li::marker { color: var(--accent); }
.lens-quote-label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); margin: 18px 0 6px;
}
.lens-quote {
  margin: 0; padding: 14px 18px;
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px;
}
.lens-fold { margin-top: 18px; }
.lens-fold summary {
  cursor: pointer; font-weight: 650; font-size: 14.5px;
  font-family: var(--font-mono);
}
.lens-fold ol { padding-left: 22px; }
.lens-fold li { margin: 6px 0; font-size: 14.5px; }

.reel-strip {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(270px, 320px);
  gap: 16px; overflow-x: auto;
  padding: 4px 2px 16px;
  scroll-snap-type: x mandatory;
}
.reel-item {
  scroll-snap-align: start;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper-2);
  padding: 18px 20px;
}
.reel-meta { font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin: 0 0 10px; }
.reel-stem { font-size: 14.5px; margin: 0 0 12px; }
.reel-item summary { cursor: pointer; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.reel-key { font-size: 13.5px; color: var(--ink); margin: 10px 0 0; }

.traps-list { counter-reset: trap; list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.traps-list li {
  counter-increment: trap;
  position: relative;
  padding: 14px 0 14px 52px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
}
.traps-list li::before {
  content: counter(trap, decimal-leading-zero);
  position: absolute; left: 0; top: 14px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--accent);
}
.provenance {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--ink-2); max-width: var(--measure);
  border-top: 1px solid var(--line); padding-top: 16px; margin: 44px 0 30px;
}

/* ---------- design desk ---------- */
.desk-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 60; }
.desk-trigger {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); color: var(--ink);
  padding: 10px 16px; cursor: pointer;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,0.4);
  transition: transform 0.2s var(--ease-snap);
}
.desk-trigger:hover { transform: translateY(-2px); }
.desk-glyph {
  width: 10px; height: 10px; border-radius: 3px;
  background: conic-gradient(from 40deg, var(--accent), var(--scope-trace-2), var(--scope-trace), var(--accent));
}
.desk {
  position: absolute; right: 0; bottom: 52px;
  width: min(320px, calc(100vw - 48px));
  max-height: min(74vh, 640px);
  overflow-y: auto;
  border: 1px solid var(--line); border-radius: 16px;
  background: color-mix(in srgb, var(--paper-2) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.45);
  padding: 22px 22px 18px;
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(0.98);
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-snap), visibility 0.28s;
}
.desk-wrap.is-open .desk { opacity: 1; visibility: visible; transform: none; }
.desk-kicker {
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
.desk-sub { font-size: 12.5px; color: var(--ink-2); margin: 0 0 16px; }
.desk-group { margin: 0 0 16px; }
.desk-label {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 8px;
}
.desk-opt {
  display: block; width: 100%; text-align: left;
  font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper); padding: 9px 12px; margin: 6px 0;
  cursor: pointer; transition: border-color 0.2s;
}
.desk-opt:hover { border-color: var(--ink-2); }
.desk-opt.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.desk-copy { font-family: var(--font-mono); font-size: 12.5px; }
.desk-swatches { display: flex; gap: 10px; }
.desk-swatch {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--sw);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 0.2s var(--ease-snap);
}
.desk-swatch:hover { transform: scale(1.12); }
.desk-swatch.is-on { box-shadow: 0 0 0 2px var(--accent); }
.desk input[type='range'] { height: 22px; }

/* ---------- the ceiling grammar: chips, hints, tags, try-cards ---------- */
.read-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 0; }
.read-chip {
  flex: 1; min-width: 96px; max-width: 180px;
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.read-k {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2);
}
.read-v {
  font-family: var(--font-mono); font-size: 21px; font-weight: 600;
  line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.read-v::after { content: ' dB'; font-size: 11px; color: var(--ink-2); font-weight: 400; }
.read-accent .read-v { color: var(--accent); }

.ctl-hint {
  font-size: 12px; color: var(--ink-2); line-height: 1.45;
  margin-top: 1px;
}
.rack .ctl-hint { color: rgba(203, 219, 211, 0.55); }

.scope-tag {
  position: absolute; top: 12px; right: 16px; z-index: 2;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(203, 219, 211, 0.5);
  pointer-events: none;
}

.try-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin: 4px 0 34px;
}
.try-card { border-top: 1px solid var(--line); padding-top: 12px; }
.try-n {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0;
}
.try-p { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; max-width: 36ch; }
.try-p b { color: var(--ink); font-weight: 650; }

.ckt-dot { fill: var(--scope-trace); }
.ckt-dot-side { fill: var(--scope-trace-2); }
@media (prefers-reduced-motion: reduce) { .ckt-dot { display: none; } }

/* ---------- traffic lights: first answers set the light ----------
   Semantics mirror the grades-dashboard SRS palette (overdue / due / on
   track), spoken in this build's own tokens. */
:root {
  --g-green: #2E7D54;
  --g-amber: #B98413;
  --g-red: #C24A33;
}
:root[data-register='night'] {
  --g-green: #5FC490;
  --g-amber: #E3B34C;
  --g-red: #E8704E;
}
.rail-mod.is-grade-green .rail-lamp { background: var(--g-green); box-shadow: 0 0 9px color-mix(in oklab, var(--g-green) 75%, transparent); }
.rail-mod.is-grade-amber .rail-lamp { background: var(--g-amber); box-shadow: 0 0 9px color-mix(in oklab, var(--g-amber) 75%, transparent); }
.rail-mod.is-grade-red .rail-lamp { background: var(--g-red); box-shadow: 0 0 9px color-mix(in oklab, var(--g-red) 75%, transparent); }

/* ---------- the stage body grid: main + bench margin ---------- */
.stage-body { display: block; }
.stage-main { min-width: 0; }
.stage-main > * { animation: rise 0.55s var(--ease-out) backwards; }
.stage-main > *:nth-child(1) { animation-delay: 0.02s; }
.stage-main > *:nth-child(2) { animation-delay: 0.08s; }
.stage-main > *:nth-child(3) { animation-delay: 0.14s; }
.stage-main > *:nth-child(4) { animation-delay: 0.2s; }
:root[data-motion='calm'] .stage-main > * { animation: none; }
@media (prefers-reduced-motion: reduce) { .stage-main > * { animation: none !important; } }

.stage-margin { margin-top: 34px; }
.margin-numeral { display: none; }
.margin-card {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper-2);
  padding: 18px 20px;
}
.margin-kicker {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}
.margin-terms { margin: 0; }
.margin-terms dt {
  font-weight: 700; font-size: 14px; margin: 12px 0 2px;
}
.margin-terms dt:first-child { margin-top: 0; }
.margin-terms dd {
  margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5;
}
.margin-light {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 16px 0 0; padding: 14px 16px;
  border: 1px dashed var(--line); border-radius: 12px;
}
.margin-lamp {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); margin-top: 4px;
  transition: background 0.5s, box-shadow 0.5s;
}
.margin-light.is-green .margin-lamp { background: var(--g-green); box-shadow: 0 0 10px color-mix(in oklab, var(--g-green) 70%, transparent); }
.margin-light.is-amber .margin-lamp { background: var(--g-amber); box-shadow: 0 0 10px color-mix(in oklab, var(--g-amber) 70%, transparent); }
.margin-light.is-red .margin-lamp { background: var(--g-red); box-shadow: 0 0 10px color-mix(in oklab, var(--g-red) 70%, transparent); }
.margin-light-text { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.margin-module {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.08em; color: var(--ink-2); margin: 14px 2px 0;
}
@media (min-width: 1180px) {
  .stage-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    column-gap: 60px;
    align-items: start;
  }
  .stage-margin {
    position: sticky; top: 72px;
    margin-top: 0;
  }
  .margin-numeral {
    display: block;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 88px; line-height: 1;
    letter-spacing: -0.03em;
    color: color-mix(in srgb, var(--ink) 9%, transparent);
    margin: 0 0 10px;
    user-select: none;
  }
  :root[data-pairing='b'] .margin-numeral { font-weight: 400; }
}

/* ---------- the revisit tray ---------- */
.tray {
  margin-top: 34px;
  border: 1px dashed var(--line); border-radius: 14px;
  padding: 22px 26px;
}
.tray-kicker {
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--g-amber); margin: 0 0 6px;
}
.tray-sub { font-size: 13.5px; color: var(--ink-2); margin: 0 0 6px; }
.chip-tray { border-color: color-mix(in srgb, var(--g-amber) 55%, var(--line)); }

/* ---------- the exam bench ---------- */
.fig-exam { margin-top: 44px; }
.exam-brief { max-width: var(--measure); }
.exam-stem {
  font-size: 15.5px; margin: 0 0 18px;
  padding: 16px 20px;
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 12px;
}
.exam-mark { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.exam-sheet { margin: 18px 0 0; max-width: var(--measure); }
.exam-line {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 14px; margin: 0;
  padding: 8px 2px;
  border-top: 1px solid var(--line-soft);
}
.exam-tick { font-family: var(--font-mono); flex: none; width: 16px; }
.exam-line.is-hit .exam-tick { color: var(--g-green); }
.exam-line.is-miss .exam-tick { color: var(--g-red); }
.exam-line.is-miss { color: var(--ink-2); }
.exam-line.is-given { color: var(--ink-2); }
.exam-total {
  font-family: var(--font-mono); font-size: 13px;
  margin: 10px 0 0; padding-top: 12px;
  border-top: 2px solid var(--ink);
}

/* ---------- the ear check ---------- */
.listen { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.listen-kicker {
  display: block;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}
.chip-take { font-size: 13px; }
.chip-take.is-on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.listen-answer { max-width: 220px; display: inline-block; margin-right: 10px; }
.listen .chip-row { margin: 6px 0 4px; }
.write-note {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-2); margin: 12px 0 0;
}

/* ---------- desk: paper + hue ---------- */
.desk-swatch-paper { border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.desk-hue { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.desk-hue .hue-dial {
  flex: 1; height: 18px;
  -webkit-appearance: none; appearance: none;
}
.hue-dial::-webkit-slider-runnable-track {
  height: 8px; border-radius: 5px;
  background: linear-gradient(90deg,
    oklch(0.6 0.15 0), oklch(0.6 0.15 60), oklch(0.6 0.15 120),
    oklch(0.6 0.15 180), oklch(0.6 0.15 240), oklch(0.6 0.15 300), oklch(0.6 0.15 360));
}
.hue-dial::-moz-range-track {
  height: 8px; border-radius: 5px;
  background: linear-gradient(90deg,
    oklch(0.6 0.15 0), oklch(0.6 0.15 60), oklch(0.6 0.15 120),
    oklch(0.6 0.15 180), oklch(0.6 0.15 240), oklch(0.6 0.15 300), oklch(0.6 0.15 360));
}
.hue-dial::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  margin-top: -4px;
}
.hue-dial::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--paper);
}
.desk-hue-label {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2);
  flex: none;
}
.desk-hue.is-on .desk-hue-label { color: var(--accent); }

/* ---------- the written sentence ---------- */
.q-writing { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.write-box {
  display: block; width: 100%; max-width: 440px;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; margin: 4px 0 10px;
}
.write-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.write-result { margin-top: 12px; }
.write-line {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 13.5px; margin: 0; padding: 5px 2px;
}
.write-line.is-hit .exam-tick { color: var(--g-green); }
.write-line.is-miss { color: var(--ink-2); }
.write-verdict {
  font-family: var(--font-mono); font-size: 12.5px;
  margin: 10px 0 0;
}
.write-model { margin-top: 10px; }
.write-model summary {
  cursor: pointer; font-family: var(--font-mono);
  font-size: 12px; color: var(--ink-2);
}
.write-model p {
  margin: 8px 0 0; font-size: 14px;
  padding: 10px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 9px;
}

/* ---------- circuit svg ---------- */
.circuit { margin: 6px 0 0; }
.circuit svg { width: 100%; height: auto; display: block;
  background: var(--scope-bg); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 22px 50px -24px var(--bezel);
  padding: 10px; }
.ckt-wire path { stroke: var(--scope-ghost); stroke-width: 1.6; fill: none; }
.ckt-side path { stroke: var(--scope-trace-2); transition: opacity 0.4s; }
.ckt-box { fill: rgba(255,255,255,0.03); stroke: var(--scope-grid-bold); stroke-width: 1.2; }
.ckt-vca { stroke: var(--scope-trace); }
.ckt-text { fill: var(--scope-label); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; }
.ckt-sub { fill: var(--scope-label); opacity: 0.7; font-family: var(--font-mono); font-size: 10px; }
.ckt-io { fill: var(--scope-label); font-family: var(--font-mono); font-size: 12px; }
.ckt-arr { fill: var(--scope-ghost); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .doors { grid-template-columns: 1fr; }
  .door + .door { border-left: none; border-top: 1px solid var(--line); }
  .plate-row { grid-template-columns: 1fr 96px; }
  .plate-mech, .plate-verdicts { grid-column: 1 / -1; }
  .lens-cols { grid-template-columns: 1fr; }
  .rail-name { display: none; }
  .rail-mod { padding: 6px 8px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .frame { padding: 0 16px 90px; }
  .rail { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .rack-meters { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .meter { height: 96px; }
  .check { padding: 20px 18px; }
  .stage-nav-row { flex-direction: column; }
  .nav-btn { width: 100%; text-align: center; }
}

/* ---------- 2026-07-15 · Mike's layout notes, back-ported 2026-07-16
   (FOUNDATION §10; the donor blocks above stay verbatim) ---------- */

/* 1 · the bench fits one screen: the scope gives up a little height and
   (order set in figures.js) the controls sit directly under the glass,
   readouts after — no more scrolling between scope and buttons. */
.scope-stage { height: min(clamp(240px, 42vw, 368px), 46vh); }
.scope-square { height: min(clamp(300px, 46vw, 420px), 50vh); } /* squarer plots keep a little more */
.mast-scope { height: clamp(170px, 26vw, 260px); } /* re-asserted after the override */

/* 2 · the margin lockup: ghost numeral + stage name, top right, level
   with the title (the stage header now lives inside the grid). */
.margin-title { display: none; }
@media (min-width: 1180px) {
  .margin-title {
    display: block;
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--ink-2);
    margin: -2px 0 16px 4px;
  }
}

/* 3 · the loop strip: the loop's two bars as a waveform, playhead live —
   the lab's AudioScrubber idiom in bench tokens. */
.loop-strip {
  position: relative;
  flex: 1; min-width: 220px; max-width: 430px;
  height: 40px; padding: 0 3px;
  display: flex; align-items: center; gap: 1.5px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper-2);
  overflow: hidden;
  cursor: crosshair;
}
.loop-strip.is-hidden { display: none; }
.loop-bar {
  flex: 1; min-width: 1px; height: 7%;
  border-radius: 1px;
  background: color-mix(in oklab, var(--ink) 30%, transparent);
  transform-origin: center;
  transition: background 0.15s;
}
.loop-bar.is-played { background: var(--accent); }
.loop-bar-2 { margin-left: 6px; } /* the barline: two bars, a visible seam */
.loop-line {
  position: absolute; top: 3px; bottom: 3px; width: 2px;
  background: var(--accent); border-radius: 1px;
  opacity: 0; transition: opacity 0.25s;
  pointer-events: none;
}
.loop-hover {
  position: absolute; top: 3px; bottom: 3px; width: 1px;
  background: color-mix(in oklab, var(--ink) 45%, transparent);
  opacity: 0; transition: opacity 0.12s;
  pointer-events: none;
}
.loop-tip {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px; white-space: nowrap;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 7px;
  opacity: 0; transition: opacity 0.12s;
  pointer-events: none;
}
/* the strip on the rack's night panel */
.rack .loop-strip { background: rgba(255, 255, 255, 0.045); border-color: rgba(203, 219, 211, 0.18); }
.rack .loop-bar { background: rgba(203, 219, 211, 0.38); }
.rack .loop-bar.is-played { background: var(--accent); }
.rack .loop-hover { background: rgba(203, 219, 211, 0.5); }
.rack .loop-tip { color: rgba(230, 238, 233, 0.9); background: #0d1322; border-color: rgba(203, 219, 211, 0.22); }
@media (prefers-reduced-motion: reduce) { .loop-bar { transition: none; } }
