/* ==========================================================================
   SynthLab — NF-1 panel styles
   Skins are CSS-variable sets on body[data-skin]. "classic" = walnut + black
   brushed panel, in the spirit of 1970s American monosynths.
   ========================================================================== */

:root {
  --cell-w: 114px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body[data-skin="classic"] {
  /* NF-1: an aubergine panel (a near-black purple) in dark walnut ends, so it stands apart
     from the NiniFoog's black panel and warmer, lighter wood */
  --desk: #141517;
  --desk-2: #1d1f23;
  --panel: #1f1428;
  --panel-hi: #2b1d36;
  --panel-lo: #160e1c;
  --ink: #ece6f2;          /* silk-screen print, a touch of lilac */
  --ink-dim: #ada5b6;
  --rule: rgba(236, 230, 242, 0.55);
  --accent: #ffb547;       /* readouts, active option */
  --led: #ff3b2f;
  --wood-1: #3a1f12;       /* dark walnut */
  --wood-2: #24130a;
  --wood-3: #4e2a17;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -10%, #2a2d33 0%, transparent 60%),
    linear-gradient(var(--desk-2), var(--desk));
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.knob-dragging { cursor: ns-resize; user-select: none; }

button { font-family: inherit; }

/* ---- app bar (modern chrome around the instrument) ----------------------- */
.appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}
.appbar-title b { font-size: 16px; letter-spacing: 0.02em; margin-right: 10px; }
.appbar-title span { font-size: 12px; color: #8b8f96; }
.appbar-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ctl { font-size: 12px; color: #b9bcc2; display: flex; align-items: center; gap: 6px; }
.ctl.check { cursor: pointer; }
select, .btn {
  font: 12px var(--font);
  color: #e6e7ea;
  background: #2a2c31;
  border: 1px solid #3a3d44;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.btn:hover, select:hover { background: #33363c; }

/* ---- stage: fixed design size, scaled to fit ----------------------------- */
/* #fit is the viewport; #stage is positioned and scaled inside it by zoom.js */
#fit { position: relative; overflow: hidden; margin-top: 20px; margin-bottom: 20px; }
#stage { position: absolute; left: 0; top: 0; width: max-content; transform-origin: 0 0; }
.zoom-ctl { display: inline-flex; align-items: center; border: 1px solid #3a3d44; border-radius: 6px; overflow: hidden; }
.zoom-ctl button { font: 12px var(--font); color: #e6e7ea; background: #2a2c31; border: none; padding: 5px 9px; cursor: pointer; }
.zoom-ctl button:hover { background: #33363c; }
.zoom-ctl .zoom-level { min-width: 52px; border-left: 1px solid #3a3d44; border-right: 1px solid #3a3d44; font-variant-numeric: tabular-nums; }
body.zoomed .zoom-ctl .zoom-level { color: var(--accent); }

/* ==========================================================================
   Oscilloscope unit
   ========================================================================== */
.scope-unit {
  display: flex; gap: 22px; align-items: stretch;
  padding: 16px 22px 12px;
  margin: 0 18px 22px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px),
    linear-gradient(#3a3c3f, #2b2d30);
  box-shadow:
    0 14px 30px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -2px 0 rgba(0,0,0,0.4);
}
.scope-screen-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bezel {
  position: relative; height: 230px;
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(#141516, #0b0c0d);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.08);
}
.bezel canvas {
  width: 100%; height: 100%; display: block;
  border-radius: 10px;
  background: radial-gradient(ellipse at center, #0c1d14 0%, #06110b 70%, #030805 100%);
}
.screen-glass {
  position: absolute; inset: 10px; border-radius: 10px; pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 10%, rgba(255,255,255,0.07), transparent 45%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.75);
}
.screen-caption {
  display: flex; align-items: center; gap: 14px;
  font-size: 10px; letter-spacing: 0.14em; color: #c9cbce; padding: 0 6px;
}
.screen-caption span:first-child { font-weight: 700; }
.screen-caption span:nth-child(2) { color: #8d9196; letter-spacing: 0.06em; }
.led-small {
  width: 7px; height: 7px; border-radius: 50%; margin-left: auto;
  background: #2b3a2e; box-shadow: inset 0 1px 1px rgba(0,0,0,0.6);
}
.led-small.on { background: #6dff95; box-shadow: 0 0 6px #52ff83; }
.trig-label { font-size: 9px; color: #8d9196; }

.scope-controls {
  width: 150px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px;
}
.scope-ctl-title { font-size: 10px; letter-spacing: 0.16em; font-weight: 700; color: #d7d9dc; }
.tb-group { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tb-buttons { display: grid; grid-template-columns: repeat(3, 40px); gap: 7px; }
.tb-btn, .hold-btn {
  height: 28px; border-radius: 4px; border: none; cursor: pointer;
  font-size: 11px; font-weight: 700; color: #1d1d1d;
  background: linear-gradient(#e7e5df, #bdbab2);
  box-shadow: 0 2px 0 #6f6d68, 0 3px 4px rgba(0,0,0,0.5), inset 0 1px 0 #fff;
}
.tb-btn:active, .hold-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #6f6d68, inset 0 1px 0 #fff; }
.tb-btn.on, .hold-btn.on {
  background: linear-gradient(#ffcf7a, #f0a43a);
  box-shadow: 0 1px 0 #8a5b17, 0 0 10px rgba(255,180,70,0.35), inset 0 1px 0 #ffe9c2;
  transform: translateY(1px);
}
.hold-btn { width: 134px; letter-spacing: 0.14em; }
.scope-brand { margin-top: auto; text-align: center; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; color: #e2e3e5; }
.scope-brand small { font-size: 8px; color: #8d9196; letter-spacing: 0.2em; font-weight: 600; }

/* ==========================================================================
   Synthesizer case
   ========================================================================== */
.synth { display: flex; align-items: stretch; filter: drop-shadow(0 24px 30px rgba(0,0,0,0.6)); }

.cheek {
  width: 46px; flex: none;
  background-color: var(--wood-1);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='600'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.012' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.08 0 0 0 0 0.02 0 0 0 0.75 0'/%3E%3C/filter%3E%3Crect width='120' height='600' filter='url(%23g)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, var(--wood-2), var(--wood-3) 40%, var(--wood-1) 70%, var(--wood-2));
  background-size: 120px 600px, 100% 100%;
}
.cheek.left { border-radius: 12px 0 0 12px; box-shadow: inset 2px 0 2px rgba(255,220,180,0.18), inset -3px 0 4px rgba(0,0,0,0.5); }
.cheek.right { border-radius: 0 12px 12px 0; box-shadow: inset -2px 0 2px rgba(255,220,180,0.12), inset 3px 0 4px rgba(0,0,0,0.5); }

.synth-body { display: flex; flex-direction: column; }

/* ---- front panel ---- */
.panel {
  position: relative;
  padding: 16px 18px 10px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 2px),
    linear-gradient(180deg, var(--panel-hi), var(--panel) 30%, #121314);
  border-top: 2px solid #3a3b3e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -8px 12px rgba(0,0,0,0.35);
}
/* panel screws */
.panel::before, .panel::after {
  content: ""; position: absolute; top: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d5d7d9, #6d7174 70%);
  box-shadow: 0 1px 1px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(0,0,0,0.25);
}
.panel::before { left: 8px; }
.panel::after { right: 8px; }

.panel-sections { display: flex; align-items: stretch; }
.panel-column { display: flex; flex-direction: column; gap: 14px; }
.section { position: relative; padding: 0 8px; }
.section-divider { width: 1px; margin: 4px 10px 0; background: linear-gradient(transparent, rgba(255,255,255,0.14) 12%, rgba(255,255,255,0.14) 88%, transparent); }

.section-title {
  text-align: center;
  margin-bottom: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1.5px solid var(--rule);
  padding-bottom: 4px;
  white-space: nowrap;
}
.section-grid { display: grid; row-gap: 0; justify-content: center; transition: opacity 0.25s, filter 0.25s; }

/* ---- lock (grey-out) ---- */
.lock-veil {
  display: none; position: absolute; inset: 26px 2px 0; border-radius: 6px;
  align-items: center; justify-content: center;
  background: repeating-linear-gradient(135deg, rgba(0,0,0,0.0) 0 8px, rgba(0,0,0,0.18) 8px 16px);
}
.lock-veil span {
  font-size: 11px; letter-spacing: 0.24em; font-weight: 700; color: #cfcfcf;
  background: rgba(0,0,0,0.7); padding: 3px 8px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.18);
}
.section.locked .section-grid { opacity: 0.22; filter: grayscale(1); pointer-events: none; }
.section.locked .section-title { opacity: 0.45; }
.section.locked .lock-veil { display: flex; }

/* ==========================================================================
   Knobs
   ========================================================================== */
.knob-cell {
  width: var(--cell-w);
  display: flex; flex-direction: column; align-items: center;
  padding-top: 4px;
}
.knob-cell.blank { visibility: hidden; }
.knob-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); white-space: nowrap; height: 15px;
}
.dial { position: relative; width: 116px; height: 116px; margin-top: -4px; }
.scale { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; } /* scale shares the pot's centre at any dial size */
.scale .tick { stroke: var(--ink); stroke-width: 1; opacity: 0.85; }
.scale .tick.minor { opacity: 0.45; }
.scale .num { fill: #cfcfcf; font: 600 9.5px var(--font); text-anchor: middle; }
.scale .unit { fill: var(--ink-dim); font: italic 600 9px var(--font); text-anchor: middle; letter-spacing: 0.04em; }
.scale .num.zero { fill: var(--ink); }
.scale .num.sign { font-size: 9px; fill: var(--ink); }
.scale .opt { cursor: pointer; }
.scale .opt .hit { fill: transparent; }
.scale .opt .num { font-size: 9.5px; }
.scale .opt .num.dense { font-size: 8px; }
.scale .opt .wave-icon { fill: none; stroke: #cfcfcf; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.scale .opt:hover .num { fill: #fff; }
.scale .opt:hover .wave-icon { stroke: #fff; }
.scale .opt.on .num { fill: var(--accent); }
.scale .opt.on .wave-icon { stroke: var(--accent); }

.knob {
  position: absolute; left: 50%; top: 50%;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; cursor: grab; outline: none;
  touch-action: none;
}
.knob:focus-visible { box-shadow: 0 0 0 2px rgba(255,181,71,0.7); }
.knob-cell.active .knob { cursor: grabbing; }

/* knurled black skirt */
.knob-body {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, transparent 62%, rgba(0,0,0,0.55) 100%),
    repeating-conic-gradient(#070707 0 4deg, #2a2a2a 4deg 6deg, #101010 6deg 9deg);
  box-shadow:
    0 0 0 1px #000,
    0 4px 5px rgba(0,0,0,0.75),
    0 1px 0 1px rgba(255,255,255,0.05);
}
/* white index line on the skirt */
.knob-body::after {
  content: ""; position: absolute; left: 50%; top: 1px; width: 2.5px; height: 10px; margin-left: -1.25px;
  background: #f1f1f1; border-radius: 1px;
}
/* spun-aluminium cap */
.knob-cap {
  position: absolute; inset: 10px; border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,255,255,0.0) 30%, rgba(0,0,0,0.25) 100%),
    conic-gradient(#d9dcdf, #8f9498, #e4e6e8, #868b8f, #d0d3d6, #92979b, #e6e8ea, #8a8f93, #d9dcdf);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.7);
}
.knob-pointer {
  position: absolute; left: 50%; top: 3px; width: 2.5px; height: 15px; margin-left: -1.25px;
  background: #151515; border-radius: 1px;
}
/* fixed highlight: does not rotate with the knob */
.knob-gloss {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 34% 26%, rgba(255,255,255,0.28), rgba(255,255,255,0) 46%);
}

/* stepped selectors: bar-shaped "chicken head" pointer knob */
.stepped .knob-body {
  inset: 6px;
  background: radial-gradient(circle at 50% 50%, #262626, #0b0b0b 70%);
}
.stepped .knob-body::after { display: none; }
.stepped .knob-cap {
  inset: -4px 16px; border-radius: 10px 10px 8px 8px;
  background: linear-gradient(90deg, #0d0d0d, #3b3b3b 45%, #1a1a1a 60%, #080808);
  box-shadow: 0 0 0 1px #000, 0 3px 4px rgba(0,0,0,0.7);
}
.stepped .knob-pointer { top: 3px; width: 2.5px; height: 19px; background: #f1f1f1; }
.stepped .knob-gloss { inset: 6px; }

.knob-value {
  height: 18px; margin-top: -8px;
  font: 700 12.5px var(--font); letter-spacing: 0.02em;
  color: var(--accent);
  opacity: 0; transition: opacity 0.12s;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* the knob in use gets its own layer while it turns: otherwise each step redraws the whole panel */
.knob-cell:hover .knob, .knob-cell.active .knob, .knob-cell.active .knob-value { will-change: transform; }
.knob-cell:hover .knob-value,
.knob-cell.active .knob-value,
.knob-cell:focus-within .knob-value,
body.show-values .knob-value { opacity: 1; }

/* ---- panel footer / brand ---- */
.panel-footer {
  display: flex; align-items: baseline; gap: 18px;
  margin-top: 6px; padding: 8px 6px 2px;
  border-top: 1.5px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark { font: italic 700 22px Georgia, "Times New Roman", serif; letter-spacing: 0.01em; }
.brand-model { font-size: 18px; font-weight: 800; letter-spacing: 0.22em; }
.brand-sub { font-size: 9.5px; letter-spacing: 0.3em; color: var(--ink-dim); margin-left: auto; }

/* ==========================================================================
   Keybed
   ========================================================================== */
.keybed {
  display: flex; height: 262px;
  background: linear-gradient(#0c0c0d, #19191b);
  padding: 12px 16px 18px;
  border-top: 3px solid #050505;
  box-shadow: inset 0 6px 10px rgba(0,0,0,0.8);
}
.perf {
  flex: none; margin-right: 16px; padding: 10px 14px 10px 6px;
  display: flex; align-items: center; gap: 6px;
  border-radius: 6px;
  background: linear-gradient(#1f2022, #141516);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.05);
}
.perf-controls { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.oct-block { text-align: center; }
.oct-title { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; margin-bottom: 8px; text-transform: uppercase; white-space: nowrap; }
.oct-buttons { display: flex; align-items: center; gap: 8px; justify-content: center; }
.oct-btn {
  width: 34px; height: 32px; border-radius: 4px; border: none; cursor: pointer;
  font-size: 18px; font-weight: 700; color: #ddd;
  background: linear-gradient(#3c3d40, #232426);
  box-shadow: 0 2px 0 #000, inset 0 1px 0 rgba(255,255,255,0.15);
}
.oct-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #000; }
.oct-readout {
  width: 46px; padding: 5px 0; border-radius: 3px;
  font: 700 15px var(--font); color: var(--accent);
  background: #0a0806; box-shadow: inset 0 1px 3px #000; font-variant-numeric: tabular-nums;
}
.range-buttons { display: flex; gap: 6px; justify-content: center; }
.range-btn {
  width: 30px; height: 28px; border-radius: 4px; border: none; cursor: pointer;
  font: 700 13px var(--font); color: #1d1d1d;
  background: linear-gradient(#e7e5df, #bdbab2);
  box-shadow: 0 2px 0 #6f6d68, 0 3px 4px rgba(0,0,0,0.5), inset 0 1px 0 #fff;
}
.range-btn:active { transform: translateY(1px); }
.range-btn.on {
  background: linear-gradient(#ffcf7a, #f0a43a);
  box-shadow: 0 1px 0 #8a5b17, 0 0 10px rgba(255,180,70,0.35), inset 0 1px 0 #ffe9c2;
  transform: translateY(1px);
}
.range-caption { margin-top: 6px; font-size: 10px; color: #9a9da2; letter-spacing: 0.12em; text-transform: uppercase; }
.perf .knob-label { visibility: hidden; height: 4px; }
.oct-hint { font-size: 10px; color: #8e9196; letter-spacing: 0.04em; }

.keys-well { flex: 1; display: flex; justify-content: center; }
.keys { position: relative; flex: 1; height: 100%; touch-action: none; user-select: none; }
.key { position: absolute; top: 0; cursor: pointer; }
.key.white {
  height: 100%;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(#f2efe6, #fbf9f3 70%, #e3dfd3);
  box-shadow: inset -1px 0 0 #b9b4a6, inset 1px 0 0 #fff, inset 0 -5px 0 #d8d3c5, 0 2px 3px rgba(0,0,0,0.5);
  z-index: 1;
}
.key.white.down {
  background: linear-gradient(#e2ded3, #ece9e0 70%, #d6d1c4);
  box-shadow: inset -1px 0 0 #b9b4a6, inset 0 -2px 0 #cfcabb, inset 0 6px 8px rgba(0,0,0,0.15);
}
.key.black {
  height: 62%;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #050505, #2a2a2a 45%, #121212 55%, #030303);
  box-shadow: 0 3px 4px rgba(0,0,0,0.7), inset 0 -7px 0 #1d1d1d, inset 0 -8px 0 #3a3a3a;
  z-index: 2;
}
.key.black.down { box-shadow: 0 1px 2px rgba(0,0,0,0.7), inset 0 -3px 0 #1d1d1d, inset 0 -4px 0 #3a3a3a; background: linear-gradient(90deg, #0b0b0b, #333 45%, #181818 55%, #050505); }
.key-label {
  position: absolute; bottom: 10px; left: 0; right: 0; text-align: center;
  font: 600 11px var(--font); color: #9a9486; pointer-events: none;
}
.key.in-range::after {
  content: ""; position: absolute; left: 30%; right: 30%; top: 4px; height: 3px; border-radius: 2px;
  background: rgba(255, 181, 71, 0.65); pointer-events: none;
}
.key.black.in-range::after { background: rgba(255, 181, 71, 0.5); }

/* ---- two-position lever switch (Mono / Legato) ---- */
.toggle-cell { width: var(--cell-w); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 2px 0 4px; }
.toggle-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.toggle-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); text-align: center; line-height: 1.2; }
.toggle-cell.titled { padding-top: 10px; }
.toggle-label {
  border: none; background: none; padding: 2px 0; cursor: pointer;
  font: 700 10.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim);
}
.toggle-label.on { color: var(--accent); }
.toggle {
  position: relative; width: 34px; height: 18px; padding: 0; border: none; cursor: pointer; flex: none;
  border-radius: 9px; background: linear-gradient(#050505, #1c1c1c);
  box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255,255,255,0.08);
}
.toggle-lever {
  position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffffff, #c4c8cc 40%, #7a7f84 80%);
  box-shadow: 0 2px 3px rgba(0,0,0,0.8);
  transition: left 0.12s ease-out;
}
.toggle.right .toggle-lever { left: 17px; }
.toggle:focus-visible, .toggle-label:focus-visible { outline: 2px solid rgba(255,181,71,0.7); outline-offset: 2px; }

/* ==========================================================================
   Help panel (modern app chrome, not part of the instrument)
   ========================================================================== */
:root { --help-w: 360px; }
.btn-help { display: inline-flex; align-items: center; gap: 6px; }
.help-q {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  font-size: 11px; font-weight: 800; background: #44474e; color: #fff;
}
body.help-open .btn-help { background: #3b3220; border-color: #8a6a2c; color: #ffd9a0; }
body.help-open .help-q { background: var(--accent); color: #1a1206; }

.help-panel {
  display: none;
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--help-w); z-index: 40;
  background: rgba(26, 28, 32, 0.97);
  border-left: 1px solid #2e3137;
  box-shadow: -14px 0 36px rgba(0,0,0,0.5);
  /* the mouse passes through to the synth underneath; the panel moves aside instead */
  pointer-events: none;
  overflow-y: auto;
  padding: 26px 26px 32px;
  color: #d9dbdf;
}
body.help-open .help-panel.visible { display: block; animation: help-in 0.15s ease-out; }
.help-panel.left { right: auto; left: 0; border-left: none; border-right: 1px solid #2e3137; box-shadow: 14px 0 36px rgba(0,0,0,0.5); }
@keyframes help-in { from { opacity: 0; } to { opacity: 1; } }
.help-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.help-title { margin: 0 0 14px; font-size: 24px; font-weight: 700; color: #fff; letter-spacing: 0.01em; line-height: 1.2; }
.help-content p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.help-value, .help-range {
  display: flex; gap: 10px; align-items: baseline; font-size: 13px; margin-bottom: 6px; color: #b5b8be;
}
.help-value span, .help-range span {
  width: 52px; flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #80848b;
}
.help-value b { font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.help-range { margin-bottom: 18px; }
.help-tip {
  margin-top: 18px; padding: 12px 14px; border-radius: 8px;
  background: #23211b; border-left: 3px solid var(--accent);
  font-size: 14px; line-height: 1.55; color: #e6dcc8;
}
.help-tip-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }

/* ---- beat light by the Detune knob ---- */
.knob-cell { position: relative; }
.beat-led { position: absolute; top: 20px; right: 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.beat-lamp {
  --glow: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%,
    color-mix(in srgb, #ffe7b0 calc(var(--glow) * 100%), #4a2f0c),
    color-mix(in srgb, #ffb547 calc(var(--glow) * 100%), #241605) 70%);
  box-shadow: 0 0 0 1px #000, 0 0 calc(var(--glow) * 12px) calc(var(--glow) * 3px) rgba(255, 181, 71, calc(var(--glow) * 0.8));
}
.beat-label { font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }

/* ==========================================================================
   Lessons
   ========================================================================== */
.mode-switch { display: inline-flex; border: 1px solid #3a3d44; border-radius: 7px; overflow: hidden; }
.mode-switch button { font: 600 12px var(--font); color: #b9bcc2; background: #23252a; border: none; padding: 6px 12px; cursor: pointer; }
.mode-switch button + button { border-left: 1px solid #3a3d44; }
.mode-switch button.on { background: #3b3220; color: #ffd9a0; }
body.lesson-mode .free-only { display: none; }

.lesson-bar {
  display: grid; grid-template-columns: 262px minmax(260px, 1fr) auto; gap: 24px; align-items: center;
  padding: 10px 24px;
  background: linear-gradient(#202227, #1a1c20);
  border-bottom: 1px solid #2e3137;
}
.lesson-bar[hidden] { display: none; }
.lb-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.lb-title { font-size: 22px; font-weight: 700; color: #fff; line-height: 1.15; }
/* the challenge numbers: under the lesson menu on the left, wrapping if there are many */
.lb-steps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; max-width: 262px; }
.lb-step {
  width: 22px; height: 22px; border-radius: 50%; padding: 0; cursor: pointer;
  font: 700 10.5px var(--font); color: #c9ccd1;
  background: #2a2c31; border: 1.5px solid #3d4047;
  display: grid; place-items: center; transition: transform 0.15s, background 0.2s;
}
.lb-step:disabled { cursor: default; color: #5d6168; background: #1f2125; border-color: #2c2f35; }
.lb-step:not(:disabled):hover { transform: translateY(-1px); border-color: #6a6e76; }
.lb-step.current { border-color: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.2); }
.lb-step.done { background: #2f8a55; border-color: #49c07c; color: #fff; }
.lb-step.done.current { box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.35); border-color: var(--accent); }
.lb-step svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lb-step.done.pop { animation: step-pop 0.5s ease-out; }
@keyframes step-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.lb-task-head { display: flex; align-items: center; gap: 12px; margin-bottom: 3px; }
.lb-task-title { font-size: 16px; font-weight: 700; color: #fff; }
.lb-task-text { font-size: 13.5px; line-height: 1.5; color: #c3c6cc; max-width: 130ch; }
.lb-status { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; }
.lb-status:empty { display: none; }
.lb-status.listen { background: #22344a; color: #9fd0ff; animation: listen-pulse 1s ease-in-out infinite; }
.lb-status.turn { background: #2b2d33; color: #d8dade; }
.lb-status.matched { background: #2f8a55; color: #fff; animation: step-pop 0.5s ease-out; }
@keyframes listen-pulse { 50% { opacity: 0.55; } }
.lb-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lb-btn {
  font: 600 13px var(--font); color: #e6e7ea; background: #2c2e34; border: 1px solid #41444c;
  border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.lb-btn:hover { background: #35383f; }
.lb-btn.primary { background: linear-gradient(#ffcf7a, #f0a43a); border-color: #c98a2e; color: #24180a; }
.lb-btn.primary:hover { background: linear-gradient(#ffd98f, #f5ae4a); }
.lb-btn.quiet { background: none; border-color: transparent; color: #b9bcc2; }
.lb-btn.quiet:hover { background: #2a2c31; }
.lb-btn[hidden], .lb-check[hidden] { display: none; }
.lb-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #b9bcc2; cursor: pointer; white-space: nowrap; }
@media (max-width: 1250px) {
  .lesson-bar { grid-template-columns: auto 1fr; }
  .lb-task { grid-column: 2; }
  .lb-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; }
}

/* while the target plays, the student can only listen */
body.auditioning .panel-sections, body.auditioning .keybed { pointer-events: none; }
body.auditioning #lb-hear, body.auditioning #lb-reset, body.auditioning .lb-steps { opacity: 0.5; pointer-events: none; }

.lesson-modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(8, 9, 11, 0.55); animation: help-in 0.3s ease-out;
}
.lesson-modal[hidden] { display: none; }
.lm-card {
  width: min(520px, calc(100vw - 32px)); padding: 30px 32px 26px; border-radius: 16px;
  background: #1d1f24; border: 1px solid #3a3d44; box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  text-align: center; animation: card-in 0.45s cubic-bezier(.2,1.4,.4,1);
}
@keyframes card-in { from { transform: translateY(20px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.lm-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.lm-title { margin: 6px 0 10px; font-size: 32px; color: #fff; }
.lm-text { margin: 0 0 22px; font-size: 15px; line-height: 1.6; color: #c9ccd1; }
.lm-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lm-actions .lb-btn { min-width: 260px; padding: 11px 16px; font-size: 14px; }
.lm-actions .lb-btn.soon { opacity: 0.6; cursor: default; background: #2c2e34; color: #c9ccd1; border-color: #41444c; }
.finale-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 70; pointer-events: none; }

/* lessons: the key to play */
.key.target-key::before {
  content: ""; position: absolute; left: 50%; bottom: 28px; width: 20px; height: 20px; margin-left: -10px;
  border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe2a8, #ffb547 55%, #c77a12);
  box-shadow: 0 0 10px 2px rgba(255, 181, 71, 0.75); pointer-events: none;
  animation: key-pulse 1.4s ease-in-out infinite;
}
.key.black.target-key::before { bottom: 14px; width: 15px; height: 15px; margin-left: -7.5px; }
@keyframes key-pulse { 50% { box-shadow: 0 0 4px 1px rgba(255, 181, 71, 0.45); } }

/* ---- patch saving ---- */
.btn-danger { color: #ffb3b3; }
.btn-danger:hover { background: #3a2427; }
.more-wrap { position: relative; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 200px; padding: 6px;
  background: #24262b; border: 1px solid #3a3d44; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.more-menu[hidden] { display: none; }
.more-menu button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: none; border-radius: 5px;
  background: none; color: #e1e3e7; font: 13px var(--font); cursor: pointer;
}
.more-menu button:hover { background: #30333a; }
.save-card { text-align: left; width: min(420px, calc(100vw - 32px)); padding: 24px 26px 20px; }
.save-title { margin: 0 0 16px; font-size: 20px; color: #fff; }
.save-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #9a9ea5; margin-bottom: 6px; }
.save-input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #454850; background: #15171a;
  color: #fff; font: 15px var(--font); outline: none;
}
.save-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,181,71,0.2); }
.save-error { min-height: 20px; margin-top: 6px; font-size: 13px; color: #ffb3a1; }
.save-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 80;
  padding: 10px 16px; border-radius: 8px; background: #2b2e34; border: 1px solid #454850; color: #fff;
  font: 600 13px var(--font); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Row headers inside a section (e.g. Oscillator 1 / 2 / 3)
   ========================================================================== */
.row-title {
  grid-column: 1 / -1; text-align: center; margin: 6px 0 0;
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim);
  height: 14px;
}
.row-title span { padding: 0 8px; }
.row-title.blank span { display: none; }

/* ==========================================================================
   Pitch and mod wheels
   ========================================================================== */
.wheel-cell { width: var(--cell-w); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wheel-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.wheel-slot {
  position: relative; width: 34px; height: 112px; border-radius: 6px; cursor: ns-resize; outline: none; touch-action: none;
  background: #050505; box-shadow: inset 0 2px 6px #000, 0 1px 0 rgba(255,255,255,0.08);
  overflow: hidden;
}
.wheel-slot:focus-visible { box-shadow: 0 0 0 2px rgba(255,181,71,0.7); }
.wheel-drum {
  position: absolute; inset: 3px 4px; border-radius: 4px;
  background: repeating-linear-gradient(0deg, #1a1a1a 0 3px, #3a3a3a 3px 4px, #121212 4px 6px);
}
.wheel-shade { position: absolute; inset: 3px 4px; border-radius: 4px; pointer-events: none;
  background: linear-gradient(#000 0%, transparent 28%, transparent 72%, #000 100%); }
.wheel-mark { position: absolute; left: 4px; right: 4px; height: 3px; margin-top: -1.5px; background: #f1f1f1; border-radius: 1px; box-shadow: 0 0 4px rgba(255,255,255,0.4); }
.wheel-value { margin-top: 0; }

/* ==========================================================================
   NiniFoog (nf3) skin: vintage. Walnut case (end cheeks, a rail above the panel
   and along the front of the keys), black panel with white legends, classic black
   knobs with silver caps, coloured rocker switches. No names or logos copied.
   ========================================================================== */
body[data-skin="vintage"] {
  --wood-1: #5e321a;
  --wood-2: #3c1e0e;
  --wood-3: #82492a;
  --accent: #ffb547;
  --led: #ff3b2f;
  --panel: #2b2d30;    /* dark grey, so the black pots stand out */
  --panel-hi: #34363a;
  --ink: #f2f0ea;
  --ink-dim: #b9b6ad;
  --rule: rgba(242, 240, 234, 0.6);
}
body[data-skin="vintage"] .cheek { width: 54px; }
body[data-skin="vintage"] .synth-body { position: relative; }
/* wooden rail above the panel and along the front of the keys */
body[data-skin="vintage"] .panel { border-top: none; }
body[data-skin="vintage"] .synth-body::before,
body[data-skin="vintage"] .synth-body::after {
  content: ""; display: block; height: 18px;
  background-color: var(--wood-1);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='40'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.9' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.08 0 0 0 0 0.02 0 0 0 0.75 0'/%3E%3C/filter%3E%3Crect width='600' height='40' filter='url(%23g)'/%3E%3C/svg%3E"),
    linear-gradient(var(--wood-3), var(--wood-1) 55%, var(--wood-2));
  box-shadow: inset 0 1px 0 rgba(255,220,180,0.18), inset 0 -2px 3px rgba(0,0,0,0.45);
}
body[data-skin="vintage"] .synth-body::before { order: -1; }
body[data-skin="vintage"] .synth-body::after { height: 22px; order: 99; }
body[data-skin="vintage"] .section-title { color: var(--ink); letter-spacing: 0.24em; }
body[data-skin="vintage"] .keybed { background: linear-gradient(#0e0e0e, #191919); }
body[data-skin="vintage"] .perf { gap: 2px; }
body[data-skin="vintage"] .perf .knob-label { visibility: visible; height: 15px; }
body[data-skin="vintage"] .oct-block { display: none; } /* fixed keyboard: no octave or range controls */
/* longer classic control names wrap onto two lines */
body[data-skin="vintage"] .knob-label {
  white-space: normal; text-align: center; line-height: 1.1; height: 24px; width: calc(var(--cell-w) - 6px);
  display: flex; align-items: flex-end; justify-content: center; font-size: 10.5px;
}
body[data-skin="vintage"] .perf .knob-label { height: 24px; }
/* rocker switches. Horizontal by default (on to the right), vertical where the classic
   panel has them upright (Osc. 3 Control, White/Pink). The lighter half of the paddle shows
   the position it is in; on/off switches only print ON, beside the "on" end. */
body[data-skin="vintage"] { --narrow-w: 72px; }
body[data-skin="vintage"] .toggle-cell, body[data-skin="vintage"] .wheel-cell { width: auto; }
body[data-skin="vintage"] .toggle-cell.titled { padding-top: 6px; }
body[data-skin="vintage"] .toggle-title { font-size: 9.5px; max-width: 96px; }
body[data-skin="vintage"] .toggle-row { gap: 5px; }
body[data-skin="vintage"] .toggle-label { font-size: 9.5px; padding: 0; }
body[data-skin="vintage"] .toggle-label.on { color: var(--ink); }
body[data-skin="vintage"] .onoff .toggle-label[data-v="off"] { display: none; }
body[data-skin="vintage"] .onoff .toggle-row { padding-left: 18px; } /* keep the paddle centred with ON beside it */
body[data-skin="vintage"] .toggle { width: 40px; height: 20px; border-radius: 3px; background: #050505; box-shadow: 0 0 0 1px #2c2c2c, inset 0 0 3px #000; }
body[data-skin="vintage"] .toggle-lever {
  top: 2px; left: 2px; width: 36px; height: 16px; border-radius: 2px;
  background: linear-gradient(90deg, var(--rk) 0 50%, var(--rk-dark) 50% 100%); /* off: lighter on the left */
  box-shadow: inset -5px 0 6px rgba(0,0,0,0.35);
  transition: background 0.1s, box-shadow 0.1s;
}
body[data-skin="vintage"] .toggle.right .toggle-lever {
  left: 2px; background: linear-gradient(90deg, var(--rk-dark) 0 50%, var(--rk) 50% 100%); /* on: lighter on the right */
  box-shadow: inset 5px 0 6px rgba(0,0,0,0.35);
}
/* vertical rockers */
body[data-skin="vintage"] .vertical .toggle-row { flex-direction: column; gap: 3px; padding-left: 0; }
body[data-skin="vintage"] .vertical.onoff .toggle-row { flex-direction: column-reverse; } /* ON at the top */
body[data-skin="vintage"] .vertical .toggle { width: 20px; height: 40px; }
body[data-skin="vintage"] .vertical .toggle-lever {
  width: 16px; height: 36px;
  background: linear-gradient(180deg, var(--rk) 0 50%, var(--rk-dark) 50% 100%); /* first option: lighter at the top */
  box-shadow: inset 0 -5px 6px rgba(0,0,0,0.35);
}
body[data-skin="vintage"] .vertical .toggle.right .toggle-lever {
  background: linear-gradient(180deg, var(--rk-dark) 0 50%, var(--rk) 50% 100%); /* second option: lighter at the bottom */
  box-shadow: inset 0 5px 6px rgba(0,0,0,0.35);
}
/* on/off verticals show ON at the top, so ON lights the top half */
body[data-skin="vintage"] .vertical.onoff .toggle-lever { background: linear-gradient(180deg, var(--rk-dark) 0 50%, var(--rk) 50% 100%); box-shadow: inset 0 5px 6px rgba(0,0,0,0.35); }
body[data-skin="vintage"] .vertical.onoff .toggle.right .toggle-lever { background: linear-gradient(180deg, var(--rk) 0 50%, var(--rk-dark) 50% 100%); box-shadow: inset 0 -5px 6px rgba(0,0,0,0.35); }
/* colours, after the classic panel */
body[data-skin="vintage"] .toggle-cell { --rk: #f59a4a; --rk-dark: #a2541a; }                          /* orange */
body[data-skin="vintage"] .toggle-cell[data-param="mix.noisetype"] { --rk: #5fb0ee; --rk-dark: #2a5f91; } /* blue */
body[data-skin="vintage"] .toggle-cell[data-param^="perf."] { --rk: #f4f1e8; --rk-dark: #9a968b; }      /* white */
body[data-skin="vintage"] .perf .toggle-cell.titled { padding-top: 2px; }
body[data-skin="vintage"] .perf .toggle-row { padding-left: 14px; }

/* the keyboard-side controls are compact so the keys get most of the width */
body[data-skin="vintage"] .perf-controls { display: none; }
body[data-skin="vintage"] .perf { padding: 8px 10px; }

/* overload light by the Feedback pot */
.overload-led { position: absolute; top: 40px; right: -26px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.overload-lamp {
  will-change: opacity; /* its own layer, as for the jack lamps */
  --glow: 0; --hue: 52;
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%,
    hsl(var(--hue) 100% calc(30% + var(--glow) * 55%)),
    hsl(var(--hue) 100% calc(12% + var(--glow) * 38%)) 70%);
  box-shadow: 0 0 0 1px #000, 0 0 calc(var(--glow) * 14px) calc(var(--glow) * 4px) hsl(var(--hue) 100% 50% / calc(var(--glow) * 0.85));
}
.knob-cell.offset { z-index: 1; }

/* ==========================================================================
   Start menu
   ========================================================================== */
.btn-synths { margin-left: 12px; }
.start-menu {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 0%, #2a2d33, #121316 70%);
  animation: help-in 0.25s ease-out;
}
.start-menu[hidden] { display: none; }
/* until the app has loaded, with no synth chosen: the menu covers the page (see index.html) */
html.choosing .start-menu[hidden] { display: grid; }
html.choosing .sm-close { display: none; }
/* sized to the window's height, so all four synths fit on one screen without scrolling */
.sm-inner { position: relative; width: min(1040px, calc(100vw - 32px), calc((100vh - 180px) * 1.55)); padding: 3vh 0; text-align: center; }
/* a menu mixing synths and studio units (not used at present): a heading, then wide, short cards */
.sm-group { margin: 2vh 0 1vh; font-size: 13px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: #c9ccd1; text-align: left; }
.sm-cards.sm-proc { grid-template-columns: 1fr; }
.sm-card.wide { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; grid-template-rows: auto auto auto 1fr; column-gap: 0; padding: 0; align-items: start; }
.sm-card.wide .sm-preview { grid-row: 1 / 5; height: clamp(90px, 12vh, 150px); margin: 0; border-bottom: none; border-right: 1px solid #2c2f35; padding: 10px 14px; }
.sm-card.wide > :not(.sm-preview) { margin-left: 22px; }
.sm-card.wide .sm-tag { margin-top: 12px; }
.sm-card.wide .sm-foot { margin-bottom: 12px; }
.sm-close {
  position: absolute; top: 3vh; right: 0; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid #3a3d44; background: #24262b; color: #d6d8dc; font-size: 20px; cursor: pointer;
}
.sm-close[hidden] { display: none; }
.sm-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.sm-title { margin: 4px 0 2.4vh; font-size: 32px; color: #fff; }
.sm-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.2vh 22px; } /* always 2 x 2, however wide the window */
@media (max-width: 640px) { .sm-cards { grid-template-columns: 1fr; } } /* one column on a phone */
.sm-card {
  text-align: left; padding: 0 0 14px; border-radius: 16px; cursor: pointer; overflow: hidden;
  background: #1c1e23; border: 1px solid #34373e; color: inherit; font: inherit;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.sm-card:hover, .sm-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 16px 40px rgba(0,0,0,0.45); outline: none; }
.sm-card > :not(.sm-preview) { margin-left: 22px; margin-right: 22px; }
.sm-preview {
  height: clamp(100px, 19.5vh, 210px); margin-bottom: 12px; padding: 12px 16px 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #2a2c31, #17181b 75%);
  border-bottom: 1px solid #2c2f35;
}
.sm-preview img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.55)); transition: transform 0.2s; }
.sm-card:hover .sm-preview img { transform: scale(1.03); }
.sm-tag { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.sm-name { font-size: 26px; font-weight: 800; color: #fff; margin-top: 2px; letter-spacing: 0.02em; }
.sm-text { font-size: 14.5px; line-height: 1.45; color: #c3c6cc; margin-top: 4px; }
.sm-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sm-play { font-weight: 700; color: #ffd9a0; }
.sm-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: #2f3238; color: #c9ccd1; }
.sm-badge.current { background: #2f8a55; color: #fff; }

.mode-switch[hidden] { display: none; }
/* NiniFoog: longer classic control names wrap onto two lines */
body[data-skin="slate"] .knob-label {
  white-space: normal; text-align: center; line-height: 1.1; height: 24px; width: calc(var(--cell-w) - 6px);
  display: flex; align-items: flex-end; justify-content: center; font-size: 10.5px;
}
body[data-skin="slate"] .perf .knob-label { height: 24px; }

/* ---- switch columns that sit on the line between two sections ---- */
.panel-column.bridge { position: relative; }
.panel-column.bridge::before {
  content: ""; position: absolute; left: 50%; top: 4px; bottom: 0; width: 1px;
  background: linear-gradient(transparent, rgba(255,255,255,0.14) 12%, rgba(255,255,255,0.14) 88%, transparent);
}
.panel-column.bridge .section { padding: 0; }
.panel-column.bridge .section-title { border-bottom-color: transparent; }
.panel-column.bridge .section-title span::after { content: "\00a0"; } /* keep the title's height so rows line up */
.panel-column.bridge .toggle-cell { position: relative; z-index: 1; padding-bottom: 6px; } /* the switch sits on the line */

/* ==========================================================================
   NiniFoog: bigger pots and lettering, using the space the layout frees
   ========================================================================== */
body[data-skin="vintage"] { --cell-w: 132px; --narrow-w: 92px; }
body[data-skin="vintage"] .dial { width: 132px; height: 132px; }
body[data-skin="vintage"] .knob { width: 68px; height: 68px; margin: -34px 0 0 -34px; }
body[data-skin="vintage"] .knob-cap { inset: 12px; }
body[data-skin="vintage"] .stepped .knob-body { inset: 7px; }
body[data-skin="vintage"] .stepped .knob-cap { inset: -5px 19px; }
body[data-skin="vintage"] .knob-pointer { height: 17px; }
body[data-skin="vintage"] .knob-label { font-size: 12.5px; height: 27px; width: calc(var(--cell-w) - 8px); }
body[data-skin="vintage"] .knob-value { font-size: 14px; height: 20px; }
body[data-skin="vintage"] .section-title { font-size: 15px; }
body[data-skin="vintage"] .row-title { font-size: 11.5px; height: 16px; }
body[data-skin="vintage"] .toggle-title { font-size: 11px; max-width: 110px; }
body[data-skin="vintage"] .toggle-label { font-size: 11px; }
body[data-skin="vintage"] .toggle { width: 46px; height: 23px; }
body[data-skin="vintage"] .toggle-lever { width: 42px; height: 19px; }
body[data-skin="vintage"] .vertical .toggle { width: 23px; height: 46px; }
body[data-skin="vintage"] .vertical .toggle-lever { width: 19px; height: 42px; }
body[data-skin="vintage"] .brand-model { font-size: 22px; }
/* keyboard side: Glide and Decay side by side, long wheels */
body[data-skin="vintage"] .keybed { height: 262px; }
body[data-skin="vintage"] .perf .wheel-slot { height: 150px; width: 38px; }
/* win back height so the larger pots show larger on screen */
/* NiniFoog: scopes are a slim strip (it is not the beginners' synth, so the displays can be compact) */
body[data-skin="vintage"] .scope-unit, body[data-skin="modular"] .scope-unit { margin-bottom: 12px; padding: 8px 18px 6px; gap: 16px; align-items: center; }
body[data-skin="vintage"] .bezel, body[data-skin="modular"] .bezel { height: 112px; padding: 6px; border-radius: 10px; }
body[data-skin="vintage"] .screen-glass, body[data-skin="modular"] .screen-glass { inset: 6px; border-radius: 7px; }
body[data-skin="vintage"] .bezel canvas, body[data-skin="modular"] .bezel canvas { border-radius: 7px; }
body[data-skin="vintage"] .scope-screen-wrap, body[data-skin="modular"] .scope-screen-wrap { gap: 4px; }
body[data-skin="vintage"] .scope-controls, body[data-skin="modular"] .scope-controls { width: auto; padding-top: 0; gap: 6px; }
body[data-skin="vintage"] .tb-group, body[data-skin="modular"] .tb-group { gap: 6px; }
body[data-skin="vintage"] .tb-buttons, body[data-skin="modular"] .tb-buttons { grid-template-columns: repeat(6, 34px); gap: 5px; }
body[data-skin="vintage"] .tb-btn, body[data-skin="modular"] .tb-btn { height: 24px; }
body[data-skin="vintage"] .hold-btn, body[data-skin="modular"] .hold-btn { width: 100%; height: 24px; }
body[data-skin="vintage"] .scope-brand, body[data-skin="modular"] .scope-brand { display: none; }
body[data-skin="vintage"] .panel { padding-top: 10px; }
body[data-skin="vintage"] .panel-column.stacked, body[data-skin="vintage"] .panel-column { gap: 6px; }
body[data-skin="vintage"] .perf .wheel-label { font-size: 12px; }
body[data-skin="vintage"] .perf .toggle-row { padding-left: 16px; }
body[data-skin="vintage"] .perf .section-title { font-size: 13px; }

.panel-column.bridge .section-grid { align-items: center; }
.panel-column.bridge .knob-cell.blank { height: 0; }

/* ---- wood band between the panel and the keys, with a name plate (vintage look) ---- */
.wood-band { display: none; }
body[data-skin="vintage"] .wood-band {
  display: flex; align-items: center; justify-content: flex-end; height: 96px; padding: 0 44px;
  background-color: var(--wood-1);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='120'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.008 0.6' numOctaves='3' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.08 0 0 0 0 0.02 0 0 0 0.7 0'/%3E%3C/filter%3E%3Crect width='900' height='120' filter='url(%23g)'/%3E%3C/svg%3E"),
    linear-gradient(var(--wood-3), var(--wood-1) 45%, var(--wood-2));
  box-shadow: inset 0 3px 4px rgba(0,0,0,0.55), inset 0 -2px 3px rgba(0,0,0,0.5);
}
body[data-skin="vintage"] .nameplate {
  display: flex; align-items: baseline; gap: 12px; padding: 12px 22px; border-radius: 6px;
  background: linear-gradient(#2a2b2d, #17181a); color: #e9e7e1;
  box-shadow: 0 0 0 2px #0c0c0c, 0 0 0 3px rgba(255,255,255,0.12), 0 6px 10px rgba(0,0,0,0.5);
}
body[data-skin="vintage"] .np-mark { font: italic 700 24px Georgia, "Times New Roman", serif; }
body[data-skin="vintage"] .np-model { font-size: 20px; font-weight: 800; letter-spacing: 0.2em; }
/* the name now lives on the plate; keep the panel's bottom edge clean */
body[data-skin="vintage"] .panel-footer { display: none; }

/* vintage panel: an even dark grey (no fade to black) */
body[data-skin="vintage"] .panel {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 2px),
    linear-gradient(180deg, var(--panel-hi), var(--panel) 25%, #26282b);
}

/* synth names: bold capitals, lighter lower-case (e.g. NiniFoog) */
.synth-name { font-weight: 400; }
.synth-name b { font-weight: 900; }

/* ---- optional scopes ---- */
body.scopes-hidden .scope-unit { display: none; }
.btn-scopes.on { background: #3b3220; border-color: #8a6a2c; color: #ffd9a0; }

/* ---- preview mode (?preview=1): only the synth, for start-menu pictures ---- */
body.preview { background: transparent; min-height: 0; }
body.preview .appbar, body.preview .scope-unit, body.preview .lesson-bar,
body.preview .help-panel, body.preview .toast, body.preview .start-menu { display: none !important; }
body.preview #fit { margin: 0; }

/* ---- lessons 2+: picker, questions, hints ---- */
.lb-lesson { margin-top: 6px; font-size: 11.5px; padding: 3px 6px; max-width: 200px; }
.lb-question { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lb-prompt { flex-basis: 100%; font-size: 14.5px; font-weight: 700; color: #fff; line-height: 1.45; margin-bottom: 2px; }
.lb-question[hidden] { display: none; }
.lb-answer {
  font: 600 13px var(--font); text-align: left; color: #e6e7ea; background: #2a2d33; border: 1px solid #454850;
  border-radius: 8px; padding: 8px 12px; cursor: pointer; flex: 1 1 0; min-width: 180px; line-height: 1.35; /* the answers share the row */
}
.lb-answer:hover:not(:disabled) { background: #33373e; border-color: #6a6e76; }
.lb-answer.right { background: #2f8a55; border-color: #49c07c; color: #fff; }
.lb-answer.wrong { background: #4a2427; border-color: #8b3a40; color: #f3c4c7; animation: shake 0.3s; }
.lb-answer:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.lb-feedback { margin-top: 8px; font-size: 13.5px; line-height: 1.5; max-width: 130ch; }
.lb-feedback:empty { display: none; }
.lb-feedback.wrong { color: #f3b4a6; }
.lb-feedback.right { color: #a9efc6; }
.lb-btn.hint { background: #3b3220; border-color: #8a6a2c; color: #ffd9a0; animation: listen-pulse 1.4s ease-in-out 3; }
.lb-hintbox { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #23211b; border-left: 3px solid var(--accent); max-width: 130ch; }
.lb-hintbox[hidden] { display: none; }
.lb-hint-text { font-size: 13.5px; line-height: 1.5; color: #e6dcc8; }
.lb-heat { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #9ec7ff; }
.lb-heat[hidden] { display: none; }
.lb-heat-track { flex: 1; height: 10px; border-radius: 6px; background: #15171a; box-shadow: inset 0 1px 2px #000; overflow: hidden; }
.lb-heat-fill { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #4d8fe0, #9b6bd6 45%, #f0a03a 75%, #ff4d3a); background-size: 300px 100%; transition: width 0.15s; }
.lb-heat-word { min-width: 92px; color: #ffd9a0; }

/* The top bar and the lesson panel stay pinned to the top of the window. The synth is sized to
   fit below them; when the scopes are on, the page opens scrolled so the lesson hangs over them,
   and scrolling up brings them into view. */
.appbar { position: sticky; top: 0; z-index: 31; background: #141518; }
.lesson-wrap { position: sticky; top: var(--appbar-h, 0px); z-index: 30; }
.lesson-bar { box-shadow: 0 10px 24px rgba(0,0,0,0.45); }

/* ==========================================================================
   Effects unit: a small separate box between the scopes and the synth
   ========================================================================== */
.fx-drawer { position: relative; margin: 10px 18px 0; display: flex; flex-direction: column; align-items: center; }
/* the thin line with its FX tab */
.fx-drawer::before { content: ''; position: absolute; left: 0; right: 0; top: 11px; height: 1px; background: rgba(255,255,255,0.12); }
.fx-tab {
  position: relative; z-index: 1; height: 22px; padding: 0 12px 0 14px; border-radius: 11px;
  border: 1px solid #44474d; background: #1d1f23; color: #b5b7ba; cursor: pointer;
  font: 800 11px/20px inherit; font-family: inherit; letter-spacing: 0.18em;
}
.fx-tab:hover { color: #fff; border-color: #6a6d74; }
.fx-arrow { display: inline-block; margin-left: 2px; letter-spacing: 0; transition: transform 0.15s; }
.fx-drawer.open .fx-arrow { transform: rotate(180deg); }
.fx-drawer.open .fx-tab { color: #ffcf7a; border-color: #8a6a35; }
.fx-unit[hidden] { display: none; }
.fx-unit {
  display: flex; width: max-content; margin-top: 8px; padding: 8px 10px 4px;
  border-radius: 10px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px), linear-gradient(#3a3c3f, #2b2d30);
  box-shadow: 0 10px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 0 rgba(0,0,0,0.4);
  --ink: #ececec; --ink-dim: #b5b7ba; --rule: rgba(236,236,236,0.45); color: #ececec;
}
.fx-sections { display: flex; gap: 6px; align-items: flex-start; }
.fx-sections .section { padding: 0 10px; }
.fx-sections .section + .section { border-left: 1px solid rgba(255,255,255,0.1); }
.fx-sections .section-title { font-size: 11px; margin-bottom: 0; padding-bottom: 3px; }
/* small pots (beat the per-skin sizes) */
body .fx-unit .knob-cell.small { width: 84px; padding-top: 2px; }
body .fx-unit .knob-cell.small .knob-label { font-size: 10px; height: 13px; width: auto; display: block; }
body .fx-unit .knob-cell.small .dial { width: 74px; height: 74px; margin-top: -4px; }
body .fx-unit .knob-cell.small .knob { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
body .fx-unit .knob-cell.small .knob-cap { inset: 6px; }
body .fx-unit .knob-cell.small .knob-pointer { height: 9px; top: 2px; width: 2px; margin-left: -1px; }
body .fx-unit .knob-cell.small .knob-body::after { height: 6px; }
body .fx-unit .knob-cell.small .knob-value { font-size: 10.5px; height: 14px; margin-top: -6px; }
.fx-unit .lock-veil { inset: 20px 2px 0; }
body.preview .fx-drawer { display: none !important; }

/* ==========================================================================
   Maximised scopes: tall screens; the keyboard folds away unless KEYBOARD is on
   ========================================================================== */
body.scopes-max .bezel, body[data-skin="vintage"].scopes-max .bezel, body[data-skin="modular"].scopes-max .bezel { height: 420px; padding: 10px; }
body.scopes-max .scope-unit { align-items: stretch; }
body[data-skin="vintage"].scopes-max .scope-controls, body[data-skin="modular"].scopes-max .scope-controls { flex-direction: column; width: 150px; }
body[data-skin="vintage"].scopes-max .tb-buttons, body[data-skin="modular"].scopes-max .tb-buttons { grid-template-columns: repeat(3, 40px); }
body.scopes-max .keybed,
body.scopes-max .wood-band { display: none; }
.max-btn { margin-top: 2px; }
.max-btn.on { background: linear-gradient(#ffcf7a, #f0a43a); }
body[data-skin="vintage"] .max-btn, body[data-skin="modular"] .max-btn { height: 24px; }

/* The screens' pixel resolution must never widen the layout: they are redrawn sharper when
   zoomed or maximised, and the page would otherwise grow, then shrink to fit. So the canvas is
   positioned inside its bezel (out of the layout flow), sized from the bezel, not the other way. */
.scope-screen-wrap, .bezel { min-width: 0; }
.bezel { --bp: 10px; }
body[data-skin="vintage"] .bezel, body[data-skin="modular"] .bezel { --bp: 6px; }
body.scopes-max .bezel, body[data-skin="vintage"].scopes-max .bezel, body[data-skin="modular"].scopes-max .bezel { --bp: 10px; }
.bezel canvas { position: absolute; top: var(--bp); left: var(--bp); width: calc(100% - 2 * var(--bp)); height: calc(100% - 2 * var(--bp)); }
.bezel .screen-glass { inset: var(--bp); }

/* ==========================================================================
   NF-MiniModular (nfm): separate module plates in a dark rack, jack sockets, patch cables
   ========================================================================== */
body[data-skin="modular"] {
  --desk: #141517; --desk-2: #1d1f23;
  --panel: #202226; --panel-hi: #2a2d31;
  --ink: #ececec; --ink-dim: #a9abae; --rule: rgba(236,236,236,0.5);
  --accent: #ffb547; --led: #ff3b2f;
  --wood-1: #2a2c30; --wood-2: #1b1c1f; --wood-3: #34363a; /* rack rails instead of wood */
}
body[data-skin="modular"] .cheek { width: 30px; background-image: linear-gradient(90deg, #1b1c1f, #3a3c40 45%, #26282b 70%, #18191b); }
body[data-skin="modular"] .panel { background: #111214; padding: 14px 14px 10px; }
body[data-skin="modular"] .panel-sections { gap: 8px; }
body[data-skin="modular"] .section-divider { display: none; }
/* each module is its own plate, with screws at its corners */
body[data-skin="modular"] .panel .section {
  padding: 10px 10px 8px; border-radius: 4px; height: 100%;
  display: flex; flex-direction: column;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #34373c, #26282c 40%, #212327);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 0 0 1px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.6);
}
body[data-skin="modular"] .panel .section::before, body[data-skin="modular"] .panel .section::after {
  content: ""; position: absolute; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c9cbcd, #5d6164 70%);
  box-shadow: 0 1px 1px rgba(0,0,0,0.8);
}
body[data-skin="modular"] .panel .section::before { top: 3px; }
body[data-skin="modular"] .panel .section::after { bottom: 3px; }
body[data-skin="modular"] .panel .section .jack-strip { margin-top: auto; }
body[data-skin="modular"] .panel-footer { margin-top: 8px; }

/* ---- jack sockets ---- */
.jack-strip {
  display: flex; justify-content: center; gap: 4px; padding: 8px 4px 6px; margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.jack-cell { position: relative; width: 62px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.jack-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
/* outputs sit on a dark plate, the usual way modules tell outputs from inputs */
.jack-cell.out { background: #2c2e31; border-radius: 6px; padding: 3px 0 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }
.jack-cell.out .jack-label { color: #f2f2f2; }
.jack-cell.in { padding: 3px 0 5px; } /* line up with the outputs on their plates */
.socket {
  width: 30px; height: 30px; border-radius: 50%; cursor: grab; touch-action: none;
  /* a thin band round the metal shows the kind of signal: blue for control, coral for sound (.audio) */
  --ring: #6a9dbd;
  background: radial-gradient(circle, #050505 0 34%, #3b3e42 36%, #c4c7ca 47%, #7d8184 56%, #3a3d40 60%, var(--ring) 62.5%);
  box-shadow: 0 2px 3px rgba(0,0,0,0.6);
  transition: box-shadow 0.12s, transform 0.12s;
}
.jack-cell.audio .socket { --ring: #cd7a66; }
.socket:hover { box-shadow: 0 0 0 3px rgba(255,181,71,0.55), 0 2px 3px rgba(0,0,0,0.6); }
body.patching { cursor: grabbing; user-select: none; }
body.patching .socket { cursor: grabbing; }
/* while dragging, the sockets that can take the cable glow */
body.patching-in .socket[data-jack], body.patching-out .socket[data-out] { box-shadow: 0 0 0 3px rgba(255,181,71,0.35), 0 2px 3px rgba(0,0,0,0.6); }
.socket.hover { box-shadow: 0 0 0 4px #ffb547, 0 0 14px rgba(255,181,71,0.8) !important; transform: scale(1.08); }
/* lamp by each output in use: lights with the signal leaving it */
.jack-cell.out.patched .jack-lamp { display: block; }
.jack-lamp {
  display: none; /* shown only on an output with a cable in it */
  will-change: opacity; /* its own layer: otherwise every flicker redraws the whole panel */
  position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%;
  --glow: 0;
  background: rgb(calc(70 + 185 * var(--glow)), calc(20 + 40 * var(--glow)), 20);
  box-shadow: 0 0 calc(10px * var(--glow)) rgba(255,60,30,calc(var(--glow)));
}
.section.locked .jack-strip { opacity: 0.22; filter: grayscale(1); pointer-events: none; }

/* ---- cables: drawn over the whole instrument, letting clicks through to the knobs ---- */
.cable-layer { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 40; }
.cable path { fill: none; stroke-linecap: round; }
.cable-shadow { stroke: rgba(0,0,0,0.45); stroke-width: 9; transform: translate(2px, 4px); }
.cable-body { stroke-width: 6.5; opacity: 0.92; }
.cable-shine { stroke: rgba(255,255,255,0.25); stroke-width: 1.6; transform: translate(-1px, -1.5px); }
.cable .plug { stroke: rgba(0,0,0,0.6); stroke-width: 1.5; }
.cable .plug-tip { fill: #d8dadc; }
.cable.live { opacity: 0.85; }
/* see-through cables: near the mouse (always), or everywhere with the See-through switch.
   The plugs stay visible so you can still see what is connected. */
.cable .cable-shadow, .cable .cable-body, .cable .cable-shine { transition: opacity 0.18s; }
.cable.near .cable-shadow, .cable.near .cable-shine { opacity: 0; }
.cable.near .cable-body { opacity: 0.14; }
body.cables-faded .cable:not(.live) .cable-shadow, body.cables-faded .cable:not(.live) .cable-shine { opacity: 0; }
body.cables-faded .cable:not(.live) .cable-body { opacity: 0.3; }
body.cables-faded .cable.near .cable-body { opacity: 0.1; }
.ctl.modular-only[hidden] { display: none; }
body.preview .cable-layer { display: block; }
/* the keyboard's jacks sit with its Glide knob, left of the keys */
body[data-skin="modular"] .perf .jack-strip { border-top-color: rgba(255,255,255,0.12); }
/* NF-MiniModular: the keyboard section holds more than Glide, so the knob keeps its label */
body[data-skin="modular"] .perf .knob-label { visibility: visible; height: 15px; }

/* NF-Modular: a two-row rack (columns stack two modules) and modules with several rows of jacks */
body[data-skin="modular"] .panel-column.stacked { gap: 8px; }
body[data-skin="modular"] .panel-column.stacked > .section { height: auto; flex: 1 1 auto; }
body[data-skin="modular"] .panel .section .jack-rows { margin-top: auto; }
.jack-rows .jack-strip { margin-top: 0; }
.jack-rows .jack-strip:first-child { margin-top: 6px; }
.jack-rows .jack-strip + .jack-strip { border-top: none; padding-top: 7px; }
.section.locked .jack-rows { opacity: 0.22; filter: grayscale(1); pointer-events: none; }
/* dual modules: a small number in front of each row of jacks */
.jack-rowlabel { align-self: center; width: 16px; font-size: 11px; font-weight: 800; color: var(--ink-dim); text-align: center; margin-top: 14px; }
/* the NF-Modular's Output: an Overload light beside its jack */
.out-overload { position: static; display: flex; justify-content: center; margin: 4px 0 6px; }

/* ==========================================================================
   NF-Modular rack: three full-width rows of modules, compact knobs
   ========================================================================== */
.panel-sections.rack { flex-direction: column; gap: 8px; }
.rack-row { display: flex; gap: 8px; align-items: stretch; }
.rack-row > .section { flex: 1 1 auto; }
body[data-synth="nfmod"] { --cell-w: 84px; }
body[data-synth="nfmod"] .panel .knob-cell { width: 84px; }
body[data-synth="nfmod"] .panel .dial { zoom: 0.8; }
body[data-synth="nfmod"] .panel .knob-label { font-size: 11px; }
body[data-synth="nfmod"] .panel .knob-value { font-size: 11px; }
body[data-synth="nfmod"] .panel .toggle-cell { width: 76px; }
body[data-synth="nfmod"] .panel .section { padding: 8px 8px 4px; }
body[data-synth="nfmod"] .panel .section-title { margin-bottom: 2px; }
body[data-synth="nfmod"] .jack-strip { padding: 5px 4px 3px; margin-top: 4px; }
body[data-synth="nfmod"] .jack-cell { width: 52px; }
body[data-synth="nfmod"] .jack-strip { gap: 3px; }
body[data-synth="nfmod"] .panel .knob-label { letter-spacing: 0.04em; }
body[data-synth="nfmod"] .jack-rowlabel { margin-top: 12px; }

/* ==========================================================================
   Module colours (both modular synths): one hue per kind of module, shades for pairs.
   The plate is a dark grey tinted with the module's colour, so the white print stays clear.
   ========================================================================== */
body[data-skin="modular"] .panel .section, body[data-skin="modular"] .perf .section { --mod: #6b6f76; }
body[data-skin="modular"] .section[data-section="vco1"],
body[data-skin="modular"] .section[data-section="osc"] { --mod: #3f6fb8; }   /* VCO: blue */
body[data-skin="modular"] .section[data-section="vco2"] { --mod: #5a8fd6; }
body[data-skin="modular"] .section[data-section="noise"] { --mod: #9aa1aa; } /* Noise: silver */
body[data-skin="modular"] .section[data-section="mix"] { --mod: #2f9c94; }   /* Mixer: teal */
body[data-skin="modular"] .section[data-section="filt"] { --mod: #d2832c; }  /* VCF: amber */
body[data-skin="modular"] .section[data-section="ring"] { --mod: #8d5bc4; }  /* Ring Mod: violet */
body[data-skin="modular"] .section[data-section="vca"] { --mod: #4f9e4a; }   /* VCA: green */
body[data-skin="modular"] .section[data-section="att"] { --mod: #8f9a46; }   /* Attenuverter: olive */
body[data-skin="modular"] .section[data-section="out"] { --mod: #4a4d52; }   /* Output: graphite */
body[data-skin="modular"] .section[data-section="env1"],
body[data-skin="modular"] .section[data-section="env"] { --mod: #c2423d; }   /* ENV: red */
body[data-skin="modular"] .section[data-section="env2"] { --mod: #de6a5e; }
body[data-skin="modular"] .section[data-section="lfo"] { --mod: #c7a434; }   /* LFO: mustard */
body[data-skin="modular"] .section[data-section="sh"] { --mod: #c4508f; }    /* S&H: magenta */
body[data-skin="modular"] .section[data-section="kb"] { --mod: #6b6f76; }    /* Keyboard: neutral */
body[data-skin="modular"] .panel .section, body[data-skin="modular"] .perf .section {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, color-mix(in srgb, var(--mod) 30%, #2f3236), color-mix(in srgb, var(--mod) 18%, #1d1f22));
  border-top: 3px solid color-mix(in srgb, var(--mod) 80%, #000);
}
body[data-skin="modular"] .panel .section-title { border-bottom-color: color-mix(in srgb, var(--mod) 55%, rgba(236,236,236,0.5)); }

/* two controls stacked in one cell (the MFO's switches) */
.stack-cell { width: var(--cell-w); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.stack-cell .toggle-cell { width: auto; padding: 0; }
/* a module split into halves (Dual VCA): parts side by side with a line between */
.section.split .parts { display: flex; justify-content: center; }
.section.split .part { display: flex; flex-direction: column; flex: 1; padding: 0 6px; }
.section.split .part + .part { border-left: 1px solid rgba(255,255,255,0.28); }
.part-title { text-align: center; font-size: 10px; font-weight: 800; letter-spacing: 0.16em; color: var(--ink-dim); margin-bottom: 1px; }
body[data-skin="modular"] .panel .section.split .part .jack-strip { margin-top: auto; }
body[data-skin="modular"] .panel .section.split .parts { flex: 1; }
body[data-skin="modular"] .section[data-section="mfo"] { --mod: #d99a2b; }   /* MFO: a deeper mustard than the LFO */
/* NF-Modular: a shorter keyboard band (the rack above is what you work on) */
body[data-synth="nfmod"] .keybed { height: 204px; padding-top: 8px; padding-bottom: 10px; }
body[data-synth="nfmod"] .perf .dial { zoom: 0.8; }
body[data-synth="nfmod"] .perf { padding-top: 4px; padding-bottom: 4px; }
/* rack rows: every module fills the full height of its row (no gaps under the shorter ones) */
.rack-row > .section { height: auto !important; align-self: stretch; }
/* modular synths: the keyboard section has no title (Glide and Mode sit side by side) */
body[data-skin="modular"] .perf .section-title:empty, body[data-skin="modular"] .perf .section-title:has(span:empty) { display: none; }
body[data-skin="modular"] .perf .section-grid { column-gap: 2px; }
/* modular synths: the Mono/Legato switch in the keyboard's controls column */
.perf-mode { width: auto; margin-top: 2px; }
.perf-mode .toggle-title { font-size: 11px; letter-spacing: 0.12em; }
/* start menu: "SynthLab by NoFoe" at the top, in its own capitals */
.sm-brand { text-transform: none; font-size: 15px; letter-spacing: 0.08em; }
.sm-brand span { font-weight: 600; color: #c9ccd1; }

/* ==========================================================================
   Touch screens
   ========================================================================== */
/* no grey flash on tap, no text selection or long-press menu on the instrument, and no
   double-tap page zoom on buttons */
html { -webkit-tap-highlight-color: transparent; }
#stage, .lesson-bar, .appbar, .start-menu { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, .btn, .toggle, .toggle-label, .lb-btn, .range-btn, .oct-btn, .tb-btn, .sm-card { touch-action: manipulation; }
/* fingers need bigger targets: the jack sockets grow an invisible ring that also counts as the socket */
@media (pointer: coarse) {
  .socket { position: relative; }
  .socket::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; }
  .knob::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
}

/* NF-1 aubergine: the panel's lower edge and the keyboard area share the tint (the scopes stay the
   same grey test instrument on every synth) */
body[data-skin="classic"] .panel { background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 2px),
    linear-gradient(180deg, var(--panel-hi), var(--panel) 30%, var(--panel-lo)); border-top-color: #3a2b45; }
body[data-skin="classic"] .keybed { background: linear-gradient(#0f0a13, #1a1220); }
body[data-skin="classic"] .perf { background: linear-gradient(#22172b, #170f1d); }

/* the pop-out graph: a floating scope screen for the teaching graphs (see main.js) */
.graph-pop {
  position: fixed; right: 16px; top: 70px; z-index: 60; width: 620px; height: 280px; max-width: calc(100vw - 32px);
  border-radius: 12px; padding: 8px; pointer-events: none; opacity: 0; transition: opacity 0.12s;
  background: linear-gradient(#3a3c3f, #2b2d30);
  box-shadow: 0 18px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.12);
}
.graph-pop canvas { width: 100%; height: 100%; border-radius: 7px; display: block; }
body.preview .graph-pop { display: none; }

/* ==========================================================================
   NF-Modular sequencer: a column beside the rack rows, full height; folds to a thin strip
   ========================================================================== */
.panel-sections.rack { flex-direction: row; align-items: stretch; }
.rack-rows { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.rack-side { flex: none; margin-right: 8px; display: flex; flex-direction: column; }
body[data-skin="modular"] .section[data-section="seq"] { --mod: #2fa6c9; } /* Sequencer: cyan */
.rack-side .section-grid { row-gap: 0; }
.rack-side .jack-rows { margin-top: auto; }
/* each step: a small pitch knob over its on/off light; the playing step glows */
.rack-side .stack-cell { gap: 0; border-radius: 8px; padding: 0 0 3px; transition: background 0.08s; }
.rack-side .stack-cell.current { background: rgba(47, 166, 201, 0.28); box-shadow: 0 0 0 1px rgba(120, 220, 255, 0.5); }
body .rack-side .knob-cell.small { width: 84px; padding-top: 0; }
body .rack-side .knob-cell.small .knob-label { font-size: 10px; height: 13px; }
body .rack-side .knob-cell.small .dial { width: 74px; height: 74px; zoom: 1; margin-top: -4px; }
body .rack-side .knob-cell.small .knob { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
body .rack-side .knob-cell.small .knob-cap { inset: 6px; }
body .rack-side .knob-cell.small .knob-pointer { height: 9px; top: 2px; width: 2px; margin-left: -1px; }
body .rack-side .knob-cell.small .knob-value { font-size: 10.5px; height: 14px; margin-top: -6px; }
.led-cell { display: flex; justify-content: center; }
.led-btn {
  width: 30px; height: 18px; border-radius: 4px; cursor: pointer; padding: 0;
  border: 1px solid #0b0b0c; background: linear-gradient(#3a3d42, #25272b);
  display: grid; place-items: center; box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}
.led-lamp { width: 10px; height: 5px; border-radius: 2px; background: #3a1c18; }
.led-btn.on .led-lamp { background: #ff5a3a; box-shadow: 0 0 8px rgba(255, 90, 58, 0.9); }
/* the fold button, in the module's title bar */
.fold-btn {
  float: left; width: 20px; height: 18px; margin: -2px 4px 0 -2px; padding: 0; border-radius: 4px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(0,0,0,0.25); color: var(--ink); font-size: 11px; line-height: 16px;
}
.fold-btn:hover { background: rgba(255,255,255,0.12); }
/* folded: a thin strip with the name running down it */
.section.folded { width: 40px; padding-left: 4px !important; padding-right: 4px !important; }
.section.folded .section-grid, .section.folded .jack-rows, .section.folded .jack-strip { display: none; }
.section.folded .section-title { border-bottom: none; writing-mode: vertical-rl; margin: 4px auto 0; padding: 0; }
.section.folded .fold-btn { float: none; margin: 0 0 8px; writing-mode: horizontal-tb; }
/* sequencer v2: two columns, a wide Run button on top, small step lights tucked under each knob */
.section-head { display: flex; justify-content: center; margin: 2px 0 4px; }
.led-cell.wide .led-btn { width: 132px; height: 26px; gap: 8px; display: flex; align-items: center; justify-content: center; }
.led-cell.wide .led-lamp { width: 9px; height: 9px; border-radius: 50%; }
.led-word { font: 800 11px var(--font); letter-spacing: 0.2em; color: var(--ink); }
.led-btn.on .led-word { color: #ffd2c6; }
.rack-side .stack-cell .led-cell { margin-top: -9px; position: relative; z-index: 1; }
.rack-side .stack-cell .led-btn { width: 22px; height: 12px; border-radius: 3px; }
.rack-side .stack-cell .led-lamp { width: 8px; height: 4px; }

=======
/* Hear target sits in the task heading, beside the challenge title, so it is not missed */
.lb-task-head { flex-wrap: wrap; }
.lb-btn.lb-hear { padding: 5px 12px; font-size: 12.5px; background: linear-gradient(#ffcf7a, #f0a43a); border-color: #c98a2e; color: #24180a; }
.lb-btn.lb-hear:hover { background: linear-gradient(#ffd98f, #f5ae4a); }

/* MIDI light in the top bar: shown while a MIDI keyboard is connected */
.midi-light { display: inline-flex; align-items: center; gap: 6px; font: 700 11px var(--font); letter-spacing: 0.1em; color: #9fe0b4; padding: 5px 9px; border: 1px solid #2f5a3e; border-radius: 6px; background: #17241c; }
.midi-light[hidden] { display: none; }
.midi-light i { width: 7px; height: 7px; border-radius: 50%; background: #49c07c; box-shadow: 0 0 6px #49c07c; }
.midi-light.hit i { background: #b8ffd0; box-shadow: 0 0 10px #8affb3; }

/* a word in a module's title that is a switch (ENV: Exponential / Linear) */
.word-switch {
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: #ffd9a0; cursor: pointer;
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 217, 160, 0.35); border-radius: 4px;
  margin-left: 8px; padding: 0 6px; line-height: 1.35;
}
.word-switch:hover { background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 217, 160, 0.8); }

/* ==========================================================================
   Maximised modules (modular synths): see maxModules.js
   ========================================================================== */
body.modules-max .scope-unit, body.modules-max .keybed, body.modules-max .wood-band,
body.modules-max .fx-drawer, body.modules-max .panel-footer { display: none; }
body.modules-max:not(.zoomed) #fit { overflow: clip; overflow-clip-margin: 120px; } /* let cables hang below the rack */
body.modules-max .cheek { display: none; }
body[data-skin="modular"].modules-max .panel { padding: 8px 8px 6px; border-radius: 6px; }
body.modules-max #sections { display: block; }
body.modules-max #sections > :not(.max-box) { display: none; }
.max-main { display: flex; align-items: stretch; }
.max-side { display: flex; }
.max-side .section { height: auto !important; }
.max-rows { min-width: 0; }
.max-rows .rack-row { flex: 1 1 auto; }
.max-box.measuring .max-main { width: max-content; }
.max-box.measuring .rack-row > .section { flex: 0 0 auto; }
.max-box .section .jack-strip, .max-box .section .jack-rows { margin-top: auto; }
/* the keyboard's outputs: one slim strip, labels beside their sockets */
.max-kb { margin-top: 6px; }
body[data-skin="modular"] .max-kb .section { height: auto; padding: 3px 14px !important; flex-direction: row; align-items: center; gap: 18px; }
.max-kb .section::before, .max-kb .section::after, .max-kb .section-grid { display: none !important; }
body[data-skin="modular"] .max-kb .section .section-title { margin: 0; padding: 0; border: none; font-size: 11.5px; }
body[data-skin="modular"] .max-kb .section .jack-rows, body[data-skin="modular"] .max-kb .section .jack-strip { margin: 0; padding: 0; border: none; gap: 10px; }
body[data-skin="modular"] .max-kb .jack-cell.out { width: auto; flex-direction: row; gap: 9px; padding: 2px 8px 2px 14px; }
.max-kb .jack-lamp { top: 3px; right: auto; left: 4px; }
/* the smiley's own small screen */
.smiley-pop {
  position: fixed; left: 50%; top: 30%; width: 280px; height: 180px; margin-left: -140px; z-index: 70; pointer-events: none;
  border-radius: 12px; padding: 8px; background: linear-gradient(#3a3c3f, #2b2d30); box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}
.smiley-pop canvas { width: 100%; height: 100%; border-radius: 7px; display: block; }

/* ==========================================================================
   NF-ModRack: an open rack (rows of a fixed width, modules at their own width,
   rack rails showing where there is room), the module drawer, moving modules
   ========================================================================== */
body.open-rack .rack-rows:not(.max-rows) > .rack-row {
  width: 1573px; min-height: 252px; position: relative; border-radius: 4px;
  /* empty rack: two rails with mounting holes */
  background:
    radial-gradient(circle at 50% 50%, #08090a 2.2px, transparent 2.8px) 0 4px / 24px 10px repeat-x,
    radial-gradient(circle at 50% 50%, #08090a 2.2px, transparent 2.8px) 0 calc(100% - 4px) / 24px 10px repeat-x,
    linear-gradient(180deg, #3b3e42 0 18px, #17181a 18px calc(100% - 18px), #3b3e42 calc(100% - 18px));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6);
}
body.open-rack .rack-rows:not(.max-rows) > .rack-row > .section { flex: 0 0 auto; }
body.open-rack .rack-row.empty::after {
  content: "Empty row: drag modules here from the Module drawer"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(236,236,236,0.35); pointer-events: none;
}
/* grip and remove button in each module's title bar */
.mod-grip, .mod-remove {
  position: absolute; top: -2px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: rgba(236,236,236,0.4); font-size: 15px; line-height: 22px; cursor: grab;
  opacity: 0; transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.mod-grip { left: 0; }
.mod-remove { right: 0; cursor: pointer; font-size: 18px; }
body.open-rack .rack-row .section-title { position: relative; }
body.open-rack .rack-row .section:hover .mod-grip, body.open-rack .rack-row .section:hover .mod-remove,
body.drawer-open .mod-grip, body.drawer-open .mod-remove, .mod-grip:focus-visible, .mod-remove:focus-visible { opacity: 1; }
.mod-grip:hover { background: rgba(255,255,255,0.1); color: #fff; }
.mod-remove:hover { background: #8e2b25; color: #fff; }
@media (hover: none) { .mod-grip, .mod-remove { opacity: 1; } }
body.rack-dragging, body.rack-dragging * { cursor: grabbing !important; user-select: none; }
.section.moving { opacity: 0.35; }
.section.just-added { animation: just-added 0.9s ease-out; }
@keyframes just-added { from { box-shadow: 0 0 0 3px #ffb547, 0 0 24px rgba(255,181,71,0.6); } }
/* where a dragged module will go */
.rack-marker {
  position: absolute; top: 6px; bottom: 6px; width: 6px; border-radius: 3px; z-index: 5; pointer-events: none;
  background: #ffb547; box-shadow: 0 0 12px rgba(255,181,71,0.8);
}
.rack-marker.full { background: #e8463b; box-shadow: 0 0 12px rgba(232,70,59,0.8); }
.rack-marker.full::after {
  content: attr(data-note); position: absolute; top: 50%; left: 12px; transform: translateY(-50%); white-space: nowrap;
  background: #e8463b; color: #fff; font-size: 13px; font-weight: 700; padding: 4px 8px; border-radius: 4px;
}
.mod-ghost {
  position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -120%);
  background: linear-gradient(180deg, #34373c, #212327); color: #ececec; border: 1px solid #ffb547; border-radius: 4px;
  padding: 8px 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}
/* the module drawer */
.module-drawer {
  position: fixed; right: 12px; top: calc(var(--appbar-h, 56px) + 12px); bottom: 12px; width: 280px; z-index: 60; /* on the right */
  overflow-y: auto; padding: 12px; border-radius: 8px;
  background: rgba(24,25,28,0.97); border: 1px solid #3a3c40; box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  color: #ececec; font-family: inherit;
}
.md-head { position: relative; padding: 0 28px 10px 2px; border-bottom: 1px solid #3a3c40; margin-bottom: 6px; }
.md-head b { display: block; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; }
.md-head span { display: block; font-size: 12px; color: #a9abae; margin-top: 3px; }
.md-close { position: absolute; right: 0; top: -2px; width: 26px; height: 26px; border: 0; border-radius: 4px; background: transparent; color: #a9abae; font-size: 20px; cursor: pointer; }
.md-close:hover { background: #2e3034; color: #fff; }
.md-group { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: #ffb547; margin: 12px 2px 6px; }
.md-card {
  padding: 8px 10px; margin-bottom: 6px; border-radius: 5px; cursor: grab; touch-action: none; user-select: none;
  background: linear-gradient(180deg, #34373c, #26282c); box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 1px 3px rgba(0,0,0,0.5);
}
.md-card:hover, .md-card:focus-visible { outline: 1px solid #ffb547; }
.md-card.no-room { opacity: 0.45; }
.md-name { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.md-desc { font-size: 12px; color: #c4c6c9; margin-top: 3px; line-height: 1.3; }
.md-size { height: 4px; margin-top: 6px; border-radius: 2px; background: #15171a; overflow: hidden; }
.md-size span { display: block; height: 100%; background: #6a9dbd; }
/* NF-ModRack: each kind of module has its colour (as on the NF-Modular); even-numbered ones a lighter shade */
body[data-skin="modular"] .section[data-type="vco"] { --mod: #3f6fb8; }
body[data-skin="modular"] .section[data-type="vco"].even { --mod: #5a8fd6; }
body[data-skin="modular"] .section[data-type="noise"] { --mod: #9aa1aa; }
body[data-skin="modular"] .section[data-type="mix"] { --mod: #2f9c94; }
body[data-skin="modular"] .section[data-type="vcf"] { --mod: #d2832c; }
body[data-skin="modular"] .section[data-type="ring"] { --mod: #8d5bc4; }
body[data-skin="modular"] .section[data-type="vca"] { --mod: #4f9e4a; }
body[data-skin="modular"] .section[data-type="att"] { --mod: #8f9a46; }
body[data-skin="modular"] .section[data-type="env"] { --mod: #c2423d; }
body[data-skin="modular"] .section[data-type="env"].even { --mod: #de6a5e; }
body[data-skin="modular"] .section[data-type="lfo"] { --mod: #c7a434; }
body[data-skin="modular"] .section[data-type="mfo"] { --mod: #d99a2b; }
body[data-skin="modular"] .section[data-type="sh"] { --mod: #c4508f; }
/* the sequencer column is exactly as tall as the three rows of the rack */
.panel-sections.rack > .rack-side { height: auto !important; align-self: stretch; }
body[data-skin="modular"] .section[data-type="ping"] { --mod: #5b62c9; }   /* Ping: indigo */
body[data-skin="modular"] .section[data-type="ping"].even { --mod: #7a80dc; }
body[data-skin="modular"] .section[data-type="string"] { --mod: #9a6a3a; } /* String: wood brown */
body[data-skin="modular"] .section[data-type="string"].even { --mod: #b5844f; }
.scale .zone { fill: none; stroke: #e8463b; stroke-width: 3; stroke-linecap: round; opacity: 0.9; }
/* NF-ModRack: the Draw module's drawing screen (across its whole width, above its knobs) */
body[data-skin="modular"] .section[data-type="draw"] { --mod: #3e9a6e; } /* Draw: jade */
body[data-skin="modular"] .section[data-type="draw"].even { --mod: #58b386; }
.screen-row { display: flex; align-items: center; gap: 8px; }
.node-cell { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 2px 0 2px 2px; }
.ne-bar { display: flex; gap: 6px; align-items: center; width: 404px; }
.ne-group { display: inline-flex; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,0.14); }
.ne-btn { font: 700 10px/1 inherit; font-family: inherit; letter-spacing: 0.1em; text-transform: uppercase; color: #c9cbcd; background: #1a1c1f;
  border: 0; padding: 5px 9px; cursor: pointer; }
.ne-btn:not(.ne-group .ne-btn) { border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,0.14); }
.ne-btn.on { background: #3b3220; color: #ffd9a0; }
.ne-sus.on { background: #1f3340; color: #8cdcff; }
.ne-snap { margin-left: auto; }
.ne-screen { display: block; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.1); cursor: grab; touch-action: none; }
.ne-screen.drawing { cursor: crosshair; }
/* NF-ModRack: the XY pad */
body[data-skin="modular"] .section[data-type="xy"] { --mod: #b0523a; } /* XY: terracotta */
body[data-skin="modular"] .section[data-type="xy"].even { --mod: #c96b52; }
.xy-cell { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 2px 0 2px 2px; }
.xy-screen { display: block; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.1); cursor: crosshair; touch-action: none; }
.xy-rec.armed { background: #4a1d1a; color: #ff8a80; }
.xy-bar { flex-wrap: nowrap; white-space: nowrap; width: auto; }
.xy-bar .ne-btn { padding: 4px 8px; }
/* the XY: sockets under the knobs, beside the pad */
.side-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
body[data-skin="modular"] .panel .section.jacks-beside .side-col .jack-strip { margin-top: 0; }
.section.jacks-beside .screen-row { align-items: stretch; flex: 1; }
.section.jacks-beside .side-col { justify-content: space-between; }
.side-col .xy-bar { width: auto; justify-content: center; }
body[data-skin="modular"] .section[data-type="wave"] { --mod: #2f7fb8; } /* Wave VCO: a VCO blue, deeper */
body[data-skin="modular"] .section[data-type="wave"].even { --mod: #4a98cf; }
/* NF-ModRack: the Bounce module's screen */
body[data-skin="modular"] .section[data-type="bounce"] { --mod: #8a6bb8; } /* Bounce: lavender */
body[data-skin="modular"] .section[data-type="bounce"].even { --mod: #a386cc; }
.bounce-cell { display: flex; padding: 2px 0 2px 2px; }
.bounce-screen { display: block; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.1); }
/* NF-ModRack: the Wavetable's screen */
body[data-skin="modular"] .section[data-type="table"] { --mod: #2c8f9e; } /* Wavetable: deep teal-blue */
body[data-skin="modular"] .section[data-type="table"].even { --mod: #44a8b6; }
.tb-name { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: #c9cbcd; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-skin="modular"] .section[data-type="poly"] { --mod: #6b6f76; } /* Poly: neutral, like the Keyboard */
/* NF-ModRack: a rack several racks wide, scrolling sideways in a window one rack wide */
/* (one rack, plus the + strip) */
.rack-scroll { width: 1627px; overflow-x: auto; overflow-y: hidden; flex: none; scrollbar-color: #4a4d52 #141517; }
.rack-scroll::-webkit-scrollbar { height: 10px; }
.rack-scroll::-webkit-scrollbar-track { background: #141517; border-radius: 5px; }
.rack-scroll::-webkit-scrollbar-thumb { background: #4a4d52; border-radius: 5px; }
.rack-content { display: flex; gap: 8px; width: max-content; padding-bottom: 6px; }
body.open-rack .rack-rows:not(.max-rows) > .rack-row { width: var(--row-w, 1573px); }
.rack-grow { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border-radius: 4px; background: repeating-linear-gradient(180deg, #1b1c1f 0 12px, #17181a 12px 24px); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6); }
.rg-btn { width: 34px; height: 34px; border-radius: 6px; border: 1px solid #4a4d52; background: #26282b; color: #ececec; font-size: 22px; line-height: 1; cursor: pointer; }
.rg-btn:hover:not(:disabled) { background: #3b3220; border-color: #8a6a2c; color: #ffd9a0; }
.rg-btn:disabled { opacity: 0.3; cursor: default; }
.rg-n { font-size: 12px; font-weight: 800; color: #a9abae; }
/* the module drawer: a picture of the module the pointer rests on, beside the drawer */
.md-pic { position: fixed; z-index: 61; width: max-content; padding: 8px; border-radius: 8px; pointer-events: none;
  background: rgba(24,25,28,0.97); border: 1px solid #3a3c40; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.md-pic img { display: block; height: auto; border-radius: 4px; }
.md-pic span { display: block; margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #a9abae; }
/* NF-ModRack: the Shaper, Quantizer and Probe */
body[data-skin="modular"] .section[data-type="shaper"] { --mod: #b8453a; } /* Shaper: hot red */
body[data-skin="modular"] .section[data-type="shaper"].even { --mod: #cc5f53; }
body[data-skin="modular"] .section[data-type="quant"] { --mod: #4a8f63; } /* Quantizer: green */
body[data-skin="modular"] .section[data-type="quant"].even { --mod: #63a87b; }
body[data-skin="modular"] .section[data-type="probe"] { --mod: #3a3f46; } /* Probe: instrument grey */
.probe-cell { display: flex; padding: 2px 0 2px 2px; }
.scale-screen { cursor: pointer; }
.sc-menu { font: 700 11px/1 inherit; font-family: inherit; letter-spacing: 0.04em; color: #ececec; background: #1a1c1f; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px; padding: 4px 6px; cursor: pointer; max-width: 100%; }
.sc-menu:focus-visible { outline: 1px solid #ffb547; }
body[data-skin="modular"] .section[data-type="chance"] { --mod: #b08a2e; } /* Chance: gold */
body[data-skin="modular"] .section[data-type="chance"].even { --mod: #c7a24a; }
/* lessons: an explanation (the NF-ModRack's lessons) */
.lb-task-text .lb-para { margin: 0 0 7px; }
.lb-task-text .lb-try { margin-top: 8px; padding: 7px 10px; border-left: 3px solid #ffb547; background: rgba(255, 181, 71, 0.08); border-radius: 0 4px 4px 0; color: #e6e0d4; }
.lb-task-text .lb-try b { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #ffb547; margin-bottom: 2px; }
/* NF-ModRack: the Drawbars (organ) */
body[data-skin="modular"] .section[data-type="organ"] { --mod: #8a5a2b; } /* Drawbars: walnut */
body[data-skin="modular"] .section[data-type="organ"].even { --mod: #a2703d; }
.drawbar-bank { display: flex; gap: 6px; padding: 2px 4px 0 2px; }
.db-col { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 40px; }
.db-tune { width: 40px; height: 18px; border-radius: 3px; background: #101113; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); color: #a9abae;
  font: 700 10px/18px "Helvetica Neue", Arial, sans-serif; text-align: center; cursor: ns-resize; user-select: none; touch-action: none; }
.db-tune.off { color: #ffb547; box-shadow: inset 0 0 0 1px rgba(255,181,71,0.5); }
.db-track { position: relative; width: 26px; height: 142px; border-radius: 3px; background: linear-gradient(90deg, #0c0d0e, #1d1f22 50%, #0c0d0e);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.8); cursor: ns-resize; touch-action: none; }
.db-bar { position: absolute; left: 3px; right: 3px; top: 0; border-radius: 0 0 3px 3px; display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(90deg, #8f9296, #d9dbdd 45%, #8f9296); box-shadow: 0 2px 3px rgba(0,0,0,0.6); }
.db-cap { width: 100%; height: 18px; border-radius: 2px; font: 800 11px/18px "Helvetica Neue", Arial, sans-serif; text-align: center; }
.db-bar.brown .db-cap { background: #6b3f1f; color: #f3e2cf; }
.db-bar.white .db-cap { background: #ece9e2; color: #222; }
.db-bar.black .db-cap { background: #1b1b1c; color: #eee; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.db-ft { font: 700 10px "Helvetica Neue", Arial, sans-serif; color: #c9cbcd; letter-spacing: 0.02em; }

/* ==========================================================================
   Ask panel (AI, local only: js/ai.js + tools/ai/server.mjs)
   ========================================================================== */
.btn-ask { display: inline-flex; align-items: center; gap: 6px; }
.btn-ask.on { background: #3b3220; border-color: #8a6a2c; color: #ffd9a0; }
.ask-spark { color: var(--accent); font-size: 12px; }
.ask-panel {
  position: fixed; left: 12px; bottom: 12px; z-index: 61; width: 390px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - var(--appbar-h, 56px) - 24px); display: flex; flex-direction: column;
  background: rgba(26, 28, 32, 0.97); border: 1px solid #3a3d44; border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55); color: #d9dbdf; font-size: 14px;
}
.ask-panel[hidden] { display: none; }
.ask-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #2e3137; }
.ask-title { font-weight: 700; color: #fff; }
.ask-local { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #8b8f97; border: 1px solid #3a3d44; border-radius: 4px; padding: 1px 5px; }
.ask-close { margin-left: auto; background: none; border: none; color: #b5b8be; font-size: 20px; cursor: pointer; line-height: 1; }
.ask-key { padding: 12px; }
.ask-key p { margin: 0 0 10px; line-height: 1.5; color: #b5b8be; }
.ask-key code, .ask-turn code { font-size: 12px; color: #ffd9a0; }
.ask-key-row { display: flex; gap: 8px; }
.ask-key-input { flex: 1; min-width: 0; background: #15171a; color: #fff; border: 1px solid #3a3d44; border-radius: 6px; padding: 7px 9px; font: inherit; }
.ask-key-msg { margin-top: 8px; color: #ffb3b3; min-height: 1em; }
.ask-log { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.ask-log:empty { display: none; }
.ask-turn { line-height: 1.5; }
.ask-turn p { margin: 0 0 6px; }
.ask-turn.you { align-self: flex-end; max-width: 85%; background: #33363c; border-radius: 10px 10px 2px 10px; padding: 6px 10px; color: #fff; }
.ask-turn.ai { background: #202227; border: 1px solid #2e3137; border-radius: 10px 10px 10px 2px; padding: 8px 10px; }
.ask-turn.error { color: #ffb3b3; }
.ask-changes summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.ask-changes ul { margin: 6px 0 0; padding-left: 16px; font-size: 12.5px; color: #b5b8be; }
.ask-changes li { margin: 2px 0; }
.ask-changes b { color: #fff; font-weight: 600; }
.ask-ctl { color: #d9dbdf; }
.ask-dropped { font-size: 12px; color: #c9a26a; }
.ask-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ask-act { background: #2a2d33; color: #d9dbdf; border: 1px solid #3a3d44; border-radius: 5px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.ask-act:hover { background: #33363c; }
.ask-act:disabled { opacity: 0.5; cursor: default; }
.ask-flag { background: none; border-color: transparent; color: #8a8e96; }
.ask-flag:hover:not(:disabled) { border-color: #3a3d44; color: #d9dbdf; }
.ask-flag:disabled { cursor: default; color: #7fb08a; }
.ask-privacy { margin: 0; padding: 0 12px 4px; font-size: 11px; color: #6f737b; }
.ask-cost { margin-left: auto; font-size: 11px; color: #6f737b; }
.ask-examples { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.ask-chip { background: none; border: 1px solid #3a3d44; color: #b5b8be; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.ask-chip:hover { border-color: #8a6a2c; color: #ffd9a0; }
.ask-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid #2e3137; }
.ask-input { flex: 1; resize: none; background: #15171a; color: #fff; border: 1px solid #3a3d44; border-radius: 6px; padding: 7px 9px; font: inherit; line-height: 1.4; }
.ask-panel.busy .ask-send, .ask-panel.busy .ask-chip { opacity: 0.5; pointer-events: none; }
.ask-dots i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #8b8f97; animation: ask-dot 1s infinite ease-in-out; }
.ask-dots i:nth-child(2) { animation-delay: 0.15s; } .ask-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ask-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.ask-glow { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; animation: ask-glow 1.2s ease-in-out 3; }
@keyframes ask-glow { 50% { outline-color: transparent; } }
.ask-form[hidden], .ask-examples[hidden], .ask-key[hidden] { display: none; }
.ask-switch { margin-left: auto; background: none; border: 1px solid #3a3d44; border-radius: 4px; color: #b5b8be; font: inherit; font-size: 11px; padding: 1px 6px; cursor: pointer; }
.ask-switch:hover { border-color: #8a6a2c; color: #ffd9a0; }
.ask-switch:not([hidden]) + .ask-close { margin-left: 4px; }
.ask-title, .ask-local, .ask-switch { white-space: nowrap; }
