/* ===========================================================
   Design tokens — dark glass, Apple-Music-inspired
   =========================================================== */
:root {
  --bg-0: #0a0510;
  --glass-fill: rgba(255, 255, 255, 0.055);
  --glass-fill-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 105, 180, 0.16);
  --glass-border-strong: rgba(255, 105, 180, 0.28);
  --text-0: rgba(255, 255, 255, 0.97);
  --text-1: rgba(255, 220, 245, 0.62);
  --text-2: rgba(255, 220, 245, 0.36);
  --accent-a: #ff2e92;
  --accent-b: #c04bff;
  --accent-grad: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  --danger: #ff453a;
  --success: #32d74b;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --blur: blur(10px);
  --glass-highlight: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 0 0 1px rgba(255,255,255,0.03);
  --font-display: -apple-system, "SF Pro Display", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --font-body: -apple-system, "SF Pro Text", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-0);
  /* Static gradient "glow" — same colors as before, but painted once by the
     GPU and left alone, instead of animated blurred shapes recomputed every
     frame. This is the single biggest performance win: no filter, no
     animation, no per-frame cost at all. */
  background:
    radial-gradient(circle at 12% -8%, rgba(255, 46, 146, 0.30), transparent 42%),
    radial-gradient(circle at 92% 2%, rgba(192, 75, 255, 0.26), transparent 46%),
    radial-gradient(circle at 35% 115%, rgba(255, 95, 184, 0.16), transparent 45%),
    var(--bg-0);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* subtle film-grain texture for a tactile, premium surface */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Starfield ----------
   A single pre-rendered tile (drawn once by starfield.js into a <canvas>,
   then used as a plain background-image) instead of 80+ individually
   animated DOM elements. Twinkle is one opacity animation on the whole
   layer — a compositor-only property, so it costs virtually nothing no
   matter how "busy" the pattern looks. */
.starfield {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-repeat: repeat;
  animation: twinkle-all 6s ease-in-out infinite;
  will-change: opacity;
}
@keyframes twinkle-all { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

/* A handful of bigger sparkle stars for visual interest — transform/opacity
   only (no filter, no blur), which the compositor can animate for free. */
.star-big {
  position: fixed; color: #c86bff; opacity: 0.8; pointer-events: none; z-index: -2;
  animation-name: starfloat; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate;
  will-change: transform, opacity;
}
.star-big svg { width: 100%; height: 100%; fill: currentColor; }
@keyframes starfloat {
  0% { transform: translateX(calc(-1 * var(--dx, 10px))); opacity: 0.5; }
  100% { transform: translateX(var(--dx, 10px)); opacity: 0.9; }
}

::selection { background: rgba(255, 55, 95, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 5px; font-size: 0.92em; }

/* ---------- Glass primitives ---------- */
.glass { background: linear-gradient(160deg, rgba(255,255,255,0.075), var(--glass-fill)); border: 1px solid var(--glass-border); box-shadow: var(--glass-highlight), 0 20px 40px -24px rgba(0,0,0,0.6); }
.glass-strong { background: linear-gradient(160deg, rgba(255,255,255,0.12), var(--glass-fill-strong)); border: 1px solid var(--glass-border-strong); box-shadow: var(--glass-highlight), 0 24px 48px -20px rgba(0,0,0,0.65); }

/* The now-playing bar sits fixed over scrolling content, so it's the one
   place a live blur is actually worth its cost — kept small and cheap. */
.now-playing.glass-strong { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.is-scrolling .now-playing.glass-strong { backdrop-filter: none; -webkit-backdrop-filter: none; }
body.is-scrolling::before { display: none; }
.card { border-radius: var(--radius-lg); transition: transform .35s var(--ease), background .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-fill-strong);
  color: var(--text-0); font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em;
  transition: transform .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.14); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { border: none; background: var(--accent-grad); color: #fff; box-shadow: 0 8px 24px -8px rgba(255, 55, 95, 0.55); }
.btn-primary:hover { box-shadow: 0 10px 30px -6px rgba(255, 55, 95, 0.7); }
.btn-danger { color: var(--danger); border-color: rgba(255,69,58,0.35); }
.btn-danger:hover { background: rgba(255,69,58,0.14); }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-1); font-weight: 600; letter-spacing: .01em; }
.field input[type="text"], .field input[type="password"], .field input[type="number"],
.field select, .field textarea {
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); color: var(--text-0); padding: 11px 14px;
  font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-a); background: rgba(255,255,255,0.08); }
