:root {
  color-scheme: dark;
  /* Whole-console zoom. Percentages scale type and spacing together (unlike a
     font-size change, which needs every px value re-tuned). */
  --ui-scale: 1.15;
  zoom: var(--ui-scale);
  --bg: #121417;
  --panel: #1b1f24;
  --panel-2: #20252b;
  --strip: #262b32;
  --strip-2: #2e343c;
  --line: #313840;
  --line-2: #3d454f;
  --ink: #e3e7ec;
  --ink-2: #b6bec8;
  --muted: #7d8794;
  --accent: #3fc1d6;
  --accent-2: #2a8fa0;
  --peq: #f2a93b;
  --thd: #b48cf2;
  --ok: #3fcf73;
  --warn: #f2b33b;
  --danger: #ef5350;
  --radius: 6px;
  --fader-h: 240px;
  --cap-h: 30px;
  --topbar-h: 64px;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
  --motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-fast: 160ms;
  --motion-panel: 240ms;
  --motion-switch: 280ms;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 0;
  /* Account for root zoom so the minimum height fits the actual viewport. */
  min-height: calc(100dvh / var(--ui-scale));
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: radial-gradient(1200px 500px at 50% -200px, #1d232a 0, transparent 70%), var(--bg);
  font: 13px/1.4 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

body.has-overlay { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }

button,
select,
input[type="text"],
input[type="number"] {
  min-height: 30px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #16191d;
  color: var(--ink);
}

/* Segoe UI / YaHei glyphs sit ~1 px below the line-box center; the extra bottom
   padding lifts text so it reads as vertically centered in buttons and fields. */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px 2px;
  line-height: 1;
  background: linear-gradient(#2c323a, #23282e);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

button:hover { border-color: #5a6470; }
button:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: 0.45; }

input[type="text"], input[type="number"], select { width: 100%; padding: 0 8px 1px; }
/* Number fields: no hidden spin-button gutter, value centered. Wheel and arrow keys still step. */
input[type="number"] { font-variant-numeric: tabular-nums; text-align: center; appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select { padding: 0 24px 2px 8px; line-height: 1; }
option { background: #1b1f24; color: var(--ink); }

input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }

.primary-action { border-color: var(--accent-2); background: linear-gradient(#2a7f8f, #1f6572); color: #f2fbfd; }
.primary-action:hover { border-color: var(--accent); }
.danger-action { border-color: #6b3434; color: #ffb3b0; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px 1px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #16191d;
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status-idle { color: var(--ink-2); }
.status-ok { border-color: rgba(63, 207, 115, 0.5); color: #8ff0b2; background: rgba(63, 207, 115, 0.08); }
.status-warn { border-color: rgba(242, 179, 59, 0.5); color: #ffd58a; background: rgba(242, 179, 59, 0.08); }
.status-error { border-color: rgba(239, 83, 80, 0.6); color: #ffaaa8; background: rgba(239, 83, 80, 0.1); }

/* ----- Top bar ----- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#20252b, #181b20);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* DSP and Scene pack left after the fixed-width brand; the variable-width status
   chips start the right-aligned group, so their text never moves the DSP switch. */
.brand { display: flex; align-items: center; gap: 10px; margin-right: 14px; }
.topbar-status { margin-left: auto; }
#sampleRateStatus { min-width: 104px; }
#dspGateStatus { min-width: 86px; }
#deviceSceneStatus { min-width: 108px; }
#flashStatus { min-width: 72px; }
#hidStatus { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
  padding: 4px 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), #2d7fbf);
  color: #071318;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.brand-meta { display: grid; line-height: 1.15; }
.brand-meta strong { font-size: 15px; }
.brand-meta small { color: var(--muted); font-size: 11px; }

.topbar-section { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-section select { width: auto; min-width: 118px; }
.section-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }
.topbar-status { flex-wrap: wrap; }
.icon-button { width: 30px; padding: 0; font-size: 16px; }
/* Crisp stroked glyph instead of the mismatched font arrow character. */
.icon-svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover .icon-svg { stroke: var(--accent); }

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #121519;
}
.segmented button {
  min-height: 26px;
  min-width: 48px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 700;
}
.segmented button.is-active { background: linear-gradient(#3b434d, #2c323a); color: #fff; box-shadow: inset 0 0 0 1px #56606c; }
.dsp-function-control button[data-dsp-function="1"].is-active { color: var(--peq); }
.dsp-function-control button[data-dsp-function="2"].is-active { color: var(--thd); }

/* One sliding selection plate; the buttons keep their existing device state. */
.dsp-function-control { position: relative; display: inline-grid; grid-template-columns: repeat(3, minmax(48px, 1fr)); --selection-line: #56606c; }
.dsp-function-control::before {
  content: "";
  position: absolute;
  inset: 2px auto 2px 2px;
  width: calc((100% - 4px) / 3);
  border-radius: 5px;
  background: linear-gradient(#3b434d, #2c323a);
  box-shadow: inset 0 0 0 1px var(--selection-line), 0 1px 3px rgba(0, 0, 0, 0.25);
  transform: translateX(calc(var(--dsp-index, 0) * 100%));
  pointer-events: none;
}
.dsp-function-control.is-animated::before { transition: transform var(--motion-switch) var(--motion-ease), box-shadow var(--motion-panel) var(--motion-ease); }
.dsp-function-control[data-mode="1"] { --selection-line: #a87c3d; }
.dsp-function-control[data-mode="2"] { --selection-line: #8c70b8; }
.dsp-function-control button { position: relative; }
.dsp-function-control button.is-active { background: transparent; box-shadow: none; }

/* Style the native picker where supported, retaining native keyboard/selection
   behaviour and the ordinary select fallback in older browsers. */
@supports (appearance: base-select) {
  .motion-select, .motion-select::picker(select) { appearance: base-select; }
  .motion-select { --picker-offset-y: -8px; align-items: center; gap: 16px; padding: 0 10px 2px; }
  .motion-select::picker-icon { color: var(--muted); transition: transform var(--motion-panel) var(--motion-ease); }
  .motion-select:open::picker-icon { transform: rotate(180deg); }
  .motion-select::picker(select) {
    min-width: anchor-size(width);
    max-width: stretch;
    max-height: min(360px, 50dvh);
    margin-block-start: 6px;
    padding: 5px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: linear-gradient(#262d35, #1b2026);
    color: var(--ink);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(var(--picker-offset-y));
    transition: opacity var(--motion-fast) var(--motion-ease), transform var(--motion-panel) var(--motion-ease),
      display var(--motion-panel) allow-discrete, overlay var(--motion-panel) allow-discrete;
  }
  .motion-select:open::picker(select) { opacity: 1; transform: none; }
  .motion-select option { min-height: 30px; padding: 5px 8px; border-radius: 4px; background: transparent; font: inherit; white-space: normal; }
  .motion-select option:hover, .motion-select option:focus-visible { background: #303a44; }
  .motion-select option:checked { background: rgba(63, 193, 214, 0.1); color: var(--accent); }
  .motion-select option::checkmark { order: 1; margin-left: auto; color: var(--accent); }
  /* Keep filter choices below the field and scroll within the available space. */
  #bandType::picker(select), #firAdc::picker(select), #firDac::picker(select) { position-try-fallbacks: none; max-height: stretch; }
  /* The footer preset menu opens upward, including its entrance/exit motion. */
  #presetSelect { --picker-offset-y: 8px; }
  #presetSelect::picker(select) { position-area: block-start span-inline-end; position-try-fallbacks: none; margin-block: 0 6px; max-height: stretch; }
  @starting-style {
    .motion-select:open::picker(select) { opacity: 0; transform: translateY(var(--picker-offset-y)); }
  }
}

/* ----- Console layout ----- */

.console {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, max-content) minmax(260px, 320px);
  justify-content: center;
  /* Stretch the buses to the rack height (and vice versa) so all panel bottoms align. */
  align-items: stretch;
  align-content: stretch;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
}

.bus, .rack-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(var(--panel-2), var(--panel));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.bus-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.bus-header h2, .rack-header h2 { margin: 0; font-size: 13px; letter-spacing: 0.12em; }
.bus-input .bus-header h2 { color: #8fd8ff; }
.bus-output .bus-header h2 { color: #ffc98a; }
.bus-meta, .rack-sub { color: var(--muted); font-size: 11px; }

.bus-body {
  display: flex;
  align-items: stretch;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}

.bus-flow {
  align-self: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--line-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bus-input .bus-flow { transform: translateX(2px); }

.bus { display: flex; flex-direction: column; }
.bus-body { flex: 1; }
.strip-pair { display: flex; align-items: stretch; gap: 4px; }

/* ----- Channel strip ----- */

.strip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-content: start;
  gap: 6px;
  width: 100px;
  flex: 0 0 auto;
  padding: 8px 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: linear-gradient(var(--strip-2), var(--strip));
}
.strip-input { box-shadow: inset 0 3px 0 #2e7ea6; }
.strip-output { box-shadow: inset 0 3px 0 #a8742c; }
.strip.is-follower .strip-head { opacity: 0.75; }

.strip-head { display: grid; justify-items: center; line-height: 1.15; }
.strip-name { font-weight: 800; font-size: 14px; letter-spacing: 0.04em; }
.strip-sub { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }

.sync-led {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3a424b;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.sync-led.led-ok { background: var(--ok); box-shadow: 0 0 6px rgba(63, 207, 115, 0.8); }
.sync-led.led-warn { background: var(--warn); box-shadow: 0 0 6px rgba(242, 179, 59, 0.7); }
.sync-led.led-off { background: transparent; box-shadow: inset 0 0 0 1px #4a525c; }

.strip-sum {
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #121519;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.strip-sum.is-boost { border-color: rgba(242, 179, 59, 0.55); color: #ffd58a; }
.strip-sum.is-muted { border-color: rgba(239, 83, 80, 0.6); color: #ffaaa8; }

/* Faders take the strip's spare height; --fader-h is the minimum travel. */
.strip-fader { flex: 1 0 auto; min-height: var(--fader-h); display: flex; justify-content: center; }
.strip-fader > .fader { width: 78px; height: auto; }

.strip-value { height: 28px; min-height: 28px; text-align: center; font-weight: 700; padding: 0 2px 1px; }
.strip-status, .usb-effective {
  display: block;
  min-height: 14px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strip-button {
  position: relative;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
.strip-button input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: inherit; }
.strip-button span {
  width: 100%;
  padding: 4px 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: linear-gradient(#323941, #282d34);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
}
.strip-button input:checked + span { border-color: #b53a37; background: linear-gradient(#d64541, #a52f2c); color: #fff; box-shadow: 0 0 10px rgba(239, 83, 80, 0.45); }
.strip-button input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.strip-button input:disabled + span { opacity: 0.45; }
.strip-button:has(input:disabled) { cursor: not-allowed; }

.strip-knobs { display: flex; justify-content: center; gap: 4px; min-height: 76px; }

.strip-dsp { display: grid; gap: 9px; padding: 2px 1px 1px; }
.dsp-button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 2px;
  min-height: 0;
  padding: 4px 4px 3px;
  border-color: var(--line-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.mini-eq { display: block; width: 100%; height: 20px; opacity: 0.7; }
/* Glow palette lives on the base class so both the running (is-active) and the
   armed-but-idle (is-standby) states can light up with the same treatment. */
.peq-button {
  --glow: #f2a93b; --glow-text: #ffc067; --glow-bg-top: #3a2f22; --glow-bg: #2a241d;
  --glow-inset: rgba(242, 140, 59, 0.45); --glow-mid: rgba(242, 140, 59, 0.75); --glow-outer: rgba(242, 120, 50, 0.45);
}
.thd-button {
  --glow: #4da3ff; --glow-text: #9ccdff; --glow-bg-top: #1d2c3f; --glow-bg: #182230;
  --glow-inset: rgba(77, 163, 255, 0.45); --glow-mid: rgba(77, 163, 255, 0.75); --glow-outer: rgba(45, 130, 240, 0.45);
}
/* Lit state for both buttons: identical bloom, only the hue differs. */
.peq-button.is-active, .thd-button.is-active {
  border-color: var(--glow);
  color: var(--glow-text);
  background: linear-gradient(var(--glow-bg-top), var(--glow-bg));
  box-shadow: inset 0 0 0 1px var(--glow-inset), 0 0 6px var(--glow-mid), 0 0 14px var(--glow-outer);
}
.peq-button.is-active .mini-eq { opacity: 1; }
.thd-button.is-active .thd-glyph { filter: drop-shadow(0 0 4px var(--glow-mid)); }
/* Armed but idle (flat EQ / zero coefficients): dashed outline + the same glow,
   so "switched on, nothing to process" reads differently from "running". */
.peq-button.is-standby, .thd-button.is-standby {
  border-style: dashed;
  border-color: var(--glow);
  color: var(--glow-text);
  background: linear-gradient(var(--glow-bg-top), var(--glow-bg));
  box-shadow: inset 0 0 0 1px var(--glow-inset), 0 0 4px var(--glow-mid), 0 0 9px var(--glow-outer);
}
.thd-button.is-standby .thd-glyph { filter: drop-shadow(0 0 3px var(--glow-mid)); }
/* Rate bypass: genuinely not processing, so muted and unlit. */
.peq-button.is-bypass {
  border-style: dashed;
  border-color: rgba(242, 179, 59, 0.6);
  color: var(--warn);
  box-shadow: none;
}
.thd-glyph { display: flex; align-items: flex-end; gap: 4px; height: 20px; padding-bottom: 2px; }
.thd-glyph i { display: block; width: 4px; border-radius: 1px; background: currentColor; opacity: 0.55; }
.thd-glyph i:nth-child(1) { height: 14px; }
.thd-glyph i:nth-child(2) { height: 9px; }
.thd-glyph i:nth-child(3) { height: 5px; }
.thd-button.is-active .thd-glyph i { opacity: 1; }
.thd-button.is-standby { border-color: rgba(180, 140, 242, 0.4); color: #c3add9; }

.pair-link {
  position: relative;
  display: flex;
  /* Keep the checkbox inside the chip instead of stretching to the strip height. */
  align-self: center;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex: 0 0 auto;
  cursor: pointer;
}
.pair-link input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.pair-link span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  writing-mode: vertical-rl;
  padding: 10px 2px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}
.pair-link input:checked + span { border-color: var(--accent-2); background: rgba(63, 193, 214, 0.12); color: var(--accent); }
.pair-link input:focus-visible + span { outline: 2px solid var(--accent); }

.link-chip, .toggle-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.link-chip input, .toggle-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.link-chip span, .toggle-chip span {
  padding: 4px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.link-chip input:checked + span { border-color: var(--accent-2); background: rgba(63, 193, 214, 0.12); color: var(--accent); }
.toggle-chip input:checked + span { border-color: rgba(63, 207, 115, 0.55); background: rgba(63, 207, 115, 0.12); color: #8ff0b2; }
.link-chip input:focus-visible + span, .toggle-chip input:focus-visible + span { outline: 2px solid var(--accent); }
.link-chip input:disabled + span, .toggle-chip input:disabled + span { opacity: 0.45; }

/* ----- USB volume group ----- */

.usb-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1a1e23;
}
.usb-head { display: grid; justify-items: center; line-height: 1.15; }
.usb-head span { font-weight: 800; letter-spacing: 0.06em; }
.usb-head small { color: var(--muted); font-size: 10px; }
.usb-faders { display: flex; flex: 1; gap: 4px; }
.usb-channel { display: flex; flex-direction: column; gap: 6px; width: 64px; }
.usb-channel.is-master { padding-right: 4px; margin-right: 2px; border-right: 1px solid var(--line); }
.usb-channel .strip-fader > .fader { width: 58px; }
.usb-channel .strip-fader > .fader .fader-cap { width: 26px; }
.usb-name { color: var(--ink-2); font-size: 10px; font-weight: 800; text-align: center; letter-spacing: 0.06em; }
.usb-channel .strip-fader { min-height: calc(var(--fader-h) + 30px); }
.usb-channel.is-muted .usb-effective { color: #ffaaa8; }
.usb-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }

/* ----- Fader ----- */

.fader {
  --t: 0;
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  height: 100%;
  min-height: 110px;
  touch-action: none;
  user-select: none;
  outline: none;
  cursor: ns-resize;
}
.fader-scale { position: relative; }
.fader-scale span {
  position: absolute;
  right: 4px;
  bottom: calc(var(--tick) * (100% - var(--cap-h)) + var(--cap-h) / 2);
  transform: translateY(50%);
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fader-scale span::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  width: 4px;
  border-top: 1px solid #4a525c;
}
.fader-track { position: relative; }
.fader-groove {
  position: absolute;
  top: calc(var(--cap-h) / 2);
  bottom: calc(var(--cap-h) / 2);
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: #0b0d10;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 0 1px #363d46;
}
.fader-fill {
  position: absolute;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 2px;
  pointer-events: none;
}
.fader.is-level .fader-fill {
  bottom: calc(var(--cap-h) / 2);
  height: calc(var(--t) * (100% - var(--cap-h)));
  background: linear-gradient(to top, rgba(63, 193, 214, 0.15), rgba(63, 193, 214, 0.65));
}
.fader.is-bipolar .fader-fill {
  bottom: calc(var(--fill-lo, 0) * (100% - var(--cap-h)) + var(--cap-h) / 2);
  height: calc(var(--fill-span, 0) * (100% - var(--cap-h)));
  background: var(--fill-color, var(--peq));
}
.fader-cap {
  position: absolute;
  left: 50%;
  bottom: calc(var(--t) * (100% - var(--cap-h)));
  width: 34px;
  height: var(--cap-h);
  transform: translateX(-50%);
  border-radius: 4px;
  background: linear-gradient(#69727e, #424a54 42%, #2b3138 50%, #3f4750 58%, #565f6a);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  cursor: grab;
}
.fader-cap-line { position: absolute; top: 50%; left: 3px; right: 3px; height: 2px; margin-top: -1px; background: #f4f7fa; border-radius: 1px; }
.fader.is-dragging .fader-cap { cursor: grabbing; box-shadow: 0 0 0 2px rgba(63, 193, 214, 0.6), 0 3px 8px rgba(0, 0, 0, 0.8); }
.fader:focus-visible .fader-cap { outline: 2px solid var(--accent); outline-offset: 2px; }
.fader.is-disabled { opacity: 0.4; cursor: not-allowed; }
.fader.is-disabled .fader-cap { cursor: not-allowed; }

/* ----- Knob ----- */

.knob {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 1px;
  width: 44px;
  outline: none;
  user-select: none;
}
.knob-dial { width: 40px; height: 40px; cursor: ns-resize; touch-action: none; }
.knob-arc-bg { fill: none; stroke: #0d1013; stroke-width: 4; stroke-linecap: round; }
.knob-arc { fill: none; stroke: var(--knob-color, var(--accent)); stroke-width: 4; stroke-linecap: round; }
.knob.is-zero .knob-arc { stroke: transparent; }
.knob-body { fill: #3a414a; stroke: #5d6671; stroke-width: 1; }
.knob-pointer { stroke: #f2f5f8; stroke-width: 2.4; stroke-linecap: round; transform-box: view-box; transform-origin: 24px 24px; transform: rotate(var(--angle, -135deg)); }
.knob-readout {
  min-width: 44px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.knob-caption { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.1em; }
.knob-input { width: 56px; min-height: 20px; height: 20px; padding: 0 3px; font-size: 11px; text-align: center; }
.knob:focus-visible .knob-body { stroke: var(--accent); stroke-width: 2; }
.knob.is-dragging .knob-body { stroke: var(--accent); }
.knob.is-disabled { opacity: 0.4; }
.knob.is-disabled .knob-dial { cursor: not-allowed; }
[data-pga-knob] { --knob-color: #8fd8ff; }
[data-gain-knob] { --knob-color: var(--warn); }
[data-mix-knob] { --knob-color: #c9a2ff; }

/* Smooth the OFF detent and readback changes without delaying values or writes. */
:is([data-mix-knob], [data-monitor-knob]) .knob-pointer {
  transition: transform var(--motion-fast) var(--motion-ease), stroke var(--motion-fast) var(--motion-ease),
    filter var(--motion-fast) var(--motion-ease);
}
:is([data-mix-knob], [data-monitor-knob]) .knob-arc {
  transition: stroke-dasharray var(--motion-fast) var(--motion-ease), stroke var(--motion-fast) var(--motion-ease);
}
:is([data-mix-knob], [data-monitor-knob]) .knob-readout { transition: color var(--motion-fast) var(--motion-ease); }

/* ----- Rack ----- */

.rack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rack > .rack-panel:last-child { flex: 1; }
.rack-panel { padding: 0 0 10px; }
.rack-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.rack-header .sync-led { margin-left: auto; }
.rack-note { margin: 8px 12px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.rack-warn { color: #ffd58a; }

.mix-row {
  display: grid;
  grid-template-columns: 34px 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 4px;
  padding: 10px 12px 0;
}
.mix-row-label { justify-self: start; color: var(--ink-2); font-weight: 800; font-size: 11px; letter-spacing: 0.08em; }
.mix-row .knob { width: 64px; }
.mix-row .knob-dial { width: 46px; height: 46px; }

.rack-field { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 8px; padding: 10px 12px 0; }
.rack-field span { color: var(--ink-2); font-weight: 800; font-size: 11px; }
.rack-field select { min-width: 0; }
.fir-panel { display: flex; flex-direction: column; }
.fir-panel .rack-actions { margin-top: auto; }

/* Reuse the last rack panel's stretch so Monitor stays level with the buses. */
.monitor-panel { display: flex; flex-direction: column; padding-bottom: 6px; }
.monitor-controls { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); gap: 6px; padding: 4px 12px 0; }
.monitor-controls .pair-link { justify-self: center; }
/* Share label/dial/readout rows to spread spare height around the dial, up to 144px. */
.monitor-channel {
  min-width: 0;
  width: 100%;
  height: 100%;
  max-height: 144px;
  align-self: center;
  display: grid;
  grid-template-rows: repeat(3, auto);
  align-content: space-between;
  justify-items: center;
  gap: 0;
}
.monitor-channel-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; }
.monitor-side { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid #3e5965; border-radius: 5px; background: #203039; color: #8de5f3; font-size: 10px; }
.monitor-channel .knob { width: 100%; grid-row: span 2; grid-template-rows: subgrid; gap: normal; --knob-color: #68d8ed; }
/* Reclaim the SVG's empty space above/below the arc without shrinking the dial. */
.monitor-channel .knob-dial { width: 112px; height: 112px; max-width: 100%; margin-block: -8px -16px; overflow: visible; }
.monitor-channel .knob-arc-bg { stroke: #10161c; stroke-width: 3; }
.monitor-channel .knob-arc { stroke-width: 3; filter: drop-shadow(0 0 1.5px #47bfd477); }
.monitor-channel .knob-body { fill: #303b46; stroke: #697986; stroke-width: 0.8; filter: drop-shadow(0 1.2px 1px #0009); }
.monitor-channel .knob-pointer { stroke: #a2f3ff; stroke-width: 2.8; filter: drop-shadow(0 0 1.5px #53d8f5) drop-shadow(0 0 3.5px #37b9dd99); }
.monitor-channel .knob.is-zero .knob-pointer { stroke: #6d8390; filter: none; }
.monitor-channel .knob-readout { display: grid; place-items: center; min-width: 78px; min-height: 26px; padding: 2px 7px; border: 1px solid #394650; border-radius: 5px; background: #151d24; color: #b8eff8; font-size: 13px; cursor: text; }
.monitor-channel .knob.is-zero .knob-readout { color: var(--muted); }
/* Keep editing the value from enlarging the readout or the whole rack. */
.monitor-channel .knob-input { width: 72px; height: 20px; min-height: 20px; font-size: 13px; }
.monitor-note { margin-top: 4px; font-size: 10px; text-align: center; }
#monitorUnavailable { flex: 1; align-content: center; min-height: 130px; text-align: center; }
.rack-actions { display: flex; gap: 8px; padding: 10px 12px 0; }
.rack-actions button { flex: 1; }

/* ----- Status bar ----- */

.statusbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 28px;
  padding: 4px 16px;
  border-top: 1px solid var(--line);
  background: #15181c;
  color: var(--ink-2);
  font-size: 12px;
}
#operationStatus { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statusbar-hint { margin-left: auto; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar-version { color: #59636e; font-family: var(--mono); font-size: 11px; }
.statusbar-tools { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-shrink: 0; }
.language-control { position: relative; }
.language-button {
  min-height: 28px;
  gap: 7px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(#252d34, #1b2127);
  color: var(--ink-2);
  font-size: 11px;
}
.language-button .globe-icon { width: 18px; height: 18px; stroke-width: 1.5; color: var(--accent); transition: transform var(--motion-panel) var(--motion-ease); }
.language-button[aria-expanded="true"] .globe-icon { transform: rotate(15deg); }
.language-button:hover, .language-button[aria-expanded="true"] { border-color: var(--accent-2); color: var(--ink); }
.language-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 160px;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: linear-gradient(#262d35, #1b2026);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--motion-fast) var(--motion-ease), transform var(--motion-panel) var(--motion-ease),
    display var(--motion-panel) allow-discrete;
}
.language-menu:not([hidden]) { opacity: 1; transform: none; }
.language-menu[hidden] { pointer-events: none; }
@starting-style {
  .language-menu:not([hidden]) { opacity: 0; transform: translateY(8px); }
}
.language-menu-title { display: block; padding: 5px 8px 8px; color: var(--muted); font-size: 10px; letter-spacing: 0.05em; }
.language-menu button { width: 100%; min-height: 34px; justify-content: flex-start; padding: 0 8px; border-color: transparent; background: transparent; }
.language-menu button small { color: var(--muted); font-size: 11px; }
.language-menu button:hover, .language-menu button:focus-visible { background: #303a44; }
.language-menu button[aria-checked="true"] { color: var(--accent); background: rgba(63, 193, 214, 0.08); }
.language-check { width: 14px; height: 14px; margin-left: auto; visibility: hidden; }
.language-menu button[aria-checked="true"] .language-check { visibility: visible; }

/* ----- Overlays (PEQ / THD) ----- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--topbar-h) + 14px) 16px 16px;
  overflow: auto;
  background: rgba(5, 7, 9, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--motion-fast) var(--motion-ease), display var(--motion-panel) allow-discrete;
}
.overlay:not([hidden]) { opacity: 1; }
.overlay[hidden] { pointer-events: none; }
.overlay-window {
  display: flex;
  flex-direction: column;
  width: min(1240px, 100%);
  min-width: 0;
  border: 1px solid #47505b;
  border-radius: 10px;
  background: linear-gradient(#22272d, #1b1f24);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  outline: none;
  transform: translateY(12px);
  transition: transform var(--motion-panel) var(--motion-ease);
}
.overlay:not([hidden]) .overlay-window { transform: none; }
@starting-style {
  .overlay:not([hidden]) { opacity: 0; }
  .overlay:not([hidden]) .overlay-window { transform: translateY(12px); }
}
.thd-window { width: min(1080px, 100%); }

/* Match the gap below the top bar to the viewport's bottom edge, not the
   underlying language/status bar. Only the graph takes the spare height. */
#peqOverlay { --peq-gap: 14px; padding-block: calc(var(--topbar-h) + var(--peq-gap)) var(--peq-gap); }
.peq-window { min-height: calc(100dvh / var(--ui-scale) - var(--topbar-h) - 2 * var(--peq-gap)); }
.peq-window > :not(.peq-body) { flex-shrink: 0; }
.peq-body { flex: 1; display: flex; flex-direction: column; }
.peq-body > .graph-box { flex: 1; min-height: 190px; }
.peq-controls { flex-shrink: 0; }

.overlay-titlebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.overlay-title { display: grid; line-height: 1.15; margin-right: auto; min-width: 0; }
.overlay-title h2 { margin: 0; font-size: 17px; }
.overlay-kicker { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; }
.peq-kicker { color: var(--peq); }
.thd-kicker { color: var(--thd); }
.overlay-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Status text in the overlay title bar matches the LINK/toggle chips beside it. */
.overlay-tools .chip { min-height: 0; padding: 4px 8px 5px; font-weight: 800; letter-spacing: 0.08em; }

.channel-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.channel-tabs button { min-width: 58px; font-weight: 800; color: var(--ink-2); }
.channel-tabs button.is-active { border-color: var(--peq); color: #ffd28c; background: linear-gradient(#3b342a, #2a2620); }
.thd-window .channel-tabs button.is-active { border-color: var(--thd); color: #dcc8ff; background: linear-gradient(#352e44, #262230); }
.tab-divider { width: 1px; height: 22px; margin: 0 6px; background: var(--line-2); }

.overlay-body { padding: 12px 14px; min-width: 0; }
.overlay-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.footer-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.footer-group select { width: auto; }
.footer-progress { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.graph-box { position: relative; min-width: 0; }
.graph-box canvas { display: block; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #101317; }
#responseCanvas { position: absolute; inset: 0; height: 100%; cursor: crosshair; touch-action: none; }
#responseCanvas.is-over-node { cursor: grab; }
#responseCanvas.is-over-axis-x { cursor: ew-resize; }
#responseCanvas.is-over-axis-y { cursor: ns-resize; }
#responseCanvas.is-dragging, #responseCanvas.is-panning { cursor: grabbing; }
#responseCanvas.response-danger { border-color: rgba(239, 83, 80, 0.75); }
/* Borderless status text, on the same visual line as the graph legend. */
.graph-badge {
  position: absolute;
  top: 23px;
  right: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(6, 8, 10, 0.9);
  pointer-events: none;
}
.graph-badge.is-live { color: #8ff0b2; }
/* THD's label sits above its plot frame, so nudge it up to the same line. */
.thd-window .graph-badge { top: 12px; right: 28px; }
.response-warning {
  position: absolute;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border: 1px solid rgba(239, 83, 80, 0.7);
  border-radius: 999px;
  background: rgba(60, 16, 16, 0.92);
  color: #ffb3b0;
  font-weight: 700;
  font-size: 12px;
  pointer-events: none;
}

.peq-controls { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; margin-top: 12px; align-items: start; }

.band-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(64px, 1fr));
  gap: 6px;
  min-width: 0;
  min-height: 0;
  /* The editor alone sets this row's height; the strips fill it, not vice versa. */
  contain: size;
  align-self: stretch;
  overflow-x: auto;
}
.band-grid.is-locked { opacity: 0.6; }
.band-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 64px;
  min-height: 0;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(var(--strip-2), var(--strip));
  cursor: pointer;
  outline: none;
}
.band-strip:focus-visible { border-color: var(--accent); }
.band-strip.active { border-color: var(--peq); box-shadow: inset 0 0 0 1px rgba(242, 169, 59, 0.35); }
.band-strip.bypassed .band-type, .band-strip.bypassed .freq-label { color: #6c7682; }
.band-number { font-weight: 800; font-size: 13px; }
.band-type { color: var(--peq); font-size: 10px; font-weight: 800; letter-spacing: 0.06em; }
.freq-label { font-size: 11px; font-variant-numeric: tabular-nums; }
.q-readout, .gain-readout {
  min-width: 46px;
  padding: 1px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink-2);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  cursor: text;
}
.q-readout:hover, .gain-readout:hover { border-color: var(--line-2); }
.gain-readout { color: var(--ink); font-weight: 700; }
.band-strip.is-editing-gain .gain-readout { display: none; }
.q-readout[contenteditable="true"] { border-color: var(--accent); background: #101317; outline: none; }
.gain-inline-input { width: 56px; min-height: 22px; height: 22px; padding: 0 4px; font-size: 11px; text-align: center; }
.band-strip > :not(.band-fader) { flex-shrink: 0; }
.band-fader { width: 58px; height: auto; min-height: 0; flex: 1; }
.band-fader .fader-cap { width: 28px; }

.band-editor { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #181b20; }
.band-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.band-editor-head h3 { margin: 0; font-size: 13px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.editor-field { display: grid; gap: 3px; min-width: 0; }
.editor-field span { color: var(--muted); font-size: 11px; }
.editor-wide { grid-column: 1 / -1; }
.field-disabled span { opacity: 0.5; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.editor-actions button { flex: 1; }

/* Share the existing footer for actions; curve names live inside the plot. */
.peq-footer { gap: 8px 12px; font-size: 12px; }
.peq-footer button { padding-left: 8px; padding-right: 8px; }
.autoeq-toolbar { margin-left: auto; padding-left: 12px; border-left: 1px solid var(--line-2); }
.autoeq-toolbar > strong { color: var(--peq); font-size: 12px; }
.autoeq-panel { padding: 8px 14px; border-top: 1px solid var(--line); background: #181c21; min-width: 0; }
.autoeq-views { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.autoeq-align, .autoeq-views label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; }
.autoeq-align input { width: 64px; }
.autoeq-alignment-controls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#curveAlignMode { min-width: 92px; }
#curveAlignMode[aria-pressed="true"] { border-color: var(--peq); color: #ffd28c; background: linear-gradient(#3b342a, #2a2620); }
.autoeq-files {
  position: absolute;
  /* drawResponse's 44/28 px plot margins + 1 px border + 8 px inner inset. */
  left: 53px;
  bottom: 37px;
  max-width: calc(100% - 77px);
  display: grid;
  gap: 3px;
  font: 600 11px/1.4 "Segoe UI", "Microsoft YaHei", sans-serif;
  text-shadow: 0 1px 2px rgba(6, 8, 10, 0.9);
  pointer-events: none;
}
.autoeq-files span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.autoeq-files span::before { content: "■ "; }
.autoeq-target { color: #d396ef; }
.autoeq-dut { color: #91a6b8; }
.autoeq-eq { color: #f2a93b; }
.autoeq-corrected { color: #69df95; }
.autoeq-metrics { color: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.autoeq-status { color: var(--accent); font-size: 11px; overflow-wrap: anywhere; }
.autoeq-status.is-error { color: var(--danger); }

/* THD overlay */
.thd-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; }
#thdCanvas { height: clamp(240px, 38vh, 380px); }
.thd-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.thd-summary-item {
  display: grid;
  gap: 1px;
  min-width: 96px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #181b20;
}
.thd-summary-item > span { color: var(--muted); font-size: 10px; }
.thd-summary-item strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.thd-reference-control { display: flex; align-items: center; gap: 4px; }
.thd-reference-control input { width: 72px; min-height: 24px; height: 24px; }
.thd-reference-control small { color: var(--muted); }
.thd-editor { display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #181b20; min-width: 0; }
.thd-bits-field { display: grid; grid-template-columns: auto 90px; align-items: center; justify-content: start; gap: 10px; }
.thd-bits-field span { color: var(--ink-2); font-weight: 700; }
.thd-terms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.thd-term {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(var(--strip-2), var(--strip));
  min-width: 0;
}
.thd-term > strong { font-size: 14px; color: var(--thd); }
.thd-term > span:not(.thd-ratio-readout) { color: var(--muted); font-size: 10px; }
.thd-fader { width: 84px; height: clamp(170px, 30vh, 260px); --fill-color: var(--thd); }
.thd-fader .fader-scale { grid-column: 1; }
.thd-fader { grid-template-columns: 36px 1fr; }
.thd-term input { height: 26px; min-height: 26px; text-align: center; padding: 0 2px 1px; }
.thd-ratio-readout { color: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.thd-harmonic-readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; color: var(--muted); font-size: 12px; }
.thd-harmonic-readouts strong { color: var(--ink); font-variant-numeric: tabular-nums; }
#thdOverlay.is-locked .thd-terms { opacity: 0.6; }

/* ----- Responsive ----- */

@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; --motion-panel: 0ms; --motion-switch: 0ms; }
}

/* Breakpoints are viewport px; with the 115% root zoom each is the old value x 1.15. */
@media (max-width: 1610px) {
  .console { grid-template-columns: repeat(2, minmax(0, max-content)); }
  .rack { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
}

@media (max-width: 1265px) {
  .console { grid-template-columns: minmax(0, 1fr); }
  .rack { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
  .bus-body { justify-content: flex-start; }
  .peq-controls { grid-template-columns: minmax(0, 1fr); }
  .band-grid { contain: none; }
  .band-fader { height: 135px; flex: none; }
  .thd-body { grid-template-columns: minmax(0, 1fr); }
}

@media (max-height: 1012px) { :root { --fader-h: 200px; } }
@media (max-height: 874px) { :root { --fader-h: 170px; } }

@media (max-width: 830px) {
  .topbar { gap: 8px 10px; padding: 8px 10px; }
  .brand { width: 100%; }
  .topbar-status .chip { font-size: 11px; }
  .topbar-connection { flex-wrap: wrap; }
  .console { padding: 10px 8px; }
  .overlay { padding: calc(var(--topbar-h) + 8px) 6px 8px; }
  #peqOverlay { --peq-gap: 8px; }
  .overlay-titlebar, .overlay-body, .overlay-footer { padding-left: 10px; padding-right: 10px; }
  .statusbar-hint { display: none; }
  .statusbar-version { display: none; }
  .thd-terms { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .thd-fader { width: 72px; grid-template-columns: 30px 1fr; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
}
