:root {
  --bg: #0b0b12;
  --bg-2: #12121c;
  --panel: #161623;
  --panel-2: #1d1d2d;
  --line: #2a2a3d;
  --text: #ececf4;
  --muted: #9a9ab2;
  --accent: #7c5cff;
  --accent-2: #a38bff;
  --accent-soft: rgba(124, 92, 255, .16);
  --danger: #ff5c7a;
  --ok: #3ddc97;
  --discord: #5865f2;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .14), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(61, 220, 151, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
.spacer { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { display: block; }

/* ── top bar ─────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px;
  background: rgba(11, 11, 18, .78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.brand img, .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.brand-mark { background: linear-gradient(135deg, var(--accent), #3ddc97); display: grid; place-items: center; color: #fff; }
.guild-switch { position: relative; }
.guild-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px 5px 5px; max-width: 280px;
}
.guild-btn:hover { border-color: #3a3a55; }
.guild-btn #guild-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.chev { color: var(--muted); font-size: 12px; }
.gicon {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--panel-2) center/cover; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
}
.guild-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 260px; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px;
}
.guild-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; padding: 8px; border-radius: 10px;
}
.guild-menu button:hover, .guild-menu button.active { background: var(--panel-2); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); margin-left: auto; }
.server-chip {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 14px 5px 5px; font-weight: 600; max-width: 260px;
}
.server-chip #guild-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewonly { font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.audio-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); color: var(--muted); border: 1px solid var(--line);
}
.audio-badge.lossless { color: var(--ok); border-color: rgba(61, 220, 151, .45); background: rgba(61, 220, 151, .08); }
.audio-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
body.viewonly .controls button, body.viewonly .sub-controls, body.viewonly .add-bar,
body.viewonly .track .actions, body.viewonly #btn-clear, body.viewonly #btn-dedupe, body.viewonly #btn-join { display: none !important; }
body.viewonly .progress { cursor: default; }
.user { display: flex; align-items: center; gap: 10px; }
.user img { width: 30px; height: 30px; border-radius: 50%; }
.user span { font-weight: 600; }

/* ── buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; text-decoration: none;
  transition: transform .08s ease, filter .15s ease, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.discord { background: var(--discord); color: #fff; font-size: 16px; padding: 13px 26px; }
.btn.discord:hover { filter: brightness(1.1); }
.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; color: var(--muted);
}
.ghost:hover { color: var(--text); border-color: #3a3a55; }
.ghost.small { padding: 5px 10px; font-size: 13px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; transition: color .15s, background .15s, transform .08s;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { color: var(--accent-2); }
.icon-btn.small { width: 34px; height: 34px; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.play-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: #fff; color: #111;
  display: grid; place-items: center; box-shadow: 0 8px 30px rgba(124, 92, 255, .45); transition: transform .08s;
}
.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: scale(.95); }
.play-btn svg { width: 28px; height: 28px; }
.play-btn:disabled { opacity: .4; cursor: default; transform: none; }
.chip {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; color: var(--muted); transition: all .15s;
}
.chip:hover { color: var(--text); border-color: #3a3a55; }
.chip.on { color: #fff; background: var(--accent-soft); border-color: var(--accent); }
.chip.danger:hover { color: var(--danger); border-color: var(--danger); }
.chip:disabled { opacity: .4; cursor: default; }

/* ── views ───────────────────────────────── */
main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 60px; }
.view.center { min-height: 70vh; display: grid; place-items: center; }
.login-card {
  text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  padding: 44px 40px; max-width: 420px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 18px 0 6px; font-size: 28px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 26px; line-height: 1.5; }
.login-card .tiny { margin: 18px 0 0; }
.login-mark {
  width: 72px; height: 72px; margin: 0 auto; border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), #3ddc97); display: grid; place-items: center; color: #fff;
}
.login-mark svg { width: 36px; height: 36px; }
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 8px 0 16px; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 36px; }
.guild-card {
  display: flex; align-items: center; gap: 14px; padding: 16px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, transform .1s; text-decoration: none; color: var(--text);
}
.guild-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.guild-card .gicon { width: 48px; height: 48px; font-size: 16px; }
.guild-card .gname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-card .gsub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.guild-card .gsub.live { color: var(--ok); }

