/* ==========================================================================
   Mario's Lucky Block - Random Song Player
   Theme inspired by the iconic golden ? block
   ========================================================================== */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --gold-light:   #FFD700;
  --gold:         #F5C518;
  --gold-dark:    #E8A317;
  --gold-shadow:  #C6890A;
  --brown-dark:   #5C3A1E;
  --brown:        #8B6914;
  --bg-dark:      #1a1a2e;
  --bg-card:      #16213e;
  --bg-card-alt:  #0f3460;
  --accent:       #FFFFFF;
  --text:         #FFFFFF;
  --text-muted:   #b8b8d0;
  --danger:       #e94560;
  --rivet:        #fff8dc;
  --font-pixel:   'Press Start 2P', monospace;
  --font-body:    'Nunito', sans-serif;
  --radius:       12px;
  --transition:   0.25s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  /* subtle pixel-grid background */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ---------- Scrollbar (retro themed) ---------- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 5px;
  border: 2px solid var(--bg-dark);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* ---------- Container ---------- */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* ---------- Header ---------- */
.header {
  text-align: center;
  padding: 32px 16px 8px;
  width: 100%;
}

.header h1,
.header .title {
  font-family: var(--font-pixel);
  font-size: 1.5rem;
  color: var(--gold);
  text-shadow:
    3px 3px 0 var(--brown-dark),
    0 0 20px rgba(245, 197, 24, 0.35);
  letter-spacing: 2px;
  line-height: 1.8;
}

.header .subtitle {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-weight: 600;
}

/* ---------- Lucky Button (the star of the show) ---------- */
.lucky-button {
  /* Layout */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 40px;
  min-width: 220px;
  cursor: pointer;
  border: none;
  outline: none;

  /* Golden block appearance */
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--accent);
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 var(--gold-shadow);
  border-radius: var(--radius);

  /* 3D block effect */
  box-shadow:
    0 6px 0 var(--gold-shadow),
    0 8px 16px rgba(0, 0, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);

  /* Idle floating animation */
  animation: luckyFloat 3s ease-in-out infinite;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    filter var(--transition);
}

/* Corner rivets like the real block */
.lucky-button::before,
.lucky-button::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rivet);
  box-shadow:
    0 0 2px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.lucky-button::before {
  top: 10px;
  left: 10px;
  /* second rivet via box-shadow on same pseudo */
  box-shadow:
    0 0 2px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    /* top-right rivet offset */
    calc(100% - 20px) 0 0 0 var(--rivet);
}
.lucky-button::after {
  bottom: 10px;
  left: 10px;
  box-shadow:
    0 0 2px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    calc(100% - 20px) 0 0 0 var(--rivet);
}

/* Hover state */
.lucky-button:hover {
  filter: brightness(1.1);
  box-shadow:
    0 6px 0 var(--gold-shadow),
    0 8px 24px rgba(245, 197, 24, 0.5),
    0 0 40px rgba(245, 197, 24, 0.25),
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  animation-play-state: paused;
  transform: translateY(-2px);
}

/* Active / click: block-hit bounce */
.lucky-button:active,
.lucky-button.hit {
  animation: luckyHit 0.45s ease;
  box-shadow:
    0 2px 0 var(--gold-shadow),
    0 3px 8px rgba(0, 0, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

/* ---------- Animations ---------- */

/* Idle floating / breathing */
@keyframes luckyFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Block-hit bounce */
@keyframes luckyHit {
  0%   { transform: translateY(0) scale(1); }
  20%  { transform: translateY(-24px) scale(1.05); }
  40%  { transform: translateY(4px) scale(0.97); }
  60%  { transform: translateY(-6px) scale(1.02); }
  80%  { transform: translateY(2px) scale(0.99); }
  100% { transform: translateY(0) scale(1); }
}

/* Coin pop (can be applied to an icon/pseudo on hit) */
@keyframes coinPop {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  50%  { opacity: 1; transform: translateY(-60px) rotate(180deg); }
  100% { opacity: 0; transform: translateY(-80px) rotate(360deg); }
}

/* Fade-in for song changes */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Video Container (16:9 responsive) ---------- */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 3px var(--gold-dark),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

.video-container iframe,
.video-container video,
.video-container embed,
.video-container object {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------- Song Info ---------- */
.song-info {
  text-align: center;
  width: 100%;
  padding: 20px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(245, 197, 24, 0.15);
  animation: fadeSlideIn 0.4s ease;
}

.song-info .song-title {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--gold);
  line-height: 1.7;
  margin-bottom: 6px;
}

.song-info .song-artist {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------- Playlist ---------- */
.playlist {
  width: 100%;
  list-style: none;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(245, 197, 24, 0.1);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition:
    background var(--transition),
    padding-left var(--transition),
    border-color var(--transition);
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
}

.playlist-item:last-child {
  border-bottom: none;
}

/* Retro index numbers */
.playlist-item::before {
  content: attr(data-index);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--gold-dark);
  min-width: 28px;
  text-align: right;
  opacity: 0.6;
}

.playlist-item:hover {
  background: rgba(245, 197, 24, 0.08);
  padding-left: 28px;
  border-color: rgba(245, 197, 24, 0.15);
}

/* Active / currently playing */
.playlist-item.active {
  background: linear-gradient(
    90deg,
    rgba(245, 197, 24, 0.15) 0%,
    rgba(245, 197, 24, 0.05) 100%
  );
  border-left: 3px solid var(--gold);
  padding-left: 17px;
}

.playlist-item.active::after {
  content: '\25B6'; /* play triangle */
  font-size: 0.65rem;
  color: var(--gold);
  margin-left: auto;
  animation: fadeSlideIn 0.3s ease;
}

.playlist-item .item-title {
  color: var(--text);
  flex: 1;
}

.playlist-item .item-artist {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.playlist-item .item-duration {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-muted);
  margin-left: auto;
  opacity: 0.7;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 24px 16px;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-pixel);
  letter-spacing: 0.5px;
  line-height: 2;
}

.footer a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}

.footer a:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

/* ---------- Utility / Helpers ---------- */

/* Pixel-art decorative border (apply to any element) */
.pixel-border {
  border: 4px solid var(--gold);
  box-shadow:
    4px 4px 0 var(--brown-dark),
    -4px -4px 0 var(--gold-light);
}

/* Coin emoji or icon that pops on button hit */
.coin-pop {
  position: absolute;
  pointer-events: none;
  font-size: 1.5rem;
  animation: coinPop 0.6s ease forwards;
}

/* Song change transition wrapper */
.song-transition-enter {
  animation: fadeSlideIn 0.4s ease;
}

/* Glow text helper */
.glow-text {
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.6);
}

/* ---------- Responsive Design ---------- */

@media (max-width: 640px) {
  .container {
    padding: 16px 12px 32px;
    gap: 24px;
  }

  .header h1,
  .header .title {
    font-size: 1rem;
    letter-spacing: 1px;
  }

  .lucky-button {
    padding: 16px 28px;
    font-size: 0.7rem;
    min-width: 180px;
  }

  .song-info .song-title {
    font-size: 0.65rem;
  }

  .playlist-item {
    padding: 12px 14px;
    font-size: 0.88rem;
  }

  .playlist-item:hover {
    padding-left: 20px;
  }

  .footer {
    font-size: 0.6rem;
  }
}

@media (max-width: 400px) {
  .header h1,
  .header .title {
    font-size: 0.8rem;
  }

  .lucky-button {
    padding: 14px 20px;
    font-size: 0.6rem;
    min-width: 160px;
  }

  .playlist-item::before {
    display: none;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lucky-button {
    animation: none;
  }
  .lucky-button:active,
  .lucky-button.hit {
    animation: none;
    transform: scale(0.97);
  }
  .song-info,
  .song-transition-enter {
    animation: none;
  }
}

/* ==========================================================================
   Playlist Management Components
   ========================================================================== */

/* ---------- Playlist Tabs ---------- */
.playlist-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 12px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.playlist-tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.playlist-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 2px solid var(--gold-dark);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.playlist-tab:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

.playlist-tab.active {
  background: linear-gradient(
    145deg,
    rgba(245, 197, 24, 0.25) 0%,
    rgba(232, 163, 23, 0.15) 100%
  );
  border-color: var(--gold);
  box-shadow:
    0 0 16px rgba(245, 197, 24, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.playlist-tab .tab-name {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text);
  letter-spacing: 0.5px;
}

.playlist-tab.active .tab-name {
  color: var(--gold-light);
  text-shadow: 0 0 8px rgba(245, 197, 24, 0.4);
}

.playlist-tab .tab-count {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--bg-dark);
  background: var(--gold-dark);
  padding: 3px 7px;
  border-radius: 8px;
  min-width: 20px;
  text-align: center;
  line-height: 1;
}

.playlist-tab.active .tab-count {
  background: var(--gold);
}

.playlist-tab .tab-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity var(--transition),
    transform var(--transition),
    background var(--transition);
}

.playlist-tab:hover .tab-delete {
  opacity: 1;
  transform: scale(1);
}

.playlist-tab .tab-delete:hover {
  background: rgba(233, 69, 96, 0.2);
}

.add-playlist-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 2px dashed var(--gold-dark);
  border-radius: var(--radius);
  color: var(--gold-dark);
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
}

.add-playlist-tab:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 197, 24, 0.08);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

