/* Slightly Epic Radio — DJ page */
:root {
  --bg: #0b0b0e;
  --panel: #15151b;
  --panel2: #1c1c24;
  --edge: #2a2a36;
  --text: #e8e6f0;
  --text2: #9994b0;
  --accent: #7c6af7;
  --accent-ink: #ffffff;
  --glow: rgba(124, 106, 247, .45);
  --glow: color-mix(in srgb, var(--accent) 45%, transparent);
  --track: #33334a;
  --lcd: #08080c;
  --lcd-ink: #c4bcff;
  --red: #ff4d5e;
  --amber: #ffb547;
  --green: #3ddc84;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(124, 106, 247, .16), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: 'Syne', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--glow); }
a { color: var(--text2); }
a:hover { color: var(--accent); }

html[data-mode="single"] .mix-only { display: none !important; }

/* ── top console ─────────────────────────────────────────────────────────── */
.console {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  padding: 14px 22px;
  background: linear-gradient(180deg, #17171e, #111116);
  border-bottom: 1px solid var(--edge);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0; margin-right: auto; white-space: nowrap; }
.brand span { color: var(--accent); }

.mode { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--lcd); border: 1px solid var(--edge); }
.mode button {
  border: 0; background: transparent; color: var(--text2);
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.mode button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 14px var(--glow); }

.master { display: flex; align-items: center; gap: 10px; }
.master label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text2); }
.master .fader { width: 120px; }
.master .vu { width: 70px; }

.embed-link { font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ── recorder ── */
.rec { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 9px; border-radius: 9px;
  border: 1px solid var(--edge); background: var(--panel2);
  font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.rec-btn:hover { border-color: var(--red); }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #5a2a30; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4); }
.rec[data-state="recording"] .rec-btn { border-color: var(--red); color: #fff; background: #2a1216; }
.rec[data-state="recording"] .rec-dot { background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink 1s steps(2, start) infinite; }
.rec[data-state="saving"] .rec-dot { background: var(--amber); }
@keyframes blink { to { visibility: hidden; } }
.rec-time { font: 600 13px 'JetBrains Mono', ui-monospace, monospace; color: var(--text2); min-width: 5ch; }
.rec[data-state="recording"] .rec-time { color: var(--red); }
.rec select {
  background: var(--lcd); border: 1px solid var(--edge); border-radius: 7px;
  padding: 5px 6px; font-size: 12px; font-weight: 700;
}
.rec select:disabled { opacity: .5; }
.rec-dl {
  padding: 6px 12px; border-radius: 9px; text-decoration: none;
  background: var(--green); color: #06210f; font-size: 12px; font-weight: 800;
}
.rec-dl:hover { color: #06210f; filter: brightness(1.08); }
.rec-note { font-size: 12px; color: var(--text2); }

/* ── deck rack ───────────────────────────────────────────────────────────── */
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 18px 12px; }
.rack {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
  align-items: stretch;
}

.deck {
  position: relative; min-width: 0; /* long now-playing text must not widen the column */
  display: grid; gap: 12px; align-content: start;
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--edge);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 14px 34px rgba(0, 0, 0, .4);
  transition: border-color .2s, box-shadow .2s;
}
.deck[data-state="playing"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--edge)); box-shadow: 0 0 0 1px var(--glow), 0 14px 34px rgba(0, 0, 0, .4); }

