/* =========================================================
   NOVA — DJ Player
   Design tokens
   ========================================================= */
:root {
  --bg: #05060a;
  --bg-2: #0a0c13;
  --panel: rgba(18, 21, 31, 0.72);
  --panel-solid: #12151f;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #eef1f7;
  --text-dim: #9aa3b5;
  --text-faint: #7d8698;
  --a: #37e6ff;
  --a-soft: rgba(55, 230, 255, 0.16);
  --b: #ff3ea5;
  --b-soft: rgba(255, 62, 165, 0.16);
  --warn: #ffd166;
  --rec: #ff4d5e;
  --ok: #4ade80;
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", monospace;
  --sans: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9), 0 2px 0 rgba(255, 255, 255, 0.04) inset;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- ambient background ---------- */
.bg-grid,
.bg-horizon,
.bg-scan { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.bg-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
}

.bg-horizon {
  background:
    radial-gradient(60% 40% at 18% 0%, rgba(55, 230, 255, 0.16), transparent 70%),
    radial-gradient(55% 38% at 82% 4%, rgba(255, 62, 165, 0.14), transparent 70%),
    radial-gradient(80% 50% at 50% 110%, rgba(90, 70, 255, 0.14), transparent 70%);
  filter: blur(6px);
}

.bg-scan {
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px);
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* ---------- a11y helpers ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--a);
  color: #04121a;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--a);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  position: relative;
  z-index: 5;
  margin: 24px;
  padding: 16px 20px;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: rgba(255, 209, 102, 0.08);
}

/* =========================================================
   Top bar
   ========================================================= */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 34px) 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 6, 10, 0.86), rgba(5, 6, 10, 0.35));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark { color: var(--a); display: grid; place-items: center; filter: drop-shadow(0 0 12px rgba(55, 230, 255, 0.45)); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__text strong {
  font-size: 19px;
  letter-spacing: 0.32em;
  font-weight: 700;
}
.brand__text small {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__status { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar__actions { display: flex; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.chip i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}
.chip[data-state="running"] { color: var(--ok); border-color: rgba(74, 222, 128, 0.35); }
.chip[data-state="running"] i { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.chip[data-state="suspended"] { color: var(--warn); border-color: rgba(255, 209, 102, 0.3); }
.chip[data-state="suspended"] i { background: var(--warn); }
.chip--ghost { color: var(--text-dim); }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-fg: var(--text);
  --btn-line: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--btn-line);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.12s var(--ease), color 0.18s var(--ease);
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn--rec { --btn-line: rgba(255, 77, 94, 0.4); --btn-bg: rgba(255, 77, 94, 0.1); color: #ffd7db; }
.btn--rec:hover { background: rgba(255, 77, 94, 0.18); }
.btn--rec[aria-pressed="true"] { background: var(--rec); color: #fff; border-color: var(--rec); animation: recpulse 1.6s infinite; }
.btn--sm { min-height: 30px; padding: 0 12px; font-size: 12px; }

@keyframes recpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 77, 94, 0); }
}

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* =========================================================
   Library
   ========================================================= */
.onboard {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 clamp(16px, 3vw, 34px) 4px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 14px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.onboard[hidden] { display: none; }
.onboard__text { margin: 0; font-size: 13px; color: var(--text-dim); flex: 1 1 240px; }
.onboard__text strong { color: var(--text); }
.btn--onboard {
  --btn-bg: color-mix(in srgb, var(--accent) 22%, transparent);
  --btn-line: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--text);
  font-weight: 650;
  flex: 0 0 auto;
}
.btn--onboard:hover { background: color-mix(in srgb, var(--accent) 32%, transparent); }

.library {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.library__label {
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.library__tracks {
  display: flex;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.library__tracks > * { scroll-snap-align: start; }
.library__add { flex: 0 0 auto; cursor: pointer; }
.library__hint {
  margin: 0 0 0 auto;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex: 0 0 auto;
}

.track-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.12s var(--ease);
}
.track-chip:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.06); transform: translateY(-1px); }
.track-chip__bpm {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--a);
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--a-soft);
}
.track-chip__name { font-weight: 600; }
.track-chip__tag { font-size: 10.5px; color: var(--text-dim); }

/* =========================================================
   App grid
   ========================================================= */
.app {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px minmax(0, 1fr);
  gap: clamp(12px, 1.6vw, 22px);
  padding: clamp(14px, 2vw, 26px) clamp(14px, 3vw, 34px) 10px;
  align-items: start;
}

.deck-slot { min-width: 0; }

/* =========================================================
   Deck
   ========================================================= */