/* ---------- Search / Add Bar ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 2px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.search-input::placeholder {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-muted);
  opacity: 0.6;
  letter-spacing: 0.5px;
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(245, 197, 24, 0.1),
    0 0 16px rgba(245, 197, 24, 0.12);
  animation: searchGlow 2s ease-in-out infinite;
}

@keyframes searchGlow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.1), 0 0 16px rgba(245, 197, 24, 0.12); }
  50%      { box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.15), 0 0 24px rgba(245, 197, 24, 0.2); }
}

.search-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 3px 0 var(--gold-shadow),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition:
    transform var(--transition),
    filter var(--transition),
    box-shadow var(--transition);
}

.search-add-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 var(--gold-shadow),
    0 6px 14px rgba(245, 197, 24, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.search-add-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--gold-shadow),
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ---------- Song Delete Button ---------- */
.song-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 50%;
  opacity: 0;
  flex-shrink: 0;
  margin-left: auto;
  transition:
    opacity var(--transition),
    background var(--transition);
}

.playlist-item:hover .song-delete {
  opacity: 1;
}

.song-delete:hover {
  background: rgba(233, 69, 96, 0.2);
}

.song-delete:active {
  background: rgba(233, 69, 96, 0.35);
}

/* ---------- Modal / Dialog ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFadeIn 0.25s ease;
  backdrop-filter: blur(4px);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 2px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 90%;
  max-width: 420px;
  box-shadow:
    0 0 0 1px rgba(245, 197, 24, 0.1),
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(245, 197, 24, 0.08);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--brown-dark);
  margin-bottom: 20px;
  letter-spacing: 1px;
  line-height: 1.6;
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  margin-bottom: 24px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.modal-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.12);
}

.modal-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    transform var(--transition),
    filter var(--transition),
    box-shadow var(--transition);
}

.modal-btn.confirm {
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  box-shadow:
    0 3px 0 var(--gold-shadow),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.modal-btn.confirm:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 var(--gold-shadow),
    0 6px 14px rgba(245, 197, 24, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.modal-btn.confirm:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--gold-shadow),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-btn.cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  box-shadow: none;
}

.modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-btn.cancel:active {
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- Toast / Notification ---------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 100%
  );
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.5px;
  padding: 12px 24px;
  border-radius: var(--radius);
  box-shadow:
    0 4px 0 var(--gold-shadow),
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(245, 197, 24, 0.2);
  z-index: 2000;
  pointer-events: none;
  animation: toastSlideUp 3s ease forwards;
  white-space: nowrap;
}

@keyframes toastSlideUp {
  0%   { opacity: 0; transform: translateX(-50%) translateY(20px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 16px;
}

.empty-state::before {
  content: '\2753'; /* question block emoji */
  font-size: 2.5rem;
  display: block;
  animation: luckyFloat 3s ease-in-out infinite;
  filter: grayscale(0.3);
}

.empty-state .empty-title {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: 1.8;
}

.empty-state .empty-message {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-muted);
  opacity: 0.6;
  font-weight: 600;
}

/* ---------- Responsive Additions (Playlist Management) ---------- */

@media (max-width: 640px) {
  .playlist-tab {
    padding: 8px 12px;
  }

  .playlist-tab .tab-name {
    font-size: 0.5rem;
  }

  .playlist-tab .tab-count {
    font-size: 0.4rem;
    padding: 2px 5px;
  }

  .add-playlist-tab {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .search-input {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .search-input::placeholder {
    font-size: 0.45rem;
  }

  .search-add-btn {
    padding: 10px 14px;
    font-size: 0.45rem;
  }

  .modal {
    padding: 22px 18px;
    width: 94%;
  }

  .modal-title {
    font-size: 0.65rem;
  }

  .toast {
    font-size: 0.5rem;
    padding: 10px 18px;
    bottom: 20px;
  }

  .empty-state {
    padding: 36px 16px;
  }

  .empty-state::before {
    font-size: 2rem;
  }
}

@media (max-width: 400px) {
  .search-bar {
    flex-direction: column;
  }

  .search-add-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Reduced motion: playlist management components */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay {
    animation: none;
  }
  .modal {
    animation: none;
  }
  .toast {
    animation: none;
    opacity: 1;
  }
  .empty-state::before {
    animation: none;
  }
  .search-input:focus {
    animation: none;
  }
}

/* ==========================================================================
   Lyrics Components
   ========================================================================== */

/* ---------- Lyrics Button ---------- */
.lyrics-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--bg-card);
  border: 2px solid var(--gold-dark);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.lyrics-button:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
  box-shadow: 0 0 20px rgba(245, 197, 24, 0.15);
  transform: translateY(-2px);
}

.lyrics-button:active {
  transform: translateY(1px);
}

/* ---------- Lyrics Panel ---------- */
.lyrics-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeSlideIn 0.4s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  background: rgba(245, 197, 24, 0.05);
}

.lyrics-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.lyrics-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.lyrics-close:hover {
  background: rgba(233, 69, 96, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.lyrics-content {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 2;
  white-space: pre-line;
}

.lyrics-content::-webkit-scrollbar {
  width: 6px;
}

.lyrics-content::-webkit-scrollbar-track {
  background: transparent;
}

.lyrics-content::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

@media (max-width: 640px) {
  .lyrics-button {
    padding: 10px 20px;
    font-size: 0.5rem;
  }

  .lyrics-content {
    padding: 16px;
    font-size: 0.88rem;
    max-height: 300px;
  }
}

/* ==========================================================================
   Player Controls Components
   ========================================================================== */

/* ---------- Pulsing Glow Animation ---------- */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(245, 197, 24, 0.3); }
  50%      { box-shadow: 0 0 14px rgba(245, 197, 24, 0.55); }
}

/* ---------- Player Controls Bar ---------- */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

/* ---------- Control Button (base) ---------- */
.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.control-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.control-btn:active {
  transform: scale(0.92);
}

/* ---------- Shuffle Button ---------- */
.shuffle-btn.active {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ---------- Loop Button ---------- */
.loop-btn.loop-all {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold);
  animation: pulseGlow 2s ease-in-out infinite;
}

.loop-btn.loop-one {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold);
  animation: pulseGlow 2s ease-in-out infinite;
  position: relative;
}

.loop-btn.loop-one::after {
  content: '1';
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-family: var(--font-pixel);
  font-size: 0.35rem;
  color: var(--gold);
  line-height: 1;
  pointer-events: none;
}

/* ---------- Prev / Next Buttons ---------- */
.prev-btn,
.next-btn {
  font-size: 1.15rem;
}

/* ---------- Volume Control ---------- */
.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-mute {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.volume-mute:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.volume-mute:active {
  transform: scale(0.92);
}

.volume-mute.muted {
  color: var(--danger);
  border-color: var(--danger);
}

/* ---------- Volume Slider (custom range) ---------- */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  transition: opacity var(--transition);
}

.volume-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--gold) var(--volume-fill, 70%),
    rgba(255, 255, 255, 0.1) var(--volume-fill, 70%)
  );
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  margin-top: -6px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.volume-slider:hover::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(245, 197, 24, 0.4), 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Firefox */
.volume-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
}

.volume-slider::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.volume-slider:hover::-moz-range-thumb {
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(245, 197, 24, 0.4), 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ---------- Queue Section ---------- */
.queue-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  background: rgba(245, 197, 24, 0.04);
}

.queue-header .queue-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.queue-header .queue-clear {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 6px;
  color: var(--danger);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.queue-header .queue-clear:hover {
  background: rgba(233, 69, 96, 0.15);
  border-color: var(--danger);
}

.queue-list {
  max-height: 280px;
  overflow-y: auto;
  list-style: none;
}

.queue-list::-webkit-scrollbar {
  width: 6px;
}

.queue-list::-webkit-scrollbar-track {
  background: transparent;
}

.queue-list::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(245, 197, 24, 0.25);
  font-weight: 600;
  font-size: 0.88rem;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.queue-item:last-child {
  border-bottom: none;
}

.queue-item:hover {
  background: rgba(245, 197, 24, 0.08);
  border-left-color: var(--gold);
}

.queue-item .queue-drag {
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 0.9rem;
  cursor: grab;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.queue-item:hover .queue-drag {
  opacity: 0.8;
}

.queue-item .item-title {
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .queue-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 50%;
  opacity: 0;
  flex-shrink: 0;
  transition:
    opacity var(--transition),
    background var(--transition);
}

.queue-item:hover .queue-remove {
  opacity: 1;
}

.queue-item .queue-remove:hover {
  background: rgba(233, 69, 96, 0.2);
}

/* ---------- Shuffle Progress ---------- */
.shuffle-progress {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.5px;
  padding: 4px 0;
}

/* ---------- Responsive: Player Controls ---------- */

@media (max-width: 640px) {
  .player-controls {
    gap: 8px;
    padding: 10px 14px;
  }

  .volume-control {
    width: 100%;
    justify-content: center;
  }

  .volume-slider {
    flex: 1;
    width: auto;
  }

  .queue-item {
    padding: 8px 14px 8px 12px;
    font-size: 0.82rem;
  }

  .queue-header {
    padding: 12px 14px;
  }
}

@media (max-width: 400px) {
  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .volume-mute {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .prev-btn,
  .next-btn {
    font-size: 1.05rem;
  }
}

/* Reduced motion: player controls */
@media (prefers-reduced-motion: reduce) {
  .shuffle-btn.active,
  .loop-btn.loop-all,
  .loop-btn.loop-one {
    animation: none;
  }
}

/* ==========================================================================
   Social & Sharing Components
   ========================================================================== */

/* ---------- Share Button (on playlist tabs) ---------- */
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--gold-dark);
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  flex-shrink: 0;
  transition:
    opacity var(--transition),
    transform var(--transition),
    background var(--transition),
    color var(--transition);
}

.playlist-tab:hover .share-btn {
  opacity: 1;
  transform: scale(1);
}

.share-btn:hover {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.2);
}

