:root {
  --bg: #05070c;
  --panel: #10151f;
  --panel-2: #161c28;
  --line: #232c40;
  --text: #eaf2ff;
  --muted: #7f90ad;
  --accent: #00e07a;
  --accent-2: #ff9b21;
  --danger: #ff3b5c;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(120% 90% at 50% 0%, #0b1018 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
  /* The page is an app shell: exactly one window tall, and it never scrolls
     itself - the rig is scaled to fit (src/ui/fit.js), so there is nothing to
     scroll to and nothing to drag. */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  /* clip, not hidden: overflow:hidden is still a scroll container and the page
     can be scrolled programmatically (a phone drag found 43px of it), while clip
     is not scrollable at all. */
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
}

/* The rig is drawn at its own size and then scaled down; its layout box is
   wider than any phone, so the scrolling element is told to clip as well -
   otherwise the page itself would carry an overflow of a few thousand pixels
   and the instrument could be dragged around like a document. */
html {
  height: 100%;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
}

/* ---------------------------------------------------------------- header */
/* Meta only: what the rig is, which part of it the screen frames, what the engine is
   doing, and the help sheet. Three columns: the wordmark left, the view switch
   centred over the mixer, the status and HELP right; every control in it is one
   height and one type style so the band reads as one strip, not a row of badges.
   The first click or key press anywhere still wakes the rig (wake() in
   src/ui/app.js). */
.app-header {
  /* Above the stage: a zoomed rig is drawn larger than the screen, and the header must
     stay on top of it and keep taking clicks. */
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0d121b, #080b11);
}

.wordmark {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.wordmark span {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.1em;
}

/* The view switch: one segmented control. The highlight is one thumb that slides
   under the chosen button (markView in src/ui/app.js moves it), rather than each
   button lighting on its own, so the four read as a single control. */
.view-switch {
  position: relative;
  display: flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.view-switch button,
.meta-btn {
  position: relative;
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 700 10px/24px "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.14em;
  white-space: nowrap;
  cursor: pointer;
}

.view-switch button:hover,
.meta-btn:hover {
  color: var(--text);
}

.view-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 0;
  border-radius: 5px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px #1d5a3c;
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.22, 0.8, 0.3, 1), width 260ms cubic-bezier(0.22, 0.8, 0.3, 1), opacity 160ms;
  pointer-events: none;
}

/* Placed without a glide the first time, so the page does not open with a slide. */
.view-thumb.still {
  transition: none;
}

.view-switch button {
  z-index: 1;
  transition: color 160ms;
}

.view-switch button[aria-pressed="true"] {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .view-thumb {
    transition: none;
  }
}

.view-switch button:focus-visible,
.meta-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.status-line {
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-btn {
  flex: none;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--panel);
}

.meta-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* A narrow window (a tablet held upright) keeps the view switch, where a rig drawn
   this small needs it most, and drops the subtitle and the status text. Phones never
   reach this band: upright they turn sideways and on their side the header floats
   (below), both without the switch. */
@media (max-width: 760px) {
  .wordmark span,
  .status-line {
    display: none;
  }
}

.file-input {
  display: none;
}

/* Blinking. Every element with .blink follows one of two phases the frame loop puts on
   it (src/ui/app.js `blinkClock`): .blink-fast-dim through the dim half of a 600 ms
   blink, .blink-slow-dim through the dim half of a 900 ms one. A CSS animation per
   element makes the browser recalculate style on every frame for as long as anything
   blinks, which a paused deck always does, and a phase set on the root re-checks the
   style of the whole face at every flip; a class on the few blinking elements changes
   only them, a few times a second. Every lamp on the rig blinks together, as a unit's
   lamps do.

   CALL/DELETE puts the pads that hold something into call-up mode, where they blink
   until one is pressed (manual p.60): dim in the first half of the 900 ms cycle. The
   face keys (.hw) have their own blink below. */
.btn.blink:not(.hw):not(.blink-slow-dim) {
  opacity: 0.3;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  background: #1a2231;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  user-select: none;
  transition: background 90ms linear, border-color 90ms linear;
}

.btn:active {
  background: #24304a;
}

.btn.on {
  border-color: var(--led, var(--accent));
  background: #16281f;
  box-shadow: 0 0 12px -2px var(--led, var(--accent));
}

.btn-hint {
  font-size: 9px;
  color: var(--muted);
}

.btn-small {
  padding: 7px 9px;
  font-size: 11px;
}

.btn-tiny {
  padding: 5px 7px;
  font-size: 10px;
}

.btn-wide,
.btn.wide {
  width: 100%;
  padding: 14px 12px;
  font-size: 13px;
}

/* ------------------------------------------------------------------ knobs */

.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}

.knob-dial {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #2a3448, #131a26);
  border: 1px solid var(--line);
  position: relative;
  cursor: ns-resize;
}

.knob-big .knob-dial {
  width: 62px;
  height: 62px;
}

.knob-pointer {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  background: var(--accent);
  border-radius: 2px;
  transform-origin: 50% 16px;
}

.knob-big .knob-pointer {
  height: 22px;
  transform-origin: 50% 27px;
}

.knob-value {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 10px;
}

/* Buttons never wrap their labels: the hardware's legends are one line, and a
   wrapped legend reads as two controls. Long text scales down instead. */
.btn .btn-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.btn-tiny .btn-label {
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------- help */

/* The help sheet lies over the whole rig as a dimmed layer with one panel in it: it is
   meta, and it must never take room from the instruments while it is closed. The panel
   scrolls on its own, so the sheet works at any size. */
.help {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(3, 5, 9, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}

.help.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 160ms ease;
}

.help-panel {
  width: min(880px, 100%);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0e16;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  padding: 14px 20px 20px;
  color: var(--muted);
  scrollbar-width: thin;
  scrollbar-color: #26314a transparent;
}

.help-head {
  position: sticky;
  top: -14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -14px -20px 8px;
  padding: 12px 20px 8px;
  background: #0a0e16;
}

.help-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
  margin: 12px 0 8px;
}

