:root {
  --bg: #0b1020;
  --bg2: #101830;
  --card: rgba(255,255,255,0.05);
  --line: rgba(255,255,255,0.1);
  --text: #eef1f8;
  --muted: rgba(238,241,248,0.55);
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --gold: #ffd76a;
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  min-height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2450 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.topbar { padding: 14px 20px; border-bottom: 1px solid var(--line); background: rgba(11,16,32,0.7); backdrop-filter: blur(8px); }
.topbar-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; font-weight: 800; }
.logo-elite { color: var(--gold); }
.me-chip { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); }
.me-chip img { width:26px; height:26px; border-radius:50%; border:2px solid var(--accent); }
.me-chip .plat-badge { font-size: 12px; }

.container { max-width: 560px; margin: 0 auto; padding: 20px; }

.screen.hidden { display:none; }
.center-box { text-align:center; padding: 48px 16px; }
.center-box h2 { font-size: 26px; margin-bottom: 10px; }
.big-emoji { font-size: 60px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.spinner { width: 44px; height:44px; margin: 0 auto 18px; border:4px solid var(--line); border-top-color: var(--accent); border-radius:50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  margin-top: 18px; padding: 12px 30px; font-size: 16px; font-weight:700; color:#fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: 12px; cursor: pointer; transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn.big { font-size: 18px; padding: 16px 44px; }

/* Now playing */
.now-playing {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 20px; margin-bottom: 16px;
}
.disc {
  width: 88px; height: 88px; border-radius: 50%; flex-shrink: 0; position: relative;
  background: conic-gradient(from 0deg, #6366f1, #8b5cf6, #ec4899, #6366f1);
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  animation: spin 8s linear infinite;
}
.disc::after {
  /* progress ring — how far through the current song we are */
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--gold) var(--progress, 0deg), rgba(255,255,255,0.12) 0deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}
.disc.paused { animation-play-state: paused; }
.disc-hole { position:absolute; width: 20px; height:20px; border-radius:50%; background: var(--bg); border: 2px solid rgba(255,255,255,0.3); }
.disc-label { position:absolute; width: 44px; height:44px; border-radius:50%; background: rgba(11,16,32,0.85); display:flex; align-items:center; justify-content:center; font-size: 22px; }

.np-info { flex: 1; min-width: 0; }
.np-cat { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold); margin-bottom: 4px; }
.np-title { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.np-artist { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.np-count { font-size: 12px; }

/* Equalizer bars */
.eq { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.eq span { width: 4px; border-radius: 2px; background: linear-gradient(180deg, var(--gold), var(--accent)); animation: eqb 1s ease-in-out infinite; }
.eq span:nth-child(1){ animation-delay:0s } .eq span:nth-child(2){ animation-delay:0.15s }
.eq span:nth-child(3){ animation-delay:0.3s } .eq span:nth-child(4){ animation-delay:0.45s }
.eq span:nth-child(5){ animation-delay:0.6s }
.eq.stopped span { animation-play-state: paused; height: 6px; }
@keyframes eqb { 0%,100% { height: 6px; } 50% { height: 26px; } }

/* Controls */
.controls { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px 20px; margin-bottom: 20px; }
.vol-row { display: flex; align-items: center; gap: 14px; }
.vol-btn {
  background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.35);
  border-radius: 12px; width: 44px; height: 44px; font-size: 20px; cursor: pointer;
  color: var(--text); transition: filter 0.15s, transform 0.1s; flex-shrink: 0;
}
.vol-btn:hover { filter: brightness(1.3); }
.vol-btn:active { transform: scale(0.92); }

/* Custom range slider with gradient fill */
input[type="range"] {
  flex: 1; height: 32px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2) var(--fill, 70%), rgba(255,255,255,0.12) var(--fill, 70%));
}
input[type="range"]::-moz-range-track {
  height: 10px; border-radius: 999px;
  background: rgba(255,255,255,0.12);
}
input[type="range"]::-moz-range-progress {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%; margin-top: -6px;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent);
}
.vol-pct { font-size: 13px; color: var(--muted); width: 42px; text-align: right; font-weight: 700; }
.controls-hint { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }

.footer { text-align: center; padding: 20px; color: var(--muted); font-size: 12.5px; }
.footer a { color: rgba(255,255,255,0.5); text-decoration: none; }
.footer a:hover { color: var(--gold); }

/* Legal */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.card h2 { font-size: 22px; margin-bottom: 6px; }
.card h3 { font-size: 15px; margin: 18px 0 8px; color: var(--gold); }
.legal-p { font-size: 13.5px; line-height: 1.65; color: rgba(238,241,248,0.85); margin-bottom: 8px; }
.legal-list { padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: rgba(238,241,248,0.85); }
.legal-list li { margin-bottom: 6px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ── Countdown overlay ──────────────────────────────────────────────── */
.countdown {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2450 0%, var(--bg) 55%);
  display: flex; align-items: center; justify-content: center;
}
.countdown.hidden { display: none; }
.cd-inner { text-align: center; }
.cd-num {
  font-size: 140px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--gold), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: cdpulse 1s ease-in-out infinite;
}
@keyframes cdpulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: 0.85; } }
.cd-label { margin-top: 14px; color: var(--muted); font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }

/* ── Leaderboard ─────────────────────────────────────────────────── */
.lb-card {
  background: linear-gradient(135deg, rgba(255,193,7,0.10), rgba(99,102,241,0.08));
  border: 1px solid rgba(255,193,7,0.28); border-radius: 20px;
  padding: 14px 16px; margin-bottom: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.lb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lb-title { font-size: 15px; color: var(--gold); letter-spacing: 0.3px; white-space: nowrap; }
.lb-sub { font-size: 11.5px; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-show {
  background: rgba(255,193,7,0.15); border: 1px solid rgba(255,193,7,0.4);
  color: var(--gold); border-radius: 999px; padding: 5px 14px; font-size: 12px;
  font-weight: 700; cursor: pointer; white-space: nowrap; transition: filter 0.15s;
}
.lb-show:hover { filter: brightness(1.25); }
.lb-rows { display: flex; flex-direction: column; gap: 5px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 12px; font-size: 13.5px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
}
.lb-row.me {
  background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.22));
  border-color: rgba(99,102,241,0.5);
}
.lb-row.muted-row { background: transparent; border: none; color: var(--muted); }
.lb-medal { width: 26px; text-align: center; font-size: 16px; flex-shrink: 0; }
.lb-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.1);
  font-size: 12px; font-weight: 800; color: var(--muted);
}
.lb-av { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); flex-shrink: 0; }
.lb-initial {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
}
.lb-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lb-you-tag {
  font-style: normal; font-size: 10px; font-weight: 800; color: #0b1020;
  background: var(--gold); border-radius: 6px; padding: 1px 6px; margin-left: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.lb-hours { font-weight: 800; color: var(--gold); font-size: 13.5px; white-space: nowrap; }
.lb-you { margin-top: 6px; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; gap: 5px; }
.lb-you.hidden { display: none; }
.lb-you .lb-row { font-size: 13px; }

/* ── Modal (full leaderboard) ─────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5,8,18,0.78); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal.hidden { display: none; }
.modal-box {
  width: 100%; max-width: 460px; max-height: 82vh;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal-title { font-weight: 800; font-size: 14.5px; }
.modal-close {
  background: rgba(255,255,255,0.08); border: none; color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
.modal-close:hover { color: #fff; background: rgba(255,255,255,0.18); }
.modal-body {
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px;
}
.modal-body .lb-row { padding: 8px 12px; }

/* ── Listening dashboard ────────────────────────────────────────────── */
.listeners-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}
.lb-icon { font-size: 16px; }
.lb-count { font-weight: 700; color: var(--gold); white-space: nowrap; }
.lb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.35);
  border-radius: 999px; padding: 3px 10px 3px 3px; font-size: 12px; cursor: pointer;
  transition: filter 0.15s;
}
.chip:hover { filter: brightness(1.25); }
.chip img { width: 20px; height: 20px; border-radius: 50%; }
.chip-dot { width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* ── Chat dashboard ────────────────────────────────────────────────── */
.chat-card {
  background: linear-gradient(180deg, rgba(99,102,241,0.07), rgba(255,255,255,0.02));
  border: 1px solid var(--line); border-radius: 20px;
  margin-bottom: 20px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; cursor: pointer; font-weight: 800; font-size: 15px;
  user-select: none; letter-spacing: 0.3px;
}
.chat-head:hover { background: rgba(255,255,255,0.04); }
.chat-title { display: flex; align-items: center; gap: 8px; }
.chat-ico { font-size: 16px; }
.chat-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,0.8); display: inline-block;
}
.chat-right { display: flex; align-items: center; gap: 8px; }
.chat-chev { color: var(--muted); font-size: 12px; transition: transform 0.2s; }
.chat-body.open .chat-chev { transform: rotate(180deg); }
.chat-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 2px 8px; font-weight: 800;
  animation: pop 0.25s ease;
}
@keyframes pop { 0% { transform: scale(0.6); } 100% { transform: scale(1); } }
.chat-body { border-top: 1px solid var(--line); padding: 12px; }
.chat-body.hidden { display: none; }
.chat-msgs {
  max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 6px 4px; scroll-behavior: smooth;
}
.chat-empty { text-align: center; padding: 20px 0; font-size: 13px; }
.msg {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px 14px 14px 4px; padding: 9px 12px; font-size: 13.5px;
  max-width: 88%; align-self: flex-start;
  animation: fadeUp 0.25s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.mine {
  background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(139,92,246,0.22));
  border-color: rgba(99,102,241,0.45); align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
}
.msg-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.msg-avatar { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); }
.msg-name { font-weight: 800; font-size: 12.5px; cursor: pointer; }
.msg-name:hover { text-decoration: underline; }
.msg-time { font-size: 10.5px; color: rgba(255,255,255,0.35); margin-left: auto; }
.msg-mention {
  background: linear-gradient(135deg, rgba(139,92,246,0.4), rgba(99,102,241,0.35));
  border-radius: 8px; padding: 1px 7px; font-size: 11.5px; color: #e2d6ff;
  font-weight: 700;
}
.msg-text { word-wrap: break-word; white-space: pre-wrap; line-height: 1.45; }
.msg-reply {
  font-size: 12px; color: var(--muted); margin-bottom: 5px;
  padding: 4px 9px; background: rgba(255,255,255,0.05); border-left: 3px solid var(--accent);
  border-radius: 8px; cursor: pointer; display: flex; gap: 6px; align-items: baseline;
}
.msg-reply .rep-snip {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255,255,255,0.55);
}
.msg-actions {
  display: flex; gap: 4px; margin-top: 5px; opacity: 0.25; transition: opacity 0.15s;
}
.msg:hover .msg-actions { opacity: 1; }
.msg-act {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-size: 12px; cursor: pointer; padding: 2px 8px; border-radius: 8px;
  transition: filter 0.15s;
}
.msg-act:hover { filter: brightness(1.4); }
.chat-reply-chip {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(99,102,241,0.15));
  border: 1px solid rgba(139,92,246,0.45);
  border-radius: 12px; padding: 7px 12px; margin: 8px 0; font-size: 12.5px;
  animation: fadeUp 0.2s ease;
}
.chat-reply-chip.hidden { display: none; }
.chat-reply-chip span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-x {
  background: rgba(255,255,255,0.1); border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; width: 22px; height: 22px; border-radius: 50%;
}
.chip-x:hover { color: #fff; background: rgba(255,255,255,0.2); }
.chat-compose {
  display: flex; gap: 8px; margin-top: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 5px 5px 16px; align-items: center;
  transition: border-color 0.15s;
}
.chat-compose:focus-within { border-color: var(--accent); }
.chat-compose input {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-size: 14px; outline: none; min-width: 0;
}
.chat-compose input::placeholder { color: rgba(255,255,255,0.35); }
.chat-compose .btn.small {
  margin-top: 0; padding: 0; width: 38px; height: 38px; border-radius: 50%;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