.field input::placeholder { color: var(--text-2); }

.file-drop {
  border: 1.5px dashed var(--glass-border-strong); border-radius: var(--radius-md);
  padding: 22px; text-align: center; color: var(--text-1); font-size: 13.5px;
  cursor: pointer; transition: border-color .2s, background .2s; background: rgba(255,255,255,0.03);
}
.file-drop:hover { border-color: var(--accent-a); background: rgba(255,55,95,0.06); }
.file-drop input { display: none; }
.file-drop .fname { color: var(--text-0); font-weight: 600; margin-top: 4px; }

/* ---------- Top bar + search ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  padding: 16px 28px;
  background: rgba(14,6,16,0.85);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.is-scrolling .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; }
.topbar.admin-topbar { display: flex; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.03em; flex-shrink: 0; justify-self: start; }
.brand { background: linear-gradient(135deg, #fff, #fff 40%, rgba(255,220,245,0.75)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent-grad); box-shadow: 0 0 16px rgba(255,46,146,0.9), 0 0 3px rgba(255,46,146,1); -webkit-text-fill-color: initial; }
.topbar-spacer { justify-self: end; }

.live-viewers {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,46,146,0.07); border: 1px solid var(--glass-border);
  font-size: 13px; font-weight: 600; color: var(--text-0); white-space: nowrap;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #34d67a; box-shadow: 0 0 8px rgba(52,214,122,0.9);
  animation: live-pulse 1.6s ease-in-out infinite;
}
.live-label { color: var(--text-2); font-weight: 500; }
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.75); }
}
@media (max-width: 720px) {
  .live-viewers { padding: 6px 10px; font-size: 12px; }
}

.search-wrap {
  grid-column: 2; justify-self: center;
  width: 100%; max-width: 440px; min-width: 220px; display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(255,46,146,0.07); border: 1px solid var(--glass-border);
  box-shadow: 0 0 0 0 rgba(255,46,146,0);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.search-wrap:focus-within { border-color: var(--accent-a); background: rgba(255,46,146,0.12); box-shadow: 0 0 22px -4px rgba(255,46,146,0.55); }
.search-wrap svg { color: var(--accent-a); flex-shrink: 0; }
.search-wrap input { flex: 1; background: none; border: none; outline: none; color: var(--text-0); font-size: 14px; font-family: inherit; text-align: center; }
.search-wrap input::placeholder { color: var(--text-2); }
.search-wrap input:focus { text-align: left; }

.container { max-width: 1180px; margin: 0 auto; padding: 34px 28px 160px; }
.container > * { animation: viewfade .4s var(--ease); }
@keyframes viewfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.section-title { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 34px 0 16px; }

.list-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sort-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.sort-wrap label { font-size: 12.5px; color: var(--text-1); font-weight: 600; }

/* Custom glass dropdown (replaces native <select>, which can't be themed) */
.dropdown { position: relative; }
.dropdown-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); color: var(--text-0);
  border-radius: 999px; padding: 7px 8px 7px 16px; font-size: 13px; font-family: inherit; font-weight: 600;
  outline: none; cursor: pointer; transition: background .2s, border-color .2s;
}
.dropdown-btn:hover { background: rgba(255,255,255,0.1); }
.dropdown-btn svg { color: var(--text-2); transition: transform .25s var(--ease); }
.dropdown.open .dropdown-btn svg { transform: rotate(180deg); }
.dropdown.open .dropdown-btn { border-color: var(--accent-a); background: rgba(255,255,255,0.1); }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 170px; z-index: 60;
  background: rgba(22,20,26,0.95); border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-md); padding: 6px; box-shadow: var(--glass-highlight), 0 20px 44px -12px rgba(0,0,0,0.7);
  opacity: 0; transform: translateY(-6px) scale(0.97); pointer-events: none;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.dropdown.open .dropdown-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: none; color: var(--text-1); font-size: 13.5px; font-family: inherit; font-weight: 600;
  text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s, color .15s;
}
.dropdown-item:hover { background: rgba(255,255,255,0.08); color: var(--text-0); }
.dropdown-item.selected { color: var(--text-0); background: rgba(255,55,95,0.14); }
.dropdown-item.selected::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-grad); flex-shrink: 0; }