/* ---------- Share Modal Content ---------- */
.share-url-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.share-url-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-dark);
  border: 2px solid var(--gold-dark);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.share-url-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.12);
}

.share-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 2px 0 var(--gold-shadow),
    0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition:
    transform var(--transition),
    filter var(--transition),
    box-shadow var(--transition);
}

.share-copy-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow:
    0 3px 0 var(--gold-shadow),
    0 5px 12px rgba(245, 197, 24, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.share-copy-btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 var(--gold-shadow),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.share-preview {
  padding: 12px 16px;
  background: rgba(245, 197, 24, 0.06);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: 8px;
  margin-bottom: 16px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--gold);
  letter-spacing: 0.5px;
  line-height: 2;
}

.share-preview .share-preview-count {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------- Import Shared Playlist ---------- */
.import-preview {
  padding: 16px;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.import-preview .import-name {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 0.5px;
  line-height: 1.8;
  margin-bottom: 4px;
}

.import-preview .import-count {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}

.import-preview .import-songs {
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid rgba(245, 197, 24, 0.1);
  padding-top: 10px;
}

.import-preview .import-songs::-webkit-scrollbar {
  width: 6px;
}

.import-preview .import-songs::-webkit-scrollbar-track {
  background: transparent;
}

.import-preview .import-songs::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.import-preview .import-songs li {
  padding: 6px 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-preview .import-songs li:last-child {
  border-bottom: none;
}

/* ---------- Export / Import Buttons Bar ---------- */
.export-import-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0;
}

.export-btn,
.import-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.export-btn:hover,
.import-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

.export-btn:active,
.import-btn:active {
  transform: translateY(1px);
}

.import-file-input {
  display: none;
}

/* ---------- Shared Playlist Badge ---------- */
.shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-pixel);
  font-size: 0.35rem;
  color: var(--gold);
  letter-spacing: 0.5px;
  opacity: 0.8;
  padding: 2px 6px;
  background: rgba(245, 197, 24, 0.1);
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1;
}

/* ---------- Responsive: Social & Sharing ---------- */

@media (max-width: 640px) {
  .share-url-input {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .share-copy-btn {
    padding: 8px 10px;
    font-size: 0.35rem;
  }

  .export-import-bar {
    gap: 6px;
  }

  .export-btn,
  .import-btn {
    padding: 6px 10px;
    font-size: 0.4rem;
  }

  .import-preview .import-songs {
    max-height: 160px;
  }
}

@media (max-width: 400px) {
  .share-url-container {
    flex-direction: column;
  }

  .share-url-input {
    width: 100%;
  }

  .share-copy-btn {
    width: 100%;
    justify-content: center;
  }

  .export-import-bar {
    flex-direction: column;
    gap: 8px;
  }

  .export-btn,
  .import-btn {
    width: 100%;
    text-align: center;
  }
}

/* Reduced motion: social & sharing */
@media (prefers-reduced-motion: reduce) {
  .share-btn {
    transition: none;
  }
}

/* ==========================================================================
   Cloud Sync Components
   ========================================================================== */

/* ---------- Sync Bar ---------- */
.sync-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 0.7rem;
}

/* ---------- Sync Button ---------- */
.sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.sync-btn::before {
  content: "\2601";
  font-size: 0.7rem;
}

.sync-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

.sync-btn:active {
  transform: translateY(1px);
}

/* ---------- Sync Status Connected ---------- */
.sync-connected {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  flex-shrink: 0;
  animation: syncPulse 2s ease-in-out infinite;
}

.sync-indicator.syncing {
  background: #FFC107;
  animation: syncPulse 0.8s ease-in-out infinite;
}

.sync-indicator.error {
  background: var(--danger);
  animation: none;
}

.sync-code-display {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.sync-disconnect {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.55rem;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition:
    color var(--transition),
    background var(--transition);
}

.sync-disconnect:hover {
  color: var(--danger);
  background: rgba(233, 69, 96, 0.15);
}

/* ---------- Sync Modal Content ---------- */
.sync-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  margin-bottom: 20px;
}

.sync-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    color var(--transition),
    border-color var(--transition);
}

.sync-tab:hover {
  color: var(--text);
}

.sync-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.sync-code-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-pixel);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 4px;
  text-transform: uppercase;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.sync-code-input::placeholder {
  color: var(--text-muted);
  opacity: 0.4;
  letter-spacing: 2px;
  text-transform: none;
}

.sync-code-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.12);
}

.sync-generated-code {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(245, 197, 24, 0.4);
  padding: 16px;
  background: rgba(245, 197, 24, 0.05);
  border-radius: 8px;
  text-align: center;
  letter-spacing: 6px;
}

.sync-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0;
}

.sync-connect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  box-shadow:
    0 3px 0 var(--gold-shadow),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition:
    transform var(--transition),
    filter var(--transition),
    box-shadow var(--transition);
}

.sync-connect-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 var(--gold-shadow),
    0 6px 14px rgba(245, 197, 24, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.sync-connect-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--gold-shadow),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ---------- Sync Pulse Animation ---------- */
@keyframes syncPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* ---------- Responsive: Cloud Sync ---------- */

@media (max-width: 640px) {
  .sync-bar {
    padding: 6px 12px;
    gap: 8px;
    font-size: 0.65rem;
  }

  .sync-btn {
    padding: 5px 10px;
    font-size: 0.4rem;
  }

  .sync-code-display {
    font-size: 0.4rem;
  }

  .sync-tab {
    padding: 8px 10px;
    font-size: 0.4rem;
  }
}

@media (max-width: 400px) {
  .sync-code-display {
    font-size: 0.35rem;
    letter-spacing: 0.5px;
  }

  .sync-generated-code {
    font-size: 0.9rem;
    letter-spacing: 4px;
    padding: 12px;
  }

  .sync-code-input {
    font-size: 0.8rem;
    letter-spacing: 3px;
  }
}

/* Reduced motion: cloud sync */
@media (prefers-reduced-motion: reduce) {
  .sync-indicator {
    animation: none;
  }
}

/* ==========================================================================
   Visual & UX Components
   ========================================================================== */

/* ---------- 1. Dark/Light Mode Toggle ---------- */

/* Smooth theme transition on body */
body {
  transition: background-color 0.3s, color 0.3s;
}

/* Theme transitions on key containers */
.container,
.header,
.playlist,
.song-info,
.video-container,
.player-controls,
.search-bar,
.playlist-item,
.modal,
.lyrics-panel,
.queue-section {
  transition:
    background-color 0.3s,
    color 0.3s,
    border-color 0.3s;
}

/* Light mode CSS variable overrides */
[data-theme="light"] {
  --bg-dark: #F5F0E8;
  --bg-card: #FFFFFF;
  --bg-card-alt: #F0EBE3;
  --text: #2D2D2D;
  --text-muted: #6B6B6B;
  --gold: #D4A017;
  --gold-light: #E8B430;
  --gold-dark: #B8860B;
  --gold-shadow: #9A7209;
  --brown-dark: #4A2F14;
  --danger: #D32F2F;
}

/* Light mode removes pixel-grid background */
[data-theme="light"] body,
body[data-theme="light"] {
  background-image: none;
}

/* Theme toggle container */
.theme-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* Toggle switch — pill shape */
.theme-switch {
  position: relative;
  width: 48px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  font-size: 0.65rem;
  line-height: 1;
}

[data-theme="light"] .theme-switch {
  background: rgba(0, 0, 0, 0.1);
}

/* Sun icon (left) and Moon icon (right) via pseudo-elements */
.theme-switch::before {
  content: "\2600";
  font-size: 0.6rem;
  opacity: 0.6;
}

.theme-switch::after {
  content: "\263D";
  font-size: 0.6rem;
  opacity: 0.6;
}

/* Sliding knob */
.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: left 0.3s ease;
}

[data-theme="light"] .theme-switch-knob {
  left: 26px;
}

/* ---------- 2. Animated Background ---------- */

.floating-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.floating-element {
  position: absolute;
  opacity: 0.06;
  animation: floatAround 25s ease-in-out infinite;
  will-change: transform;
}

/* Size and opacity variations */
.floating-element:nth-child(1) { font-size: 1.2rem; opacity: 0.04; animation-duration: 28s; }
.floating-element:nth-child(2) { font-size: 0.8rem; opacity: 0.07; animation-duration: 35s; animation-delay: -5s; }
.floating-element:nth-child(3) { font-size: 1.6rem; opacity: 0.05; animation-duration: 22s; animation-delay: -10s; }
.floating-element:nth-child(4) { font-size: 1rem;   opacity: 0.08; animation-duration: 30s; animation-delay: -3s; }
.floating-element:nth-child(5) { font-size: 2rem;   opacity: 0.04; animation-duration: 40s; animation-delay: -8s; }
.floating-element:nth-child(6) { font-size: 0.9rem; opacity: 0.1;  animation-duration: 18s; animation-delay: -12s; }
.floating-element:nth-child(7) { font-size: 1.4rem; opacity: 0.05; animation-duration: 32s; animation-delay: -7s; }
.floating-element:nth-child(8) { font-size: 1.1rem; opacity: 0.06; animation-duration: 15s; animation-delay: -2s; }
.floating-element:nth-child(9) { font-size: 1.8rem; opacity: 0.04; animation-duration: 38s; animation-delay: -15s; }
.floating-element:nth-child(10) { font-size: 0.85rem; opacity: 0.09; animation-duration: 20s; animation-delay: -6s; }
.floating-element:nth-child(11) { font-size: 1.3rem; opacity: 0.05; animation-duration: 26s; animation-delay: -9s; }
.floating-element:nth-child(12) { font-size: 0.95rem; opacity: 0.07; animation-duration: 33s; animation-delay: -14s; }

