:root {
  --bg: #08070d;
  --bg-2: #11101c;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f1ff;
  --muted: #948dad;
  --amber: #ffb648;
  --magenta: #ff3d81;
  --teal: #2de2c4;
  --violet: #8b5cf6;
  --danger: #ff5a5f;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue",
    "Noto Sans Thai", "Leelawadee UI", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(255, 61, 129, 0.18), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, rgba(139, 92, 246, 0.18), transparent 55%),
    radial-gradient(900px 800px at 50% 120%, rgba(45, 226, 196, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* subtle film grain */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 20px 18px 120px; }

/* ---------- typography ---------- */
.brand {
  font-weight: 900; letter-spacing: -0.02em; line-height: 0.95;
  text-transform: uppercase;
}
.eyebrow {
  font: 600 11px/1 var(--font-mono); letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--muted);
}
.glow-amber { text-shadow: 0 0 24px rgba(255, 182, 72, 0.5); color: var(--amber); }
.glow-mag { text-shadow: 0 0 24px rgba(255, 61, 129, 0.5); color: var(--magenta); }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--magenta), var(--amber));
  display: grid; place-items: center; font-size: 18px;
  box-shadow: 0 6px 24px rgba(255, 61, 129, 0.35);
}
.logo .name { font-weight: 900; letter-spacing: -0.01em; font-size: 17px; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 12px/1 var(--font-mono); color: var(--teal);
  background: rgba(45, 226, 196, 0.08); border: 1px solid rgba(45, 226, 196, 0.25);
  padding: 7px 11px; border-radius: 999px;
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
  box-shadow: 0 0 10px var(--teal); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- now playing card ---------- */
.now {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  display: flex; gap: 14px; align-items: center; margin-bottom: 22px;
}
.now .art { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; flex: none;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5); }
.now .meta { min-width: 0; }
.now .label { font: 600 10px/1 var(--font-mono); letter-spacing: 0.22em; color: var(--amber);
  text-transform: uppercase; margin-bottom: 6px; }
.now .title { font-weight: 800; font-size: 17px; line-height: 1.2; margin: 0 0 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .artist { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq { display: flex; gap: 3px; align-items: flex-end; height: 22px; margin-left: auto; flex: none; }
.eq span { width: 4px; background: linear-gradient(var(--amber), var(--magenta)); border-radius: 2px;
  animation: bounce 0.9s ease-in-out infinite; }
.eq span:nth-child(2){ animation-delay: .15s } .eq span:nth-child(3){ animation-delay: .3s }
.eq span:nth-child(4){ animation-delay: .45s } .eq span:nth-child(5){ animation-delay: .6s }
@keyframes bounce { 0%,100% { height: 5px } 50% { height: 22px } }
.paused .eq span { animation-play-state: paused; }

/* ---------- queue list ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.section-head h2 { margin: 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.queue { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px;
  background: var(--panel); transition: transform .25s, border-color .25s;
}
.row.top { border-color: rgba(255, 182, 72, 0.5); background: rgba(255, 182, 72, 0.06); }
.rank { font: 800 15px/1 var(--font-mono); width: 26px; text-align: center; color: var(--muted); flex: none; }
.row.top .rank { color: var(--amber); }
.row .art { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: none; }
.row .info { min-width: 0; flex: 1; }
.row .t { font-weight: 700; font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .a { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { font: 800 13px/1 var(--font-mono); color: var(--teal); min-width: 40px; text-align: right; }
.votebtn {
  flex: none; border: none; cursor: pointer; border-radius: 12px; padding: 9px 13px;
  font-weight: 800; font-size: 13px; color: #1a0a12;
  background: linear-gradient(135deg, var(--amber), var(--magenta));
  display: inline-flex; align-items: center; gap: 6px; transition: transform .1s, filter .2s;
}
.votebtn:active { transform: scale(0.94); }
.votebtn:disabled { filter: grayscale(0.7) brightness(0.7); cursor: not-allowed; }
.voted { color: var(--teal); font: 700 12px/1 var(--font-mono); padding: 9px 6px; }

/* ---------- add bar (sticky bottom) ---------- */
.addbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: linear-gradient(180deg, transparent, var(--bg) 26%);
  padding: 24px 18px 18px;
}
.addbar .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 9px; }
.addbar input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 14px 15px; font-size: 15px; font-family: var(--font-sans);
}
.addbar input:focus { outline: none; border-color: var(--magenta); }
.addbar button {
  border: none; cursor: pointer; border-radius: 14px; padding: 0 18px; font-weight: 800; font-size: 15px;
  color: #1a0a12; background: linear-gradient(135deg, var(--teal), var(--amber));
}
.cooldown { text-align: center; font: 600 12px/1 var(--font-mono); color: var(--amber); margin: 0 0 9px; min-height: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: #1c1830; border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 10;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(255,90,95,0.5); color: #ffb3b5; }
.toast.ok { border-color: rgba(45,226,196,0.5); color: var(--teal); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: 14px; }