/* ---------- Grids / tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 20px; }
.tile { padding: 14px; cursor: pointer; position: relative; overflow: hidden; contain: layout paint; }
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.14) 45%, transparent 60%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.tile:hover::before { transform: translateX(120%); }
.tile:hover { transform: translateY(-5px); background: var(--glass-fill-strong); box-shadow: var(--glass-highlight), 0 24px 40px -16px rgba(255,55,95,0.28), 0 24px 48px -20px rgba(0,0,0,0.7); }
.tile-cover {
  width: 100%; aspect-ratio: 1; border-radius: var(--radius-md);
  background: var(--accent-grad); background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px; position: relative; overflow: hidden;
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.18);
}
.tile-cover svg { width: 34%; height: 34%; opacity: .85; }
.tile-title { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { font-size: 12.5px; color: var(--text-1); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Song rows ---------- */
.song-row { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: var(--radius-md); transition: background .2s, box-shadow .2s; position: relative; content-visibility: auto; contain-intrinsic-size: auto 68px; }
.song-item:not(:last-child) .song-row::after {
  content: ""; position: absolute; left: 60px; right: 12px; bottom: 0; height: 1px; background: rgba(255,255,255,0.055);
}
.song-row:hover { background: rgba(255,255,255,0.06); }
.song-row:hover::after, .song-row.active::after { opacity: 0; }
.song-row.active { background: rgba(255,55,95,0.12); box-shadow: inset 0 0 0 1px rgba(255,55,95,0.25); }
.song-cover { width: 46px; height: 46px; border-radius: 8px; flex-shrink: 0; background: var(--accent-grad); background-size: cover; background-position: center; box-shadow: 0 4px 12px -4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15); }
.song-meta { flex: 1; min-width: 0; }
.song-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 12.5px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-dur { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; width: 40px; text-align: right; flex-shrink: 0; }
.desc-toggle {
  flex-shrink: 0; background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
  color: var(--text-1); font-size: 11.5px; font-weight: 600; font-family: inherit;
  padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.desc-toggle:hover, .desc-toggle.open { color: var(--text-0); border-color: var(--accent-a); background: rgba(255,55,95,0.12); }
.song-desc {
  padding: 2px 18px 14px 74px; font-size: 13px; line-height: 1.6; color: var(--text-1);
  white-space: pre-wrap; word-break: break-word;
}
.song-play-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; flex-shrink: 0;
  background: #fff; color: #0a0a0d; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px -2px rgba(0,0,0,0.5); transition: background .2s, transform .15s, color .2s;
}
.song-play-btn:hover { transform: scale(1.06); }
.song-row:hover .song-play-btn, .song-row.active .song-play-btn { background: var(--accent-grad); color: #fff; }

/* ---------- Song stats: views + like (YouTube-style) ---------- */
.song-stats { display: flex; align-items: center; gap: 14px; flex-shrink: 0; height: 22px; }
.stat, .like-btn { height: 22px; box-sizing: border-box; line-height: 1; }
.stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.stat svg, .like-btn svg { flex-shrink: 0; width: 14px; height: 14px; display: block; }
.like-btn {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 0; margin: 0; border-radius: 999px;
  font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; font-family: inherit;
  transition: color .2s, transform .15s;
}
.like-btn:hover { color: var(--text-0); transform: scale(1.08); }
.like-btn.liked { color: var(--accent-a); }
.like-btn.liked svg { fill: var(--accent-a); }
.like-btn.pop svg { animation: likepop .35s var(--ease); }
@keyframes likepop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 90px 20px; color: var(--text-1); }
.empty h3 { color: var(--text-0); font-family: var(--font-display); font-size: 20px; margin-bottom: 8px; }