@keyframes floatAround {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  25% {
    transform: translateY(-80px) translateX(40px) rotate(90deg);
  }
  50% {
    transform: translateY(-150px) translateX(-30px) rotate(180deg);
  }
  75% {
    transform: translateY(-60px) translateX(60px) rotate(270deg);
  }
  100% {
    transform: translateY(0) translateX(0) rotate(360deg);
  }
}

/* Light mode: slightly higher opacity */
[data-theme="light"] .floating-element {
  opacity: 0.08;
}
[data-theme="light"] .floating-element:nth-child(1) { opacity: 0.06; }
[data-theme="light"] .floating-element:nth-child(2) { opacity: 0.09; }
[data-theme="light"] .floating-element:nth-child(3) { opacity: 0.07; }
[data-theme="light"] .floating-element:nth-child(4) { opacity: 0.1; }
[data-theme="light"] .floating-element:nth-child(5) { opacity: 0.06; }
[data-theme="light"] .floating-element:nth-child(6) { opacity: 0.12; }
[data-theme="light"] .floating-element:nth-child(7) { opacity: 0.07; }
[data-theme="light"] .floating-element:nth-child(8) { opacity: 0.08; }
[data-theme="light"] .floating-element:nth-child(9) { opacity: 0.06; }
[data-theme="light"] .floating-element:nth-child(10) { opacity: 0.11; }
[data-theme="light"] .floating-element:nth-child(11) { opacity: 0.07; }
[data-theme="light"] .floating-element:nth-child(12) { opacity: 0.09; }

/* ---------- 3. Song Thumbnails ---------- */

/* Small thumbnail in playlist items */
.song-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(245, 197, 24, 0.15);
}

/* Larger thumbnail in now-playing / song-info area */
.now-playing-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--gold-dark);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Song info becomes flex row to accommodate thumbnail */
.song-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- 4. Drag & Drop ---------- */

.playlist-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.3);
}

.playlist-item.drag-over {
  border-top: 2px solid var(--gold);
  background: rgba(245, 197, 24, 0.06);
}

.drag-handle {
  color: var(--text-muted);
  opacity: 0.3;
  cursor: grab;
  font-size: 1rem;
  flex-shrink: 0;
  margin-right: 4px;
  transition: opacity var(--transition);
  user-select: none;
}

.drag-handle:hover {
  opacity: 0.7;
}

.drag-handle:active {
  cursor: grabbing;
}

.playlist-item:hover .drag-handle {
  opacity: 0.6;
}

/* ---------- Responsive: Visual & UX ---------- */

@media (max-width: 640px) {
  .song-thumb {
    width: 32px;
    height: 32px;
  }

  .now-playing-thumb {
    width: 60px;
    height: 60px;
  }

  .theme-switch {
    width: 40px;
    height: 20px;
  }

  .theme-switch-knob {
    width: 16px;
    height: 16px;
  }

  [data-theme="light"] .theme-switch-knob {
    left: 22px;
  }
}

@media (max-width: 400px) {
  .floating-bg {
    display: none;
  }

  .song-thumb {
    width: 28px;
    height: 28px;
  }

  .now-playing-thumb {
    width: 48px;
    height: 48px;
  }
}

/* Reduced motion: Visual & UX */
@media (prefers-reduced-motion: reduce) {
  .floating-element {
    animation: none;
  }

  body,
  .container,
  .header,
  .playlist,
  .song-info,
  .video-container,
  .player-controls,
  .search-bar,
  .playlist-item,
  .modal,
  .lyrics-panel,
  .queue-section {
    transition: none;
  }

  .theme-switch-knob {
    transition: none;
  }
}

/* ==========================================================================
   Discovery Components
   Search, History, and Discover panels
   ========================================================================== */

/* ---------- Search Results Panel ---------- */
.search-results {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 400px;
  overflow-y: auto;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(245, 197, 24, 0.06);
  animation: fadeSlideIn 0.3s ease;
  z-index: 50;
}

.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* ---------- Search Result Item ---------- */
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition:
    background var(--transition);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover {
  background: rgba(245, 197, 24, 0.08);
}

.search-result-thumb {
  width: 60px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-dark);
}

.search-result-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  gap: 2px;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.search-result-channel {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-result-duration {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--gold-dark);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.search-result-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(245, 197, 24, 0.25);
  background: transparent;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity var(--transition),
    transform var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.search-result:hover .search-result-add {
  opacity: 1;
  transform: scale(1);
}

.search-result-add:hover {
  background: rgba(245, 197, 24, 0.2);
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(245, 197, 24, 0.2);
}

/* ---------- Search Loading State ---------- */
.search-loading {
  text-align: center;
  padding: 20px;
  color: var(--gold);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  animation: searchLoadPulse 1.5s ease-in-out infinite;
}

@keyframes searchLoadPulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ---------- Search Mode Toggle ---------- */
.search-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  letter-spacing: 0.5px;
  border-radius: 6px;
  transition:
    color var(--transition),
    background var(--transition);
}

.search-mode.url-detected {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.08);
}

.search-mode.text-search {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.search-mode-icon {
  font-size: 0.65rem;
}

/* ==========================================================================
   History Components
   ========================================================================== */

/* ---------- History Toggle Button ---------- */
.history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.history-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.history-btn:active {
  transform: scale(0.92);
}

.history-btn.active {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ---------- History Panel ---------- */
.history-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeSlideIn 0.4s ease;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  background: rgba(245, 197, 24, 0.04);
}

.history-header .history-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.history-header .history-clear {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 6px;
  color: var(--danger);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.history-header .history-clear:hover {
  background: rgba(233, 69, 96, 0.15);
  border-color: var(--danger);
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
  list-style: none;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-weight: 600;
  font-size: 0.88rem;
  transition:
    background var(--transition);
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: rgba(245, 197, 24, 0.08);
}

.history-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-dark);
}

.history-title {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.history-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ==========================================================================
   Discover Components
   ========================================================================== */

/* ---------- Discover Button ---------- */
.discover-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: transparent;
  border: 2px solid var(--gold-dark);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.discover-btn:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
  box-shadow:
    0 0 20px rgba(245, 197, 24, 0.15),
    0 0 40px rgba(245, 197, 24, 0.06);
  transform: translateY(-2px);
}

.discover-btn:active {
  transform: translateY(1px);
}

/* ---------- Discover Panel ---------- */
.discover-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeSlideIn 0.4s ease;
}

.discover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  background: rgba(245, 197, 24, 0.05);
}