.deck {
  --accent: var(--a);
  --accent-soft: var(--a-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 26%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.deck[data-deck="b"] { --accent: var(--b); --accent-soft: var(--b-soft); }
.deck.is-playing { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.deck.is-dragover { border-color: var(--accent); background-color: color-mix(in srgb, var(--accent) 10%, var(--panel-solid)); }
.deck.is-empty .deck__body { opacity: 0.55; }

.deck__head { display: flex; align-items: center; gap: 10px; }
.deck__tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #04121a;
  background: var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
}
.deck__title-wrap { min-width: 0; flex: 1; }
.deck__title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deck__sub {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.deck__load { flex: 0 0 auto; }

/* platter + waveform row */
.deck__stage {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.platter {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #1b1f2b 0 18%, #0d1017 19% 100%);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.35), 0 10px 26px -14px #000;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.platter__disc {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 50%, #161a24, #0a0c12);
  animation: spin 2.4s linear infinite;
  animation-play-state: paused;
}
.deck.is-playing .platter__disc { animation-play-state: running; }
.platter__label {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 40%, #000));
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: #04121a;
  letter-spacing: 0.08em;
  box-shadow: 0 0 18px -4px var(--accent);
}
.platter__label::after {
  content: "";
  position: absolute;
  width: 6px; height: 6px; border-radius: 50%;
  background: #05060a;
}
@keyframes spin { to { transform: rotate(360deg); } }

.wave-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.wave {
  position: relative;
  width: 100%;
  height: 108px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}
.wave canvas { display: block; width: 100%; height: 100%; }
.wave__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  pointer-events: none;
}
.wave__empty strong { color: var(--text); display: block; font-size: 12.5px; margin-bottom: 2px; }
.wave__empty[hidden] { display: none; }

.timebar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.timebar__pos { font-size: 19px; font-weight: 600; letter-spacing: 0.02em; }
.timebar__rem { font-size: 11.5px; color: var(--text-dim); }
.timebar__bpm {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.timebar__bpm b { font-size: 16px; color: var(--accent); font-weight: 650; }
.timebar__beat {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  align-self: center;
  transition: background 0.06s linear, box-shadow 0.06s linear;
}
.timebar__beat.is-on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* transport */
.transport { display: flex; gap: 8px; }
.transport .btn { flex: 1 1 0; min-width: 0; min-height: 44px; }
.transport .btn--jump { flex: 0 0 40px; min-width: 40px; font-size: 20px; line-height: 1; color: var(--text-dim); }
.transport .btn--jump:hover { color: var(--text); }
.btn--play {
  --btn-bg: color-mix(in srgb, var(--accent) 16%, transparent);
  --btn-line: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.btn--play:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.btn--play[aria-pressed="true"] {
  background: var(--accent);
  color: #04121a;
  border-color: var(--accent);
  box-shadow: 0 0 24px -6px var(--accent);
}
.btn--cue { --btn-line: var(--line-strong); }
.btn--sync {
  flex: 0 0 auto !important;
  min-width: 62px;
}
.btn--sync[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
}

/* knobs row */
.knobs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 12px 6px 6px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.knob-unit { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.knob-unit__label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.knob {
  --knob-size: 46px;
  position: relative;
  width: var(--knob-size);
  height: var(--knob-size);
  border-radius: 50%;
  cursor: ns-resize;
  touch-action: none;
  background: radial-gradient(circle at 38% 30%, #2a3040, #12151d 70%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 6px 14px -8px #000, inset 0 1px 0 rgba(255, 255, 255, 0.09);
  display: grid;
  place-items: center;
  transition: border-color 0.18s var(--ease);
}
.knob:hover { border-color: var(--accent); }
.knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.knob__arc { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); pointer-events: none; }
.knob__arc-track { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 2.5; stroke-linecap: round; }
.knob__arc-fill { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; transition: stroke-dashoffset 0.06s linear; }
.knob__pointer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 36%;
  background: var(--accent);
  border-radius: 2px;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(var(--rot, 0deg));
  box-shadow: 0 0 8px var(--accent);
  transition: transform 0.06s linear;
}
.knob__value {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-height: 12px;
}
.knob.is-center .knob__value { color: var(--text-faint); }

/* faders (tempo) */
.tempo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px;
}
.tempo__label { font-size: 10px; letter-spacing: 0.14em; color: var(--text-dim); }
.tempo__readout {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  min-width: 52px;
  font-variant-numeric: tabular-nums;
}
.tempo__range { flex: 1; }

/* range base */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.1));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #e9edf5;
  border: 2px solid #05060a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 2px 8px -2px #000;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #e9edf5;
  border: 2px solid #05060a;
}

/* hot cues + loop */
.pads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pad {
  position: relative;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.pad:hover { border-color: var(--line-strong); color: var(--text); }
.pad.has-cue {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--accent-soft);
}
.pad.is-hit { animation: padhit 0.28s var(--ease); }
.pad__num { position: absolute; top: 4px; left: 7px; font-size: 9.5px; color: var(--text-dim); }
.pad__time { font-size: 10px; letter-spacing: 0.02em; }
@keyframes padhit { 0% { transform: scale(0.94); } 100% { transform: scale(1); } }

.loopbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}
.loopbar__btn {
  min-height: 34px;
  padding: 0 12px;
}
.loopbar__btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
}
.loopbar__len {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.seg button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.seg button:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* =========================================================
   Mixer
   ========================================================= */
.mixer {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.mixer__head { display: flex; align-items: center; justify-content: space-between; }
.mixer__title { font-size: 10.5px; letter-spacing: 0.26em; color: var(--text-dim); }
.mixer__live {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  color: var(--text-dim);
}
.mixer__live i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.mixer__live.is-live { color: var(--ok); }
.mixer__live.is-live i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.mixer__live.is-rec { color: var(--rec); }
.mixer__live.is-rec i { background: var(--rec); box-shadow: 0 0 8px var(--rec); animation: recpulse 1.2s infinite; }

.mixer__meter { display: flex; align-items: center; gap: 14px; }
.meter { display: flex; gap: 8px; align-items: stretch; height: 84px; }
.meter__scale {
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--mono); font-size: 9px; color: var(--text-dim);
}
.meter__scale i { font-style: normal; }
.meter__bars { display: flex; gap: 4px; }
.meter__bar {
  position: relative;
  width: 9px;
  height: 100%;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.meter__bar i {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0%;
  border-radius: 4px;
  background: linear-gradient(0deg, var(--ok) 0%, var(--ok) 62%, var(--warn) 82%, var(--rec) 100%);
  transition: height 0.08s linear;
}
.mixer__readout { display: flex; flex-direction: column; gap: 2px; }
.readout__label { font-size: 9.5px; letter-spacing: 0.2em; color: var(--text-dim); }
.readout__value { font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }

.crossfader { display: flex; flex-direction: column; gap: 4px; }
.crossfader__labels {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; color: var(--text-dim);
}
input.fader--h { height: 34px; }
.fader--h::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(90deg, var(--a) 0%, rgba(255,255,255,0.14) 50%, var(--b) 100%);
  opacity: 0.85;
}
.fader--h::-webkit-slider-thumb {
  width: 22px; height: 26px; margin-top: -9px; border-radius: 6px;
  background: linear-gradient(180deg, #f2f5fb, #b9c1d1);
  border: 1px solid #05060a;
}
.fader--h::-moz-range-track {
  height: 8px;
  background: linear-gradient(90deg, var(--a), rgba(255,255,255,0.14), var(--b));
}

.harmonic {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}
.harmonic__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.harmonic__label { font-size: 9.5px; letter-spacing: 0.2em; color: var(--text-dim); }
.harmonic__verdict { font-size: 11px; color: var(--text-dim); text-align: right; }
.harmonic__verdict[data-tone="good"] { color: var(--ok); }
.harmonic__verdict[data-tone="ok"] { color: var(--warn); }
.harmonic__verdict[data-tone="clash"] { color: var(--rec); }
.harmonic__keys { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; }
.harmonic__key { padding: 2px 8px; border-radius: 5px; background: rgba(255,255,255,0.05); }
.harmonic__key--a { color: var(--a); }
.harmonic__key--b { color: var(--b); }
.harmonic__link { color: var(--text-faint); font-size: 11px; }
.harmonic__bar { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.harmonic__bar i { display: block; height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, var(--rec), var(--warn), var(--ok)); transition: width 0.35s var(--ease); }

.mixer__bottom { display: flex; gap: 16px; align-items: flex-start; }
.fader-unit { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fader-unit__label { font-size: 9.5px; letter-spacing: 0.16em; color: var(--text-dim); }
.fader-stack { display: flex; justify-content: center; height: 130px; }
.fader-unit__value { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); }

input.fader--v {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 34px;
  height: 130px;
  padding: 0;
}
.fader--v::-webkit-slider-runnable-track {
  width: 8px; height: 100%;
  background: linear-gradient(0deg, rgba(255,255,255,0.1), rgba(255,255,255,0.24));
}
.fader--v::-webkit-slider-thumb {
  width: 26px; height: 18px; margin-left: -9px; border-radius: 5px;
  background: linear-gradient(180deg, #f2f5fb, #b9c1d1);
  border: 1px solid #05060a;
}
.fader--v::-moz-range-track { width: 8px; background: rgba(255,255,255,0.16); }

.rec { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rec__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.rec__time { font-family: var(--mono); font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.rec__save { font-size: 12px; text-decoration: none; }
.rec__hint { margin: 0; font-size: 11px; color: var(--text-dim); line-height: 1.45; }

/* =========================================================
   Footer
   ========================================================= */
.footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 14px clamp(16px, 3vw, 34px) 26px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.footer__keys { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.footer__keys span { font-size: 11px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 5px; }
.footer__note { margin: 0 0 0 auto; font-size: 11px; color: var(--text-dim); max-width: 52ch; line-height: 1.5; }
kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
}

/* =========================================================
   Modal
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: min(560px, calc(100vw - 32px));
  max-height: min(84vh, 720px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #0b0e15;
  color: var(--text);
  box-shadow: 0 40px 90px -30px #000;
  overflow: hidden;
}
.modal::backdrop { background: rgba(2, 3, 6, 0.72); backdrop-filter: blur(6px); }
.modal__inner { display: flex; flex-direction: column; max-height: inherit; }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 { margin: 0; font-size: 16px; letter-spacing: 0.02em; }
.modal__body { padding: 18px 20px 24px; overflow-y: auto; }
.modal__body h3 { font-size: 12px; letter-spacing: 0.16em; color: var(--text-dim); margin: 22px 0 10px; text-transform: uppercase; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--text-dim); }
.steps strong { color: var(--text); }
.keys { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.keys th { text-align: left; font-weight: 500; padding: 7px 12px 7px 0; white-space: nowrap; vertical-align: top; }
.keys td { padding: 7px 0; color: var(--text-dim); }
.keys tr + tr { border-top: 1px solid var(--line); }
.notes { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-dim); display: flex; flex-direction: column; gap: 8px; }

/* =========================================================
   Toast
   ========================================================= */
.midi__status { font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px; }
.midi__status[data-ok="true"] { color: var(--ok); }
.midi__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.midi__hint { font-size: 12px; line-height: 1.7; color: var(--text-dim); margin-bottom: 14px; }
.midi__list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.midi__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.03); font-size: 12.5px; }
.midi__row.is-learning { background: rgba(255,62,165,0.12); outline: 1px solid var(--rec); }
.midi__row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.midi__row-map { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.midi__row .btn { flex: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(14, 17, 25, 0.94);
  color: var(--text);
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
  max-width: min(90vw, 460px);
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { border-color: rgba(255, 77, 94, 0.6); color: #ffd7db; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .library__hint { display: none; }
  .app { grid-template-columns: minmax(0, 1fr) 260px minmax(0, 1fr); }
  .deck__stage { grid-template-columns: 88px minmax(0, 1fr); }
  .platter { width: 88px; height: 88px; }
  .wave { height: 92px; }
  .platter__label { width: 38px; height: 38px; font-size: 8px; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .deck-slot { order: 1; }
  .mixer { position: static; order: 2; }
  #deck-b { order: 3; }
  .mixer__bottom { align-items: center; }
  .library__hint { display: none; }
}

@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding-bottom: 12px; }
  .brand__text small { display: none; }
  .topbar__status { order: 3; margin-left: 0; width: 100%; }
  .topbar__actions { margin-left: auto; }
  .deck { padding: 12px; gap: 12px; }
  .deck__stage { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  .platter { width: 72px; height: 72px; }
  .platter__label { width: 32px; height: 32px; font-size: 7px; }
  .wave { height: 78px; }
  .knobs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding-inline: 0; }
  .knob { --knob-size: 40px; }
  .timebar__pos { font-size: 16px; }
  .transport .btn { min-height: 46px; font-size: 12px; }
  .transport .btn--jump { display: none; }
  .btn { min-height: 44px; }
  .btn--sm { min-height: 44px; }
  .track-chip { min-height: 44px; }
  .seg button { min-height: 44px; min-width: 40px; padding: 0 12px; }
  input[type="range"] { height: 44px; }
  input.fader--v { width: 44px; }
  .tempo__range { height: 44px; }
  .loopbar__btn { min-height: 44px; }
  .pad { min-height: 46px; }
  .icon-btn { width: 44px; height: 44px; }
  .knob { --knob-size: 44px; }
  .footer__note { margin-left: 0; }
}

/* =========================================================
   Motion preferences
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .platter__disc { animation: none !important; }
  .bg-scan { display: none; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(255,255,255,0.24); --text-dim: #c3cad8; --text-faint: #98a1b2; }
}

@media print { .bg-grid, .bg-horizon, .bg-scan { display: none; } }
