:root {
  --bg: #0a0c10;
  --bg-elev: #12151c;
  --bg-hover: #1b2029;
  --border: #242b38;
  --text: #eef2f8;
  --text-dim: #8b96ab;
  --accent: #22d9a7;
  --accent2: #1db954;
  --accent-soft: rgba(34, 217, 167, .14);
  --danger: #ff5b6a;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* ambient gradient orbs — central orb follows the equalizer palette (--eq-glow) */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(34, 217, 167, .12), transparent 70%),
    radial-gradient(700px 500px at 85% 90%, rgba(29, 185, 84, .10), transparent 70%),
    radial-gradient(820px 560px at 50% 32%, var(--eq-glow, rgba(34, 217, 167, .10)), transparent 72%);
  pointer-events: none;
  transition: background 1.1s ease;
}

/* soft glow behind the equalizer — color follows the track palette (--eq-glow) */
.eq-glow {
  position: fixed;
  left: 50%;
  top: 30%;
  width: 720px;
  height: 460px;
  transform: translateX(-50%);
  border-radius: 50%;
  background-color: var(--eq-glow, rgba(34, 217, 167, 0));
  filter: blur(110px);
  opacity: .55;
  z-index: -1;
  pointer-events: none;
  transition: background-color 1.4s ease;
}