.discover-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.discover-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.discover-close:hover {
  background: rgba(233, 69, 96, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.discover-list {
  max-height: 400px;
  overflow-y: auto;
}

.discover-list::-webkit-scrollbar {
  width: 6px;
}

.discover-list::-webkit-scrollbar-track {
  background: transparent;
}

.discover-list::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.discover-list::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* Discover panel reuses .search-result styles for its items */

/* ==========================================================================
   Discovery Responsive Styles
   ========================================================================== */

@media (max-width: 640px) {
  .search-result-thumb {
    width: 48px;
    height: 32px;
  }

  .search-result {
    padding: 8px 12px;
    gap: 10px;
  }

  .search-result-title {
    font-size: 0.8rem;
  }

  .search-result-channel {
    font-size: 0.7rem;
  }

  .history-item {
    padding: 8px 14px 8px 12px;
    font-size: 0.82rem;
  }

  .history-thumb {
    width: 30px;
    height: 30px;
  }

  .history-title {
    font-size: 0.8rem;
  }

  .history-header {
    padding: 12px 14px;
  }

  .discover-btn {
    padding: 10px 20px;
    font-size: 0.5rem;
  }

  .discover-header {
    padding: 12px 14px;
  }
}

@media (max-width: 400px) {
  .search-results {
    max-height: 300px;
  }

  .search-result {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-result-info {
    min-width: 0;
    flex-basis: calc(100% - 76px);
  }

  .search-result-duration {
    margin-left: auto;
  }

  .search-result-add {
    opacity: 1;
    transform: scale(1);
  }

  .history-panel {
    width: 100%;
  }

  .history-list {
    max-height: 250px;
  }

  .history-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .discover-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Reduced motion for discovery components */
@media (prefers-reduced-motion: reduce) {
  .search-results,
  .history-panel,
  .discover-panel {
    animation: none;
  }

  .search-loading {
    animation: none;
    opacity: 1;
  }

  .history-btn.active {
    animation: none;
  }
}

/* ==========================================================================
   Personalization Components
   ========================================================================== */

/* ---------- Playlist Color Picker ---------- */
.color-picker {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px rgba(245, 197, 24, 0.15);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 100;
  animation: fadeSlideIn 0.3s ease;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.color-swatch:hover {
  border-color: white;
  transform: scale(1.2);
}

.color-swatch.selected {
  border-color: white;
  box-shadow: 0 0 8px currentColor;
}

.playlist-tab .tab-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.playlist-tab .tab-color-dot:hover {
  transform: scale(1.5);
  box-shadow: 0 0 6px currentColor;
}

/* ---------- Username / Profile ---------- */
.username-display {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}

.username-display:hover {
  color: var(--gold);
  text-decoration: underline;
}

.username-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: center;
  outline: none;
  width: auto;
  max-width: 200px;
}

/* ---------- Play Counter ---------- */
.play-count {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.play-count.hot {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
}

/* ---------- Sort Button ---------- */
.sort-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.sort-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.sort-btn:active {
  transform: scale(0.92);
}

/* ---------- Personalization Responsive: 640px ---------- */
@media (max-width: 640px) {
  .color-swatch {
    width: 20px;
    height: 20px;
  }

  .play-count {
    font-size: 0.35rem;
  }
}

/* ---------- Personalization Responsive: 400px ---------- */
@media (max-width: 400px) {
  .username-input {
    width: 100%;
    max-width: 100%;
  }
}

/* ---------- Personalization Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .color-picker {
    animation: none;
  }

  .color-swatch {
    transition: none;
  }
}

/* ==========================================================================
   Account System UI
   ========================================================================== */

/* ---------- Account Bar ---------- */
.account-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.login-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

.login-btn:active {
  transform: translateY(1px);
}

/* ---------- Account Info (Logged In) ---------- */
.account-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.account-username {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color var(--transition);
}

.logout-btn:hover {
  color: var(--danger);
}

/* ---------- Account Status Indicator ---------- */
.account-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  flex-shrink: 0;
  animation: syncPulse 2s ease-in-out infinite;
}

.account-indicator.saved {
  background: #4CAF50;
  animation: syncPulse 2s ease-in-out infinite;
}

.account-indicator.saving {
  background: #FFC107;
  animation: syncPulse 0.8s ease-in-out infinite;
}

.account-indicator.error {
  background: var(--danger);
  animation: none;
}

/* ---------- Account Status Text ---------- */
.account-status {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ---------- Account Modal Body ---------- */
.account-modal-body {
  margin-bottom: 10px;
}

/* ---------- Account Field ---------- */
.account-field {
  margin-bottom: 16px;
}

.account-field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 4px;
}

/* ---------- Auth Tabs ---------- */
.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition:
    color var(--transition),
    border-color var(--transition);
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
}

/* ---------- Auth Form ---------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-label {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.auth-input {
  width: 100%;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.auth-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.auth-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

/* ---------- Auth PIN Input ---------- */
.auth-pin-input {
  width: 100%;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  text-align: center;
  letter-spacing: 8px;
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  max-width: 160px;
  margin: 0 auto;
  display: block;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.auth-pin-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.15);
}

/* ---------- Auth Submit Button ---------- */
.auth-submit {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  box-shadow:
    0 3px 0 var(--gold-shadow),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition:
    transform var(--transition),
    filter var(--transition),
    box-shadow var(--transition);
}

.auth-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 var(--gold-shadow),
    0 6px 14px rgba(245, 197, 24, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.auth-submit:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--gold-shadow),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ---------- Auth Error Message ---------- */
.auth-error {
  color: var(--danger);
  font-size: 0.8rem;
  text-align: center;
  padding: 8px;
  background: rgba(233, 69, 96, 0.1);
  border-radius: 6px;
  animation: fadeSlideIn 0.3s ease;
}

/* ---------- Account System Responsive ---------- */
@media (max-width: 640px) {
  .account-bar {
    gap: 6px;
  }

  .login-btn {
    padding: 5px 10px;
    font-size: 0.4rem;
  }

  .account-username {
    font-size: 0.45rem;
  }

  .logout-btn {
    font-size: 0.35rem;
    padding: 3px 6px;
  }

  .auth-tab {
    padding: 8px 10px;
    font-size: 0.4rem;
  }
}

@media (max-width: 400px) {
  .auth-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .auth-pin-input {
    max-width: 140px;
    font-size: 1rem;
    letter-spacing: 6px;
    padding: 10px 12px;
  }

  .auth-label {
    font-size: 0.4rem;
  }

  .auth-submit {
    width: 100%;
  }
}

/* ---------- Account System Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .account-indicator {
    animation: none;
  }
}

/* ==========================================================================
   Keyboard Shortcuts Help
   ========================================================================== */

/* ---------- Shortcuts Button ---------- */
.shortcuts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.shortcuts-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.shortcuts-btn:active {
  transform: scale(0.92);
}

/* ---------- Shortcuts Overlay ---------- */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Shortcuts Panel ---------- */
.shortcuts-panel {
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: var(--radius);
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(245, 197, 24, 0.08);
  animation: fadeSlideIn 0.3s ease;
}

.shortcuts-title {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--gold);
  text-align: center;
  padding: 20px 20px 12px;
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.3);
  letter-spacing: 1px;
}

.shortcuts-list {
  list-style: none;
  padding: 0 8px 12px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.06);
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-key {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  background: rgba(245, 197, 24, 0.9);
  color: var(--bg-dark);
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  line-height: 1.4;
  text-shadow: none;
  box-shadow: 0 2px 0 var(--gold-dark);
}

.shortcut-desc {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.shortcuts-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  position: absolute;
  top: 12px;
  right: 12px;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.shortcuts-close:hover {
  background: rgba(233, 69, 96, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

/* ==========================================================================
   Sleep Timer
   ========================================================================== */

/* ---------- Sleep Timer Button ---------- */
.sleep-timer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.sleep-timer-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.sleep-timer-btn:active {
  transform: scale(0.92);
}

.sleep-timer-btn.active {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ---------- Timer Menu ---------- */
.timer-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: var(--radius);
  min-width: 160px;
  overflow: hidden;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(245, 197, 24, 0.06);
  z-index: 100;
  animation: fadeSlideIn 0.25s ease;
}

.timer-option {
  padding: 10px 20px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  white-space: nowrap;
}

.timer-option:hover {
  background: rgba(245, 197, 24, 0.12);
  color: var(--gold);
}

.timer-option.active {
  color: var(--gold);
}

/* ---------- Timer Display ---------- */
.timer-display {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--gold);
  animation: timerPulse 2s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

/* ==========================================================================
   Song Rating (Stars)
   ========================================================================== */

.song-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.rating-star {
  font-size: 0.7rem;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.3;
  transition:
    color 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

.rating-star:hover {
  color: #FFD700;
  opacity: 1;
  transform: scale(1.2);
}

.song-rating:hover .rating-star {
  color: #FFD700;
  opacity: 0.6;
}

.song-rating:hover .rating-star:hover,
.song-rating:hover .rating-star:hover ~ .rating-star {
  opacity: 0.3;
}

.song-rating .rating-star:hover,
.song-rating .rating-star:hover ~ .rating-star {
  /* handled by JS hover logic */
}

.rating-star.filled {
  color: #FFD700;
  opacity: 1;
}

.rating-star.hot {
  color: #FF6600;
  opacity: 1;
}

.playlist-rating-avg {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--gold);
  margin-left: 4px;
  line-height: 1;
}

/* ==========================================================================
   Listening Stats
   ========================================================================== */

/* ---------- Stats Button ---------- */
.stats-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  cursor: pointer;
  letter-spacing: 1px;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.stats-btn:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
  box-shadow:
    0 0 12px rgba(245, 197, 24, 0.15),
    inset 0 0 12px rgba(245, 197, 24, 0.03);
  transform: translateY(-2px);
}

.stats-btn:active {
  transform: translateY(1px);
}

/* ---------- Stats Panel ---------- */
.stats-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeSlideIn 0.4s ease;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
}

.stats-header .stats-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.3);
}

/* ---------- Stats Grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 20px;
}

/* ---------- Stat Card ---------- */
.stat-card {
  background: rgba(245, 197, 24, 0.05);
  border: 1px solid rgba(245, 197, 24, 0.1);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(245, 197, 24, 0.35);
  line-height: 1.4;
}

.stat-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Stat List (Top 5) ---------- */
.stat-list {
  list-style: none;
  padding: 0;
}

.stat-list-item {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(245, 197, 24, 0.06);
}

.stat-list-item:last-child {
  border-bottom: none;
}

.stat-list-rank {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--gold);
  min-width: 20px;
  flex-shrink: 0;
}

.stat-list-name {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-list-count {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-muted);
  margin-left: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   New Features — Responsive Overrides
   ========================================================================== */

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .shortcuts-panel {
    width: 90vw;
  }

  .rating-star {
    font-size: 0.6rem;
  }

  .stat-value {
    font-size: 1rem;
  }
}

@media (max-width: 400px) {
  .shortcuts-panel {
    width: 95vw;
  }

  .timer-menu {
    min-width: 200px;
  }

  .sleep-timer-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .stats-btn {
    padding: 10px 16px;
    font-size: 0.5rem;
  }

  .rating-star {
    font-size: 0.55rem;
  }
}

/* ---------- New Features Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .shortcuts-overlay {
    animation: none;
  }

  .shortcuts-panel,
  .timer-menu,
  .stats-panel {
    animation: none;
  }

  .sleep-timer-btn.active {
    animation: none;
  }

  .timer-display {
    animation: none;
    opacity: 1;
  }
}

/* ==========================================================================
   NEW FEATURES: Themes, Achievements, Duplicate Finder, Playlist Merge
   ========================================================================== */

