/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg: #14101a;
  --bg-panel: #1e1726;
  --bg-panel-raised: #271d33;
  --border: rgba(242, 237, 233, 0.09);
  --text: #f2ede9;
  --text-dim: #9c8fa6;
  --magenta: #ff2e92;
  --cyan: #2ee6d6;
  --magenta-dim: #7a1a4c;
  --cyan-dim: #157a70;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}

button, input { font-family: inherit; }

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Gate screen ─────────────────────────────────────────────────── */
#gate-waveform {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
}

.gate-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 40px 36px;
}

.marquee {
  font-family: var(--font-display);
  font-size: clamp(48px, 10vw, 84px);
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--text);
  text-shadow:
    0 0 12px rgba(255, 46, 146, 0.55),
    0 0 34px rgba(46, 230, 214, 0.25);
}

.gate-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
}

.gate-fine {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  max-width: 360px;
  text-align: center;
}
.gate-fine code {
  color: var(--cyan);
}

.passcode-dots {
  display: flex;
  gap: 14px;
  height: 18px;
}
.passcode-dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.passcode-dots .dot.filled {
  background: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 0 0 10px rgba(255, 46, 146, 0.7);
}
.passcode-dots.shake {
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 14px;
}

.key {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}
.key:active {
  transform: scale(0.94);
}
.key:hover {
  background: var(--bg-panel-raised);
  box-shadow: 0 0 0 1px var(--cyan-dim), 0 0 16px rgba(46, 230, 214, 0.25);
}
.key-ghost {
  color: var(--text-dim);
  font-size: 20px;
}
.key-accent {
  background: var(--magenta-dim);
  border-color: var(--magenta);
  color: var(--text);
}
.key-accent:hover {
  box-shadow: 0 0 0 1px var(--magenta), 0 0 18px rgba(255, 46, 146, 0.45);
}

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-panel), transparent);
}
.topbar-brand {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--text);
}
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover {
  color: var(--magenta);
  border-color: var(--magenta);
}

/* ── Console layout ──────────────────────────────────────────────── */
#app-screen {
  flex-direction: column;
  align-items: stretch;
  padding-top: 48px;
  padding-bottom: 88px;
}

.console {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}

.channel {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.channel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.channel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}

.view { display: none; }
.view.active { display: block; }

.search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
}
.search-input:focus {
  outline: none;
  border-color: var(--cyan-dim);
}

.track-list, .playlist-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-row, .playlist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dim);
}
.track-row:hover, .playlist-row:hover {
  background: var(--bg-panel-raised);
  color: var(--text);
}
.track-row img, .playlist-row img {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.track-row-text, .playlist-row-text {
  min-width: 0;
  overflow: hidden;
}
.track-row-title, .playlist-row-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}
.track-row-sub {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-note {
  color: var(--text-dim);
  font-size: 13px;
  padding: 10px 4px;
}

.back-row {
  color: var(--cyan);
  font-size: 13px;
  padding: 6px 4px 10px;
  cursor: pointer;
}

/* ── Center stage ────────────────────────────────────────────────── */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  min-height: 0;
}

.disc-wrap {
  position: relative;
  width: min(38vh, 280px);
  height: min(38vh, 280px);
}

.disc-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 46, 146, 0.25), transparent 70%);
  filter: blur(4px);
  transition: opacity 0.15s ease, transform 0.08s ease;
  opacity: 0.5;
}

.disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(255,255,255,0.03) 0 2px, transparent 2px 5px),
    #0e0b13;
  border: 6px solid var(--bg-panel-raised);
  box-shadow: 0 0 0 1px var(--border), 0 12px 40px rgba(0,0,0,0.5);
  animation: spin 14s linear infinite;
  animation-play-state: paused;
  display: flex;
  align-items: center;
  justify-content: center;
}
.disc.spinning { animation-play-state: running; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.disc img#disc-art {
  width: 58%;
  height: 58%;
  border-radius: 50%;
  object-fit: cover;
}

.disc-hole {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--bg-panel-raised);
}

.now-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.03em;
  margin: 0;
  text-align: center;
}
.now-artist {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── Visualizer ──────────────────────────────────────────────────── */
.visualizer {
  width: 100%;
  height: 220px;
  display: block;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.visualizer-caption {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
  margin: 10px 2px 0;
}

/* ── Deck bar ─────────────────────────────────────────────────────── */
.deck {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 88px;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 22px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
}

.deck-transport {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.deck-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}
.deck-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.deck-btn-main {
  width: 48px;
  height: 48px;
  background: var(--magenta-dim);
  border-color: var(--magenta);
  font-size: 16px;
}
.deck-btn-main:hover {
  box-shadow: 0 0 16px rgba(255, 46, 146, 0.45);
  color: var(--text);
}

.deck-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.deck-time {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  width: 38px;
  flex-shrink: 0;
}
.deck-time:last-child { text-align: right; }

.deck-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.deck-vol-icon { font-size: 14px; }

.fader {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  flex: 1;
  cursor: pointer;
}
.fader-short { width: 90px; flex: none; }
.fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px rgba(46, 230, 214, 0.6);
  cursor: pointer;
}
.fader::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  cursor: pointer;
}

/* ── Small screens ───────────────────────────────────────────────── */
@media (max-width: 820px) {
  .console { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .channel-right { display: none; }
  .channel-left { max-height: 34vh; }
  .deck { gap: 14px; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .disc { animation: none; }
}
