:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-glow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-tint: color-mix(in srgb, var(--accent) 12%, transparent);
}

body { position: relative; }

#bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#bg-particles span {
  position: absolute;
  bottom: -20px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
  animation: particle-float linear infinite;
}
@keyframes particle-float {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.35; }
  90% { opacity: 0.2; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 20px)); opacity: 0; }
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  position: relative;
  z-index: 1;
}
.top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }

.header { margin-bottom: 28px; }
h1 {
  font-family: var(--font-display);
  font-size: 27px;
  margin: 12px 0 6px;
  letter-spacing: -0.01em;
}
.sub-copy { color: var(--text-dim); font-size: 14px; margin: 0; line-height: 1.5; }

form {
  padding: 20px;
  margin-top: 24px;
  position: relative;
  overflow: visible;
}
form::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: 2px;
}
.field { margin-bottom: 12px; position: relative; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input[type="text"] {
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.field input[type="text"]:focus {
  box-shadow: var(--shadow-glow);
}
.field-note { font-size: 11px; color: var(--text-dim); margin: 6px 2px 0; }

.artist-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  animation: chip-in 0.2s ease;
}
@keyframes chip-in {
  from { opacity: 0; transform: scale(0.9) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.artist-chip button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
  transition: opacity 0.1s;
}
.artist-chip button:hover { opacity: 1; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  background: var(--surface, #14151c);
  border: 1px solid var(--border, rgba(255,255,255,0.09));
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.search-results::-webkit-scrollbar {
  width: 6px;
}
.search-results::-webkit-scrollbar-track {
  background: transparent;
}
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.search-result-item:hover,
.search-result-item.active {
  background: var(--accent-tint);
}
.search-result-item img {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2, rgba(255,255,255,0.05));
}
.search-result-item .meta { min-width: 0; flex: 1; }
.search-result-item .title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-item .channel {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.search-status {
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
}

.search-skeleton-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}
.skeleton-block {
  background: linear-gradient(90deg,
    var(--surface-2, rgba(255,255,255,0.06)) 25%,
    color-mix(in srgb, var(--accent) 14%, var(--surface-2, rgba(255,255,255,0.06))) 50%,
    var(--surface-2, rgba(255,255,255,0.06)) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.search-skeleton-item .skeleton-thumb { width: 42px; height: 42px; border-radius: 6px; flex-shrink: 0; }
.search-skeleton-item .skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.search-skeleton-item .skeleton-line { height: 10px; }
.search-skeleton-item .skeleton-line.short { width: 55%; }

.btn {
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; transform: none; }

.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple-expand {
  to { transform: scale(1); opacity: 0; }
}

.btn-primary {
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 45%, transparent);
  filter: brightness(1.06);
}

.account-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
}
.account-box .avatar { width: 26px; height: 26px; border-radius: 50%; }
.account-box .name { font-size: 13px; font-weight: 600; }
.account-box .logout-link {
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}
.account-box .logout-link:hover { color: var(--danger); }

.twitch-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #9146ff;
  color: #fff;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(145,70,255,0.35);
}
.twitch-login-btn:hover { background: #a45cff; filter: none; }

.login-gate {
  text-align: center;
  padding: 40px 24px;
}
.login-gate p { color: var(--text-dim); font-size: 14px; margin: 8px 0 20px; }

.banned-notice {
  padding: 16px 18px;
  border: 1px solid var(--danger);
  background: rgba(255, 93, 93, 0.08);
  color: var(--danger);
  font-size: 13px;
  margin-top: 24px;
}

.queue-section { margin-top: 40px; }
.queue-section h2 {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.now-playing-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface, #14151c), var(--surface, #14151c)) padding-box,
    var(--gradient-brand) border-box;
  animation: np-glow 2.4s ease-in-out infinite;
}
@keyframes np-glow {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent-tint); }
  50% { box-shadow: 0 0 18px 1px color-mix(in srgb, var(--accent) 35%, transparent); }
}
.now-playing-strip::after {
  content: "";
  position: absolute;
  inset: 1px;
  background: linear-gradient(100deg, var(--accent-tint), var(--surface, #14151c) 70%);
  border-radius: inherit;
  z-index: 0;
}

.np-ambient-bg {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.4);
  opacity: 0.35;
  z-index: 0;
  transition: background-image 0.4s ease;
}

.now-playing-strip > * { position: relative; z-index: 1; }

.now-playing-strip img.thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--accent-dim, rgba(255,255,255,0.2));
  animation: vinyl-spin 6s linear infinite;
}
@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.now-playing-strip .label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.now-playing-strip .title { font-weight: 600; font-size: 14px; margin-top: 2px; }
.now-playing-strip .sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

.now-playing-progress-track {
  height: 3px;
  width: 100%;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.now-playing-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-brand);
  border-radius: 2px;
  transition: width 0.9s linear;
  position: relative;
  overflow: hidden;
}
.now-playing-progress-fill::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: progress-shimmer 1.6s ease-in-out infinite;
}
@keyframes progress-shimmer {
  0% { transform: translateX(-60px); }
  100% { transform: translateX(160px); }
}