/* ---------- Theme: Retro ---------- */
[data-theme="retro"] {
  --bg-dark: #2B1B0E;
  --bg-card: #3D2B1A;
  --text: #F5E6D3;
  --text-muted: #BFA98A;
  --gold: #D4A017;
  --gold-light: #E8B430;
  --gold-dark: #B8860B;
  --gold-shadow: #8B6508;
  --danger: #CC4422;
}

/* ---------- Theme: Neon ---------- */
[data-theme="neon"] {
  --bg-dark: #0A0A1A;
  --bg-card: #12122A;
  --text: #EEEEFF;
  --text-muted: #8888CC;
  --gold: #00FFFF;
  --gold-light: #44FFFF;
  --gold-dark: #00CCCC;
  --gold-shadow: #009999;
  --danger: #FF0066;
}

/* ---------- Theme: Ocean ---------- */
[data-theme="ocean"] {
  --bg-dark: #0A1628;
  --bg-card: #122240;
  --text: #E0EAF5;
  --text-muted: #7A9BC0;
  --gold: #20B2AA;
  --gold-light: #48D1CC;
  --gold-dark: #178F89;
  --gold-shadow: #106B66;
  --danger: #FF6B6B;
}

/* ---------- Theme: Forest ---------- */
[data-theme="forest"] {
  --bg-dark: #0E1A0E;
  --bg-card: #1A2E1A;
  --text: #E0F0E0;
  --text-muted: #88AA88;
  --gold: #8FBC5F;
  --gold-light: #A8D480;
  --gold-dark: #6B9940;
  --gold-shadow: #4D7A2A;
  --danger: #E06040;
}

/* ---------- Theme Menu Dropdown ---------- */
.theme-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(245, 197, 24, 0.08);
  z-index: 1000;
  overflow: hidden;
  animation: fadeSlideIn 0.25s ease;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  transition:
    background var(--transition),
    color var(--transition);
}

.theme-option:hover {
  background: rgba(245, 197, 24, 0.15);
  color: var(--gold);
}

.theme-option.active {
  color: var(--gold);
}

.theme-option.active::after {
  content: '\2714';
  margin-left: auto;
  font-size: 0.45rem;
  color: var(--gold);
}

.theme-color-preview {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

/* ---------- Achievements Button ---------- */
.achievements-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  cursor: pointer;
  letter-spacing: 1px;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.achievements-btn:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
  box-shadow:
    0 0 12px rgba(245, 197, 24, 0.15),
    inset 0 0 12px rgba(245, 197, 24, 0.03);
  transform: translateY(-2px);
}

.achievements-btn:active {
  transform: translateY(1px);
}

/* ---------- Achievements Panel ---------- */
.achievements-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeSlideIn 0.4s ease;
}

.achievements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
}

.achievements-header .achievements-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.3);
}

/* ---------- Badge Grid ---------- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 20px;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 197, 24, 0.08);
  border-radius: var(--radius);
  text-align: center;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    opacity var(--transition),
    filter var(--transition);
}

.badge-card.locked {
  filter: grayscale(1);
  opacity: 0.4;
}

.badge-card.unlocked {
  border-color: var(--gold-dark);
  box-shadow:
    0 0 12px rgba(245, 197, 24, 0.12),
    inset 0 0 8px rgba(245, 197, 24, 0.04);
}

.badge-icon {
  font-size: 2rem;
  line-height: 1;
  text-align: center;
}

.badge-name {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text);
  letter-spacing: 0.5px;
}

.badge-desc {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---------- Badge Toast ---------- */
.toast.badge-toast {
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 50%,
    var(--gold-dark) 100%
  );
  box-shadow:
    0 4px 0 var(--gold-shadow),
    0 6px 24px rgba(0, 0, 0, 0.5),
    0 0 32px rgba(245, 197, 24, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
}

.toast.badge-toast .badge-toast-icon {
  font-size: 1.4rem;
}

/* ---------- Duplicate Finder Button ---------- */
.duplicates-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.duplicates-btn:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
  color: var(--gold);
  transform: translateY(-1px);
}

.duplicates-btn:active {
  transform: translateY(1px);
}

/* ---------- Duplicates Panel ---------- */
.duplicates-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeSlideIn 0.4s ease;
}

.duplicates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
}

.duplicates-header .duplicates-title {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.3);
}

.duplicates-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.duplicate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 197, 24, 0.06);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text);
}

.duplicate-item .duplicate-song-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duplicate-item .duplicate-playlists {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.duplicate-remove-btn {
  padding: 4px 10px;
  background: rgba(233, 69, 96, 0.15);
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition:
    background var(--transition),
    transform var(--transition);
  flex-shrink: 0;
}

.duplicate-remove-btn:hover {
  background: rgba(233, 69, 96, 0.3);
  transform: translateY(-1px);
}

.duplicate-remove-btn:active {
  transform: translateY(1px);
}

.remove-all-duplicates {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 100%
  );
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 -1px 0 var(--gold-shadow);
  transition:
    filter var(--transition),
    transform var(--transition);
}

.remove-all-duplicates:hover {
  filter: brightness(1.1);
}

.remove-all-duplicates:active {
  filter: brightness(0.95);
}

/* ---------- Playlist Merge Button ---------- */
.merge-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition:
    border-color var(--transition),
    color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.merge-btn:hover {
  border-color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
  color: var(--gold);
  transform: translateY(-1px);
}

.merge-btn:active {
  transform: translateY(1px);
}

/* ---------- Merge Modal Components ---------- */
.merge-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-dark);
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23F5C518' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.merge-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.12);
}

.merge-preview {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 197, 24, 0.08);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-height: 180px;
  overflow-y: auto;
}

.merge-preview .merge-preview-count {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.merge-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: background var(--transition);
}

.merge-option:hover {
  background: rgba(245, 197, 24, 0.06);
}

.merge-option input[type="radio"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.merge-option label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.merge-option .merge-option-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---------- Responsive: 640px - New Features ---------- */
@media (max-width: 640px) {
  .theme-menu {
    min-width: 160px;
  }

  .theme-option {
    padding: 7px 12px;
    font-size: 0.45rem;
  }

  .achievements-btn {
    padding: 10px 16px;
    font-size: 0.5rem;
  }

  .achievements-panel {
    border-radius: 10px;
  }

  .badge-grid {
    gap: 10px;
    padding: 16px;
  }

  .badge-card {
    padding: 12px 10px;
  }

  .badge-icon {
    font-size: 1.6rem;
  }

  .badge-name {
    font-size: 0.45rem;
  }

  .badge-desc {
    font-size: 0.65rem;
  }

  .duplicates-btn,
  .merge-btn {
    padding: 7px 12px;
    font-size: 0.4rem;
  }

  .duplicates-panel {
    border-radius: 10px;
  }

  .duplicates-list {
    padding: 12px 16px;
    max-height: 280px;
  }

  .duplicate-item {
    padding: 8px 12px;
    font-size: 0.75rem;
    flex-wrap: wrap;
  }

  .duplicate-item .duplicate-playlists {
    font-size: 0.65rem;
    width: 100%;
  }

  .remove-all-duplicates {
    padding: 10px 16px;
    font-size: 0.45rem;
  }

  .merge-select {
    font-size: 0.8rem;
    padding: 9px 12px;
  }

  .merge-preview {
    font-size: 0.75rem;
    max-height: 140px;
  }

  .merge-option label {
    font-size: 0.8rem;
  }
}

/* ---------- Responsive: 400px - New Features ---------- */
@media (max-width: 400px) {
  .theme-menu {
    min-width: 140px;
    right: -10px;
  }

  .theme-option {
    padding: 6px 10px;
    font-size: 0.4rem;
  }

  .theme-color-preview {
    width: 10px;
    height: 10px;
  }

  .achievements-btn {
    padding: 8px 12px;
    font-size: 0.45rem;
    gap: 6px;
  }

  .badge-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .badge-card {
    flex-direction: row;
    text-align: left;
    padding: 10px 12px;
    gap: 10px;
  }

  .badge-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
  }

  .badge-name {
    font-size: 0.4rem;
  }

  .badge-desc {
    font-size: 0.6rem;
  }

  .duplicates-btn,
  .merge-btn {
    padding: 6px 10px;
    font-size: 0.35rem;
  }

  .duplicates-list {
    padding: 10px 12px;
    max-height: 240px;
  }

  .duplicate-item {
    padding: 8px 10px;
    font-size: 0.7rem;
    gap: 8px;
  }

  .duplicate-remove-btn {
    padding: 3px 8px;
    font-size: 0.35rem;
  }

  .remove-all-duplicates {
    padding: 9px 12px;
    font-size: 0.4rem;
  }

  .merge-select {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .merge-preview {
    padding: 10px 12px;
    font-size: 0.7rem;
    max-height: 120px;
  }

  .merge-option {
    padding: 6px 10px;
    gap: 8px;
  }

  .merge-option label {
    font-size: 0.75rem;
  }

  .merge-option .merge-option-desc {
    font-size: 0.6rem;
  }
}

/* ---------- Reduced Motion: New Features ---------- */
@media (prefers-reduced-motion: reduce) {
  .theme-menu,
  .achievements-panel,
  .duplicates-panel {
    animation: none;
  }
}

/* ==========================================================================
   Feature: Mini Player
   ========================================================================== */

.mini-player {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 900;
  background: var(--bg-card);
  border-top: 1px solid rgba(245, 197, 24, 0.15);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.mini-player.visible {
  transform: translateY(0);
}

.mini-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.mini-info {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.mini-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color var(--transition);
}

.mini-title:hover {
  color: var(--gold);
}

.mini-artist {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mini-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.mini-btn:hover {
  border-color: rgba(245, 197, 24, 0.4);
  color: var(--gold);
}

.mini-btn:active {
  transform: scale(0.9);
}

/* ==========================================================================
   Feature: Fullscreen Mode
   ========================================================================== */

.fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  z-index: 5;
  transition: all var(--transition);
  opacity: 0;
}

.video-container:hover .fullscreen-btn,
.fullscreen-btn:focus-visible {
  opacity: 1;
}

.fullscreen-btn:hover {
  background: rgba(245, 197, 24, 0.3);
  color: var(--gold);
}

.video-container.is-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-container.is-fullscreen #yt-player,
.video-container.is-fullscreen iframe {
  width: 100vw !important;
  height: 100vh !important;
}

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.fullscreen-overlay[hidden] {
  display: none;
}

.fullscreen-video {
  max-width: 90vw;
  max-height: 70vh;
  border-radius: 8px;
}

.fullscreen-info {
  text-align: center;
  padding: 16px;
}

.fullscreen-info .fullscreen-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.fullscreen-info .fullscreen-artist {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fullscreen-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
}

.fullscreen-controls .control-btn {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
}

.fullscreen-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.fullscreen-close:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 197, 24, 0.1);
}