/* ---------- Setup banner ---------- */
.setup-banner { display: none; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.setup-banner .glass-strong { max-width: 460px; padding: 34px; border-radius: var(--radius-xl); text-align: center; }
.setup-banner h1 { font-family: var(--font-display); font-size: 21px; margin: 4px 0 12px; }
.setup-banner p { color: var(--text-1); font-size: 14px; line-height: 1.6; }

/* ---------- Now playing bar ---------- */
.now-playing {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 12px 22px;
  background: rgba(10,10,13,0.92);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -12px 32px -8px rgba(0,0,0,0.55);
  display: grid; grid-template-columns: 1fr minmax(280px, 640px) 1fr;
  align-items: center; gap: 18px;
  transform: translate3d(0, 110%, 0);
  transition: transform .45s var(--ease);
  will-change: transform;
  backface-visibility: hidden;
}
.now-playing.show { transform: translate3d(0, 0, 0); }

.np-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np-cover { width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0; background: var(--accent-grad); background-size: cover; background-position: center; box-shadow: 0 6px 16px -6px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08), inset 0 1px 0 rgba(255,255,255,0.2); }
.np-info { min-width: 0; }
.np-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 12px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.np-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.np-controls { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.np-controls button { background: none; border: none; color: var(--text-1); display: flex; position: relative; flex-shrink: 0; transition: color .2s, transform .12s; }
.np-controls button:hover { color: var(--text-0); }
.np-controls button:active { transform: scale(0.88); }
.np-controls button.active { color: var(--accent-a); }
.np-play {
  width: 46px; height: 46px; border-radius: 50%; background: #fff !important; color: #0a0a0d !important;
  display: flex; align-items: center; justify-content: center; overflow: visible;
  border: 2px solid rgba(255,46,146,0.55);
  box-shadow: 0 0 20px -2px rgba(255,46,146,0.65), 0 0 46px -6px rgba(192,75,255,0.5), 0 4px 14px -4px rgba(0,0,0,0.6);
  transition: box-shadow .25s, transform .15s;
}
.np-play svg { width: 17px; height: 17px; fill: #0a0a0d !important; display: block; }
.np-play:hover { box-shadow: 0 0 28px -2px rgba(255,46,146,0.85), 0 0 60px -6px rgba(192,75,255,0.65), 0 4px 14px -4px rgba(0,0,0,0.6); }
.np-play:active { transform: scale(0.94); }
.np-play.is-playing { animation: np-breathe 1.8s ease-in-out infinite; }
@keyframes np-breathe {
  0%, 100% { box-shadow: 0 0 20px -2px rgba(255,46,146,0.65), 0 0 46px -6px rgba(192,75,255,0.5), 0 4px 14px -4px rgba(0,0,0,0.6); }
  50% { box-shadow: 0 0 30px 2px rgba(255,46,146,0.9), 0 0 64px -4px rgba(192,75,255,0.75), 0 4px 14px -4px rgba(0,0,0,0.6); }
}
.repeat-one-badge {
  position: absolute; top: -6px; right: -7px; background: var(--accent-a); color: #fff;
  font-size: 8.5px; font-weight: 800; width: 13px; height: 13px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.np-progress { display: flex; align-items: center; gap: 8px; width: 100%; }
.np-time { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; width: 36px; text-align: center; }

.np-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px; flex: 1; cursor: pointer;
  background: linear-gradient(to right, var(--accent-a) var(--fill, 0%), rgba(255,255,255,0.14) 0);
  transition: box-shadow .2s;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12), 0 0 10px -1px rgba(255,55,95,0.7); margin-top: -4.5px;
  transition: transform .15s;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]::-moz-range-track { background: rgba(255,255,255,0.14); height: 4px; border-radius: 3px; }
input[type="range"]::-moz-range-progress { background: var(--accent-a); height: 4px; border-radius: 3px; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: none; box-shadow: 0 0 10px -1px rgba(255,55,95,0.7); }

.vol-wrap { display: flex; align-items: center; gap: 8px; width: 120px; }

.eq { display: flex; align-items: flex-end; gap: 2px; height: 14px; width: 14px; }
.eq span { width: 2.5px; height: 100%; background: var(--accent-a); border-radius: 2px; transform-origin: bottom; animation: eqbounce 1s ease-in-out infinite; }
.eq span:nth-child(1) { animation-delay: -0.9s; }
.eq span:nth-child(2) { animation-delay: -0.5s; }
.eq span:nth-child(3) { animation-delay: -0.2s; }
@keyframes eqbounce { 0%, 100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }
.eq.paused span { animation-play-state: paused; transform: scaleY(0.25) !important; }

/* ---------- Playlist header ---------- */
.playlist-header { display: flex; gap: 26px; align-items: flex-end; padding: 26px; margin-bottom: 10px; }
.playlist-header .tile-cover { width: 190px; height: 190px; margin: 0; flex-shrink: 0; }
.playlist-header h1 { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
.playlist-header p { color: var(--text-1); margin: 0; font-size: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-1); font-size: 13.5px; font-weight: 600; margin-bottom: 18px; }
.back-link:hover { color: var(--text-0); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 12px 22px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: rgba(30,26,34,0.95); border: 1px solid var(--glass-border-strong);
  opacity: 0; pointer-events: none; transition: all .35s var(--ease); z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Modal (song editing) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5,2,8,0.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 100%; max-width: 480px; padding: 28px; border-radius: var(--radius-xl);
  max-height: 86vh; overflow-y: auto;
  transform: translateY(10px) scale(0.98); transition: transform .2s var(--ease);
}
.modal-overlay.show .modal-card { transform: translateY(0) scale(1); }
.modal-card h2 { font-family: var(--font-display); font-size: 18px; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* ---------- Admin-specific shared bits ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 34px; border-radius: var(--radius-xl); text-align: center; }
.login-card h1 { font-family: var(--font-display); font-size: 22px; margin: 4px 0 26px; }
.login-card .field { margin-bottom: 16px; text-align: left; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }
.lock-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }

.admin-shell { display: none; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; }
.panel { padding: 24px; border-radius: var(--radius-lg); }
.panel h2 { font-family: var(--font-display); font-size: 17px; margin: 0 0 18px; }
.panel form { display: flex; flex-direction: column; gap: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--glass-border-strong); background: rgba(255,255,255,0.05); color: var(--text-1); transition: all .2s; }
.chip.selected { background: var(--accent-grad); color: #fff; border-color: transparent; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; }

/* ---------- Analytics panel ---------- */
.analytics-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.analytics-stat {
  flex: 1; min-width: 140px; text-align: center; padding: 18px 12px; border-radius: var(--radius-md);
  background: rgba(255,46,146,0.07); border: 1px solid var(--glass-border);
}
.analytics-stat-num {
  font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.02em;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.analytics-stat-label { margin-top: 6px; font-size: 12px; color: var(--text-2); font-weight: 600; line-height: 1.4; }
.analytics-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.analytics-date { width: 90px; flex-shrink: 0; font-size: 12.5px; color: var(--text-1); font-weight: 600; }
.analytics-bar-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.analytics-bar { height: 100%; border-radius: 999px; background: var(--accent-grad); min-width: 3px; }
.analytics-count { width: 34px; text-align: right; flex-shrink: 0; font-size: 12.5px; color: var(--text-0); font-weight: 700; }
.list-item:hover { background: rgba(255,255,255,0.05); }
.list-item .thumb { width: 40px; height: 40px; border-radius: 8px; background: var(--accent-grad); background-size: cover; background-position: center; flex-shrink: 0; }
.list-item .info { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: 12px; color: var(--text-1); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr; row-gap: 12px; padding: 14px 18px; }
  .brand { justify-self: center; }
  .search-wrap { grid-column: 1; max-width: 100%; }
  .topbar-spacer { grid-column: 1; justify-self: center; }
  .now-playing { grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 12px 14px; }
  .np-right { display: none; }
  .np-center { grid-column: 2; min-width: 0; }
  .np-controls { gap: 10px; }
  .playlist-header { flex-direction: column; align-items: flex-start; }
  .playlist-header .tile-cover { width: 130px; height: 130px; }
  .container { padding: 24px 16px 180px; }
  .song-stats { gap: 10px; }
  .song-dur { display: none; }
}
@media (max-width: 480px) {
  .stat:not(.like-btn) span { display: none; }
  #np-shuffle, #np-repeat { display: none; }
  .np-controls { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