.help-head .help-title {
  margin: 0;
  font-size: 13px;
}

.help-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: #b8c3d6;
}

.help-steps li {
  margin-bottom: 6px;
}

.help-steps b {
  color: var(--text);
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px 18px;
  font-size: 12px;
}

.help-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.help-key {
  flex: none;
  background: #1a2231;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
  font-size: 11px;
}

/* On a turned phone the sheet turns with the rig: it takes the screen's long side as
   its width and is laid on its side about the screen's centre, like the header. */
body.sideways .help {
  inset: auto;
  left: 50%;
  top: 50%;
  width: var(--sideways-length, 844px);
  height: var(--sideways-short, 390px);
  transform: translate(-50%, -50%) rotate(90deg);
}

/* The header and the keyboard sheet turn with the rig. */
body.sideways .app-header {
  width: var(--sideways-length, 844px);
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
}

/* The header lies along the turned page's top edge, which under rotate(90deg)
   is the screen's RIGHT edge: turning the phone counter-clockwise reads it
   upright, and the turned page's top is the screen's right. A fixed 54px band,
   paired with the stage's calc(100vw - 54px) band + 27px shift beside it. */
/* Chrome, not instrument: on a phone the header floats along the turned top
   edge instead of taking a band off the rig, so the player can use the whole
   screen. It is translucent because it lies over the rig's own edge. */