/* ==========================================================================
   Feature: Daily Random Song
   ========================================================================== */

.daily-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.daily-badge {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  background: var(--gold);
  color: var(--bg-dark);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-weight: 700;
}

.daily-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px solid var(--gold);
  object-fit: cover;
  flex-shrink: 0;
}

.daily-info {
  flex: 1;
  min-width: 0;
}

.daily-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-artist {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow:
    0 3px 0 var(--gold-shadow),
    0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all var(--transition);
  flex-shrink: 0;
}

.daily-play:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.daily-play:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--gold-shadow),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.daily-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: transparent;
  color: var(--gold);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  font-weight: 700;
  border: 1px solid var(--gold);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.daily-add:hover {
  background: rgba(245, 197, 24, 0.1);
  transform: translateY(-1px);
}

.daily-add:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Feature: Public Playlists / Top 10
   ========================================================================== */

.public-tab {
  position: relative;
  border-color: rgba(100, 180, 255, 0.3) !important;
}

.public-tab:hover {
  border-color: rgba(150, 210, 255, 0.5) !important;
  background: rgba(100, 180, 255, 0.08) !important;
}

.public-badge {
  font-family: var(--font-pixel);
  font-size: 0.35rem;
  color: rgba(150, 210, 255, 0.8);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

.top10-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.15);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.top10-header {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--gold);
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
  letter-spacing: 1px;
}

.top10-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  transition: background var(--transition);
}

.top10-item:hover {
  background: rgba(245, 197, 24, 0.05);
}

.top10-rank {
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: var(--gold);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.top10-rank.gold {
  color: #FFD700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.top10-rank.silver {
  color: #C0C0C0;
  text-shadow: 0 0 6px rgba(192, 192, 192, 0.3);
}

.top10-rank.bronze {
  color: #CD7F32;
  text-shadow: 0 0 6px rgba(205, 127, 50, 0.3);
}

.top10-thumb {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.top10-info {
  flex: 1;
  min-width: 0;
}

.top10-info .top10-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-info .top10-artist {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.3);
  color: var(--gold);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.top10-add:hover {
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold);
  transform: scale(1.1);
}

.top10-add:active {
  transform: scale(0.9);
}

.copy-playlist-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(
    145deg,
    var(--gold-light) 0%,
    var(--gold) 40%,
    var(--gold-dark) 100%
  );
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  font-weight: 700;
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 -1px 0 var(--gold-shadow);
  transition: all var(--transition);
  text-align: center;
}

.copy-playlist-btn:hover {
  filter: brightness(1.1);
}

.copy-playlist-btn:active {
  filter: brightness(0.95);
}

/* ---------- Responsive: New Features (640px) ---------- */
@media (max-width: 640px) {
  .mini-player {
    padding: 6px 10px;
    gap: 8px;
  }

  .mini-thumb {
    width: 34px;
    height: 34px;
  }

  .mini-title {
    font-size: 0.7rem;
  }

  .mini-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .daily-section {
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 10px;
  }

  .daily-thumb {
    width: 48px;
    height: 48px;
  }

  .daily-play,
  .daily-add {
    padding: 8px 12px;
    font-size: 0.45rem;
  }

  .fullscreen-controls {
    gap: 10px;
  }

  .fullscreen-controls .control-btn {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .fullscreen-close {
    width: 34px;
    height: 34px;
    top: 10px;
    right: 10px;
  }

  .top10-item {
    padding: 8px 14px;
    gap: 8px;
  }

  .top10-rank {
    font-size: 0.8rem;
    min-width: 24px;
  }

  .top10-thumb {
    width: 40px;
    height: 30px;
  }

  .copy-playlist-btn {
    padding: 10px 16px;
    font-size: 0.5rem;
  }
}

/* ---------- Responsive: New Features (400px) ---------- */
@media (max-width: 400px) {
  .mini-player {
    padding: 5px 8px;
    gap: 6px;
  }

  .mini-thumb {
    width: 30px;
    height: 30px;
  }

  .mini-title {
    font-size: 0.65rem;
  }

  .mini-artist {
    font-size: 0.6rem;
  }

  .mini-btn {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
  }

  .mini-controls {
    gap: 4px;
  }

  .daily-section {
    padding: 10px 12px;
    gap: 8px;
  }

  .daily-thumb {
    width: 40px;
    height: 40px;
  }

  .daily-title {
    font-size: 0.85rem;
  }

  .daily-artist {
    font-size: 0.7rem;
  }

  .fullscreen-info .fullscreen-title {
    font-size: 0.9rem;
  }

  .fullscreen-info .fullscreen-artist {
    font-size: 0.75rem;
  }

  .top10-item {
    padding: 6px 10px;
    gap: 6px;
  }

  .top10-rank {
    font-size: 0.7rem;
    min-width: 20px;
  }

  .top10-thumb {
    width: 36px;
    height: 27px;
  }

  .top10-info .top10-title {
    font-size: 0.75rem;
  }

  .top10-info .top10-artist {
    font-size: 0.65rem;
  }

  .top10-add {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .copy-playlist-btn {
    padding: 10px 12px;
    font-size: 0.45rem;
  }
}

/* ---------- Reduced Motion: New Features (Part 2) ---------- */
@media (prefers-reduced-motion: reduce) {
  .mini-player {
    transition: none;
  }

  .fullscreen-btn {
    opacity: 1;
  }
}

/* ==========================================================================
   Feature: Custom Background
   ========================================================================== */

/* ---------- Background Button ---------- */
.bg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.bg-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.bg-btn:active {
  transform: scale(0.92);
}

/* ---------- Background Menu ---------- */
.bg-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(245, 197, 24, 0.08);
  z-index: 1000;
  overflow: hidden;
  animation: fadeSlideIn 0.25s ease;
  padding: 8px 0;
}

.bg-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}

.bg-option:hover {
  background: rgba(245, 197, 24, 0.08);
  color: var(--gold);
}

.bg-option.active {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(245, 197, 24, 0.3);
}

.bg-gradient-preview {
  width: 40px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.bg-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
}

.bg-input-row label {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 50px;
}

.bg-color-input {
  flex: 1;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.bg-color-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(245, 197, 24, 0.12);
}

.bg-url-input {
  flex: 1;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.bg-url-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 0.75rem;
}

.bg-url-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(245, 197, 24, 0.12);
}

.bg-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  cursor: pointer;
  padding: 6px 14px;
  transition: color var(--transition);
}

.bg-reset:hover {
  color: var(--danger);
}

/* ---------- Preset Gradient Classes ---------- */
body.bg-cosmic {
  background-image: linear-gradient(135deg, #0c0015 0%, #1a0033 30%, #0d001a 100%) !important;
}

body.bg-sunset {
  background-image: linear-gradient(135deg, #1a0a00 0%, #331a00 30%, #1a0d00 100%) !important;
}

body.bg-aurora {
  background-image: linear-gradient(135deg, #001a0d 0%, #00331a 30%, #001a1a 100%) !important;
}

body.bg-midnight {
  background-image: linear-gradient(135deg, #000d1a 0%, #001a33 30%, #000a1a 100%) !important;
}

body.bg-candy {
  background-image: linear-gradient(135deg, #1a0019 0%, #330033 30%, #1a001a 100%) !important;
}

body.bg-custom-image {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.bg-custom-color {
  background-image: none !important;
}

/* ==========================================================================
   Feature: Follow Users / Friends
   ========================================================================== */

/* ---------- Friends Button ---------- */
.friends-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(245, 197, 24, 0.2);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  cursor: pointer;
  transition:
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.friends-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

.friends-btn:active {
  transform: scale(0.92);
}

/* ---------- Friends Panel ---------- */
.friends-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 197, 24, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fadeSlideIn 0.4s ease;
}

.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.1);
}

.friends-header h3 {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.friends-header .close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: color var(--transition);
}

.friends-header .close-btn:hover {
  color: var(--danger);
}

/* ---------- Friends Add Row ---------- */
.friends-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.06);
}

.friends-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.friends-input::placeholder {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.friends-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.1);
}