.now-playing-times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-display);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.queue-item .remove-own-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.queue-item .remove-own-btn:hover { color: var(--danger); border-color: var(--danger); }
.queue-item:hover { border-color: var(--accent-dim); transform: translateX(2px); }
.queue-item .thumb { width: 46px; height: 46px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.queue-index {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.queue-item .title { font-size: 13.5px; font-weight: 500; }
.queue-item .sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

.queue-item-new {
  animation: queue-item-slide-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes queue-item-slide-in {
  from { opacity: 0; transform: translateX(-16px) scale(0.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.empty-state {
  text-align: center;
  padding: 34px 20px;
  color: var(--text-dim);
  font-size: 13px;
}

.leaderboard-section {
  margin-top: 40px;
}
.leaderboard-section h2 {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

@media (min-width: 1100px) {
  .leaderboard-section {
    position: fixed;
    top: 40px;
    left: 40px;
    width: clamp(220px, calc(50% - 280px - 80px), 340px);
    margin-top: 0;
    z-index: 2;
  }
}
.lb-card { padding: 6px; }
.lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}
.lb-item + .lb-item { border-top: 1px solid var(--border); }
.lb-rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dim);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.lb-item.lb-top1 .lb-rank, .lb-item.lb-top1 .lb-name { color: #ffd23f; }
.lb-item.lb-top2 .lb-rank, .lb-item.lb-top2 .lb-name { color: #d6dbe4; }
.lb-item.lb-top3 .lb-rank, .lb-item.lb-top3 .lb-name { color: #e2985a; }
.lb-item img.avatar { width: 34px; height: 34px; }
.lb-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-count {
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--accent);
  flex-shrink: 0;
}
.lb-count .lb-count-label {
  color: var(--text-dim);
  font-family: var(--font-body);
  margin-left: 3px;
}

#confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 8px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to {
    transform: translateY(110vh) translateX(var(--drift, 0px)) rotate(var(--spin, 360deg));
    opacity: 0;
  }
}

.toast {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.toast.show {
  animation: toast-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toast-pop {
  0% { transform: translateY(12px) scale(0.9); opacity: 0; }
  60% { transform: translateY(-3px) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

#maintenance-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.10), transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(0,0,0,0.15), transparent 50%),
    linear-gradient(135deg, #ffb800 0%, #ffd23f 45%, #ffb800 100%);
  overflow: hidden;
}
#maintenance-overlay::before,
#maintenance-overlay::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  pointer-events: none;
}
#maintenance-overlay::before { width: 420px; height: 420px; top: -140px; left: -120px; }
#maintenance-overlay::after { width: 320px; height: 320px; bottom: -120px; right: -100px; }

.stripe-bar {
  position: absolute;
  left: -80px; right: -80px;
  height: 34px;
  background: repeating-linear-gradient(
    135deg,
    #14151c 0 22px,
    #ffd23f 22px 44px
  );
  background-size: 200% 100%;
  opacity: 0.9;
}
.stripe-bar.top {
  top: 0;
  animation: stripe-scroll-right 3s linear infinite;
}
.stripe-bar.bottom {
  bottom: 0;
  animation: stripe-scroll-left 3s linear infinite;
}
@keyframes stripe-scroll-right {
  from { background-position: 0 0; }
  to { background-position: 62.2px 0; }
}
@keyframes stripe-scroll-left {
  from { background-position: 0 0; }
  to { background-position: -62.2px 0; }
}

.maintenance-card {
  position: relative;
  z-index: 1;
  max-width: 460px;
  width: 100%;
  text-align: center;
  padding: 44px 32px 36px;
  border-radius: 20px;
  background: rgba(20, 21, 28, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  color: #f5f5f5;
}

.maintenance-icon-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}
.maintenance-icon-row svg {
  width: 34px;
  height: 34px;
  color: #ffd23f;
  filter: drop-shadow(0 4px 10px rgba(255, 210, 63, 0.35));
}
.maintenance-icon-row svg:nth-child(2) {
  animation: wrench-wiggle 2.4s ease-in-out infinite;
}
.maintenance-icon-row svg:nth-child(1) {
  animation: gear-spin 6s linear infinite;
}
.maintenance-icon-row svg:nth-child(3) {
  animation: spark-pulse 1.8s ease-in-out infinite;
}
@keyframes gear-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes wrench-wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg); }
}
@keyframes spark-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.05); }
}

.maintenance-eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffd23f;
  font-weight: 700;
}
.maintenance-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 10px 0 10px;
  letter-spacing: -0.01em;
}
.maintenance-copy {
  font-size: 14px;
  color: #b9bac2;
  line-height: 1.6;
  margin: 0 0 26px;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: 999px;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 8px 22px -6px rgba(88, 101, 242, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.discord-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgba(88, 101, 242, 0.75);
  filter: brightness(1.05);
}
.discord-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

#app-content.maintenance-hidden { display: none; }

.search-result-item.artist-result img {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  margin-right: 4px;
  border: 2px solid var(--accent);
}
.search-result-item.artist-result .title {
  font-weight: 700;
  color: var(--accent);
}