/* ── player layout ───────────────────────── */
.player { display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 24px; align-items: start; }
.np-card {
  position: relative;
  border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
}
.np-bg {
  position: absolute; inset: -40px; background: center/cover; filter: blur(50px) saturate(1.4); opacity: .45;
  transition: background-image .4s;
}
.np-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22, 22, 35, .3), var(--panel) 85%); }
.np-inner { position: relative; padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.np-art-wrap { aspect-ratio: 1 / 1; width: 100%; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); background: var(--panel-2); }
.np-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-art.placeholder { display: grid; place-items: center; color: #3a3a55; background: linear-gradient(135deg, #1d1d2d, #15151f); }
.np-art.placeholder svg { width: 30%; height: 30%; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); display: flex; align-items: center; gap: 8px; }
.eyebrow .eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.eyebrow .eq i { width: 3px; background: var(--accent-2); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eyebrow .eq i:nth-child(2) { animation-delay: -.3s; }
.eyebrow .eq i:nth-child(3) { animation-delay: -.6s; }
.paused .eyebrow .eq i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.np-title { font-size: 22px; line-height: 1.25; margin: 6px 0 4px; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-title a { color: inherit; text-decoration: none; }
.np-title a:hover { text-decoration: underline; }
.np-author { color: var(--muted); font-weight: 500; }
.np-req { color: var(--muted); font-size: 13px; margin-top: 6px; }
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.time { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); width: 44px; }
.time:last-child { text-align: right; }
.progress { position: relative; flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); cursor: pointer; }
.progress::before { content: ""; position: absolute; inset: -8px 0; }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.progress-fill::after {
  content: ""; position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); transform: scale(0); transition: transform .12s;
}
.progress:hover .progress-fill::after { transform: scale(1); }
.progress-hover { position: absolute; top: -30px; transform: translateX(-50%); background: #000; padding: 3px 7px; border-radius: 6px; font-size: 12px; pointer-events: none; opacity: 0; }
.progress:hover .progress-hover { opacity: 1; }
.progress.disabled { cursor: default; }
.progress.disabled .progress-hover { display: none; }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.sub-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.volume { display: flex; align-items: center; gap: 8px; width: 100%; }
.vol-val { width: 44px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 6px; outline: none;
  background: linear-gradient(90deg, var(--accent) var(--fill, 30%), rgba(255, 255, 255, .12) var(--fill, 30%));
}
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; }
.select-wrap select {
  appearance: none; background: rgba(255, 255, 255, .03) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9ab2'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 30px 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.select-wrap select.on { color: #fff; border-color: var(--accent); background-color: var(--accent-soft); }
.select-wrap option { background: var(--panel); color: var(--text); }
.listeners { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.listeners img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); margin-left: -6px; }
.listeners img:first-of-type { margin-left: 0; }
.listeners span { font-size: 12.5px; color: var(--muted); margin-left: 8px; }

/* ── queue ───────────────────────────────── */
.queue-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 20px; min-width: 0; }
.add-bar { position: relative; display: flex; gap: 10px; }
.add-input { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.add-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-icon { color: var(--muted); }
.add-icon svg { width: 18px; height: 18px; }
.add-input input { flex: 1; background: none; border: 0; outline: none; padding: 12px 0; min-width: 0; }
.results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 10; max-height: 460px; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px;
}
.results .loading, .results .none { padding: 18px; text-align: center; color: var(--muted); }
.tabs { display: flex; align-items: center; gap: 6px; margin: 18px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tab { background: none; border: 0; padding: 7px 12px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.tab.active { color: var(--text); background: var(--panel-2); }
.count { background: var(--accent-soft); color: var(--accent-2); border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.track-list { list-style: none; margin: 0; padding: 0; }
.track {
  display: grid; grid-template-columns: 28px 48px 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 10px; border-radius: 12px; transition: background .12s;
}
.track:hover { background: rgba(255, 255, 255, .04); }
.track.dragging { opacity: .4; }
.track.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.track.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.track .idx { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; cursor: grab; }
.track .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.track .info { min-width: 0; }
.track .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .title a { color: inherit; text-decoration: none; }
.track .title a:hover { text-decoration: underline; }
.track .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.track .dur { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track .actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.track:hover .actions, .track:focus-within .actions { opacity: 1; }
.track .actions .icon-btn { width: 32px; height: 32px; }
.track .actions .icon-btn svg { width: 16px; height: 16px; }
.track .actions .icon-btn.del:hover { color: var(--danger); }
.results .track { grid-template-columns: 48px 1fr auto auto; }
.results .track .actions { opacity: 1; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty p { margin: 6px 0; }
.empty-mark { width: 54px; height: 54px; margin: 0 auto 12px; color: #3a3a55; }

/* ── toasts ──────────────────────────────── */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: center; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px; animation: pop .2s ease; max-width: 90vw;
}
.toast.error { border-color: var(--danger); color: #ffd1da; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.conn-banner { background: rgba(255, 92, 122, .12); color: #ffd1da; border: 1px solid rgba(255, 92, 122, .4); padding: 8px 14px; border-radius: 10px; font-size: 13px; text-align: center; margin-bottom: 16px; }

/* ── responsive ──────────────────────────── */
@media (min-width: 921px) and (min-height: 940px) {
  .np-card { position: sticky; top: 84px; }
}
@media (max-width: 920px) {
  .player { grid-template-columns: 1fr; }
  .np-card { position: relative; top: 0; }
  .np-art-wrap { max-width: 280px; margin: 0 auto; }
}
@media (max-width: 600px) {
  main { padding: 16px 12px 40px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  #bot-name, #user-name { display: none; }
  .guild-btn { max-width: 170px; }
  .np-inner { padding: 18px; }
  .queue-panel { padding: 14px; border-radius: 18px; }
  .track { grid-template-columns: 22px 40px 1fr auto; gap: 10px; }
  .track .thumb { width: 40px; height: 40px; }
  .track .dur { display: none; }
  .track .actions { opacity: 1; gap: 0; }
  .track .actions .icon-btn { width: 28px; height: 28px; }
  .track .actions .icon-btn[title="Move to top"] { display: none; }
  .tab { white-space: nowrap; padding: 7px 8px; }
  #q-total { display: none; }
  .results .track { grid-template-columns: 40px 1fr auto; }
  .add-bar .btn { padding: 11px 14px; }
}