.friends-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  color: var(--bg-dark);
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

.friends-add-btn:hover {
  background: var(--gold-light);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.3);
  transform: scale(1.05);
}

.friends-add-btn:active {
  transform: scale(0.92);
}

/* ---------- Friend Item ---------- */
.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(245, 197, 24, 0.04);
  transition: background var(--transition);
}

.friend-item:hover {
  background: rgba(245, 197, 24, 0.03);
}

.friend-name {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.friend-status {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.friend-now-playing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.friend-now-playing img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.friend-now-playing span {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.friend-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
  flex-shrink: 0;
}

.friend-offline {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
  flex-shrink: 0;
}

.friend-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition:
    color var(--transition),
    opacity var(--transition);
}

.friend-item:hover .friend-remove {
  opacity: 1;
}

.friend-remove:hover {
  color: var(--danger);
}

.friend-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  opacity: 0.6;
}

/* ==========================================================================
   Feature: Collaborative Playlists
   ========================================================================== */

/* ---------- Collab Indicator ---------- */
.collab-indicator {
  font-size: 0.6rem;
  margin-left: 4px;
  color: var(--gold-dark);
  opacity: 0.7;
}

/* ---------- Collab Button ---------- */
.collab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--gold-dark);
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transform: scale(0.85);
  transition:
    opacity var(--transition),
    transform var(--transition),
    color var(--transition),
    background var(--transition);
}

.playlist-tab:hover .collab-btn {
  opacity: 1;
  transform: scale(1);
}

.collab-btn:hover {
  color: var(--gold);
  background: rgba(245, 197, 24, 0.2);
}

/* ---------- Collab Code Display ---------- */
.collab-code-display {
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 0 12px rgba(245, 197, 24, 0.4);
  padding: 14px;
  background: rgba(245, 197, 24, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(245, 197, 24, 0.12);
}

/* ---------- Collab Join Input ---------- */
.collab-join-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-dark);
  border: 2px solid rgba(245, 197, 24, 0.15);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.collab-join-input::placeholder {
  color: var(--text-muted);
  opacity: 0.4;
  letter-spacing: 1px;
  text-transform: none;
}

.collab-join-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.12);
}

/* ==========================================================================
   Responsive: Custom Background, Friends, Collab (640px)
   ========================================================================== */
@media (max-width: 640px) {
  .bg-menu {
    min-width: 180px;
  }

  .bg-option {
    padding: 7px 12px;
    font-size: 0.45rem;
  }

  .bg-gradient-preview {
    width: 32px;
    height: 16px;
  }

  .bg-input-row {
    padding: 5px 12px;
  }

  .bg-input-row label {
    font-size: 0.4rem;
    min-width: 40px;
  }

  .bg-color-input,
  .bg-url-input {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .friends-panel {
    border-radius: 10px;
  }

  .friends-header {
    padding: 12px 16px;
  }

  .friends-header h3 {
    font-size: 0.5rem;
  }

  .friends-add {
    padding: 10px 12px;
  }

  .friends-input {
    padding: 7px 10px;
    font-size: 0.75rem;
  }

  .friends-input::placeholder {
    font-size: 0.35rem;
  }

  .friends-add-btn {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .friend-item {
    padding: 8px 12px;
    gap: 8px;
  }

  .friend-name {
    font-size: 0.5rem;
  }

  .friend-status {
    font-size: 0.7rem;
  }

  .friend-now-playing img {
    width: 20px;
    height: 20px;
  }

  .friend-now-playing span {
    font-size: 0.65rem;
    max-width: 120px;
  }

  .collab-code-display {
    font-size: 0.85rem;
    padding: 12px;
  }

  .collab-join-input {
    padding: 8px 10px;
    font-size: 0.7rem;
  }
}

/* ==========================================================================
   Responsive: Custom Background, Friends, Collab (400px)
   ========================================================================== */
@media (max-width: 400px) {
  .bg-btn,
  .friends-btn {
    width: 28px;
    height: 28px;
    font-size: 0.5rem;
  }

  .bg-menu {
    min-width: 160px;
    right: -10px;
  }

  .bg-option {
    padding: 6px 10px;
    font-size: 0.4rem;
  }

  .bg-gradient-preview {
    width: 28px;
    height: 14px;
  }

  .bg-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .bg-color-input,
  .bg-url-input {
    font-size: 0.7rem;
  }

  .bg-reset {
    font-size: 0.4rem;
  }

  .friends-header {
    padding: 10px 14px;
  }

  .friends-header h3 {
    font-size: 0.45rem;
  }

  .friends-add {
    padding: 8px 10px;
    gap: 6px;
  }

  .friends-input {
    padding: 6px 8px;
    font-size: 0.7rem;
  }

  .friends-add-btn {
    width: 26px;
    height: 26px;
    font-size: 0.65rem;
  }

  .friend-item {
    padding: 7px 10px;
    gap: 6px;
  }

  .friend-name {
    font-size: 0.45rem;
  }

  .friend-status {
    font-size: 0.65rem;
  }

  .friend-now-playing img {
    width: 18px;
    height: 18px;
  }

  .friend-now-playing span {
    font-size: 0.6rem;
    max-width: 100px;
  }

  .friend-empty {
    font-size: 0.7rem;
    padding: 18px 12px;
  }

  .collab-code-display {
    font-size: 0.7rem;
    padding: 10px;
    letter-spacing: 1.5px;
  }

  .collab-join-input {
    padding: 7px 8px;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
  }
}

/* ---------- Reduced Motion: Background, Friends, Collab ---------- */
@media (prefers-reduced-motion: reduce) {
  .bg-menu,
  .friends-panel {
    animation: none;
  }

  .collab-btn {
    opacity: 1;
    transform: scale(1);
  }

  .friend-remove {
    opacity: 1;
  }
}

/* ==========================================================================
   Mobile Optimization
   ========================================================================== */

/* Touch-friendly tap targets (minimum 44px) */
@media (max-width: 640px) {
  /* Header compact layout */
  .header {
    padding: 16px 8px 4px;
  }
  .header h1, .header .title {
    font-size: 0.85rem;
  }
  .sync-bar, .account-bar {
    gap: 6px;
  }

  /* Buttons: minimum touch target 44px */
  .control-btn, .volume-mute, .sleep-timer-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .mini-btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* Song delete/queue buttons always visible on mobile (no hover) */
  .song-delete, .playlist-item .song-delete {
    opacity: 0.5;
  }
  .tab-delete, .tab-share, .collab-btn {
    opacity: 0.7;
    transform: scale(1);
  }

  /* Drag handle always visible */
  .drag-handle {
    opacity: 0.5;
  }

  /* Full-width panels */
  .friends-panel, .stats-panel, .history-panel,
  .duplicates-panel, .discover-panel, .lyrics-panel {
    border-radius: 8px;
  }

  /* Footer tools wrap */
  .footer-tools {
    flex-wrap: wrap;
    gap: 6px;
  }
  .footer-tool-btn {
    padding: 6px 10px;
    font-size: 0.4rem;
  }

  /* Mini player mobile */
  .mini-player {
    padding: 6px 10px;
    gap: 8px;
  }
  .mini-thumb {
    width: 32px;
    height: 32px;
  }
  .mini-title {
    font-size: 0.7rem;
  }

  /* Daily section stack on mobile */
  .daily-section {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* BG menu and theme menu full width on mobile */
  .bg-menu, .theme-menu {
    position: fixed;
    left: 5%;
    right: 5%;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Timer menu full width */
  .timer-menu {
    position: fixed;
    left: 10%;
    right: 10%;
    width: 80%;
  }

  /* Color picker centered */
  .color-picker {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Search results max height smaller */
  .search-results {
    max-height: 300px;
  }

  /* Stars slightly bigger for touch */
  .rating-star {
    font-size: 0.85rem;
    padding: 2px;
  }

  /* Shortcuts overlay padding */
  .shortcuts-panel {
    width: 95vw;
    max-height: 80vh;
    overflow-y: auto;
  }
}

@media (max-width: 400px) {
  /* Extra small screens */
  .container {
    padding: 8px 6px 24px;
    gap: 16px;
  }

  .header h1, .header .title {
    font-size: 0.7rem;
  }

  .lucky-button {
    padding: 12px 16px;
    font-size: 0.55rem;
    min-width: 140px;
  }

  /* Stack player controls in 2 rows */
  .player-controls {
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
  }

  /* Playlist tabs scroll hint */
  .playlist-tabs {
    padding-bottom: 8px;
  }

  /* Modal full width */
  .modal {
    width: 96%;
    padding: 16px 12px;
    max-height: 85vh;
    overflow-y: auto;
  }

  /* Public playlists compact */
  .top10-item {
    padding: 6px 0;
  }

  /* Friends panel compact */
  .friend-item {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Footer super compact */
  .footer-tools {
    gap: 4px;
  }
  .footer-tool-btn {
    padding: 5px 8px;
    font-size: 0.35rem;
  }
}

/* iOS safe area support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mini-player {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* Prevent text selection on buttons for mobile */
button, .control-btn, .mini-btn, .playlist-tab, .rating-star {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling for all scrollable containers */
.playlist, .queue-list, .history-list, .search-results,
.lyrics-content, .stats-grid, .friends-list {
  -webkit-overflow-scrolling: touch;
}
