/* ================= Aura DJ ================= */
:root {
  --bg: #0a0c11;
  --bg2: #0e1117;
  --panel: #12151d;
  --panel2: #171b25;
  --panel3: #1d2230;
  --line: rgba(255, 255, 255, 0.06);
  --line2: rgba(255, 255, 255, 0.1);
  --text: #e9ecf4;
  --text2: #b9c0d0;
  --muted: #7d859a;
  --a: #5ee6d0;
  --b: #ffb86b;
  --accent: #b884ff;
  --good: #5ee6a8;
  --warn: #ffd166;
  --danger: #ff5d6c;
  --radius: 18px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(94, 230, 208, 0.06), transparent 60%),
    radial-gradient(1000px 600px at 90% -10%, rgba(255, 184, 107, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
input, select, textarea { user-select: text; }
button {
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible, .knob:focus-visible, .fader:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid rgba(184, 132, 255, 0.7); outline-offset: 2px;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  height: 56px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 12, 17, 0.7);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 28px; height: 28px; }
.brand-name { font-weight: 300; font-size: 20px; letter-spacing: 0.02em; direction: ltr; }
.brand-name b { font-weight: 800; margin-inline-start: 2px; background: linear-gradient(90deg, var(--a), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--text2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.rec-btn {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line2); color: var(--text2); font-weight: 500; transition: all 0.2s;
}
.rec-btn i { width: 10px; height: 10px; border-radius: 50%; background: #5a6070; transition: background 0.2s; }
.rec-btn:hover { color: var(--text); border-color: rgba(255, 93, 108, 0.5); }
.rec-btn.on { border-color: var(--danger); color: #fff; background: rgba(255, 93, 108, 0.12); }
.rec-btn.on i { background: var(--danger); animation: pulse 1s infinite; }
.rec-btn time { font-family: var(--mono); font-size: 12px; color: var(--danger); }
.rec-btn time:empty { display: none; }

/* ---------- stage ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 12px 0;
}
.deck, .mixer, .library > * {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ---------- deck ---------- */
.deck { --dc: var(--a); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative; transition: box-shadow 0.2s, border-color 0.2s; }
.deck-B { --dc: var(--b); }
.deck.drop { border-color: var(--dc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dc) 25%, transparent); }
.deck.drop .drop-hint { opacity: 1; }
.deck.playing { border-color: color-mix(in srgb, var(--dc) 22%, transparent); }

.deck-head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.deck-B .deck-head { flex-direction: row-reverse; }
.deck-B .deck-meta { text-align: right; }
.deck-letter {
  width: 36px; height: 36px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: var(--bg);
  background: var(--dc);
  box-shadow: 0 0 18px color-mix(in srgb, var(--dc) 40%, transparent);
}
.deck-meta { flex: 1; min-width: 0; direction: rtl; text-align: left; }
.deck-A .deck-meta { text-align: left; }
.deck-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.deck-artist { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.deck.empty .deck-title { color: var(--muted); font-weight: 500; }
.beat-dots { display: flex; gap: 4px; }
.beat-dots i { width: 7px; height: 7px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); transition: background 0.05s; }
.beat-dots i:first-child { width: 11px; }
.beat-dots i.on { background: var(--dc); box-shadow: 0 0 8px var(--dc); }
.deck-key {
  --k: var(--muted);
  font-family: var(--mono); font-weight: 700; font-size: 13px; min-width: 42px; text-align: center;
  padding: 5px 8px; border-radius: 9px;
  color: var(--k); background: color-mix(in srgb, var(--k) 14%, transparent); border: 1px solid color-mix(in srgb, var(--k) 30%, transparent);
}
.deck-bpm { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; min-width: 74px; }
.deck-B .deck-bpm { align-items: flex-start; }
.deck-bpm span { font-family: var(--mono); font-weight: 700; font-size: 24px; letter-spacing: -0.02em; }
.deck-bpm small { font-family: var(--mono); color: var(--muted); font-size: 10.5px; margin-top: 4px; }

.wave-zoom {
  position: relative; height: 112px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, #0b0e14, #0d1018);
  border: 1px solid var(--line);
}
.wave-zoom canvas, .wave-over canvas { display: block; width: 100%; height: 100%; }
.wave-zoom canvas { cursor: grab; }
.wave-zoom canvas.grabbing { cursor: grabbing; }
.zoom-ctl { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.deck-B .zoom-ctl { right: auto; left: 6px; }
.wave-zoom:hover .zoom-ctl { opacity: 1; }
.zoom-ctl button { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(18, 21, 29, 0.85); color: var(--text2); }
.zoom-ctl svg { width: 14px; height: 14px; }
.drop-hint {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--dc) 14%, rgba(10, 12, 17, 0.75)); color: var(--dc);
  font-weight: 600; opacity: 0; transition: opacity 0.15s; direction: rtl;
}
.wave-over { height: 38px; border-radius: 9px; overflow: hidden; background: #0c0f15; border: 1px solid var(--line); cursor: pointer; }

.deck-times { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 13px; color: var(--text2); padding: 0 2px; margin-top: -2px; }
.deck-times .pitch { color: var(--muted); font-size: 12px; }
.deck.ending [data-r="remain"] { color: var(--danger); animation: blinkText 0.8s infinite; }

.deck-body { display: flex; gap: 14px; flex: 1; min-height: 0; }
.deck-A .tempo-col { order: -1; }
.deck-controls { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.deck.empty .deck-controls, .deck.empty .tempo-col, .deck.empty .grid-tools { opacity: 0.55; }

.transport { display: flex; align-items: center; gap: 12px; }
.tbtn {
  width: 62px; height: 62px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #262c3b, #171b25);
  border: 1px solid var(--line2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.08s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}
.tbtn:active { transform: scale(0.95); }
.tbtn.cue { font-family: var(--mono); font-weight: 700; font-size: 13px; color: #ff9f43; border-color: rgba(255, 159, 67, 0.35); }
.tbtn.play { color: var(--dc); border-color: color-mix(in srgb, var(--dc) 40%, transparent); }
.tbtn.play svg { width: 26px; height: 26px; }
.deck.playing .tbtn.play { box-shadow: 0 0 22px color-mix(in srgb, var(--dc) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.06); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--dc) 22%, #262c3b), #171b25); }
.tbtn.blink { animation: btnBlink 1.1s infinite; }
.tgl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: 1; min-width: 0; }
.tgl {
  height: 28px; border-radius: 8px; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--muted); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line);
  transition: all 0.15s;
}
.tgl:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tgl.on { color: var(--dc); background: color-mix(in srgb, var(--dc) 14%, transparent); border-color: color-mix(in srgb, var(--dc) 45%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--dc) 18%, transparent); }

.sect { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 2px; direction: ltr; }
.sect span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sect em { font-style: normal; font-size: 11px; color: #5c6375; direction: rtl; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pads { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.pad {
  height: 34px; border-radius: 8px; position: relative; overflow: hidden;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line);
  font-family: var(--mono); font-weight: 700; font-size: 12px; color: var(--muted);
  transition: all 0.12s;
}
.pad::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--c); opacity: 0.45; }
.pad:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.pad.set { background: color-mix(in srgb, var(--c) 80%, #000); color: #0b0d12; border-color: transparent; box-shadow: 0 0 14px color-mix(in srgb, var(--c) 30%, transparent); }
.pad.set::after { display: none; }
.pad:active { transform: scale(0.95); }

.loops { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.loops.sub { grid-template-columns: repeat(4, 1fr) 1.6fr; }
.loops.jumps { grid-template-columns: 1fr 1fr 1.6fr 1fr 1fr; }
.loops button {
  height: 28px; border-radius: 7px; font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  color: var(--text2); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); transition: all 0.12s;
}
.loops button:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.loops button.on { color: #0b0d12; background: var(--good); border-color: transparent; box-shadow: 0 0 12px rgba(94, 230, 168, 0.3); }
.loops button.armed { color: var(--good); border-color: rgba(94, 230, 168, 0.5); }
.loops .jl { display: grid; place-items: center; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; color: #5c6375; }

.fx-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-row .knob { margin: -4px 0; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }
.seg button { height: 24px; padding: 0 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); transition: all 0.12s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel3); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.seg.dim { opacity: 0.35; pointer-events: none; }
.fx-beats button { font-family: var(--mono); padding: 0 7px; }
.fx-on { width: 44px; flex: none; }
.deck .seg button.on { color: var(--dc); }

/* tempo column */
.tempo-col { width: 58px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.seg.vseg { flex-direction: column; width: 100%; }
.seg.vseg button { padding: 0; font-family: var(--mono); font-size: 10.5px; }
.tempo-wrap { flex: 1; min-height: 150px; display: flex; justify-content: center; width: 100%; }
.nudge { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.nudge button, .reset0 {
  height: 26px; border-radius: 7px; display: grid; place-items: center; width: 100%;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); color: var(--text2);
}
.nudge button:active { background: color-mix(in srgb, var(--dc) 25%, transparent); color: var(--dc); }
.nudge svg { width: 14px; height: 14px; }
.reset0 { font-family: var(--mono); font-size: 10.5px; font-weight: 600; }

.grid-tools { display: flex; align-items: center; gap: 5px; padding-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.grid-tools .gl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; color: #5c6375; margin-inline-end: 4px; direction: rtl; }
.grid-tools button {
  height: 24px; padding: 0 8px; border-radius: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); transition: all 0.12s;
}
.grid-tools button:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.grid-tools [data-a="downbeat"] { font-family: var(--sans); }
.grid-tools .ej { margin-inline-start: auto; }

/* ---------- knobs ---------- */
.knob { --kc: var(--text); display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: ns-resize; touch-action: none; border-radius: 10px; }
.knob svg { width: 44px; height: 44px; stroke-width: 3; overflow: visible; }
.knob.small svg { width: 36px; height: 36px; }
.knob.master svg { width: 50px; height: 50px; }
.k-track { stroke: rgba(255, 255, 255, 0.09); stroke-width: 3.2; }
.k-val { stroke: var(--kc); stroke-width: 3.2; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--kc) 50%, transparent)); }
.k-cap { fill: #1c212d; stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.knob.active .k-cap, .knob:hover .k-cap { fill: #232937; }
.k-ind { stroke: #f2f4fa; stroke-width: 2.4; }
.k-label { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.knob.moved .k-label { color: var(--text2); }

/* ---------- faders ---------- */
.fader { position: relative; touch-action: none; cursor: pointer; }
.vfader { width: 38px; min-height: 120px; align-self: stretch; }
.hfader { height: 38px; width: 100%; }
.f-track { position: absolute; border-radius: 4px; background: #07090d; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--line); }
.vfader .f-track { left: 50%; top: 8px; bottom: 8px; width: 5px; transform: translateX(-50%); }
.hfader .f-track { top: 50%; left: 10px; right: 10px; height: 5px; transform: translateY(-50%); }
.f-ticks { position: absolute; pointer-events: none; }
.vfader .f-ticks { left: -12px; right: -12px; top: 0; bottom: 0; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 10%); mask: linear-gradient(90deg, #000 0 8px, transparent 8px calc(100% - 8px), #000 calc(100% - 8px)); -webkit-mask: linear-gradient(90deg, #000 0 8px, transparent 8px calc(100% - 8px), #000 calc(100% - 8px)); }
.hfader .f-ticks { top: -10px; bottom: -10px; left: 0; right: 0; background: repeating-linear-gradient(to right, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 10%); mask: linear-gradient(#000 0 6px, transparent 6px calc(100% - 6px), #000 calc(100% - 6px)); -webkit-mask: linear-gradient(#000 0 6px, transparent 6px calc(100% - 6px), #000 calc(100% - 6px)); }
.f-fill { position: absolute; border-radius: 4px; background: var(--fc, var(--text2)); opacity: 0.8; }
.vfader .f-fill { left: 0; right: 0; bottom: 0; height: calc(var(--p) * 100%); }
.hfader .f-fill { display: none; }
.f-thumb {
  position: absolute; display: grid; place-items: center;
  background: linear-gradient(180deg, #3a4153, #222836);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: grab;
}
.fader.active .f-thumb { cursor: grabbing; background: linear-gradient(180deg, #444c60, #2a3141); }
.vfader .f-thumb { left: 50%; width: 34px; height: 18px; border-radius: 6px; transform: translateX(-50%); bottom: calc(var(--p) * (100% - 18px)); }
.vfader .f-thumb i { width: 70%; height: 2px; border-radius: 2px; background: var(--fc, #fff); }
.hfader .f-thumb { top: 50%; width: 20px; height: 34px; border-radius: 6px; transform: translateY(-50%); left: calc(var(--p) * (100% - 20px)); }
.hfader .f-thumb i { width: 2px; height: 70%; border-radius: 2px; background: #fff; }
.fader.tempo { --fc: var(--dc); }
.fader.tempo .f-fill { display: none; }
.fader.tempo .f-track::after { content: ''; position: absolute; left: -9px; right: -9px; top: 50%; height: 2px; margin-top: -1px; background: rgba(255, 255, 255, 0.25); border-radius: 2px; }

/* ---------- VU ---------- */
.vu { position: relative; width: 6px; border-radius: 3px; overflow: hidden; background: linear-gradient(to top, #2fd6a0 0%, #5ee6a8 55%, #ffd166 78%, #ff9f43 90%, #ff5d6c 100%); }
.vu-mask { position: absolute; inset: 0; background: #090b10; transform-origin: top; transform: scaleY(1); }
.vu-peak { position: absolute; left: 0; right: 0; height: 2px; background: #fff; opacity: 0; margin-bottom: -1px; }
.vu.clip { box-shadow: 0 0 8px var(--danger); }

/* ---------- mixer ---------- */
.mixer { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.phase-meter { display: flex; align-items: center; gap: 8px; }
.phase-meter span { font-family: var(--mono); font-size: 9.5px; color: #5c6375; letter-spacing: 0.1em; }
.pm-track { flex: 1; position: relative; height: 8px; border-radius: 4px; background: #07090d; box-shadow: 0 0 0 1px var(--line); }
.pm-center { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(255, 255, 255, 0.25); }
.pm-dot { --x: 0; position: absolute; top: 50%; left: calc(50% + var(--x) * 50%); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--warn); transition: left 0.08s linear, opacity 0.3s; }
.pm-dot.locked { background: var(--good); box-shadow: 0 0 10px var(--good); }
.pm-dot.idle { opacity: 0.15; background: var(--muted); left: 50%; }

.mixer-strips { display: grid; grid-template-columns: 1fr 84px 1fr; gap: 6px; flex: 1; }
.strip { --dc: var(--a); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); }
.strip-B { --dc: var(--b); }
.strip .knob { --kc: var(--dc); }
.strip .knob.eq { --kc: color-mix(in srgb, var(--dc) 70%, #fff); }
.strip .knob.filter { --kc: var(--accent); }
.strip-letter { font-weight: 800; font-size: 12px; color: var(--dc); letter-spacing: 0.1em; }
.eq-group { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); width: 100%; align-items: center; }
.pfl { width: 40px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); transition: all 0.15s; }
.pfl svg { width: 16px; height: 16px; }
.pfl.on { color: #0b0d12; background: var(--warn); border-color: transparent; box-shadow: 0 0 12px rgba(255, 209, 102, 0.35); }
.fader-wrap { flex: 1; display: flex; gap: 6px; min-height: 140px; width: 100%; justify-content: center; align-items: stretch; padding-top: 4px; }
.vu-slot { width: 6px; margin: 8px 0; }
.fader.channel { --fc: var(--dc); }
.master-col { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; }
.master-col .knob { --kc: #fff; }
.master-vu { display: flex; gap: 4px; flex: 1; min-height: 140px; padding: 4px 0; }
.master-vu .vu { width: 7px; height: 100%; }
.cue-ctl { display: flex; flex-direction: column; gap: 4px; }
.cue-ctl .knob { --kc: var(--warn); }
body:not(.cue-ready) .cue-ctl { opacity: 0.45; }

.xfade { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.xf-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.xl { font-weight: 800; font-size: 12px; width: 14px; text-align: center; }
.xl.a { color: var(--a); }
.xl.b { color: var(--b); }
.fader.xfader { flex: 1; }
.fader.xfader .f-track { background: linear-gradient(90deg, color-mix(in srgb, var(--a) 40%, #07090d), #07090d 40%, #07090d 60%, color-mix(in srgb, var(--b) 40%, #07090d)); }
.curve { direction: rtl; }

/* ---------- library ---------- */
.library { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; padding: 12px; flex: 1; min-height: 340px; }
.lib-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: visible; position: relative; z-index: 5; max-height: calc(100vh - 80px); }
.lib-toolbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lib-title { display: flex; align-items: baseline; gap: 10px; }
.lib-title h2 { margin: 0; font-size: 17px; font-weight: 700; }
.lib-count { color: var(--muted); font-size: 12.5px; }
.search { flex: 1; min-width: 180px; max-width: 380px; position: relative; }
.search svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input {
  width: 100%; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25);
  color: var(--text); font: inherit; padding: 0 36px 0 12px; outline: none; transition: border-color 0.15s;
}
.search input:focus { border-color: rgba(184, 132, 255, 0.5); }
.lib-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.btn {
  height: 36px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 600; font-size: 13.5px; transition: all 0.15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--a), #4cc9f0); color: #07110f; box-shadow: 0 6px 18px rgba(94, 230, 208, 0.2); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border: 1px solid var(--line2); color: var(--text2); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn.accent { background: linear-gradient(135deg, var(--accent), #8b7bff); color: #fff; box-shadow: 0 6px 18px rgba(184, 132, 255, 0.22); }
.btn.accent:hover { filter: brightness(1.08); }
.btn.danger { border: 1px solid rgba(255, 93, 108, 0.4); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 93, 108, 0.1); }
.btn.block { width: 100%; height: 42px; }

.lib-head, .row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 64px 62px 54px 104px 168px;
  align-items: center; gap: 8px; padding: 0 16px;
}
.lib-head { height: 34px; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; border-bottom: 1px solid var(--line); }
.lib-list { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 0 10px; }
.lib-list::-webkit-scrollbar { width: 10px; }
.lib-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.row { height: 50px; position: relative; border-radius: 10px; margin: 0 6px; padding: 0 10px; transition: background 0.12s, opacity 0.2s; cursor: default; }
.row:hover { background: rgba(255, 255, 255, 0.035); }
.row .c-idx { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.grip { cursor: grab; color: #464d5e; letter-spacing: -2px; font-size: 13px; }
.row:hover .grip { color: var(--text2); }
.c-title { min-width: 0; }
.c-title .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: right; }
.c-title .ar { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: right; }
.c-bpm, .c-dur { font-family: var(--mono); font-size: 12.5px; color: var(--text2); direction: ltr; text-align: right; }
.keychip { font-family: var(--mono); font-weight: 700; font-size: 11.5px; padding: 3px 7px; border-radius: 7px; color: var(--k); background: color-mix(in srgb, var(--k) 14%, transparent); border: 1px solid color-mix(in srgb, var(--k) 28%, transparent); }
.c-state { display: flex; align-items: center; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.live { color: #07110f; background: var(--a); }
.badge.next { color: var(--accent); background: rgba(184, 132, 255, 0.12); border: 1px solid rgba(184, 132, 255, 0.35); }
.badge.loaded { color: var(--text2); background: rgba(255, 255, 255, 0.06); }
.badge.played { color: var(--muted); }
.hint { font-size: 10px; }
.hint.good { color: var(--good); }
.hint.ok { color: var(--warn); }
.eqi { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 10px; }
.eqi b { width: 2px; background: currentColor; animation: eq 0.9s infinite ease-in-out; }
.eqi b:nth-child(2) { animation-delay: -0.3s; }
.eqi b:nth-child(3) { animation-delay: -0.6s; }
.c-act { display: flex; gap: 4px; justify-content: flex-end; opacity: 0.35; transition: opacity 0.15s; }
.row:hover .c-act { opacity: 1; }
.mini { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: var(--text2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); transition: all 0.12s; }
.mini svg { width: 14px; height: 14px; transform: scaleX(-1); }
.mini.deck-a:hover { color: #07110f; background: var(--a); }
.mini.deck-b:hover { color: #1a1005; background: var(--b); }
.mini:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.mini.danger:hover { color: #fff; background: var(--danger); }
.row.live { background: linear-gradient(270deg, rgba(94, 230, 208, 0.12), rgba(94, 230, 208, 0.02)); }
.row.live::before { content: ''; position: absolute; right: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--a); }
.row.next { background: rgba(184, 132, 255, 0.06); }
.row.played { opacity: 0.45; }
.row.on-a .mini.deck-a { color: var(--a); border-color: rgba(94, 230, 208, 0.45); }
.row.on-b .mini.deck-b { color: var(--b); border-color: rgba(255, 184, 107, 0.45); }
.row.analyzing .c-title .t { color: var(--text2); }
.row-progress { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--a)); transform-origin: right; transform: scaleX(0); transition: transform 0.3s; }
.row.error { opacity: 0.6; }
.err { color: var(--danger); font-size: 11.5px; }
.row.dragging { opacity: 0.35; }
.row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }

.lib-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--muted); height: 100%; }
.lib-empty h3 { margin: 6px 0 0; color: var(--text); font-weight: 600; }
.lib-empty p { margin: 0; line-height: 1.7; max-width: 440px; }
.lib-empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: rgba(184, 132, 255, 0.1); color: var(--accent); border: 1px dashed rgba(184, 132, 255, 0.4); }
.lib-empty-icon svg { width: 28px; height: 28px; }

/* ---------- automix panel ---------- */
.automix { max-height: calc(100vh - 80px); padding: 16px; display: flex; flex-direction: column; gap: 14px; transition: border-color 0.3s, box-shadow 0.3s; overflow-y: auto; }
body.automix-on .automix { border-color: rgba(184, 132, 255, 0.4); box-shadow: 0 0 0 1px rgba(184, 132, 255, 0.15), 0 10px 40px rgba(184, 132, 255, 0.08); }
.am-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.am-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.am-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.am-status { min-height: 74px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.am-idle { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.am-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.am-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--text2); }
.am-pill.on { background: rgba(184, 132, 255, 0.18); color: var(--accent); }
.am-pill.mixing { background: var(--accent); color: #fff; animation: pulse 1.2s infinite; }
.am-time { font-family: var(--mono); font-size: 12.5px; color: var(--text2); }
.am-next { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.am-bar i { display: block; height: 100%; background: linear-gradient(270deg, var(--accent), var(--a)); transform-origin: right; }
.am-field { display: flex; flex-direction: column; gap: 7px; }
.am-field > label { font-size: 12.5px; font-weight: 600; color: var(--text2); }
.am-field .sub { font-weight: 400; color: var(--muted); }
.am-field .seg button { font-family: var(--mono); height: 28px; }
.am-field .seg button.on { color: var(--accent); }
.am-sub { font-size: 11.5px; color: var(--muted); }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.styles button { text-align: right; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; transition: all 0.15s; }
.styles button:last-child { grid-column: span 2; }
.styles b { font-size: 13px; font-weight: 600; }
.styles span { font-size: 11px; color: var(--muted); }
.styles button:hover { background: rgba(255, 255, 255, 0.06); }
.styles button.on { border-color: rgba(184, 132, 255, 0.55); background: rgba(184, 132, 255, 0.1); }
.styles button.on b { color: var(--accent); }

.switch { position: relative; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.1); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform 0.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2px solid rgba(184, 132, 255, 0.7); outline-offset: 2px; }

.chk { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); cursor: pointer; }
.chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.chk span { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line2); flex: none; display: grid; place-items: center; transition: all 0.15s; }
.chk input:checked + span { background: var(--accent); border-color: var(--accent); }
.chk input:checked + span::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.chk input:focus-visible + span { outline: 2px solid rgba(184, 132, 255, 0.7); outline-offset: 2px; }

/* ---------- overlays ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(8, 10, 14, 0.7); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.drop-overlay.show { opacity: 1; }
.drop-card { text-align: center; padding: 40px 56px; border-radius: 24px; border: 2px dashed rgba(184, 132, 255, 0.6); background: rgba(184, 132, 255, 0.06); }
.drop-card svg { width: 40px; height: 40px; color: var(--accent); }
.drop-card h3 { margin: 12px 0 4px; font-size: 20px; }
.drop-card p { margin: 0; color: var(--muted); }

.dlg { border: 1px solid var(--line2); border-radius: 20px; padding: 0; background: var(--panel2); color: var(--text); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.dlg.wide { width: min(860px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 6, 9, 0.65); backdrop-filter: blur(6px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel2); }
.dlg-head h3 { margin: 0; font-size: 17px; }
.dlg-body { padding: 8px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.dlg-body h4 { margin: 14px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text2); }
.field small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.field select { height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font: inherit; padding: 0 10px; }
.note { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.6; }
.note:empty { display: none; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.help ol { margin: 8px 0 0; padding-inline-start: 18px; line-height: 1.8; color: var(--text2); }
.keys { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.keys th { text-align: right; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px 6px; }
.keys td { padding: 6px; border-bottom: 1px solid var(--line); color: var(--text2); }
kbd { display: inline-block; min-width: 22px; text-align: center; font-family: var(--mono); font-size: 11.5px; padding: 2px 6px; border-radius: 6px; background: var(--panel3); border: 1px solid var(--line2); border-bottom-width: 2px; color: var(--text); }

.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 12px; background: rgba(29, 34, 48, 0.96); border: 1px solid var(--line2); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); font-size: 13.5px; opacity: 0; transform: translateY(10px); transition: all 0.25s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: none; }
.toast.warn { border-color: rgba(255, 209, 102, 0.35); }
.toast button { color: var(--accent); font-weight: 700; }

/* ---------- animations ---------- */
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes blinkText { 50% { opacity: 0.35; } }
@keyframes btnBlink { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent), 0 6px 16px rgba(0, 0, 0, 0.35); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .stage { grid-template-columns: minmax(0, 1fr) 260px minmax(0, 1fr); }
  .mixer-strips { grid-template-columns: 1fr 70px 1fr; }
  .knob svg { width: 40px; height: 40px; }
  .lib-head, .row { grid-template-columns: 50px minmax(0, 1fr) 58px 56px 50px 92px 162px; }
}
@media (max-width: 1080px) {
  .stage { grid-template-columns: 1fr 1fr; }
  .mixer { grid-column: 1 / -1; order: 3; }
  .mixer-strips { grid-template-columns: 1fr 90px 1fr; }
  .strip { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .eq-group { flex-direction: row; width: auto; border: 0; padding: 0; }
  .fader-wrap { flex: 1 1 100%; min-height: 120px; }
  .library { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; padding: 10px 10px 0; }
  .library { padding: 10px; }
  .topbar { padding: 0 12px; }
  .rec-btn span { display: none; }
  .lib-head { display: none; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 54px 50px; height: auto; min-height: 54px; padding: 6px 8px; row-gap: 4px; }
  .row .c-dur, .row .c-state { display: none; }
  .row .c-act { grid-column: 1 / -1; opacity: 1; justify-content: flex-start; }
  .lib-actions { margin: 0; flex-wrap: wrap; }
  .help-grid { grid-template-columns: 1fr; }
  .pads { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- audio outputs ---------- */
.out-btn { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text2); font-size: 12.5px; transition: all 0.2s; }
.out-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.out-btn .ob-item { display: flex; align-items: center; gap: 6px; }
.out-btn svg { width: 15px; height: 15px; }
.out-btn b { font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out-btn .ob-sep { width: 1px; height: 16px; background: var(--line2); }
.out-btn .ob-item:last-child { color: var(--muted); }
.out-btn.ready .ob-item:last-child { color: var(--warn); }
.outputs .lead { margin: 4px 0 0; color: var(--text2); line-height: 1.7; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.modes button { position: relative; text-align: right; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; transition: all 0.15s; }
.modes button:hover { background: rgba(255, 255, 255, 0.06); }
.modes button.on { border-color: rgba(184, 132, 255, 0.6); background: rgba(184, 132, 255, 0.1); }
.modes .m-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.05); color: var(--text2); margin-bottom: 4px; }
.modes button.on .m-ico { color: var(--accent); background: rgba(184, 132, 255, 0.15); }
.modes b { font-size: 13.5px; }
.modes span { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.modes em { position: absolute; top: 10px; left: 10px; font-style: normal; font-size: 10px; font-weight: 700; color: var(--accent); background: rgba(184, 132, 255, 0.14); padding: 2px 7px; border-radius: 999px; }
.out-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.out-card { padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.oc-head { display: flex; align-items: center; gap: 8px; }
.oc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--a); box-shadow: 0 0 8px var(--a); }
.out-card.cue .oc-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.oc-sub { margin-inline-start: auto; font-size: 11.5px; color: var(--muted); }
.oc-row { display: flex; gap: 8px; }
.oc-row select { flex: 1; min-width: 0; height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font: inherit; padding: 0 10px; }
.oc-row select:disabled { opacity: 0.5; }
.oc-row .test { height: 38px; flex: none; }
.out-card small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.out-card small:empty { display: none; }
.out-card small.warn { color: var(--warn); }
.sync-box { padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.sb-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.sb-head b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.sb-head span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.sb-head output { font-family: var(--mono); font-size: 13px; color: var(--accent); white-space: nowrap; padding: 4px 10px; border-radius: 8px; background: rgba(184, 132, 255, 0.1); }
.sb-row { display: flex; align-items: center; gap: 10px; }
.sb-row input { flex: 1; accent-color: var(--accent); direction: ltr; }
.sb-l { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sb-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sb-presets [data-off] { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--text2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.sb-presets [data-off]:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.small-btn { height: 28px; font-size: 12px; margin-inline-start: auto; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .modes, .out-cards { grid-template-columns: 1fr; }
  .out-btn b { max-width: 70px; }
}

/* ---------- sorting ---------- */
.sort-wrap { position: relative; }
.sort-wrap .chev { width: 14px; height: 14px; opacity: 0.6; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 280px; padding: 6px; border-radius: 14px; background: var(--panel3); border: 1px solid var(--line2); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 1px; }
.menu-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); padding: 6px 10px 4px; }
.menu button { display: flex; align-items: baseline; gap: 8px; text-align: right; padding: 8px 10px; border-radius: 9px; transition: background 0.1s; }
.menu button:hover { background: rgba(255, 255, 255, 0.06); }
.menu button b { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.menu button span { font-size: 12px; color: var(--muted); }
.menu button.star { background: rgba(184, 132, 255, 0.08); flex-direction: column; gap: 1px; margin: 2px 0; }
.menu button.star b { color: var(--accent); }
.menu-foot { font-size: 11px; color: #5c6375; padding: 6px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; line-height: 1.5; }
.lib-head [data-sort] { color: inherit; font: inherit; letter-spacing: inherit; padding: 2px 0; transition: color 0.12s; }
.lib-head [data-sort]:hover { color: var(--text); }
.lib-head [data-sort].sorted { color: var(--accent); }
.lib-head [data-sort].sorted::after { content: '▲'; font-size: 8px; margin-inline-start: 4px; vertical-align: 1px; }
.lib-head [data-sort].sorted[data-dir="desc"]::after { content: '▼'; }

/* ---------- names & recognition ---------- */
.c-title .ar.unknown { color: #5c6375; font-style: italic; }
.c-title .ar.recog { color: var(--accent); display: flex; align-items: center; gap: 6px; }
.link { color: var(--accent); font-style: normal; font-weight: 600; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: #d2b5ff; }
.src-tag { font-size: 10px; color: var(--good); font-weight: 600; margin-inline-start: 4px; }
.spin.sm { width: 10px; height: 10px; border-width: 1.5px; vertical-align: -1px; }
.recog-btn { color: var(--accent); border-color: rgba(184, 132, 255, 0.35); }
.recog-btn:hover { background: rgba(184, 132, 255, 0.1); color: #d2b5ff; }
.field input[type="text"], .field input[type="password"] { height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font: inherit; padding: 0 12px; outline: none; min-width: 0; unicode-bidi: plaintext; flex: none; }
.oc-row input { flex: 1 !important; }
.field input:focus { border-color: rgba(184, 132, 255, 0.55); }
.field small a { color: var(--accent); }
.recog-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: rgba(184, 132, 255, 0.06); border: 1px solid rgba(184, 132, 255, 0.2); }
.recog-box .btn { color: var(--accent); border-color: rgba(184, 132, 255, 0.4); }
.recog-box .btn:disabled { opacity: 0.5; cursor: wait; }
.ed-status { font-size: 12.5px; color: var(--text2); flex: 1; min-width: 160px; }
.ed-status.ok { color: var(--good); }
.ed-status.warn { color: var(--warn); }
.row-btns.end { justify-content: flex-end; margin-top: 4px; }
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu { max-height: min(460px, 80vh); overflow-y: auto; }

/* ---------- saved sets ---------- */
.lib-title { align-items: center; flex-wrap: wrap; }
.pl-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px; border-radius: 10px; font-size: 16px; font-weight: 700; color: var(--text); border: 1px solid transparent; transition: all 0.15s; max-width: 280px; }
.pl-btn:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line2); }
.pl-btn svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.pl-btn .chev { width: 14px; height: 14px; }
.pl-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library.in-set .pl-btn svg:first-child { color: var(--accent); }
.btn.slim { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.slim svg { width: 14px; height: 14px; }
.lib-empty .btn { margin-top: 10px; }

.pl-save { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: rgba(94, 230, 208, 0.05); border: 1px solid rgba(94, 230, 208, 0.16); margin-top: 8px; }
.pl-save label { font-size: 13px; color: var(--text2); font-weight: 600; }
.pl-row input { flex: 1; min-width: 0; height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font: inherit; padding: 0 12px; outline: none; unicode-bidi: plaintext; }
.pl-row input:focus { border-color: rgba(184, 132, 255, 0.55); }
.pl-row .btn { height: 38px; padding: 0 20px; }
.pl-list { display: flex; flex-direction: column; gap: 6px; }
.pl-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); transition: border-color 0.15s, background 0.15s; }
.pl-item:hover { border-color: var(--line2); background: rgba(255, 255, 255, 0.035); }
.pl-item.cur { border-color: rgba(184, 132, 255, 0.45); background: rgba(184, 132, 255, 0.07); }
.pl-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.05); color: var(--muted); }
.pl-item.cur .pl-ico { color: var(--accent); background: rgba(184, 132, 255, 0.14); }
.pl-ico svg { width: 17px; height: 17px; }
.pl-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pl-meta input, .pl-meta b { font: inherit; font-weight: 600; font-size: 14px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 1px 4px; margin: 0 -5px; outline: none; min-width: 0; unicode-bidi: plaintext; text-align: right; }
.pl-meta input:hover { border-color: var(--line2); }
.pl-meta input:focus { border-color: rgba(184, 132, 255, 0.55); background: var(--bg2); }
.pl-meta span { font-size: 12px; color: var(--muted); }
.pl-meta .cur-tag { color: var(--accent); font-weight: 600; }
.pl-acts { display: flex; gap: 4px; align-items: center; }
.pl-acts .btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
.pl-acts .mini { width: 30px; height: 30px; }
.danger-t { color: var(--danger) !important; }

.pick-search { max-width: none; margin-top: 8px; }
.pick-tools { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.pick-list { max-height: min(48vh, 420px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.pick-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 54px 40px; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pick-row:hover { background: rgba(255, 255, 255, 0.04); }
.pick-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.pick-row .pt { min-width: 0; display: flex; flex-direction: column; }
.pick-row .pt b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row .pt span { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row .pb { font-family: var(--mono); font-size: 12px; color: var(--text2); text-align: left; }
.pick-row[hidden] { display: none; }
.pick-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- recording ---------- */
.rec-group { display: flex; align-items: center; }
.rec-group .rec-btn { border-start-end-radius: 0; border-end-end-radius: 0; }
.rec-menu { height: 36px; width: 34px; display: grid; place-items: center; border: 1px solid var(--line2); border-inline-start: none; border-radius: 0 999px 999px 0; color: var(--muted); transition: all 0.2s; }
[dir="rtl"] .rec-menu { border-radius: 999px 0 0 999px; }
.rec-menu:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.rec-menu svg { width: 15px; height: 15px; }
.rec-btn.paused i { animation: none; background: var(--warn); }
.rec-btn.paused time { color: var(--warn); }

.rc-panel { margin-top: 8px; padding: 16px; border-radius: 16px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.025); display: flex; flex-direction: column; gap: 12px; transition: all 0.2s; }
.rc-panel.on { border-color: rgba(255, 93, 108, 0.45); background: rgba(255, 93, 108, 0.06); }
.rc-panel.paused { border-color: rgba(255, 209, 102, 0.4); background: rgba(255, 209, 102, 0.05); }
.rc-status { display: flex; align-items: center; gap: 10px; }
.rc-status b { font-size: 15px; }
.rc-dot { width: 12px; height: 12px; border-radius: 50%; background: #5a6070; }
.rc-panel.on .rc-dot { background: var(--danger); animation: pulse 1s infinite; }
.rc-panel.paused .rc-dot { background: var(--warn); animation: none; }
.rc-status time { margin-inline-start: auto; font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: 0.02em; color: var(--muted); }
.rc-panel.on time { color: var(--text); }
.rc-meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; direction: ltr; }
.rc-meter i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: linear-gradient(90deg, var(--good), var(--warn) 80%, var(--danger)); border-radius: 99px; transition: width 0.06s linear; }
.rc-meter.hot i { box-shadow: 0 0 10px rgba(255, 93, 108, 0.6); }
.rc-tracks { font-size: 12.5px; color: var(--text2); }
.rc-tracks:empty { display: none; }
.rc-btns { display: flex; gap: 8px; }
.rec-go { flex: 1; height: 44px; justify-content: center; background: var(--danger); color: #fff; font-weight: 700; font-size: 15px; box-shadow: 0 6px 18px rgba(255, 93, 108, 0.25); }
.rec-go:hover { filter: brightness(1.08); }
.rec-go i { width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.rec-go i.sq { border-radius: 2px; }
.rc-panel.on .rec-go { background: var(--panel3); box-shadow: none; border: 1px solid var(--line2); }
.rc-btns #rcPause { height: 44px; min-width: 96px; justify-content: center; }
.rc-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rc-settings .seg button { height: 30px; font-size: 12px; }
.rc-settings .seg button:disabled { opacity: 0.5; cursor: not-allowed; }
.rc-settings label { display: flex; justify-content: space-between; }
.rc-settings output { font-family: var(--mono); font-size: 12px; color: var(--text); }
.rc-settings input[type="range"] { width: 100%; accent-color: var(--danger); direction: ltr; }
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-item { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: rgba(255, 255, 255, 0.02); }
.rec-item.fresh { border-color: rgba(94, 230, 168, 0.5); background: rgba(94, 230, 168, 0.05); }
.rec-top { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.rec-play { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); color: var(--text); }
.rec-play:hover { background: rgba(255, 255, 255, 0.12); }
.rec-play svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.rec-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rec-name { font: inherit; font-weight: 600; font-size: 14px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 1px 4px; margin: 0 -5px; outline: none; min-width: 0; unicode-bidi: plaintext; text-align: right; }
.rec-name:hover { border-color: var(--line2); }
.rec-name:focus { border-color: rgba(184, 132, 255, 0.55); background: var(--bg2); }
.rec-info span { font-size: 11.5px; color: var(--muted); }
.rec-acts { display: flex; gap: 4px; }
.rec-acts .btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
.rec-tl { margin: 0; padding: 0 22px 0 0; max-height: 132px; overflow-y: auto; font-size: 12.5px; color: var(--text2); display: flex; flex-direction: column; gap: 2px; }
.rec-tl time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-inline-end: 10px; display: inline-block; min-width: 40px; }
.rec-player:empty { display: none; }
.rec-player audio { width: 100%; height: 36px; }
.rec-empty { padding: 6px 0; }
@media (max-width: 640px) {
  .rc-settings { grid-template-columns: 1fr; }
  .rec-top { grid-template-columns: 36px minmax(0, 1fr); }
  .rec-acts { grid-column: 1 / -1; }
  .pl-item { grid-template-columns: minmax(0, 1fr); }
  .pl-ico { display: none; }
}
.rec-info span bdi, .pl-meta span bdi { unicode-bidi: isolate; }
.rec-info span bdi { white-space: nowrap; }
.unsupported { padding: 14px 20px; background: rgba(255, 93, 108, 0.15); border-bottom: 1px solid var(--danger); color: #fff; text-align: center; font-weight: 600; }
