/* ------------------------------------------------------------------
   Disco — shared design tokens & components
   ------------------------------------------------------------------ */
:root {
  --bg-0: #07080b;
  --bg-1: #101218;
  --bg-2: #16181f;
  --bg-3: #1d2029;
  --bg-4: #262934;
  --line: rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.10);

  --text: #e8eaef;
  --text-dim: #a8acb6;
  --text-mute: #6b6f7a;

  --chrome-1: #cdd2dc;
  --chrome-2: #9aa1b1;
  --chrome-3: #6b7384;

  --accent: #ff7a59;
  --accent-soft: #ff9c7e;
  --accent-glow: rgba(255,122,89,0.35);

  --ok: #7bd88f;
  --warn: #ffb454;
  --err: #ff6b8a;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 32px -16px rgba(0,0,0,0.6);
  --shadow-pop:  0 24px 60px -20px rgba(0,0,0,0.7), 0 2px 0 rgba(255,255,255,0.04) inset;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-glow); color: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 100px;
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.btn:hover { background: var(--bg-4); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #1a0e08;
  font-weight: 600;
  border: 0;
  box-shadow: 0 8px 24px -8px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-soft); }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: rgba(255,107,138,0.08); border-color: rgba(255,107,138,0.3); }
.btn svg { width: 14px; height: 14px; }

.icon-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--text-mute);
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg-4); color: var(--text); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.icon-btn svg { width: 14px; height: 14px; }

.icon-btn-ghost {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-mute);
}
.icon-btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.icon-btn-ghost svg { width: 14px; height: 14px; }

.round-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  display: grid; place-items: center;
  color: var(--text-dim);
}
.round-btn:hover { background: rgba(0,0,0,0.6); color: var(--text); }
.round-btn svg { width: 14px; height: 14px; }

/* ---------- inputs ---------- */
.input {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 10px 16px;
  color: var(--text);
  font: inherit;
  outline: 0;
  transition: border-color 120ms, background 120ms;
}
.input:focus { border-color: var(--accent); background: var(--bg-4); }
.input::placeholder { color: var(--text-mute); }

/* ---------- pills/badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-3);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.pill.live { color: var(--accent); border-color: rgba(255,122,89,0.3); background: rgba(255,122,89,0.08); }
.pill.owner { color: var(--warn); border-color: rgba(255,180,84,0.3); background: rgba(255,180,84,0.08); }

/* ---------- brand ---------- */
.brand {
  display: flex; align-items: center; gap: 12px;
}
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--chrome-1) 30%, var(--chrome-2) 60%, var(--chrome-3) 100%);
  box-shadow: 0 0 24px rgba(205,210,220,0.15), inset -4px -6px 10px rgba(0,0,0,0.25);
  overflow: hidden;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-logo img { width: 110%; height: 110%; object-fit: cover; }
.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-mute);
  margin-top: 4px;
}

/* ---------- avatar / chrome cover ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--chrome-1), var(--chrome-3));
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  color: rgba(0,0,0,0.6);
  flex-shrink: 0;
}

/* ---------- queue rows ---------- */
.queue-table { display: flex; flex-direction: column; }
.queue-head {
  display: grid;
  grid-template-columns: 32px 56px 1fr 100px 80px;
  gap: 16px;
  padding: 8px 16px;
  color: var(--text-mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.queue-row {
  display: grid;
  grid-template-columns: 32px 56px 1fr 100px 80px;
  gap: 16px;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--r-md);
  transition: background 120ms;
  color: var(--text-dim);
  user-select: none;
  -webkit-user-select: none;
}
/* Player's queue gets an extra leading column for the drag handle. The
   actions column has duration + 4 icon-btns (jump, up, down, remove) plus
   gaps, so it needs ~170px to avoid overlap with the addedBy column. The
   playlist-songs and search-results templates reuse .queue-row but don't
   render a handle, so they keep the original 5-column layout. */
#player-content .queue-head,
#player-content .queue-row {
  grid-template-columns: 20px 32px 56px 1fr 100px 170px;
}
.queue-row .drag-handle {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  color: var(--text-mute);
  opacity: 0;
  cursor: grab;
  transition: opacity 120ms;
  touch-action: none;
}
/* SVG must not eat clicks — let the handle div be the event target. */
.queue-row .drag-handle svg { width: 14px; height: 14px; pointer-events: none; }
.queue-row:hover .drag-handle { opacity: 0.55; }
.queue-row .drag-handle:hover { opacity: 1; color: var(--text); }
.queue-row .drag-handle:active { cursor: grabbing; }
.queue-row-ghost { opacity: 0.35; background: rgba(114,137,218,0.08); }
.queue-row-chosen { background: rgba(114,137,218,0.18); }
.queue-row:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.queue-row.current { background: rgba(114,137,218,0.10); }
.queue-row.current:hover { background: rgba(114,137,218,0.16); }
.queue-row.current .title { color: var(--accent, #7289DA); font-weight: 600; }
.queue-row .idx { font-variant-numeric: tabular-nums; font-size: 13px; text-align: center; }
.queue-row .thumb {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--chrome-3), #2a2d36);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.queue-row .thumb::after {
  content: "♪";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.35);
  font-size: 18px;
}
.queue-row .title {
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-row .sub {
  color: var(--text-mute);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-row .duration {
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
  font-size: 13px;
  text-align: right;
}
.queue-row .actions {
  display: flex; gap: 2px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 120ms;
}
.queue-row:hover .actions { opacity: 1; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); border: 2px solid transparent; background-clip: padding-box; }

/* ---------- standalone page wrapper (for admin / login / unauthorized) ---------- */
.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,122,89,0.10), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(98,163,255,0.08), transparent 50%),
    var(--bg-0);
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  padding: 36px;
  width: 100%;
  max-width: 540px;
}
.section-h {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.muted { color: var(--text-mute); }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
code.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--bg-3);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
}