.mono { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* listeners table */
.list-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin: 6px 0 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.tbl thead th { position: sticky; top: 0; text-align: left; padding: 6px 8px; background: var(--bg-elev); color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border); }
.tbl tbody td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl .ip { font-family: var(--mono); color: var(--accent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.small { font-size: 11px; }
.dim { color: var(--text-dim); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt { margin-top: 16px; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hdr { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span { color: var(--text); -webkit-text-fill-color: var(--text); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
}
.brand-genre { font-size: 11px; color: var(--text-dim); }
.hdr-right { display: flex; align-items: center; gap: 12px; }

.badge {
  background: var(--accent);
  color: #03130d;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}
.badge.live { animation: pulse 2s infinite; }
.badge.off { background: #4a5262; color: #0c0f14; animation: none; }
@keyframes pulse { 0%,100% {opacity:1} 50% {opacity:0.6} }

/* admin gear link in header */
.admin-link {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
}
.admin-link:hover { color: var(--accent); border-color: var(--accent); }

.listeners { font-size: 12px; }
.listeners { color: var(--accent2); }
.listeners.zero { color: var(--text-dim); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

.player { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.now { display: flex; gap: 16px; align-items: center; }
.art {
  width: 72px; height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: #1a1f29;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.now-info { min-width: 0; }
.now .artist {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}
.now .title { font-size: 21px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* video + equalizer surfaces */
.video-shell, .eq-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #05070a;
  border: 1px solid var(--border);
}
.video-shell video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.eq-shell { background: linear-gradient(180deg, #0b0e14, #07090d); }
.eq-canvas { width: 100%; height: 100%; display: block; }
.eq-hint {
  position: absolute;
  bottom: 10px; left: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(139, 150, 171, .6);
  text-transform: uppercase;
}

/* always-on mini equalizer (cheap, ~10fps, survives video mode too) */
.mini-eq {
  width: 64px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0a0c10;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color .15s;
}
.mini-eq:hover { border-color: var(--accent2); }

.seekbar { display: flex; flex-direction: column; gap: 4px; }
.seekbar-track {
  position: relative;
  height: 6px;
  background: #0a0c10;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.03);
}
.seekbar-buffer {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: #30394a;
  width: 0%;
  pointer-events: none;
}
.seekbar-played {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: linear-gradient(to right, var(--accent2), var(--accent));
  width: 0%;
  pointer-events: none;
}
.seekbar-handle {
  position: absolute;
  width: 13px; height: 13px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 50%;
  top: 50%; transform: translate(-50%, -50%);
  left: 0%;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(34, 217, 167, .6);
}
.seekbar-labels { display: flex; justify-content: space-between; align-items: center; }
.live-hint { color: var(--accent); font-weight: 700; letter-spacing: 1px; }

.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mode-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mode-btn {
  border: none;
  background: var(--bg-hover);
  color: var(--text-dim);
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}
.mode-btn.active { background: var(--accent); color: #03130d; font-weight: 700; }
.mode-btn:not(.active):hover { background: var(--bg-hover); color: var(--text); }

.btn {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #03130d; font-weight: 700; }
.btn-xs { padding: 2px 7px; font-size: 12px; border-radius: 6px; margin-left: 8px; }

/* ── Play/pause pill switch (minimal, smooth) ─────────────────────────── */
.pill-switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  user-select: none;
}
.pill-switch input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.pill-track {
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: 16px;
  background: linear-gradient(180deg, #232a38, #1a1f2a);
  border: 1px solid #3a4254;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, .55),
    0 1px 0 rgba(255, 255, 255, .04);
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
  flex-shrink: 0;
}
.pill-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f5f7fb, #c6ced9);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, .5),
    inset 0 1px 1px rgba(255, 255, 255, .7),
    inset 0 -1px 2px rgba(0, 0, 0, .15);
  transition: transform .3s cubic-bezier(.4, 1.2, .5, 1), background .3s ease;
}
.pill-switch input:checked + .pill-track {
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-color: var(--accent);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, .35),
    0 0 16px rgba(34, 217, 167, .45);
}
.pill-switch input:checked + .pill-track .pill-thumb {
  transform: translateX(26px);
  background: linear-gradient(180deg, #ffffff, #dcecf4);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, .4),
    inset 0 1px 1px rgba(255, 255, 255, .8);
}
.pill-switch:hover .pill-track { border-color: #4a5468; }
.pill-switch:hover input:checked + .pill-track { border-color: #35e180; box-shadow: inset 0 2px 4px rgba(0,0,0,.35), 0 0 22px rgba(34,217,167,.6); }
.switch-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .3px;
  transition: color .2s;
}
.pill-switch input:checked ~ .switch-caption { color: var(--accent); }
.btn-danger { color: var(--danger); border-color: rgba(255, 91, 106, .4); }
.btn-danger:hover { background: rgba(255, 91, 106, .12); }
.goat-btn { font-size: 15px; border-color: rgba(255, 196, 0, .35); }
.goat-btn:not(.voted):hover { border-color: rgba(255, 196, 0, .8); filter: brightness(1.25); }
.goat-btn.voted { border-color: rgba(255, 196, 0, .8); background: rgba(255, 196, 0, .1); }
.goat-btn .goat-count-num { font-variant-numeric: tabular-nums; }
.goat-btn.pop { animation: goatPop .5s ease; }
@keyframes goatPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(-6deg); }
  70% { transform: scale(.9); }
  100% { transform: scale(1); }
}
.status-msg { font-size: 12px; color: var(--text-dim); margin-left: auto; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }

.panel { padding: 16px 18px; }
.panel h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.list { list-style: none; max-height: 340px; overflow-y: auto; }
.list li {
  padding: 7px 10px;
  border-radius: 8px;
  transition: background .1s;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.list li:hover { background: var(--bg-hover); }
.list li .l { flex: 1; min-width: 0; overflow: hidden; }
.list li .r { flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.list li.current { background: var(--accent-soft); }
.list li.current .t-title { color: var(--accent); font-weight: 700; }
.list li.track { cursor: default; }
.list li.track:nth-child(odd) { background: rgba(255,255,255,0.015); }
.list li.track .t-artist {
  color: var(--text-dim);
  font-size: 12px;
  display: block;
  letter-spacing: 0.3px;
}
.list li.track .t-title {
  font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list li.hist .h-when { font-size: 10px; }
.list li.empty { color: var(--text-dim); font-style: italic; }

.mini-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  width: 24px; height: 24px;
  line-height: 1;
  cursor: pointer;
  font-size: 13px;
}
.mini-btn:hover { color: var(--accent); border-color: var(--accent); }
.mini-btn.ok:hover { color: var(--accent2); border-color: var(--accent2); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.mini-btn.pending-play.playing { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.stats .stat b { color: var(--text); font-weight: 600; margin-right: 4px; }
.stats .stat .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.on { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); }
.dot.off { background: #4a5262; }
.dot.err { background: var(--danger); }

.library-list { max-height: 440px; }
.badge-mini {
  display: inline-block;
  font-size: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  color: var(--text-dim);
  font-weight: 600;
}
.badge-mini.ok { color: var(--accent2); border-color: rgba(29, 185, 84, .4); }

.in {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}
.in.num { width: 64px; }
.in:focus { outline: none; border-color: var(--accent); }
.lib-tools { display: inline-flex; gap: 8px; flex-wrap: wrap; }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px 0 0; font-size: 12px; color: var(--text-dim); }

.foot { display: flex; justify-content: center; padding: 8px 0 24px; }

.hidden-audio { display: none; }

/* ── admin ── */
.admin-body .card { max-width: 1080px; margin: 0 auto; }
.login-card { max-width: 420px; margin: 40px auto 0; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { font-size: 18px; }
.login-row { display: flex; gap: 8px; }
.login-row .in { flex: 1; }
.queue-block { margin-bottom: 8px; }
.queue-block:last-child { margin-bottom: 0; }
.queue-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.chip {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .6px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.chip-audio { color: var(--accent); }
.chip-video { color: #ff9f7f; }
.track .r { gap: 8px; }
.mini-flag { font-size: 12px; opacity: .8; }
.admin-clickable { cursor: pointer; }
.admin-clickable:hover .t-title { color: var(--accent); }
.plan-row { display: flex; gap: 8px; margin-bottom: 10px; }
.plan-row .in:first-child { flex: 1; }
.pending-list li { align-items: flex-start; }
.pending-list .r { align-items: center; }
.pending-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.pending-preview-row audio { height: 32px; flex: 1; min-width: 0; }
.pending-preview-row .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }

.plan-status { margin-bottom: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.plan-status .loader { margin-right: 6px; vertical-align: middle; }
.plan-log { margin: 6px 0 0; max-height: 180px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; font-size: 11px; line-height: 1.45; color: var(--text-dim); }
.blacklist-list li { align-items: flex-start; }
.blacklist-list .r { align-items: center; }

/* scrollbars */
.list::-webkit-scrollbar, .eq-shell::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-track { background: transparent; }
.list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.list::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

@media (max-width: 600px) {
  body { padding: 14px; }
  .now { flex-direction: column; align-items: flex-start; }
  .art { width: 96px; height: 96px; }
  .controls { flex-direction: column; align-items: stretch; }
  .status-msg { margin-left: 0; }
}
