/* Page colors (the Setup area follows light / dark). The instrument panel keeps its own dark finish. */
:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #22211f;
  --muted: #6f6b64;
  --border: #e3e0da;
  --accent: #3f6f8f;
  --accent-text: #ffffff;
  --accent-soft: #e4eef4;
  --error: #b23b3b;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a19;
    --card: #242423;
    --text: #ecebe8;
    --muted: #9d9992;
    --border: #3a3937;
    --accent: #7fb0cf;
    --accent-text: #10202b;
    --accent-soft: #2c3a43;
    --error: #e27b7b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Hiragino Sans", sans-serif;
}

/* MARK: instrument panel */

.synth {
  /* panel palette: charcoal with amber markings, like a hardware synth */
  --panel: #1b1c1e;
  --module: #242528;
  --module-edge: #333539;
  --ink: #d8d2c4;        /* panel printing */
  --ink-dim: #8c877c;
  --amber: #f2a541;
  --amber-dim: #6b4d24;
  --lcd: #17130c;
  --lcd-grid: #3b2f1b;
  --lcd-text: #b8955a;
  /* the graphs read these from their canvas */
  --accent: var(--amber);
  --border: var(--lcd-grid);
  --muted: var(--lcd-text);

  color-scheme: dark;
  color: var(--ink);
  background: linear-gradient(180deg, #202124, var(--panel) 120px);
  border-bottom: 6px solid #0f1011;
  padding: 12px 16px 16px;
  display: grid;
  gap: 12px;
  font-size: 13px;
}

.synth button, .synth select, .synth .button-like {
  font: inherit;
  color: var(--ink);
  background: #2c2e32;
  border: 1px solid #3e4146;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.synth button:hover, .synth .button-like:hover { border-color: var(--amber-dim); }
.synth button:focus-visible, .synth select:focus-visible, .knob-dial:focus-visible, .synth h3:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* top strip */

.strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.brand {
  font-weight: 800;
  letter-spacing: .18em;
  font-size: 15px;
  color: var(--ink);
  margin-right: 4px;
}

.brand span { color: var(--amber); font-weight: 400; margin-left: .3em; }
.strip-note { color: var(--ink-dim); font-size: 12px; margin: 0; }

.led {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3a2a14;
  box-shadow: inset 0 0 2px #000;
}

.led.on { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.led.flash { background: #ffd28a; box-shadow: 0 0 10px #ffd28a; }

.power { display: inline-flex; align-items: center; gap: 8px; }

.program { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.lcd {
  background: var(--lcd);
  border: 1px solid #000;
  border-radius: 6px;
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, .7);
}

.program-lcd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 2px 10px;
  min-width: 220px;
}

.lcd-dim { color: var(--lcd-text); font: 12px ui-monospace, "SF Mono", Menlo, monospace; }

.synth .program-lcd select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--amber);
  font: 600 15px ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .04em;
  padding: 4px 2px;
}

.program-lcd select option { background: var(--lcd); }

.pages { display: flex; align-items: center; gap: 8px; }
.midi-led { margin-left: auto; }

/* displays */

.displays {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.screen { margin: 0; padding: 4px 6px 6px; min-width: 0; }

.screen figcaption {
  color: var(--lcd-text);
  font: 10px ui-monospace, "SF Mono", Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.screen canvas { display: block; width: 100%; height: 96px; }

/* modules */

.modules { display: flex; flex-wrap: wrap; gap: 8px; }

.module {
  flex: 1 1 auto;
  background: var(--module);
  border: 1px solid var(--module-edge);
  border-radius: 8px;
  padding: 6px 10px 10px;
  min-width: 0;
}

.module h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--ink);
  border-bottom: 1px solid var(--module-edge);
  padding-bottom: 4px;
  cursor: help;
}

.module-body { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: flex-start; }
.module-switch { flex-basis: 100%; margin-bottom: 4px; }

/* knob */

.knob { display: grid; justify-items: center; width: 58px; user-select: none; -webkit-user-select: none; }
.knob-lg { width: 76px; }
.knob-sm { width: 44px; }

.knob-dial { position: relative; width: 44px; height: 44px; cursor: ns-resize; touch-action: none; border-radius: 50%; }
.knob-lg .knob-dial { width: 62px; height: 62px; }
.knob-sm .knob-dial { width: 32px; height: 32px; }

.knob svg { width: 100%; height: 100%; overflow: visible; }
.knob-track { fill: none; stroke: #3a3c40; stroke-width: 3.5; stroke-linecap: round; }
.knob-arc { fill: none; stroke: var(--amber); stroke-width: 3.5; stroke-linecap: round; }
.knob-cap { fill: #34363a; stroke: #111; stroke-width: 1; }
.knob-dial.turning .knob-cap, .knob-dial:hover .knob-cap { fill: #3c3e43; }
.knob-pointer { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }

.knob-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--amber);
  color: #1b1307;
  font: 700 9px/15px system-ui, sans-serif;
  text-align: center;
}

.knob-label {
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}

.knob-value {
  font: 10px ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* switches (wave shapes etc.) */

.switch { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.knob-badge.switch-badge { position: static; margin-left: 4px; }

.synth .switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 6px;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.switch button svg { width: 22px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.synth .switch button.on { color: #1b1307; background: var(--amber); border-color: var(--amber); }

/* additive drawbars */

.additive {
  display: grid;
  grid-template-columns: repeat(8, minmax(44px, 1fr));
  gap: 6px;
}

.partial {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 0;
  border-radius: 6px;
  background: #1f2023;
}

.partial.unused { opacity: .45; }
.partial-title { font: 700 10px system-ui, sans-serif; color: var(--ink-dim); }

.drawbar { position: relative; display: grid; justify-items: center; gap: 2px; }
.knob-badge.drawbar-badge { top: 0; right: -14px; }

.drawbar input {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 22px;
  height: 90px;
  accent-color: var(--amber);
  cursor: ns-resize;
}

.drawbar output { font: 10px ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-dim); }

/* keyboard */

.keyboard-row { display: grid; gap: 6px; }

.keyboard {
  position: relative;
  height: 110px;
  background: #0d0d0e;
  border-radius: 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.key { position: absolute; top: 0; cursor: pointer; }

.key.white {
  height: 100%;
  background: linear-gradient(180deg, #e9e6df, #f7f5f0 80%, #dcd8cf);
  border: 1px solid #0d0d0e;
  border-top: none;
  border-radius: 0 0 4px 4px;
}

.key.white[data-label]::after {
  content: attr(data-label);
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  color: #8a857b;
}

.key.black {
  height: 62%;
  z-index: 1;
  background: linear-gradient(180deg, #2a2b2e, #111 90%);
  border: 1px solid #000;
  border-top: none;
  border-radius: 0 0 3px 3px;
}

.key.white.down { background: linear-gradient(180deg, #f6c77f, var(--amber)); }
.key.black.down { background: linear-gradient(180deg, #a86f22, #7a4f17); }

@media (max-width: 640px) {
  .synth { padding: 10px; }
  .displays { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .displays .screen:last-child { grid-column: 1 / -1; }
  .additive { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
  .program-lcd { min-width: 0; flex: 1; }
}

/* Edit / Play modes */

.synth .mode-toggle.on { color: #1b1307; background: var(--amber); border-color: var(--amber); }
.play { display: none; gap: 8px; }
body.mode-play .play { display: grid; }
body.mode-play .edit-only { display: none !important; }
/* the Controller screen: only the strip and the surface */
.surface { display: none; gap: 8px; }
body.mode-controller .surface { display: grid; }
body.mode-controller .edit-only, body.mode-controller .play, body.mode-controller .displays { display: none !important; }
.surface-row { display: flex; flex-wrap: wrap; gap: 8px; }
.surface-pads { display: grid; gap: 8px; }
.surface-widget { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 64px; padding: 8px 10px; text-align: left; }
.surface-knobs, .surface-sliders { border-radius: 999px; align-items: center; text-align: center; }
.surface-name { font-weight: 600; }
.surface-source { font-size: 11px; color: var(--ink-dim); }
.surface-widget.unbound { opacity: 0.55; }
.surface-widget.target { outline: 2px solid var(--accent); opacity: 1; }
.surface-widget.hit { background: var(--accent); color: #000; }
.module.paged > h3 { color: var(--accent); }
.module > h3 { cursor: pointer; }
body.mode-play .displays { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.play-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.play-row:last-child { margin-bottom: 0; }
.play-size { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-dim); font-size: 12px; }
.play-slot { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-dim); font-size: 12px; }
.play-slot.on { color: var(--accent); font-weight: 600; }
.play-loop button.on { color: var(--accent); border-color: var(--accent); }
.synth .play-loop .play-size input[type=number] { width: 60px; }
.loop-lcd { min-width: 56px; text-align: center; padding: 4px 10px; }
.loop-bar { flex: 1; min-width: 120px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.loop-fill { height: 100%; width: 0; background: var(--accent); }
.loop-layer { font-size: 12px; padding: 2px 8px; }
.loop-layer.muted { opacity: 0.4; text-decoration: line-through; }
.loop-layer.recording { color: var(--accent); }

.synth .play-size input {
  width: 48px;
  font: inherit;
  color: var(--ink);
  background: #2c2e32;
  border: 1px solid #3e4146;
  border-radius: 6px;
  padding: 3px 6px;
}

.synth .play button.on { color: #1b1307; background: var(--amber); border-color: var(--amber); }
.play-learn { margin-top: 6px; color: var(--amber); font-size: 13px; }
.play-learn p { margin: 0 0 6px; }
/* where the next new physical pad / knob will link */
.synth .pad.learn-next, .play-knob.learn-next { animation: teach 1.6s ease-in-out infinite; }

.pad-grid { display: grid; gap: 8px; }

.synth .pad {
  position: relative;
  display: grid;
  align-content: space-between;
  justify-items: start;
  min-height: 72px;
  padding: 8px;
  text-align: left;
  background: linear-gradient(180deg, #34363b, #2a2c30);
  border: 1px solid #45484e;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.synth .pad.empty { opacity: .55; }
.synth .pad.selected { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.synth .pad.hit { background: linear-gradient(180deg, #f6c77f, var(--amber)); color: #1b1307; }
.pad-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.pad-note { font: 11px ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-dim); }
.pad-link { font: 10px ui-monospace, "SF Mono", Menlo, monospace; color: var(--amber); }
.pad.hit .pad-note, .pad.hit .pad-link { color: #3a2508; }

.play-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--module-edge);
  font-size: 12px;
}

.play-editor label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-dim); }
.play-note { font: 12px ui-monospace, "SF Mono", Menlo, monospace; min-width: 64px; text-align: center; color: var(--ink); }

.play-knobs { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.play-knob { display: grid; justify-items: center; gap: 2px; padding: 4px; border-radius: 8px; border: 1px solid transparent; }
.play-knob.selected { border-color: var(--amber); }
.play-knob-empty { width: 58px; height: 72px; display: grid; place-items: center; color: var(--ink-dim); }
.synth .play-knob-target { padding: 2px 6px; font-size: 10px; letter-spacing: .04em; }

/* lessons drawer */

.synth .lessons-toggle { margin-left: auto; }
.synth .lessons-toggle.on { color: #1b1307; background: var(--amber); border-color: var(--amber); }
.lessons-toggle + .midi-led { margin-left: 0; }

.lessons {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: #1d1e21;
  border-left: 1px solid var(--module-edge);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .35);
  color: var(--ink);
}

.lessons[hidden] { display: none; }

.lessons-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--module-edge);
}

.lessons-head h2 { margin: 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.lessons-body { flex: 1; overflow-y: auto; padding: 12px 16px 24px; font-size: 14px; line-height: 1.55; }
.lessons-body h3 { margin: 8px 0 4px; font-size: 16px; }
.lessons-body h4 { margin: 14px 0 4px; font-size: 14px; color: var(--amber); }
.lessons-body p { margin: 0 0 10px; }

.lesson-intro, .lesson-note { color: var(--ink-dim); font-size: 13px; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.synth .lesson-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  line-height: 1.35;
}

.lesson-item strong { display: block; font-size: 13px; }
.lesson-item small { display: block; color: var(--ink-dim); font-size: 12px; }
.lesson-num { color: var(--amber); font: 700 13px ui-monospace, "SF Mono", Menlo, monospace; min-width: 18px; }

.synth .lesson-back { border: none; background: none; padding: 0; color: var(--ink-dim); }
.synth .lesson-back:hover { color: var(--ink); }

.lesson-progress { display: grid; gap: 4px; color: var(--ink-dim); font-size: 12px; }
.lesson-bar { display: block; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--amber) calc(var(--p) * 100%), #333539 0); }

.lesson-actions, .lesson-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.lesson-nav { justify-content: space-between; border-top: 1px solid var(--module-edge); padding-top: 12px; }
.synth .lessons button.primary { color: #1b1307; background: var(--amber); border-color: var(--amber); }
.synth .lessons button:disabled { opacity: .4; cursor: default; }

/* the controls a lesson step is about */
.teach { border-radius: 8px; animation: teach 1.6s ease-in-out infinite; }

@keyframes teach {
  0%, 100% { box-shadow: 0 0 0 2px rgba(242, 165, 65, .9); }
  50% { box-shadow: 0 0 0 5px rgba(242, 165, 65, .25); }
}

@media (prefers-reduced-motion: reduce) {
  .teach { animation: none; box-shadow: 0 0 0 2px var(--amber); }
}

/* on wide screens the drawer sits beside the panel instead of over it */
@media (min-width: 900px) {
  body.lessons-open .synth, body.lessons-open .setup { margin-right: 380px; }
}

/* MARK: setup area (shown on the Setup screen only) */

body:not(.mode-controller) .controller-only { display: none !important; }
body.mode-controller .keyboard-row { display: none; }
.setup-devices .list { margin-bottom: 8px; }
.setup-devices .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.setup { max-width: 1080px; margin: 0 auto; padding: 12px 16px 32px; }

.setup main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  padding-top: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.card h2 { font-size: 13px; margin: 0 0 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.wide { grid-column: 1 / -1; }

.setup button, .setup select, .setup .button-like {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.setup button:hover, .setup .button-like:hover { border-color: var(--accent); }
.setup .button-like { display: inline-block; cursor: pointer; }
.setup button:disabled { opacity: .5; cursor: default; }
.setup button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.error { color: var(--error); font-size: 13px; margin: 8px 0 0; white-space: pre-wrap; }

.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }

.mapping {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 16px;
  font-size: 13px;
}

.mapping li { display: flex; gap: 8px; }
.mapping li span { color: var(--muted); min-width: 56px; }

textarea {
  width: 100%;
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
}

.log {
  margin: 0;
  height: 180px;
  overflow: auto;
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
}

/* FM page */

body:not(.mode-fm) .fm-only { display: none !important; }
body.mode-fm .edit-only { display: none !important; }
.fm { display: grid; gap: 8px; }
.fm-top { align-items: stretch; }
.fm-module .module-body { gap: 6px 10px; }
.fm-group { display: grid; gap: 2px; align-content: start; }
.fm-group-label { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim); }
.fm-group-body { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: flex-start; }
.fm-choice button { font-size: 10px; padding: 3px 6px; }

.fm-graph { margin: 0; padding: 2px; border-radius: 4px; }
.fm-graph figcaption { display: none; }
.fm-graph canvas { display: block; width: 120px; height: 44px; }
.fm-graph-wide canvas { width: 168px; height: 52px; }

.fm-alg-module { flex: 0 1 auto; }
.fm-alg-screen { padding: 4px; border-radius: 4px; }
.fm-alg { display: block; width: 210px; height: 150px; }
.fm-alg-nav { display: flex; align-items: center; gap: 4px; }
.fm-alg-num { font: 700 18px ui-monospace, "SF Mono", Menlo, monospace; padding: 2px 8px; color: var(--amber); border-radius: 4px; }
.fm-alg-edge, .fm-alg-bus { stroke: var(--lcd-text); stroke-width: 1.5; }
.fm-alg-fb { fill: none; stroke: var(--amber); stroke-width: 1.2; stroke-dasharray: 3 2; }
.fm-alg [class^=fm-alg-op] { cursor: pointer; }
.fm-alg [class^=fm-alg-op] rect:first-child { fill: #241c10; stroke: var(--lcd-text); stroke-width: 1.2; }
.fm-alg .carrier rect:first-child { stroke: var(--amber); }
.fm-alg .current rect:first-child { stroke: #fff; stroke-width: 2; }
.fm-alg-level { fill: var(--amber-dim); opacity: .8; pointer-events: none; }
.fm-alg text { fill: var(--ink); font: 700 13px ui-monospace, "SF Mono", Menlo, monospace; pointer-events: none; }

.fm-op.muted-op { opacity: .55; }
.fm-op h3 { display: flex; align-items: center; gap: 8px; }
.fm-op-role { font-weight: 400; letter-spacing: .06em; color: var(--ink-dim); text-transform: lowercase; }
.fm-op-freq { margin-left: auto; padding: 1px 6px; border-radius: 3px; font: 11px ui-monospace, "SF Mono", Menlo, monospace; color: var(--amber); letter-spacing: 0; }

.fm-name { width: 11ch; font: 14px ui-monospace, "SF Mono", Menlo, monospace; color: var(--amber); border: 1px solid var(--lcd-grid); border-radius: 4px; padding: 4px 6px; }
.synth .fm-op-on { font-size: 10px; padding: 1px 6px; }
.synth .fm-op-on.on { color: #1b1307; background: var(--amber); border-color: var(--amber); }

.fm-bank { position: fixed; inset: 64px 16px auto auto; margin: 0; z-index: 20; box-shadow: 0 8px 30px rgb(0 0 0 / .5); max-width: 560px; width: calc(100% - 32px); background: var(--module); color: var(--ink); border: 1px solid var(--module-edge); border-radius: 8px; }
.fm-bank::backdrop { background: rgb(0 0 0 / .5); }
.fm-bank header { display: flex; align-items: baseline; gap: 8px; }
.fm-bank h2 { margin: 0; font-size: 14px; }
.fm-bank-list { columns: 2; padding-left: 2.2em; margin: 8px 0; font: 12px ui-monospace, "SF Mono", Menlo, monospace; }
.fm-bank-list li { break-inside: avoid; }
.synth .fm-bank-voice, .fm-bank-voice { font: inherit; padding: 1px 6px; margin: 1px 0; background: none; border: 1px solid transparent; color: var(--ink); cursor: pointer; border-radius: 3px; }
.fm-bank-voice:hover { border-color: var(--amber-dim); }
.fm-bank-voice.on { background: var(--amber); color: #1b1307; }
.fm-bank footer { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
@media (max-width: 640px) {
  .fm-bank-list { columns: 1; }
}
.fm.drop { outline: 2px dashed var(--amber); outline-offset: 4px; border-radius: 8px; }

/* FM page: operators at a glance + the selected one in detail */
.fm-overview { flex: 1 1 520px; }
.fm-strips { display: grid; grid-template-columns: repeat(6, minmax(64px, 1fr)); gap: 6px; width: 100%; }
.fm-strip { display: grid; justify-items: center; gap: 3px; padding: 6px 4px; border: 1px solid var(--module-edge); border-top: 3px solid var(--module-edge); border-radius: 6px; cursor: pointer; background: #202124; }
.fm-strip.carrier { border-top-color: var(--amber); }
.fm-strip.current { outline: 2px solid var(--amber); outline-offset: -1px; background: #2a2620; }
.fm-strip.muted-op { opacity: .5; }
.fm-strip-head { display: flex; align-items: center; gap: 6px; }
.fm-strip-name { font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.fm-strip .fm-op-role { font-size: 10px; color: var(--ink-dim); }
.fm-strip .fm-op-freq { margin: 0; }
.fm-graph-thumb canvas { width: 64px; height: 26px; }
.fm-graph-big canvas { width: 260px; height: 80px; }
.fm-detail { border-left: 3px solid var(--module-edge); }
.fm-detail.carrier { border-left-color: var(--amber); }
.fm-advanced { flex-basis: 100%; margin-top: 4px; }
.fm-advanced summary { cursor: pointer; font-size: 11px; color: var(--ink-dim); letter-spacing: .06em; }
.fm-advanced[open] summary { color: var(--ink); margin-bottom: 4px; }
.fm-advanced-note { margin: 0 0 6px; font-size: 11px; color: var(--ink-dim); }
.fm-module.foldable > h3 { cursor: pointer; }
.fm-module.foldable > h3::before { content: '▾ '; color: var(--ink-dim); }
.fm-module.foldable.folded > h3::before { content: '▸ '; }
.fm-module.folded > .module-body { display: none; }
.fm-module.folded > h3 { margin-bottom: 0; border-bottom: 0; padding-bottom: 0; }
.fm-more { align-items: flex-start; }
@media (max-width: 640px) {
  .fm-strips { grid-template-columns: repeat(3, minmax(64px, 1fr)); }
}

/* master volume in the header */
.master { display: inline-flex; align-items: center; gap: 6px; }
.master input[type=range] { width: 96px; accent-color: var(--amber); }
.master output { min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.play-loop .click-volume { width: 90px; accent-color: var(--amber); }
