/* n3r4.xyz front page: a two-deck controller (a DJ-505-style body over a Serato-style library) */

[data-deck="a"] { --deck: var(--cue-b); }
[data-deck="b"] { --deck: var(--cue-e); }

.ds-letter {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 3px;
  background: var(--deck); color: #000; font-weight: 700; font-size: 18px; box-shadow: 0 0 14px color-mix(in srgb, var(--deck) 50%, transparent);
}
.ds-letter.small { width: 22px; height: 22px; font-size: 12px; }
/* the waveform behind the top bar */
.topbar { position: relative; overflow: hidden; }
.topbar > :not(.topwave) { position: relative; z-index: 1; }
.topwave { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .32; pointer-events: none; transition: opacity .6s ease; }
.topbar.on-air .topwave { opacity: .85; }
.topbar.on-air { box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--cue-d) 30%, transparent); }

/* full screen */
.fs { align-self: center; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink-faint); }
.fs svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
.fs:hover { color: var(--accent); border-color: var(--line-2); }
.fs.on { color: var(--accent); }
.fs[hidden] { display: none; }
:fullscreen body, :-webkit-full-screen body { overflow-y: auto; }

/* ---------- controller ---------- */
.controller { display: grid; grid-template-columns: 1fr 230px 1fr; gap: 0; padding: 0; }
.deck { padding: 14px 16px 16px; display: grid; gap: 14px; align-content: start; }
.deck[data-deck="a"] { border-right: 1px solid var(--line); }
.deck[data-deck="b"] { border-left: 1px solid var(--line); }
.deck-head { display: flex; justify-content: space-between; }
.deck-name { color: var(--deck); }
.deck-body { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.deck[data-deck="a"] .deck-body { grid-template-columns: auto 1fr; }
.deck[data-deck="a"] .tempo { order: -1; }
.deck[data-deck="b"] .tempo { order: 2; }

/* jog wheel: one spiral that is a groove, a pocketing toolpath and a tree's rings */
.jog-wrap { display: grid; place-items: center; }
.jog {
  position: relative; width: min(100%, 300px); aspect-ratio: 1; border-radius: 50%;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.jog:active { cursor: grabbing; }
.jog { transition: opacity .25s, filter .25s; }
.jog.idle { opacity: .4; filter: saturate(.35); cursor: default; }
.jog:focus-visible { outline-offset: 6px; }
.platter { width: 100%; height: 100%; display: block; overflow: visible; }
.platter .rim { fill: #0b0c0f; stroke: var(--line-2); stroke-width: 1.2; }
.platter .ring-led { fill: none; stroke: var(--deck); stroke-width: 1.4; stroke-dasharray: 2 4.5; opacity: .9; filter: drop-shadow(0 0 2px var(--deck)); }
.platter .groove { fill: none; stroke: #262a31; stroke-width: .55; }
.platter .marker { stroke: var(--deck); stroke-width: 2.4; stroke-linecap: round; filter: drop-shadow(0 0 3px var(--deck)); }
.platter .label-disc { fill: #050607; }
.platter .label-ring { fill: none; stroke: var(--deck); stroke-width: 1; }
.jog.has-img .jog-center { display: none; }
.jog-center {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 2px; pointer-events: none;
}
.jog-idx { font-size: clamp(20px, 3vw, 28px); color: var(--deck); text-shadow: 0 0 10px color-mix(in srgb, var(--deck) 60%, transparent); }
.jog-of { font-size: 10px; }

/* faders. TEMPO is a channel selector: 1 at the top, one detent per channel */
.tempo { display: grid; justify-items: center; gap: 8px; }
.tempo-rail { display: grid; grid-template-columns: auto auto; gap: 2px; }
.deck[data-deck="a"] .ticks { order: -1; }
.vfader.tfader { direction: ltr; }
.ticks { list-style: none; margin: 0; padding: 7px 0; display: flex; flex-direction: column; justify-content: space-between; }
.ticks li { font: 9px/1 var(--f-seg); color: var(--ink-faint); text-align: center; min-width: 10px; }
.ticks li.on { color: var(--deck); text-shadow: 0 0 6px var(--deck); }
.vfader {
  -webkit-appearance: none; appearance: none; writing-mode: vertical-lr; direction: rtl;
  width: 28px; height: 190px; background: transparent; margin: 0; cursor: ns-resize;
}
.vfader::-webkit-slider-runnable-track { width: 4px; background: #000; border: 1px solid var(--line-2); border-radius: 2px; }
.vfader::-moz-range-track { width: 4px; background: #000; border: 1px solid var(--line-2); border-radius: 2px; }
.vfader::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 14px; margin-left: -13px; border-radius: 2px;
  background: linear-gradient(180deg, #3a4048, #1a1d22 45%, #e6e9ed 47% 53%, #1a1d22 55%, #2b3036);
  border: 1px solid #000; box-shadow: 0 2px 3px rgba(0,0,0,.6);
}
.vfader::-moz-range-thumb {
  width: 28px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, #3a4048, #1a1d22 45%, #e6e9ed 47% 53%, #1a1d22 55%, #2b3036);
  border: 1px solid #000;
}
.seg.small { font-size: 12px; }

/* the music player's CUE and PLAY, under the crossfader, with what's playing between them */
.transport { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.transport .mid { display: grid; justify-items: center; gap: 4px; min-width: 0; flex: 1; }
.now { color: var(--cue-d); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: .04em; }
.now:empty { display: none; }
.btn.round:disabled { opacity: .35; cursor: default; }
.btn.round {
  width: 40px; height: 40px; border-radius: 50%; justify-content: center; padding: 0; font-size: 9px;
  background: #0d0f12; border-color: var(--line); box-shadow: none; color: var(--ink-faint);
}
.btn.round:hover { color: var(--ink); border-color: var(--line-2); }
.btn.play:hover { color: var(--cue-d); }
.btn.cue:hover { color: var(--cue-b); }
.btn.round.lit { color: var(--cue-d); border-color: color-mix(in srgb, var(--cue-d) 60%, #000); box-shadow: 0 0 10px color-mix(in srgb, var(--cue-d) 35%, transparent); }
.btn.round.hit { transform: translateY(1px); }

/* 8 pads, one bank, across the whole controller */
.pads { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; grid-column: 1 / -1; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.pad {
  --pc: var(--line-2);
  position: relative; aspect-ratio: 1.6; border-radius: 6px; display: grid; place-items: end start; padding: 7px 8px;
  font: 700 10px/1.1 var(--f-pixel); text-transform: uppercase; letter-spacing: .08em; text-decoration: none; color: var(--ink);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--pc) 26%, #121418), #0c0d10 80%);
  border: 1px solid color-mix(in srgb, var(--pc) 55%, #000);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--pc) 22%, transparent), 0 2px 0 #000;
  cursor: pointer; overflow: hidden; transition: transform .06s, box-shadow .15s;
}
.pad::after { content: attr(data-n); position: absolute; top: 6px; right: 8px; font: 9px var(--f-seg); color: color-mix(in srgb, var(--pc) 70%, #000); }
.pad:hover { box-shadow: inset 0 0 26px color-mix(in srgb, var(--pc) 45%, transparent), 0 0 14px color-mix(in srgb, var(--pc) 35%, transparent), 0 2px 0 #000; }
.pad:active, .pad.hit { transform: translateY(1px); background: radial-gradient(circle at 50% 45%, var(--pc), color-mix(in srgb, var(--pc) 40%, #000) 85%); color: #000; }
.pad.empty { cursor: default; background: #0b0c0f; box-shadow: inset 0 0 0 1px #15181c; border-color: #000; color: var(--ink-faint); }
.pad.empty::after { color: #22262c; }


/* mixer */
.mixer { padding: 14px 14px 16px; display: grid; gap: 14px; align-content: space-between; background: linear-gradient(180deg, #121519, #0c0e11); }
.channels { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.ch { display: grid; justify-items: center; gap: 10px; }
.ch-fader { height: 170px; }
.vu-v { display: grid; grid-template-rows: repeat(20, 1fr); gap: 2px; width: 10px; height: 120px; }
.vu-v i { background: #15181c; border-radius: 1px; }
.vu-v i.on { background: var(--cue-d); box-shadow: 0 0 5px color-mix(in srgb, var(--cue-d) 60%, transparent); }
.vu-v i.on.hot { background: var(--cue-c); }
.vu-v i.on.peak { background: var(--cue-a); }
.master { display: grid; justify-items: center; gap: 10px; align-self: stretch; align-content: start; padding-top: 2px; }
.bpm-big { font-size: 22px; }
.beat { animation: beat var(--beat) steps(1) infinite; }
@keyframes beat { 0% { opacity: 1; } 18% { opacity: .15; } }
.xlii { margin-top: auto; display: block; opacity: .82; transition: opacity .2s, filter .2s; }
.xlii img { display: block; width: 64px; height: auto; image-rendering: pixelated; }
.xlii:hover { opacity: 1; filter: drop-shadow(0 0 6px var(--accent)); }
.xfade { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
#xfader { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; cursor: ew-resize; }
#xfader::-webkit-slider-runnable-track { height: 4px; background: #000; border: 1px solid var(--line-2); border-radius: 2px; }
#xfader::-moz-range-track { height: 4px; background: #000; border: 1px solid var(--line-2); border-radius: 2px; }
#xfader::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 28px; margin-top: -13px; border-radius: 2px; background: linear-gradient(90deg, #2b3036, #1a1d22 45%, #e6e9ed 47% 53%, #1a1d22 55%, #3a4048); border: 1px solid #000; }
#xfader::-moz-range-thumb { width: 16px; height: 28px; border-radius: 2px; background: linear-gradient(90deg, #2b3036, #1a1d22 45%, #e6e9ed 47% 53%, #1a1d22 55%, #3a4048); border: 1px solid #000; }

.xhint { text-align: center; color: var(--ink-dim); }
.xfade.nudge { animation: nudge .6s ease; border-radius: 4px; }
@keyframes nudge { 30% { box-shadow: 0 0 0 1px var(--accent), 0 0 16px color-mix(in srgb, var(--accent) 50%, transparent); } }

/* ---------- library ---------- */
.library { display: grid; grid-template-columns: 200px 1fr; min-height: 300px; padding: 0; }
.library > *, .controller > * { min-width: 0; }
.crates { border-right: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; }
.crates-h { padding: 0 14px 8px; }
.crates ul { list-style: none; margin: 0; padding: 0; }
.crate {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 14px; border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--ink-dim); font-size: 13px;
}
.crate:hover { color: var(--ink); background: #12151a; }
.crate.on { color: var(--ink); background: linear-gradient(90deg, color-mix(in srgb, var(--deck) 18%, transparent), transparent); box-shadow: inset 2px 0 0 var(--deck); }
.crate .tnum { font-size: 11px; color: var(--ink-faint); min-width: 1.2em; }
.crate .tag { font: 700 9px/1 var(--f-pixel); padding: 3px 4px; border-radius: 2px; background: var(--deck); color: #000; }
.crate .ct { margin-left: auto; font-size: 11px; color: var(--ink-faint); }
/* the channel list: one group per deck */
.ch-group { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.ch-group:first-child { padding-top: 2px; }
.ch-group .tag { font: 700 9px/1 var(--f-pixel); padding: 3px 4px; border-radius: 2px; background: var(--deck); color: #000; }
.ch-group:not(.live) { opacity: .6; }
.built { margin-top: auto; padding: 12px 14px 0; line-height: 1.5; }
.queues { display: grid; grid-template-columns: 1fr 1fr; min-width: 0; }
.queue { min-width: 0; display: flex; flex-direction: column; transition: opacity .25s; }
.queue:not(.live) { opacity: .55; }
.queue.live .q-head { box-shadow: inset 0 -2px 0 var(--deck); }
.queue[data-deck="a"] { border-right: 1px solid var(--line); }
/* the playlist's title header: the channel, and what's selected on it */
.q-head { display: grid; gap: 6px; padding: 10px 14px 8px; border-bottom: 1px solid var(--line); }
.q-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.q-chan { color: var(--deck); font-size: 12px; white-space: nowrap; }
.q-count { white-space: nowrap; }
.q-meta { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-dim); }
.q-now { min-width: 0; }
.q-now-t { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-now-b { color: var(--ink-dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-dname { color: var(--ink-faint); white-space: nowrap; }
.q-open { display: inline-block; margin-top: 6px; color: var(--deck); text-decoration: none; }
.q-open:hover { text-decoration: underline; }
.q-open[hidden] { display: none; }
.q-row.playing .q-t::before { content: "♪ "; color: var(--cue-d); }
.q-list { list-style: none; margin: 0; padding: 0; max-height: min(640px, 70vh); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.q-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 14px; border-bottom: 1px solid #15181c; cursor: pointer; font-size: 13px;
}
.q-row:hover { background: #111419; }
.q-row.sel { background: linear-gradient(90deg, color-mix(in srgb, var(--deck) 20%, transparent), color-mix(in srgb, var(--deck) 4%, transparent)); box-shadow: inset 3px 0 0 var(--deck); }
.q-n { font: 11px var(--f-seg); color: var(--ink-faint); }
.q-img { width: 30px; height: 30px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line-2); }
.q-row.sel .q-img { border-color: var(--deck); }
/* gallery view: a grid of pictures */
.q-list.view-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 10px; align-content: start; }
.view-gallery .q-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 6px; border: 1px solid #15181c; border-radius: 4px; }
.view-gallery .q-img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 3px; }
.view-gallery .q-row.sel { box-shadow: inset 0 0 0 2px var(--deck); background: color-mix(in srgb, var(--deck) 10%, transparent); }
.view-gallery .q-side { display: none; }
.q-row.sel .q-n { color: var(--deck); }
.q-main { min-width: 0; }
.q-t { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-b { color: var(--ink-faint); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-side { display: flex; gap: 10px; align-items: center; color: var(--ink-faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.q-dl { color: var(--deck); text-decoration: none; font-size: 14px; padding: 2px 4px; }
.q-empty { padding: 24px 14px; color: var(--ink-faint); font-size: 13px; }
.q-empty .pixel { display: block; color: var(--deck); margin-bottom: 6px; font-size: 12px; }

/* ---------- smaller screens: both decks stay, just smaller; the crossfader picks the one you turn ---------- */
@media (max-width: 1080px) {
  .controller { grid-template-columns: 1fr 200px 1fr; }
}
@media (max-width: 860px) {
  .controller { grid-template-columns: 1fr 1fr; grid-template-areas: "a b" "mix mix" "pads pads"; }
  .deck[data-deck="a"] { grid-area: a; }
  .deck[data-deck="b"] { grid-area: b; }
  .mixer { grid-area: mix; border-top: 1px solid var(--line); padding: 10px 14px 12px; gap: 10px; }
  .deck { padding: 10px 10px 12px; gap: 8px; }
  .deck-body { gap: 6px; }
  .channels { display: none; }
  .vfader { height: 140px; width: 24px; }
  .vfader::-webkit-slider-thumb { width: 24px; height: 12px; margin-left: -11px; }
  .vfader::-moz-range-thumb { width: 24px; height: 12px; }
  .ticks { padding: 6px 0; }
  .pads { grid-template-columns: repeat(4, 1fr); padding: 12px 14px 14px; }
  .pad { aspect-ratio: 1.5; }
  .queues { grid-template-columns: 1fr; }
  .queue:not(.live) { display: none; }
  .library { grid-template-columns: 1fr; min-height: 0; align-content: start; }
  .crates { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 0 0; }
  .crates ul { display: flex; overflow-x: auto; gap: 4px; padding: 0 10px 10px; scrollbar-width: none; }
  .crate { width: auto; flex: none; white-space: nowrap; border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px; }
  .crate.on { box-shadow: inset 0 -2px 0 var(--deck); }
  .ch-group, .ch-item { flex: none; }
  .ch-group { padding: 0 4px 0 0; }
  .ch-group .label { display: none; }
  .ch-group:not(.live), .ch-item:not(.live) { display: none; }
  .built { display: none; }
  .queue[data-deck="a"] { border-right: 0; }
}
@media (max-width: 560px) {
  .q-list.view-gallery { grid-template-columns: repeat(3, 1fr); }
  .deck-head .label { font-size: 9px; }
  .deck-head .label:not(.deck-name) { display: none; }
  .tempo > .label { display: none; }
  .vfader { height: 118px; }
  .jog-idx { font-size: 18px; }
  .btn.round { width: 48px; height: 48px; }
}

/* Insert coin: blinks while it asks the tailnet, shakes "player 1 only" when there's nowhere else to go */
.coin.checking .led { animation: coin .3s steps(2) infinite; }
@keyframes coin { 50% { opacity: .2; } }
.coin.nope { animation: nope .4s; }
.coin.nope::after { content: "Player 1 only"; margin-left: 8px; color: var(--ink-faint); }
@keyframes nope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