.deck-head { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.deck-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text2); }
.deck-label b { color: var(--text); font: 600 12px 'JetBrains Mono', ui-monospace, monospace; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #2c2c38; flex: none; }
.deck[data-state="playing"] .led { background: var(--green); box-shadow: 0 0 8px var(--green); }
.deck[data-state="loading"] .led { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.deck[data-state="error"] .led { background: var(--red); box-shadow: 0 0 8px var(--red); }
.x {
  margin-left: auto; width: 26px; height: 26px; padding: 4px;
  border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--text2);
}
.x svg { width: 100%; height: 100%; display: block; }
.x:hover { color: #fff; background: #3a1a20; border-color: var(--red); }
.rack[data-count="1"] .x { visibility: hidden; }

/* platter */
.platter { position: relative; width: min(100%, 210px); aspect-ratio: 1; margin: 2px auto 0; }
.vinyl {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, transparent 31%, rgba(255, 255, 255, .06) 31.5%, transparent 32.5%),
    repeating-radial-gradient(circle, #121216 0 2px, #191920 2px 3px),
    #111;
  box-shadow: 0 0 0 6px #0d0d11, 0 0 0 7px var(--edge), 0 10px 24px rgba(0, 0, 0, .5);
  display: grid; place-items: center;
  animation: spin 1.8s linear infinite; /* 33⅓ rpm */
  animation-play-state: paused;
}
.vinyl::after { /* light sheen, so the spin is visible on a plain record */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 20deg, transparent 0 10%, rgba(255, 255, 255, .07) 14%, transparent 20% 60%, rgba(255, 255, 255, .05) 64%, transparent 70%);
}
.label {
  width: 40%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; position: relative; z-index: 1;
  background: linear-gradient(135deg, var(--accent), #4f3fc7);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .5);
}
.label::after { /* spindle hole */
  content: ''; position: absolute; left: 50%; top: 50%; width: 9%; height: 9%;
  transform: translate(-50%, -50%); border-radius: 50%; background: #0b0b0e;
}
.label-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.deck[data-state="playing"] .vinyl { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }

.tonearm {
  position: absolute; right: -4%; top: -2%; width: 46%; height: 62%;
  transform-origin: 82% 10%; transform: rotate(-24deg);
  transition: transform .6s cubic-bezier(.3, .7, .3, 1);
  pointer-events: none; z-index: 2;
}
.tonearm::before { /* pivot */
  content: ''; position: absolute; right: 9%; top: 2%; width: 18%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #555 0 30%, #2a2a33 32%); box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.tonearm i {
  position: absolute; right: 17%; top: 10%; width: 4px; height: 82%;
  background: linear-gradient(90deg, #8a8a96, #cfcfd8 50%, #7a7a86); border-radius: 2px;
  transform-origin: top center; transform: rotate(18deg);
}
.tonearm i::after { /* head shell */
  content: ''; position: absolute; left: -4px; bottom: -8px; width: 12px; height: 14px; border-radius: 2px;
  background: #b8b8c4;
}
.deck[data-state="playing"] .tonearm, .deck[data-state="loading"] .tonearm { transform: rotate(0deg); }

/* station select */
.select-wrap { position: relative; }
.station {
  appearance: none; -webkit-appearance: none; width: 100%;
  font-weight: 700; font-size: 15px;
  background: var(--lcd); border: 1px solid var(--edge); border-radius: 10px;
  padding: 9px 30px 9px 12px; cursor: pointer;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.station:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--edge)); }
.station option { background: var(--panel); color: var(--text); font-weight: 500; }
.chev { position: absolute; right: 11px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); color: var(--text2); pointer-events: none; }

/* LCD now-playing */
.lcd {
  min-width: 0;
  background: var(--lcd); border-radius: 8px; padding: 8px 10px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .7), 0 0 0 1px #20202a;
  font: 400 12.5px 'JetBrains Mono', ui-monospace, monospace; color: var(--lcd-ink);
  text-shadow: 0 0 6px color-mix(in srgb, var(--lcd-ink) 40%, transparent);
}
.lcd-track { overflow: hidden; white-space: nowrap; }
.lcd-text { display: inline-block; }
.lcd-track.scroll .lcd-text { animation: marquee var(--marquee-dur, 12s) linear infinite; }
.lcd-track.scroll b { font-weight: inherit; padding-right: 3em; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.deck[data-state="error"] .lcd { color: var(--red); }
.deck[data-state="idle"] .lcd { color: var(--text2); text-shadow: none; }

/* transport */
.transport { display: flex; align-items: center; gap: 8px; }
.play {
  width: 50px; height: 50px; border: 0; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08) inset;
  transition: transform .12s, filter .15s;
}
.play:hover:not(:disabled) { filter: brightness(1.1); }
.play:active:not(:disabled) { transform: scale(.94); }
.play:disabled { opacity: .5; cursor: default; }
.play svg { width: 24px; height: 24px; grid-area: 1 / 1; }
.play .i-pause, .play .i-spin { display: none; }
.deck[data-state="playing"] .play .i-play { display: none; }
.deck[data-state="playing"] .play .i-pause { display: block; }
.deck[data-state="loading"] .play .i-play { display: none; }
.deck[data-state="loading"] .play .i-spin { display: block; animation: spin .9s linear infinite; }