body.sideways .app-header {
  height: auto;
  width: auto;
  padding: 4px 12px;
  gap: 10px;
  transform: translate(-50%, -50%) rotate(90deg) translateY(calc(-50vw + 17px));
  background: rgba(8, 11, 17, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 5;
}


/* ======================================================== the rig on the screen
   One row of furniture — a player, the mixer, the other player — drawn at its own
   size and placed by src/ui/fit.js with one transform: fitted to the screen, turned
   a quarter on a phone held upright, and pinched closer on demand. The stage is
   fixed so it contributes no scrollable overflow: nothing on the page scrolls. */
.stage {
  /* The rig takes every gesture itself — a pinch zooms the rig, not the page
     (src/ui/fit.js) — so the browser is told to do nothing with touches on it. */
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  align-items: flex-end;
  gap: 30px;
  padding: 30px;
  width: max-content;
  transform-origin: 0 0;
  touch-action: none;
  overflow: visible;
}

.stage.zoomed {
  cursor: grab;
}

/* While a pinch, a drag or a trackpad zoom moves the rig (src/ui/fit.js): scale the
   picture already drawn rather than repaint the rig at every step. */
.stage.pinching {
  will-change: transform;
}

/* A view change from the header's switch glides; a pinch or a drag never does
   (src/ui/fit.js turns this on only for showView). */
.stage.gliding {
  transition: transform 320ms cubic-bezier(0.22, 0.8, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
  .stage.gliding {
    transition: none;
  }
}

/* ============================================================ a player's face
   The CDJ-3000 as the reference photograph shows it from above
   (references/cdj-3000-top.webp). DeckPanel places every part in the photograph's
   own 1090x1500 pixels, and the face is drawn at that size: the rig's millimetre
   scale is set by the mixer beside it, and only the stage's one transform
   (src/ui/fit.js) shrinks the rig to the screen. The face is never shrunk with CSS
   zoom, because WebKit clamps zoomed-down text to its minimum font size, which
   swells every legend on an iPhone until it runs into the keys. */
.deck {
  --metal: #16171a;
  position: relative;
  flex: none;
  width: 1090px;
  height: 1500px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: #d9dbdf;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.deck > * {
  position: absolute;
}

/* The metal: black anodised aluminium, brushed top to bottom. */
:is(.deck, .mixer) .chassis {
  border-radius: 14px 14px 6px 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #1c1d20, #121315 60%, #0f1012);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px #2a2c30, 0 18px 40px rgba(0, 0, 0, 0.6);
}

.deck .chassis-lip {
  border-radius: 0 0 10px 10px;
  background: linear-gradient(180deg, #2b2c30, #1a1b1e);
}

/* The display housing stands up from the plate: glossy black, lighter on its top face. */
.deck .housing {
  border-radius: 12px 12px 4px 4px;
  background:
    linear-gradient(180deg, #2a2b2f 0, #1c1d20 22px, #111214 100px, #0a0a0b 100%);
  box-shadow: inset 0 0 0 1px #34363b, 0 10px 24px rgba(0, 0, 0, 0.55);
}

.deck.focused .chassis {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px #2a2c30, 0 0 0 3px rgba(47, 155, 255, 0.55), 0 18px 40px rgba(0, 0, 0, 0.6);
}

.deck.drag-over .chassis {
  box-shadow: inset 0 0 0 4px #2f9bff;
}

/* ---------------------------------------------------------------- silk */
:is(.deck, .mixer) .silk {
  transform: translate(-50%, -50%);
  white-space: pre;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #cfd1d5;
  pointer-events: none;
}

:is(.deck, .mixer) .silk.small { font-size: 12px; }
:is(.deck, .mixer) .silk.tiny { font-size: 10px; }
:is(.deck, .mixer) .silk.micro { font-size: 8px; }
:is(.deck, .mixer) .silk.label { font-size: 14px; }
:is(.deck, .mixer) .silk.label.narrow { font-size: 12px; }
:is(.deck, .mixer) .silk.boxed { padding: 0 3px; border: 1px solid #cfd1d5; border-radius: 3px; }
:is(.deck, .mixer) .silk.chip {
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #cfd1d5;
  color: #141517;
}
:is(.deck, .mixer) .silk.rekordbox { font-size: 24px; font-weight: 500; color: #9a9da3; letter-spacing: 0; }
:is(.deck, .mixer) .silk.formats { font-size: 17px; font-style: italic; font-weight: 700; color: #b5b8bd; }
:is(.deck, .mixer) .silk.logo { font-size: 50px; font-style: italic; font-weight: 800; letter-spacing: -0.02em; color: #d6d8dc; }
:is(.deck, .mixer) .silk.model { font-size: 25px; font-weight: 800; color: #e3e5e8; }
:is(.deck, .mixer) .silk.model-small { font-size: 13px; font-weight: 600; }
:is(.deck, .mixer) .silk.lever-legend { font-size: 14px; }
:is(.deck, .mixer) .silk.lever-legend.rev { color: #ff4a4a; }

:is(.deck, .mixer) .silk-rule { background: #b9bcc1; pointer-events: none; }
:is(.deck, .mixer) .silk-dash { background: #cfd1d5; }
:is(.deck, .mixer) .tempo-scale {
  background: repeating-linear-gradient(180deg, #cfd1d5 0 2px, transparent 2px 7px);
}

/* Small glyphs the metal prints: the laptop over USB STOP, the SD card, power, and
   the TOUCH/BRAKE curves. */
.deck .glyph-laptop { border: 2px solid #cfd1d5; border-bottom-width: 4px; border-radius: 2px 2px 0 0; }
.deck .glyph-sd { border: 2px solid #cfd1d5; border-radius: 2px 5px 2px 2px; }
.deck .glyph-power { border: 2px solid #cfd1d5; border-top-color: transparent; border-radius: 50%; }
.deck .glyph-touch { border-left: 2px solid #cfd1d5; border-bottom: 2px solid #cfd1d5; border-top: 2px solid #cfd1d5; width: 10px; }
.deck .glyph-brake { border-top: 2px solid #cfd1d5; transform: skewX(40deg); border-right: 2px solid #cfd1d5; }

/* Frames the metal draws round a group of keys. */
.deck .key-frame,
.deck .lever-frame,
.deck .search-pill,
.deck .selector-pad {
  border-radius: 10px;
  background: #0c0c0e;
  box-shadow: inset 0 0 0 2px #2e3035, inset 0 2px 6px rgba(0, 0, 0, 0.8);
}

.deck .search-pill { border-radius: 30px; }
.deck .selector-pad {
  border-radius: 26px;
  background: linear-gradient(180deg, #2c2d31, #1b1c1f);
  box-shadow: inset 0 0 0 1px #3a3c41, 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------------------- keys
   Every key resets the app's generic button and is drawn as the unit's own. */
:is(.deck, .mixer) .hw {
  all: unset;
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre;
  cursor: pointer;
  touch-action: none;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  line-height: 1.05;
  color: #e6e7ea;
}

:is(.deck, .mixer) .hw .btn-hint { display: none; }

:is(.deck, .mixer) .hw .btn-label {
  display: block;
  overflow: visible;
  white-space: pre;
  text-overflow: clip;
  max-width: none;
  font: inherit;
  letter-spacing: inherit;
  pointer-events: none;
}

:is(.deck, .mixer) .hw.blink.blink-fast-dim:not(.big-key) { filter: brightness(0.35); }

/* Rubber keys: the screen keys, the cluster keys, BEAT SYNC and the rest. */
:is(.deck, .mixer) .hw.screen-key,
:is(.deck, .mixer) .hw.pad-key,
:is(.deck, .mixer) .hw.red-key,
:is(.deck, .mixer) .hw.jump-key,
:is(.deck, .mixer) .hw.call-key,
:is(.deck, .mixer) .hw.cue-pad {
  border-radius: 5px;
  background: linear-gradient(180deg, #33353a, #232428 55%, #1b1c1f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px #0a0a0b, 0 2px 3px rgba(0, 0, 0, 0.7);
}

:is(.deck, .mixer) .hw:active { filter: brightness(1.25); }

:is(.deck, .mixer) .hw.screen-key { font-size: 14px; letter-spacing: 0.02em; }
:is(.deck, .mixer) .hw.screen-key.blue { color: #3aa6ff; }
:is(.deck, .mixer) .hw.screen-key.on { box-shadow: inset 0 0 0 1px #3aa6ff, 0 0 12px rgba(58, 166, 255, 0.55); color: #ffffff; }

:is(.deck, .mixer) .hw.pad-key { font-size: 10px; color: #d4d6da; }
:is(.deck, .mixer) .hw.pad-key.tight { font-size: 7.5px; letter-spacing: -0.02em; }
:is(.deck, .mixer) .hw.pad-key.on { color: #ffffff; box-shadow: inset 0 0 0 1px #d4d6da, 0 0 10px rgba(255, 255, 255, 0.3); }
:is(.deck, .mixer) .hw.sync-key.on { color: #3aa6ff; box-shadow: inset 0 0 0 1px #3aa6ff, 0 0 12px rgba(58, 166, 255, 0.6); }
:is(.deck, .mixer) .hw.master-key { color: #f5a623; }
:is(.deck, .mixer) .hw.master-key.on { color: #ffc15a; box-shadow: inset 0 0 0 1px #f5a623, 0 0 12px rgba(245, 166, 35, 0.65); }
:is(.deck, .mixer) .hw.key-sync { color: #3aa6ff; }
:is(.deck, .mixer) .hw.key-sync.on { box-shadow: inset 0 0 0 1px #3aa6ff, 0 0 12px rgba(58, 166, 255, 0.6); }

/* SLIP and QUANTIZE: red legends, lit red. */
:is(.deck, .mixer) .hw.red-key { font-size: 9px; letter-spacing: -0.02em; color: #ff4a4a; background: linear-gradient(180deg, #3a1c1e, #2a1416); }
:is(.deck, .mixer) .hw.red-key.on { color: #ffd6d6; background: linear-gradient(180deg, #d63a3a, #9e2424); box-shadow: 0 0 14px rgba(255, 60, 60, 0.7); }

:is(.deck, .mixer) .hw.jump-key { font-size: 22px; }

/* CALL/DELETE: a square key with the brushed insert. */
:is(.deck, .mixer) .hw.call-key::after {
  content: "";
  width: 30px;
  height: 22px;
  border-radius: 3px;
  background: conic-gradient(from 200deg, #6d7076, #e3e5e8, #7a7d83, #cfd2d6, #6d7076);
}
:is(.deck, .mixer) .hw.call-key.on { box-shadow: inset 0 0 0 2px #ff4a4a, 0 0 12px rgba(255, 74, 74, 0.6); }

/* Hot cue pads: the letter in the pad's colour and a bar under it, the whole pad
   lit in the light the model gives it. */
:is(.deck, .mixer) .hw.cue-pad {
  justify-content: flex-start;
  align-items: flex-start;
  padding: 7px 0 0 20px;
  font-size: 14px;
  color: var(--pad);
}
:is(.deck, .mixer) .hw.cue-pad::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 9px;
  height: 4px;
  border-radius: 2px;
  background: var(--pad);
  opacity: 0.9;
}
:is(.deck, .mixer) .hw.cue-pad.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--led) 70%, #fff 10%), color-mix(in srgb, var(--led) 55%, #000));
  color: #0a0a0b;
  box-shadow: 0 0 16px color-mix(in srgb, var(--led) 70%, transparent);
}

/* Round keys. */
:is(.deck, .mixer) .hw.metal-round,
:is(.deck, .mixer) .hw.metal-search,
:is(.deck, .mixer) .hw.call-round,
:is(.deck, .mixer) .hw.beat-loop,
:is(.deck, .mixer) .hw.loop-cap,
:is(.deck, .mixer) .hw.reloop,
:is(.deck, .mixer) .hw.big-key {
  border-radius: 50%;
}

:is(.deck, .mixer) .hw.metal-round {
  background: conic-gradient(from 210deg, #55585e, #d9dbdf, #6d7076, #c7cacf, #55585e);
  box-shadow: 0 0 0 4px #0b0b0c, 0 0 0 5px #34363b, 0 3px 6px rgba(0, 0, 0, 0.8);
}
:is(.deck, .mixer) .hw.metal-round.lamp-red::after {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: #4a1515;
}
:is(.deck, .mixer) .hw.metal-round.lamp-red.on::after { background: #ff3030; box-shadow: 0 0 10px #ff3030; }
:is(.deck, .mixer) .hw.metal-round.on:not(.lamp-red) { box-shadow: 0 0 0 4px #0b0b0c, 0 0 0 5px #34363b, 0 0 14px rgba(255, 255, 255, 0.5); }

:is(.deck, .mixer) .hw.metal-search {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.12em;
  color: #f5a623;
  background: conic-gradient(from 210deg, #5c5f65, #e5e7ea, #72757b, #d4d7db, #5c5f65);
  box-shadow: 0 0 0 3px #0b0b0c, 0 3px 6px rgba(0, 0, 0, 0.8);
}

:is(.deck, .mixer) .hw.call-round {
  font-size: 13px;
  color: #f5a623;
  background: radial-gradient(circle at 40% 35%, #4a4c51, #1c1d20 70%);
  box-shadow: 0 0 0 3px #0b0b0c, 0 0 0 4px #34363b;
}

:is(.deck, .mixer) .hw.beat-loop {
  font-size: 22px;
  font-weight: 500;
  color: #f5a623;
  background: radial-gradient(circle at 45% 35%, #3a3c41, #16171a 70%);
  box-shadow: 0 0 0 4px #0b0b0c, 0 0 0 5px #34363b;
}
:is(.deck, .mixer) .hw.beat-loop.on { color: #ffd18a; box-shadow: 0 0 0 4px #0b0b0c, 0 0 0 5px #f5a623, 0 0 14px rgba(245, 166, 35, 0.7); }

/* IN/CUE and OUT: amber caps in a black bezel, bright while a loop is set. */
:is(.deck, .mixer) .hw.loop-cap {
  background: #0b0b0c;
  box-shadow: inset 0 0 0 2px #34363b;
}
:is(.deck, .mixer) .hw.loop-cap::after {
  content: "";
  width: 76%;
  height: 76%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #d99a3a, #9a6414 75%);
}
:is(.deck, .mixer) .hw.loop-cap.on::after {
  background: radial-gradient(circle at 42% 36%, #ffe08a, #ffae1f 55%, #e08a00);
  box-shadow: 0 0 16px rgba(255, 174, 31, 0.8);
}

/* RELOOP/EXIT: a black key with an amber dot. */
:is(.deck, .mixer) .hw.reloop {
  background: radial-gradient(circle, #1c1d20 0 60%, #0b0b0c 62%);
  box-shadow: inset 0 0 0 2px #34363b;
}
:is(.deck, .mixer) .hw.reloop::after {
  content: "";
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: #7a4c0c;
}
:is(.deck, .mixer) .hw.reloop.on::after { background: #ffae1f; box-shadow: 0 0 10px #ffae1f; }

/* CUE and PLAY/PAUSE: brushed discs in their coloured rings. */
:is(.deck, .mixer) .hw.big-key {
  font-size: 22px;
  font-weight: 700;
  color: #4b4e54;
  background:
    radial-gradient(circle closest-side, transparent 0 76%, #0b0b0c 77% 81%, var(--ring) 82% 100%),
    conic-gradient(from 200deg, #6d7076, #eceef0, #85888e, #dcdfe2, #6d7076, #e5e7ea, #6d7076);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}
:is(.deck, .mixer) .hw.cue-key { --ring: #6e4a12; }
:is(.deck, .mixer) .hw.play-key { --ring: #145c2a; font-size: 20px; }
:is(.deck, .mixer) .hw.cue-key.on { --ring: #ffa91f; box-shadow: 0 0 22px rgba(255, 169, 31, 0.55); }
:is(.deck, .mixer) .hw.play-key.on { --ring: #2ee05a; box-shadow: 0 0 22px rgba(46, 224, 90, 0.55); }
:is(.deck, .mixer) .hw.big-key.blink.blink-slow-dim { --ring: #1b1c1f; box-shadow: none; }

/* The media slots: the USB port lit in the device colour, the SD slot's bar. */
/* The player's USB port (references/cdj-3000-top.webp): a square well framed by the
   indicator, which lights in the device colour, and the USB-A receptacle standing in
   it, seen from above — a metal shell and, inside, the contact tongue filling the
   shell's top half. */
:is(.deck, .mixer) .hw.usb-port {
  border-radius: 5px;
  background: radial-gradient(120% 90% at 50% 20%, #1c1d21, #08080a 70%);
  box-shadow: inset 0 0 0 4px #1d2b3d, inset 0 0 0 6px #050506, 0 0 0 2px #2a2c30;
}
:is(.deck, .mixer) .hw.usb-port.on {
  box-shadow: inset 0 0 0 4px var(--led, #2f9bff), inset 0 0 0 6px #050506, 0 0 0 2px #2a2c30, 0 0 14px var(--led, #2f9bff);
}
:is(.deck, .mixer) .hw.usb-port:hover .usb-socket { border-color: #d7dade; }
.deck .usb-socket {
  position: relative;
  width: 36px;
  height: 14px;
  margin-top: 18px;
  border: 2px solid #9a9ea5;
  border-radius: 1px;
  background: #050506;
  box-shadow: 0 0 0 1px #000, 0 3px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.deck .usb-socket::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 1px;
  height: 5px;
  background: linear-gradient(180deg, #3b3d42, #26282c);
}
/* The USB trident under 5V ⎓ 1A. */
.deck .glyph-usb {
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 22' fill='none' stroke='%23cfd1d5' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 11h33M12 11l6-7h7M17 11l5 6h6'/%3E%3Ccircle cx='3' cy='11' r='2.6' fill='%23cfd1d5' stroke='none'/%3E%3Cpath d='M36 11l-5-3v6z' fill='%23cfd1d5'/%3E%3Ccircle cx='26' cy='4' r='2.2' fill='%23cfd1d5' stroke='none'/%3E%3Crect x='27' y='15' width='4' height='4' fill='%23cfd1d5' stroke='none'/%3E%3C/svg%3E");
}

:is(.deck, .mixer) .hw.sd-slot {
  border-radius: 6px;
  background: linear-gradient(180deg, #2a2b2f, #151618);
  box-shadow: inset 0 0 0 2px #3a3c41, 0 2px 4px rgba(0, 0, 0, 0.7);
}
:is(.deck, .mixer) .hw.sd-slot::after {
  content: "";
  position: absolute;
  left: 23px;
  right: 23px;
  bottom: 8px;
  height: 5px;
  border-radius: 2px;
  background: #1c5c9a;
}
:is(.deck, .mixer) .hw.sd-slot:hover::after { background: #3aa6ff; box-shadow: 0 0 10px #3aa6ff; }

/* The SOURCE indicator above the screen keys. */
.deck .source-lamp { border-radius: 3px; background: #1a2230; }
.deck .source-lamp.lit { background: var(--led, #2f9bff); box-shadow: 0 0 12px var(--led, #2f9bff); }
.deck .source-lamp.blink.blink-slow-dim { filter: brightness(0.35); }

/* The VINYL/CDJ indicator. */
.deck .jog-mode-lamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}
.deck .jog-mode-lamp .vinyl { color: #28405a; }
.deck .jog-mode-lamp .cdj { color: #e6f25a; }
.deck .jog-mode-lamp.vinyl-on .vinyl { color: #3aa6ff; text-shadow: 0 0 8px #3aa6ff; }
.deck .jog-mode-lamp.vinyl-on .cdj { color: #4a4f24; }

/* The DIRECTION lever: the handle stands at the model's position and lights red
   while the deck plays backwards; the legends are where it is pushed to. */
.deck .lever-handle {
  border-radius: 3px;
  background: linear-gradient(180deg, #4a4c51, #2a2b2f 50%, #1c1d20);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: top 80ms linear;
}
.deck .lever-handle.lit { box-shadow: inset 0 0 0 2px #ff4a4a, 0 0 12px rgba(255, 74, 74, 0.7); }
.deck .lever-handle.blink.blink-fast-dim { filter: brightness(0.35); }
:is(.deck, .mixer) .hw.lever-zone { background: transparent; }

/* The screen, its bezel line and the typed field over its foot. */
.deck .display-canvas {
  border-radius: 2px;
  background: #000;
  box-shadow: 0 0 0 6px #050506, 0 0 0 7px #26282c;
  touch-action: none;
}

.deck .load-label {
  font-size: 12px;
  text-align: center;
  color: #6d727b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.deck .screen-field {
  display: none;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid #2f9bff;
  border-radius: 4px;
  background: #0b0d12;
  color: #ffffff;
  font: 600 14px "Helvetica Neue", Arial, sans-serif;
  outline: none;
}
.deck .screen-field.shown { display: block; }

/* The jog, and the REV and FWD arrows printed beside it. */
.deck .jog-canvas {
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
}
.deck .jog-arc {
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}
.deck .jog-arc.rev { border-left-color: #cfd1d5; transform: rotate(-30deg); }
.deck .jog-arc.fwd { border-right-color: #cfd1d5; transform: rotate(30deg); }

/* The two feel knobs and the rotary selector: knurled metal with a white index. */
:is(.deck, .mixer) .face-knob .knob-label,
:is(.deck, .mixer) .face-knob .knob-value,
.deck .rotary .rotary-label,
.deck .rotary .rotary-value {
  display: none;
}

:is(.deck, .mixer) .face-knob .knob-dial {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #3d3f44, #8c8f95, #3d3f44, #6f7278, #3d3f44, #8c8f95, #3d3f44);
  box-shadow: 0 0 0 3px #0b0b0c, 0 3px 6px rgba(0, 0, 0, 0.8);
  cursor: ns-resize;
  touch-action: none;
}
:is(.deck, .mixer) .face-knob .knob-pointer {
  top: 3px;
  height: 20px;
  width: 4px;
  margin-left: -2px;
  background: #ffffff;
  transform-origin: 50% 21px;
}

.deck .rotary .rotary-dial {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  border: none;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, transparent 0 60%, #f2f3f5 61% 68%, transparent 69%),
    radial-gradient(circle closest-side at 45% 40%, #8a8d93, #3a3c41 45%, #16171a 75%, #0b0b0c 100%);
  box-shadow: 0 0 0 6px #111214, 0 0 0 7px #3a3c41, 0 4px 10px rgba(0, 0, 0, 0.8);
}
.deck .rotary .rotary-pointer {
  top: 22%;
  height: 12%;
  width: 3px;
  margin-left: -1.5px;
  background: #cfd1d5;
  transform-origin: 50% 235%;
}

/* The TEMPO slider: a long frame with its scale, the slot, and the cap with a white
   index line. */
.deck .tempo-slider {
  border-radius: 8px;
  background: #0d0e10;
  box-shadow: inset 0 0 0 2px #2e3035;
  cursor: ns-resize;
  touch-action: none;
}
.tempo-slider .slider-slot {
  position: absolute;
  left: 50%;
  top: 34px;
  bottom: 44px;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: #000;
}
.tempo-slider .slider-tick {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  background: linear-gradient(90deg, #8a8d93 0 40%, transparent 40% 60%, #8a8d93 60%);
  pointer-events: none;
}
.tempo-slider .slider-tick.long { left: 8px; right: 8px; background: linear-gradient(90deg, #cfd1d5 0 42%, transparent 42% 58%, #cfd1d5 58%); }
.tempo-slider .slider-cap {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 46px;
  margin-top: -23px;
  border-radius: 4px;
  background: linear-gradient(180deg, #3a3c41, #1c1d20 45%, #26282c 55%, #151618);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  pointer-events: none;
}
.tempo-slider .slider-cap::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: #f2f3f5;
}
.tempo-slider .slider-legend {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #cfd1d5;
  pointer-events: none;
}

.deck .tempo-reset-lamp { border-radius: 2px; background: #2c3510; }
.deck .tempo-reset-lamp.lit { background: #c6f23a; box-shadow: 0 0 10px #c6f23a; }

/* ------------------------------------------------ the header on a small screen
   A phone gives the rig every pixel it has. On a phone on its side (short and
   touch-driven) and on a turned phone the header stops being a band and floats small
   over the gap the decks' display housings leave above the mixer, carrying only the
   HELP button; src/ui/fit.js reads a fixed header as taking no height. A short
   desktop window has a mouse and keeps the whole header: `pointer: coarse` is what
   tells a phone from a laptop window dragged short. */
@media (max-height: 500px) and (pointer: coarse) {
  .app-header {
    position: fixed;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    height: auto;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 11, 17, 0.72);
  }

  .app-header .wordmark,
  .app-header .view-switch,
  .app-header .status-line {
    display: none;
  }
}

body.sideways .app-header .wordmark,
body.sideways .app-header .view-switch,
body.sideways .app-header .status-line {
  display: none;
}

body.sideways .app-header {
  display: flex;
  height: auto;
  padding: 3px;
  transform: translate(-50%, -50%) rotate(90deg) translateY(calc(-50vw + 14px));
}

/* ============================================================== the mixer's face
   The DJM-A9 as the reference photograph shows it from above
   (references/djm-a9-top.webp). MixerPanel places every part in the photograph's own
   1200x1248 pixels and sets the zoom that brings the face to the players' scale. */
.mixer {
  position: relative;
  flex: none;
  width: 1200px;
  height: 1248px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: #d9dbdf;
  user-select: none;
  -webkit-user-select: none;
  --mixer-display: 1;
  --mixer-indicator: 1;
}

.mixer > * {
  position: absolute;
}

.mixer .chassis {
  border-radius: 10px;
}

.mixer .silk.tiny { font-size: 9px; }
.mixer .silk.micro { font-size: 7.5px; }
.mixer .silk.small { font-size: 11px; }
.mixer .silk.label { font-size: 13px; }
.mixer .silk.head { font-size: 19px; font-weight: 500; letter-spacing: 0.02em; }
.mixer .silk.channel-no { font-size: 34px; font-weight: 400; }
.mixer .silk.logo { font-size: 36px; }
.mixer .silk.model { font-size: 25px; }
.mixer .silk.magvel { font-size: 15px; font-weight: 800; letter-spacing: 0.08em; }
.mixer .silk.boxed-bg { background: #141517; padding: 0 6px; }

/* Media slots, jacks and the screen's frame: fixtures, not controls. */
.mixer .usb-slot {
  border-radius: 6px;
  background: linear-gradient(180deg, #2a2b2f, #151618);
  box-shadow: inset 0 0 0 2px #3a3c41, 0 2px 4px rgba(0, 0, 0, 0.7);
}
.mixer .usb-slot::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 4px;
  border-radius: 2px;
  background: #2f7dff;
  box-shadow: 0 0 8px #2f7dff;
}
.mixer .usb-slot.small::after { display: none; }
.mixer .jack {
  border-radius: 50%;
  background: radial-gradient(circle, #000 0 38%, #2a2b2f 40% 62%, #111 64%);
  box-shadow: 0 0 0 2px #3a3c41;
}
.mixer .jack.mini { background: radial-gradient(circle, #000 0 36%, #c9a24a 38% 70%, #111 72%); }
.mixer .screen-bezel {
  border-radius: 8px;
  background: #0a0a0b;
  box-shadow: inset 0 0 0 2px #2e3035;
}
.mixer .fx-canvas { border-radius: 2px; background: #000; touch-action: none; }
.mixer .beat-frame {
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px #3a3c41;
}

/* The X-PAD: a touch strip with its printed marks. */
.mixer .x-pad {
  border-radius: 4px;
  background:
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(255, 255, 255, 0.18) 44px 46px),
    linear-gradient(180deg, #2c2e33, #16171a);
  box-shadow: inset 0 0 0 2px #3a3c41, inset 0 -6px 0 #505257;
  touch-action: none;
  cursor: ew-resize;
}

/* Level indicators: one column of segments per meter. */
.mixer .face-meter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
}
.mixer .meter-cell {
  flex: 1;
  border-radius: 1px;
  background: #1b2a1d;
}
.mixer .meter-cell.orange { background: #3a2a12; }
.mixer .meter-cell.red { background: #3a1414; }
.mixer .meter-cell.lit.green { background: #3cff5a; box-shadow: 0 0 6px rgba(60, 255, 90, 0.6); }
.mixer .meter-cell.lit.orange { background: #ffb020; box-shadow: 0 0 6px rgba(255, 176, 32, 0.6); }
.mixer .meter-cell.lit.red { background: #ff3030; box-shadow: 0 0 6px rgba(255, 48, 48, 0.7); }

/* Small indicator lamps. */
.mixer .fx-lamp { border-radius: 3px; background: #10264a; }
.mixer .fx-lamp.lit { background: #2f9bff; box-shadow: 0 0 8px #2f9bff; }
.mixer .fx-lamp.blink.blink-fast-dim { filter: brightness(0.35); }
.mixer .clip-lamp {
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 13px;
  color: #6a2020;
  background: #1c0c0c;
}
.mixer .clip-lamp.lit { color: #fff; background: #ff2a2a; box-shadow: 0 0 10px #ff2a2a; }
.mixer .center-lamp { border-radius: 3px; box-shadow: inset 0 0 0 2px #cfd1d5; }
.mixer .center-lamp.lit { background: #cfd1d5; }

/* ---------------------------------------------------------------- keys */
.mixer .hw.lit-key,
.mixer .hw.cue-key,
.mixer .hw.amber-key,
.mixer .hw.rubber-key {
  border-radius: 5px;
  font-size: 10px;
  background: linear-gradient(180deg, #2c2e33, #1a1b1e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1px #0a0a0b, 0 2px 3px rgba(0, 0, 0, 0.7);
}
.mixer .hw.lit-key.blue { color: #3a8dff; box-shadow: inset 0 0 0 2px #1f4fb0, 0 2px 3px rgba(0, 0, 0, 0.7); }
.mixer .hw.lit-key.blue.on { color: #ffffff; background: linear-gradient(180deg, #2f7dff, #1d56d8); box-shadow: 0 0 12px rgba(47, 125, 255, 0.8); }
.mixer .hw.lit-key.white { color: #e6e7ea; box-shadow: inset 0 0 0 2px #9fa3ab, 0 2px 3px rgba(0, 0, 0, 0.7); }
.mixer .hw.lit-key.white.on { color: #101114; background: #e6e8ec; box-shadow: 0 0 12px rgba(255, 255, 255, 0.6); }
.mixer .hw.lit-key.red { color: #ff5a5a; box-shadow: inset 0 0 0 2px #8a1c1c, 0 2px 3px rgba(0, 0, 0, 0.7); }
.mixer .hw.lit-key.red.on { color: #ffffff; background: linear-gradient(180deg, #e03a3a, #a82020); box-shadow: 0 0 12px rgba(255, 60, 60, 0.7); }
.mixer .hw.cue-key { font-size: 14px; color: #2a1a05; background: linear-gradient(180deg, #b87a2a, #8a5716); }
.mixer .hw.cue-key.outline { font-size: 11px; color: #f5a623; background: #1a1b1e; box-shadow: inset 0 0 0 3px #b87a2a; }
.mixer .hw.cue-key.on { color: #1a1005; background: linear-gradient(180deg, #ffb347, #f59a1a); box-shadow: 0 0 12px rgba(255, 170, 60, 0.75); }
.mixer .hw.cue-key.outline.on { color: #1a1005; }
.mixer .hw.amber-key { font-size: 11px; color: #d99a2a; }
.mixer .hw.amber-key.on { color: #1a1005; background: linear-gradient(180deg, #ffb347, #f59a1a); box-shadow: 0 0 12px rgba(255, 170, 60, 0.7); }
.mixer .hw.rubber-key { font-size: 16px; }

.mixer .hw.round-lamp {
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, #3a3c41, #16171a 70%);
  box-shadow: 0 0 0 3px #0b0b0c, 0 0 0 4px #3a3c41;
}
.mixer .hw.round-lamp::after {
  content: "";
  width: 36%;
  height: 36%;
  border-radius: 50%;
  background: var(--lamp-off, #3a1414);
}
.mixer .hw.round-lamp.blue { --lamp-off: #10264a; --lamp-on: #2f7dff; }
.mixer .hw.round-lamp.red { --lamp-off: #3a1414; --lamp-on: #ff3030; }
.mixer .hw.round-lamp.on::after { background: var(--lamp-on); box-shadow: 0 0 10px var(--lamp-on); }

.mixer .hw.ring-key {
  border-radius: 50%;
  font-size: 13px;
  color: #3a8dff;
  background: #111214;
  box-shadow: inset 0 0 0 3px #1f4fb0;
}
.mixer .hw.ring-key.on { color: #fff; box-shadow: inset 0 0 0 3px #2f7dff, 0 0 14px rgba(47, 125, 255, 0.8); }

.mixer .hw.tap-key {
  border-radius: 50%;
  font-size: 15px;
  color: #2ee05a;
  background: radial-gradient(circle, #1b1c1f 0 64%, #2ee05a 66% 74%, #0b0b0c 76%);
  box-shadow: 0 0 0 4px #2a2c30, 0 3px 6px rgba(0, 0, 0, 0.8);
}
.mixer .hw.tap-key.on { box-shadow: 0 0 0 4px #2a2c30, 0 0 16px rgba(46, 224, 90, 0.7); }

.mixer .hw.fx-on {
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #6c8cff, #3a55d8 60%, #1b2a6a);
  box-shadow: 0 0 0 5px #1b1c1f, 0 0 0 6px #3a3c41;
  filter: brightness(0.55);
}
.mixer .hw.fx-on.on { filter: none; box-shadow: 0 0 0 5px #1b1c1f, 0 0 22px rgba(108, 140, 255, 0.9); }

/* Slide switches: the handle stands at the position the model holds. */
.mixer .hw.slide-switch {
  border-radius: 4px;
  background: #0b0b0c;
  box-shadow: inset 0 0 0 2px #3a3c41;
}
.mixer .hw.slide-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 34%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6d7076, #d9dbdf 50%, #6d7076);
  left: 3px;
  transition: left 80ms linear, top 80ms linear;
}
.mixer .hw.slide-switch[data-position="1"]::after { left: calc(100% - 34% - 3px); }
.mixer .hw.slide-switch.three[data-position="1"]::after { left: 33%; }
.mixer .hw.slide-switch.three[data-position="2"]::after { left: calc(100% - 34% - 3px); }
.mixer .hw.slide-switch.vertical::after { left: 3px; right: 3px; width: auto; top: 3px; bottom: auto; height: 40%; }
.mixer .hw.slide-switch.vertical[data-position="1"]::after { top: calc(100% - 40% - 3px); left: 3px; }

/* Knobs: dark knurled caps with a white index, the EQ caps in their white ring,
   the big COLOR caps, and the endless TIME knob. */
.mixer .face-knob .knob-label,
.mixer .face-knob .knob-value { display: none; }
.mixer .face-knob .knob-dial {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 38%, #55585e, #26282c 55%, #121315);
  box-shadow: 0 0 0 2px #0b0b0c, 0 3px 6px rgba(0, 0, 0, 0.8);
  cursor: ns-resize;
  touch-action: none;
}
.mixer .face-knob .knob-pointer {
  top: 6%;
  height: 40%;
  width: 4px;
  margin-left: -2px;
  background: #ffffff;
  transform-origin: 50% 110%;
}
.mixer .face-knob.knob-ring .knob-dial { box-shadow: 0 0 0 3px #cfd1d5, 0 0 0 5px #0b0b0c, 0 3px 6px rgba(0, 0, 0, 0.8); }
.mixer .face-knob.knob-color .knob-dial {
  background: conic-gradient(from 0deg, #2a2b2f, #6d7076, #2a2b2f, #55585e, #2a2b2f, #6d7076, #2a2b2f);
  box-shadow: 0 0 0 4px #cfd1d5, 0 0 0 7px #0b0b0c, 0 4px 8px rgba(0, 0, 0, 0.8);
}
.mixer .face-knob.knob-color .knob-pointer { width: 7px; margin-left: -3.5px; }
.mixer .face-knob.knob-endless .knob-pointer { display: none; }
.mixer .face-knob.knob-endless .knob-dial { background: conic-gradient(from 0deg, #1c1d20, #3a3c41, #1c1d20, #3a3c41, #1c1d20, #3a3c41, #1c1d20); }

/* Faders: the channel faders and the crossfader. */
.mixer .slider { cursor: ns-resize; touch-action: none; }
.mixer .slider .slider-slot { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 6px; margin-left: -3px; border-radius: 3px; background: #000; }
.mixer .slider .slider-cap {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 22px;
  margin-top: -11px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4a4c51, #1c1d20 45%, #26282c 55%, #151618);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.mixer .slider .slider-cap::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: #f2f3f5;
}
.mixer .channel-fader {
  background: repeating-linear-gradient(180deg, transparent 0 9px, #8a8d93 9px 11px, transparent 11px 13px) center 10px / 70% 132px no-repeat;
}
.mixer .cross-fader { cursor: ew-resize; background: repeating-linear-gradient(90deg, transparent 0 10px, #8a8d93 10px 12px) center / 100% 60% no-repeat; }
.mixer .cross-fader .slider-slot { left: 6px; right: 6px; top: 50%; bottom: auto; width: auto; height: 6px; margin: -3px 0 0 0; }
.mixer .cross-fader .slider-cap { left: auto; right: auto; top: 4px; bottom: 4px; height: auto; width: 26px; margin: 0 0 0 -13px; }
.mixer .cross-fader .slider-cap::after { left: 50%; right: auto; top: 4px; bottom: 4px; width: 3px; height: auto; margin: 0 0 0 -1.5px; }

/* The settings the panel's own presentation reads (manual p81, p84). */
.mixer.standby-dim { filter: brightness(0.55); }
.mixer.standby-off { filter: brightness(0.2); }

/* ------------------------------------------------ touch targets larger than the metal
   On a phone the whole rig is drawn at a fraction of its size, and a fader drawn true to
   the metal is a few screen pixels wide. Each fader and the X-PAD therefore reaches past
   its drawn edges with an invisible pseudo-element, so a finger landing beside the slot
   still takes the fader. The reach stops short of the neighbouring control. */
.slider::before,
.mixer .x-pad::before {
  content: "";
  position: absolute;
  inset: -8px -18px;
}
.mixer .cross-fader::before {
  inset: -18px -8px;
}

/* The diagnostics overlay (src/ui/diagnostics-hud.js): the ` key or ?debug. It sits over
   the header's corner, outside the stage, so opening it never moves or rescales the rig,
   and it is plain text so that drawing it costs next to nothing. */
.diag {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  display: none;
  max-width: min(760px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.9);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  color: var(--text);
}

.diag.open {
  display: block;
}

.diag-body {
  margin: 0;
  padding: 10px 12px 6px;
  font: 11px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.diag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 8px 8px;
}

.diag-actions .meta-btn {
  border: 1px solid var(--line);
}

/* The jog's upper two layers (DeckPanel.buildJog) let every touch through to the metal
   layer under them, and the turning layer is its own compositor layer, so turning it is
   a transform the compositor applies rather than a repaint. */
.deck .jog-layer {
  pointer-events: none;
}

.deck .jog-spin {
  will-change: transform;
}