.pad {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  border: 1px solid var(--edge); background: var(--lcd); color: var(--text2);
  font: 800 13px 'JetBrains Mono', ui-monospace, monospace;
}
.pad:hover { color: var(--text); }
.mute[aria-pressed="true"] { background: #3a1a20; border-color: var(--red); color: #fff; box-shadow: 0 0 10px rgba(255, 77, 94, .35); }
.solo[aria-pressed="true"] { background: #3a2d10; border-color: var(--amber); color: #fff; box-shadow: 0 0 10px rgba(255, 181, 71, .35); }
.deck.silenced .vinyl { filter: brightness(.7); }

.assign { margin-left: auto; display: inline-flex; border: 1px solid var(--edge); border-radius: 9px; overflow: hidden; background: var(--lcd); }
.assign button {
  width: 30px; height: 34px; border: 0; background: transparent; color: var(--text2);
  font: 800 12px 'JetBrains Mono', ui-monospace, monospace;
}
.assign button + button { border-left: 1px solid var(--edge); }
.assign button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* faders + VU */
.fader-row { display: flex; align-items: center; gap: 12px; }
.fader-row .fader { flex: 1; }
.fader-row .vu { width: 64px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 22px; margin: 0; background: transparent; cursor: pointer;
  --fill: 80%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill), var(--track) var(--fill));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 22px; margin-top: -8px; border-radius: 4px;
  background: linear-gradient(180deg, #e6e6ee, #a9a9b6); border: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .6), inset 0 -2px 0 rgba(0, 0, 0, .15);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 22px; border-radius: 4px; border: 0;
  background: linear-gradient(180deg, #e6e6ee, #a9a9b6);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .6);
}
input[type="range"]:focus-visible { box-shadow: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--glow); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--glow); }

.vu {
  position: relative; height: 10px; border-radius: 3px; overflow: hidden; flex: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 4px, var(--lcd) 4px 6px),
    linear-gradient(90deg, var(--green) 0 62%, var(--amber) 62% 84%, var(--red) 84%);
  box-shadow: 0 0 0 1px #20202a;
  --lvl: 0;
}
.vu i { /* covers the unlit part of the meter */
  position: absolute; top: 0; bottom: 0; right: 0;
  width: calc((1 - var(--lvl)) * 100%);
  background: repeating-linear-gradient(90deg, #1d1d26 0 4px, var(--lcd) 4px 6px);
}

/* add-deck tile */
.add-deck {
  min-height: 220px;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  border-radius: 18px; border: 2px dashed var(--edge); background: transparent; color: var(--text2);
  transition: border-color .15s, color .15s, background .15s;
}
.add-deck:hover:not(:disabled) { border-color: var(--accent); color: var(--text); background: rgba(124, 106, 247, .05); }
.add-deck .plus {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-size: 34px; font-weight: 500; line-height: 1;
  background: var(--panel2); border: 1px solid var(--edge);
}
.add-deck:hover:not(:disabled) .plus { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 18px var(--glow); }
.add-text { font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.add-deck:disabled { opacity: .45; cursor: default; }

/* crossfader */
.xfader {
  display: flex; align-items: center; gap: 14px;
  max-width: 560px; margin: 26px auto 0; padding: 14px 18px;
  border-radius: 16px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--edge);
}
.xf-side { font: 800 14px 'JetBrains Mono', ui-monospace, monospace; color: var(--text2); }
#xfade { flex: 1; }
#xfade::-webkit-slider-runnable-track { background: var(--track); }
#xfade::-moz-range-progress { background: transparent; }
#xfade::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
#xfade::-moz-range-thumb { width: 26px; height: 26px; }
.xf-center {
  border: 1px solid var(--edge); background: var(--lcd); color: var(--text2);
  border-radius: 8px; padding: 6px 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.xf-center:hover { color: var(--text); }

.hint { text-align: center; color: var(--text2); font-size: 13px; margin: 22px 0 0; }
.hint:empty { display: none; }

.foot { text-align: center; color: var(--text2); font-size: 13px; padding: 18px; }

@media (max-width: 720px) {
  .console { padding: 12px 14px; gap: 10px 14px; position: static; } /* too tall to pin on a phone */
  .brand { width: 100%; }
  .master .fader { width: 90px; }
  main { padding: 16px 12px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .vinyl, .lcd-track.scroll .lcd-text { animation: none !important; }
  .lcd-track.scroll b + b { display: none; }
  .tonearm { transition: none; }
  .rec[data-state="recording"] .rec-dot { animation: none; }
}
