:root {
  --bg-main: #f0f4f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #e2e8f0;
  --border-subtle: rgba(0, 102, 255, 0.12);
  
  --spotify-green: #0066ff;
  --spotify-green-glow: rgba(0, 102, 255, 0.25);
  --accent-purple: #00c6ff;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --shape-xl: 24px;
  --shape-l: 18px;
  --shape-m: 12px;
  --shape-full: 9999px;
  
  --transition-smooth: all 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  --shadow-glow: 0 10px 25px -5px rgba(0, 102, 255, 0.15);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background: #cbd5e1;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  position: relative;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
}

.header {
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(to bottom, var(--bg-main), rgba(240, 244, 249, 0.85));
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 10;
}
.search-box-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--shape-full);
  padding: 2px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: var(--transition-smooth);
}
.search-box-wrapper:focus-within {
  border-color: var(--spotify-green);
  box-shadow: 0 0 15px var(--spotify-green-glow);
}
.search-box-wrapper i {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-right: 10px;
}
.search-box {
  width: 100%;
  padding: 12px 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
}
.search-box::placeholder { color: var(--text-muted); }

.search-btn {
  background: var(--spotify-green);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--shape-full);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
  box-shadow: 0 4px 15px var(--spotify-green-glow);
}
.search-btn:active { transform: scale(0.92); }

.brand-widget {
  margin: 6px 16px 14px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #ffffff, #e0f2fe);
  border-radius: var(--shape-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(0, 102, 255, 0.15);
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.05);
}
.brand-widget h1 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.clock-chip {
  background: rgba(0, 102, 255, 0.1);
  color: var(--spotify-green);
  padding: 8px 14px;
  border-radius: var(--shape-full);
  font-weight: 800;
  font-size: 0.88rem;
  border: 1px solid rgba(0, 102, 255, 0.2);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }
/* Saat mini player tampil, sisakan ruang di bawah supaya kartu terakhir
   (lagu / playlist) tidak ketumpuk mini bar. */
body.mini-on .content { padding-bottom: 12px; }

.section-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 14px 2px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-title span {
  font-size: 0.8rem;
  color: var(--spotify-green);
  font-weight: 700;
}

.song-card {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--shape-l);
  margin-bottom: 10px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, background 0.2s ease;
}
.song-card:active {
  transform: scale(0.98);
  background: var(--bg-card-hover);
}
.song-card.playing {
  border-color: var(--spotify-green);
  background: #e0f2fe;
}
.song-card-img-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  margin-right: 14px;
  flex-shrink: 0;
}
.song-card img {
  width: 100%;
  height: 100%;
  border-radius: var(--shape-m);
  object-fit: cover;
}
.song-card .playing-bars {
  position: absolute;
  inset: 0;
  background: rgba(0, 102, 255, 0.25);
  border-radius: var(--shape-m);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.song-card.playing .playing-bars { display: flex; }
.playing-bars span {
  width: 3px;
  height: 16px;
  background: var(--spotify-green);
  border-radius: 2px;
  animation: eqBounce 0.8s ease-in-out infinite alternate;
}
.playing-bars span:nth-child(2) { animation-delay: 0.2s; }
.playing-bars span:nth-child(3) { animation-delay: 0.4s; }
@keyframes eqBounce { 0% { height: 4px; } 100% { height: 18px; } }

.song-info { flex: 1; min-width: 0; }
.song-info b {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
.song-info p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-action-btn {
  color: var(--text-muted);
  padding: 10px;
  font-size: 1rem;
  transition: color 0.2s;
}
.song-action-btn:active { color: var(--spotify-green); }

.skeleton-card {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--shape-l);
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.skel-block {
  background: linear-gradient(90deg, rgba(0,0,0,0.03) 25%, rgba(0,102,255,0.08) 37%, rgba(0,0,0,0.03) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--shape-m);
}
.skel-img { width: 52px; height: 52px; margin-right: 14px; flex-shrink: 0; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-line-1 { height: 12px; width: 70%; border-radius: 6px; }
.skel-line-2 { height: 10px; width: 45%; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.stats-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 4px;
}
.stats-card {
  background: var(--bg-card);
  border-radius: var(--shape-xl);
  padding: 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}
.stats-hero {
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.12), rgba(0, 198, 255, 0.12));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stats-hero-val {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--spotify-green);
}
.stats-hero-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.stats-hero-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--shape-l);
  background: rgba(0, 102, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--spotify-green);
}

.weekly-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 120px;
  padding-top: 10px;
  gap: 6px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.chart-bar-wrap {
  width: 100%;
  max-width: 24px;
  height: 80px;
  background: rgba(0, 102, 255, 0.06);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.chart-bar {
  width: 100%;
  background: linear-gradient(to top, var(--spotify-green), var(--accent-purple));
  border-radius: 8px;
  transition: height 0.5s ease;
  min-height: 4px;
}
.chart-day {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.chart-col.today .chart-day {
  color: var(--spotify-green);
  font-weight: 800;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-main);
  border-radius: var(--shape-l);
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
}
.badge-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--shape-m);
  background: #e2e8f0;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.achievement-item.unlocked .badge-icon {
  background: linear-gradient(135deg, #0066ff, #00c6ff);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--spotify-green-glow);
}
.badge-info { flex: 1; }
.badge-info b { font-size: 0.85rem; display: block; color: var(--text-primary); }
.badge-info p { font-size: 0.72rem; margin: 2px 0 0; color: var(--text-secondary); }
.badge-status {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--shape-full);
  background: rgba(0,0,0,0.05);
  color: var(--text-muted);
}
.achievement-item.unlocked .badge-status {
  background: rgba(0, 102, 255, 0.12);
  color: var(--spotify-green);
}

.ach-summary { margin-bottom: 12px; }
.ach-sum-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; }
.ach-sum-row b { color: var(--text-primary); font-size: 0.85rem; }
.ach-sum-bar { height: 8px; border-radius: var(--shape-full); background: rgba(0,0,0,0.07); overflow: hidden; }
.ach-sum-bar > div { height: 100%; border-radius: var(--shape-full); background: linear-gradient(90deg, #0066ff, #00c6ff); transition: width 0.5s ease; }
.ach-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ach-prog-bar { flex: 1; height: 5px; border-radius: var(--shape-full); background: rgba(0,0,0,0.07); overflow: hidden; }
.ach-prog-bar > div { height: 100%; background: var(--spotify-green); opacity: 0.65; border-radius: var(--shape-full); }
.ach-prog span { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); }
.ach-list { max-height: 460px; overflow-y: auto; }
.ach-list::-webkit-scrollbar { width: 0; }

.mini-player {
  /* In normal flex flow above the bottom nav — it can never be covered by the
     nav, the gesture bar, or a mobile browser toolbar. */
  position: relative;
  flex-shrink: 0;
  margin: 0 12px 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  height: 64px;
  border-radius: var(--shape-xl);
  display: flex;
  align-items: center;
  padding: 0 12px 0 8px;
  z-index: 9600;
  gap: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(0, 102, 255, 0.15);
  cursor: pointer;
}
#mimg {
  width: 48px;
  height: 48px;
  border-radius: var(--shape-m);
  object-fit: cover;
  flex-shrink: 0;
}
.mini-info { flex: 1; min-width: 0; }
.mini-info b {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.mini-info p {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-btn {
  background: var(--spotify-green);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: var(--shape-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
}

.bottom-nav {
  position: relative;
  flex-shrink: 0;
  height: 74px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
}
.nav-item {
  color: var(--text-muted);
  text-align: center;
  flex: 1;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.nav-item .pill {
  width: 52px;
  height: 30px;
  border-radius: var(--shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.nav-item i { font-size: 1.1rem; }
.nav-item.active { color: var(--spotify-green); }
.nav-item.active .pill {
  background: rgba(0, 102, 255, 0.12);
  color: var(--spotify-green);
}

.full-player {
  position: absolute;
  inset: 0;
  background: var(--bg-main);
  z-index: 200;
  display: none;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-x;
}
.full-player::-webkit-scrollbar { display: none; }

.full-player.active {
  display: flex;
  animation: slideUp 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 9700;
}
.full-player.closing {
  animation: slideDown 0.34s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 9700;
}
/* Saat kembali dari lirik fullscreen, full player cuma "dimunculkan" lagi —
   jangan putar ulang animasi slide up. */
.full-player.no-anim,
.full-player.no-anim.active {
  animation: none !important;
  transition: none !important;
}
/* Saat pemutar penuh terbuka, mini bar disembunyikan supaya tidak ketumpuk. */
body.player-open .mini-player { display: none !important; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(0); } to { transform: translateY(100%); } }

.full-bg {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  background-size: cover;
  background-position: center;
  filter: blur(80px) brightness(1.08) saturate(1.4);
  opacity: 0.35;
  z-index: -2;
  transition: background-image 0.6s ease;
}
.full-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(240, 244, 249, 0.4) 0%, rgba(240, 244, 249, 0.88) 70%, #f0f4f9 100%);
  z-index: -1;
}

.full-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  flex-shrink: 0;
}
.icon-pill {
  width: 42px;
  height: 42px;
  border-radius: var(--shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s;
}
.icon-pill:active { transform: scale(0.9); }

.artwork-container {
  margin: 14px auto 10px;
  height: min(300px, 78vw, 30vh);
  width: auto;
  aspect-ratio: 1/1;
  position: relative;
  flex-shrink: 0;
}
#fimg {
  width: 100%;
  height: 100%;
  border-radius: var(--shape-xl);
  object-fit: cover;
  background: #0f172a;
  box-shadow: 0 20px 40px rgba(0, 102, 255, 0.22);
  transition: transform 0.3s cubic-bezier(0.2,0.8,0.2,1);
}
.full-player.playing #fimg { transform: scale(1.02); }

.full-lower {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.full-lower .spotify-lyrics-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.full-lower .lyrics-card-snippet { flex: 1; min-height: 0; }

.player-track-info {
  margin: 6px 0 12px;
  text-align: center;
  position: relative;
  padding: 0 48px;
}
.track-text { min-width: 0; }
#ftit {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
#fart {
  color: var(--spotify-green);
  margin: 4px 0 0;
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  transition: transform 0.2s, color 0.2s;
}
.fav-btn.active { color: #ef4444; }
.fav-btn:active { transform: translateY(-50%) scale(1.25); }


.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0 2px;
}
.seeker-wrapper { position: relative; margin: 4px 0 10px; }
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--shape-full);
  cursor: pointer;
  outline: none;
  background: linear-gradient(to right, var(--spotify-green) 0%, var(--spotify-green) var(--seek-pct,0%), rgba(0,0,0,0.1) var(--seek-pct,0%), rgba(0,0,0,0.1) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--spotify-green);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--spotify-green-glow);
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.3); }

.transport-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  margin-bottom: 14px;
}
.transport-btn {
  font-size: 1.3rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 10px;
  transition: transform 0.15s, color 0.2s;
}
.transport-btn.active { color: var(--spotify-green); }
.transport-btn:active { transform: scale(0.85); }

.play-btn-circle {
  background: var(--spotify-green);
  color: #ffffff;
  width: 62px;
  height: 62px;
  border-radius: var(--shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 8px 25px var(--spotify-green-glow);
  transition: transform 0.15s;
}
.play-btn-circle:active { transform: scale(0.92); }

.spotify-lyrics-card {
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.12), rgba(0, 198, 255, 0.12));
  backdrop-filter: blur(20px);
  border-radius: var(--shape-xl);
  padding: 16px 18px;
  margin-top: 4px;
  border: 1px solid rgba(0, 102, 255, 0.2);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.08);
  transition: transform 0.2s ease;
}
.spotify-lyrics-card:active { transform: scale(0.99); }

.lyrics-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.lyrics-card-head b {
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lyrics-card-head b i { color: var(--spotify-green); }
.expand-btn-pill {
  background: rgba(0, 102, 255, 0.15);
  color: var(--spotify-green);
  padding: 5px 12px;
  border-radius: var(--shape-full);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(0, 102, 255, 0.2);
}

.lyrics-card-snippet {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-primary);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  position: relative;
}
.lyrics-card-snippet p {
  margin: 0;
  opacity: 0.5;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  transform: translateY(0);
  transition: opacity 0.45s cubic-bezier(0.22,1,0.36,1), transform 0.5s cubic-bezier(0.22,1,0.36,1), color 0.35s ease, font-size 0.35s ease;
  animation: lyricSlideIn 0.5s cubic-bezier(0.22,1,0.36,1) both;
}
.lyrics-card-snippet p.prev { opacity: 0.38; font-size: 0.85rem; color: var(--text-muted); }
.lyrics-card-snippet p.active {
  opacity: 1;
  color: var(--spotify-green);
  font-size: 1.18rem;
  text-shadow: 0 0 14px rgba(0, 102, 255, 0.25);
}
.lyrics-card-snippet p.next { opacity: 0.5; font-size: 0.9rem; color: var(--text-muted); }
/* "Not started yet" state — nothing is highlighted before the first lyric hits */
.lyrics-card-snippet p.waiting {
  opacity: 0.55;
  font-size: 0.74rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lyrics-card-snippet p.waiting i { font-size: 0.8rem; animation: notePulse 1.6s ease-in-out infinite; }
@keyframes notePulse { 0%,100% { opacity: 0.5; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
/* Slide only (no opacity) so lines never flash to solid black mid-transition */
@keyframes lyricSlideIn {
  from { transform: translateY(14px); }
  to { transform: translateY(0); }
}

.fullscreen-lyrics-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: #f0f4f9;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.fullscreen-lyrics-modal.active {
  display: flex;
  animation: none;
}
/* Full player memakai animasi transform yang membuat stacking context sendiri.
   Sembunyikan layer itu saat lirik fullscreen aktif agar tidak bisa menutup modal. */
body.lyrics-fullscreen-open .full-player {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
body.lyrics-fullscreen-open .fullscreen-lyrics-modal.active {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
body.lyrics-fullscreen-open .mini-player,
body.lyrics-fullscreen-open .bottom-nav {
  visibility: hidden;
  pointer-events: none;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.fs-lyrics-bg {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  background-size: cover;
  background-position: center;
  filter: blur(90px) brightness(1.08) saturate(1.4);
  opacity: 0.35;
  z-index: -1;
}

/* Fixed Header Layout Fix for Lyrics Screen */
.fs-lyrics-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  background: linear-gradient(to bottom, rgba(240, 244, 249, 0.96) 65%, rgba(240, 244, 249, 0));
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.fs-lyrics-title {
  text-align: center;
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}
.fs-lyrics-title b {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fs-lyrics-title p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--spotify-green);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-lyrics-container {
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
  overflow-y: auto;
  padding: 30vh 22px 45vh;
  scroll-behavior: smooth;
  scrollbar-width: none;
  text-align: left;
}
.fs-lyrics-container::-webkit-scrollbar { display: none; }

/* Spotify Style Lyric Text Animation */
.fs-lyric-line {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.4;
  color: #94a3b8;
  margin: 22px 0;
  cursor: pointer;
  transition: transform 0.45s cubic-bezier(0.22,1,0.36,1), color 0.35s ease, opacity 0.35s ease, text-shadow 0.35s ease, filter 0.35s ease, font-size 0.35s ease;
  padding: 8px 12px;
  border-radius: 14px;
  transform-origin: left center;
  opacity: 0.4;
  filter: blur(0.4px);
}
.fs-lyric-line:active { background: rgba(0, 102, 255, 0.08); }
.fs-lyric-line.active {
  color: var(--spotify-green);
  font-size: 2rem;
  opacity: 1;
  filter: blur(0px);
  transform: scale(1.02) translateX(2px);
  text-shadow: 0 4px 22px rgba(0, 102, 255, 0.32);
}
.fs-lyric-line.passed {
  color: #cbd5e1;
  opacity: 0.55;
  filter: blur(0px);
}

.fs-lyrics-status {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 35vh;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pl-pick-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.pl-pick-overlay.show { opacity: 1; pointer-events: auto; }

.pl-pick-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9991;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2,0.9,0.25,1.1);
  max-height: 65vh;
  overflow-y: auto;
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
}
.pl-pick-sheet.show { transform: translateY(0); }
.pl-pick-handle {
  width: 36px;
  height: 4px;
  background: rgba(0,0,0,0.15);
  border-radius: var(--shape-full);
  margin: 6px auto 14px;
}
.pl-pick-sheet h4 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: var(--text-primary);
  text-align: center;
}
.pl-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--shape-l);
  background: var(--bg-main);
  margin-bottom: 8px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}
.pl-pick-item i { color: var(--spotify-green); font-size: 1.1rem; width: 24px; text-align: center; }
.pl-pick-item b { color: var(--text-primary); font-size: 0.9rem; font-weight: 700; flex: 1; }

.app-toast {
  position: fixed;
  bottom: 160px;
  left: 50%;
  z-index: 10050;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--shape-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.2,0.9,0.25,1.1), opacity 0.22s ease;
}
.app-toast.show { transform: translate(-50%, 0); opacity: 1; }
.app-toast i { color: #38bdf8; }

/* ================= DARK THEME (soft dark, never pure black) ================= */
body.dark {
  --bg-main: #191c22;
  --bg-surface: #232730;
  --bg-card: #232730;
  --bg-card-hover: #2c313c;
  --border-subtle: rgba(255, 255, 255, 0.10);

  --spotify-green: #ffffff;
  --spotify-green-glow: rgba(255, 255, 255, 0.18);
  --accent-purple: #cbd5e1;

  --text-primary: #eceef3;
  --text-secondary: #b3bac7;
  --text-muted: #7d8595;

  --shadow-glow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}
body.dark { background: #101318; }
body.dark .header {
  background: linear-gradient(to bottom, var(--bg-main), rgba(25, 28, 34, 0.85));
}
body.dark .brand-widget {
  background: linear-gradient(135deg, #232730, #2b313d);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: none;
}
body.dark .clock-chip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.14);
}
body.dark .search-btn,
body.dark .play-btn-circle,
body.dark .mini-btn,
body.dark .api-icon-btn { color: #191c22; }
body.dark .song-card.playing { background: #2c313c; }
body.dark .bottom-nav { background: rgba(30, 34, 41, 0.95); }
body.dark .nav-item.active .pill { background: rgba(255, 255, 255, 0.12); }
/* Shuffle/Repeat active state — white blends into the other icons in dark
   mode, so use a distinct accent instead of --spotify-green here. */
body.dark .transport-btn.active {
  color: #4ade80;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.55);
}
body.dark .full-bg-overlay {
  background: linear-gradient(to bottom, rgba(25, 28, 34, 0.45) 0%, rgba(25, 28, 34, 0.9) 70%, #191c22 100%);
}
body.dark .full-bg, body.dark .fs-lyrics-bg { filter: blur(80px) brightness(0.55) saturate(1.2); opacity: 0.5; }
body.dark .fullscreen-lyrics-modal { background: var(--bg-main); }
body.dark .fs-lyrics-header {
  background: linear-gradient(to bottom, rgba(25, 28, 34, 0.96) 65%, rgba(25, 28, 34, 0));
}
body.dark .fs-lyric-line { color: #7d8595; }
body.dark .fs-lyric-line.passed { color: #59616f; }
body.dark .fs-lyric-line.active { text-shadow: 0 4px 22px rgba(255, 255, 255, 0.22); }
body.dark .lyrics-card-snippet p.active { text-shadow: 0 0 14px rgba(255, 255, 255, 0.2); }
body.dark .spotify-lyrics-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: none;
}
body.dark .expand-btn-pill {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.16);
}
body.dark .icon-pill { background: rgba(255, 255, 255, 0.10); }
body.dark .pl-pick-sheet, body.dark .mini-player { background: var(--bg-surface); }
body.dark .app-toast { background: #2c313c; color: #eceef3; }
body.dark .app-toast i { color: #eceef3; }
body.dark input[type="range"] {
  background: linear-gradient(to right, var(--spotify-green) 0%, var(--spotify-green) var(--seek-pct,0%), rgba(255,255,255,0.15) var(--seek-pct,0%), rgba(255,255,255,0.15) 100%);
}
body.dark .ach-sum-bar, body.dark .ach-prog-bar { background: rgba(255,255,255,0.10); }

/* ================= SETTINGS SECTION ================= */
.set-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--shape-l);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.set-card h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}
.set-card p.set-sub {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.5;
}
.theme-options { display: flex; gap: 10px; }
.theme-opt {
  flex: 1;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--shape-m);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-secondary);
  background: var(--bg-main);
  transition: var(--transition-smooth);
}
.theme-opt i { display: block; font-size: 1.2rem; margin-bottom: 8px; }
.theme-opt.active {
  border-color: var(--spotify-green);
  color: var(--spotify-green);
  box-shadow: 0 0 0 3px var(--spotify-green-glow);
}
.credit-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.credit-row:last-child { border-bottom: none; }
.credit-row i { color: var(--spotify-green); font-size: 1rem; width: 22px; text-align: center; margin-top: 3px; }
.credit-row b { display: block; font-size: 0.85rem; color: var(--text-primary); font-weight: 800; }
.credit-row span { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; line-height: 1.5; }
.credit-foot {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  margin: 4px 0 10px;
}

/* ================= SECTION / TAB TRANSITIONS ================= */
.tab-view { animation: tabIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; will-change: transform, opacity; }
@keyframes tabIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.content { contain: layout paint; }
.nav-item .pill { transition: background 0.25s ease, transform 0.25s cubic-bezier(0.2,0.9,0.25,1.4); }
.nav-item.active .pill { transform: translateY(-2px) scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .tab-view { animation: none; }
}

#yt-api { position: absolute; top: -9999px; left: -9999px; opacity: 0; pointer-events: none; }

/* ============================================================
   DESKTOP OPTIMIZATION (>=900px)
   Additive only — mobile layout above is untouched below this point.
   Sidebar nav + card grid + split-view full player, Spotify-style.
   ============================================================ */
@media (min-width: 900px) {

  :root { --sidebar-w: 104px; }

  /* True fullscreen — no floating card / letterboxing on any screen size */
  body { padding: 0; }

  #app-container {
    max-width: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }

  /* ---- Sidebar navigation (was bottom-nav) ---- */
  .bottom-nav {
    position: absolute;
    margin: 0;
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--sidebar-w);
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    padding: calc(28px + env(safe-area-inset-top)) 0 20px;
    border-top: none;
    border-right: 1px solid var(--border-subtle);
  }
  .nav-item { flex: none; width: 100%; }
  .nav-item .pill { width: 56px; height: 40px; }
  .nav-item.active .pill { transform: translateY(0) scale(1); }

  /* ---- Push in-flow content beside the sidebar ---- */
  .header { padding-left: calc(var(--sidebar-w) + 24px); padding-right: 28px; gap: 14px; }
  .search-box-wrapper { flex: 0 1 520px; }

  .content {
    padding-left: calc(var(--sidebar-w) + 24px);
    padding-right: 28px;
    padding-bottom: 110px;
  }

  .brand-widget { margin-left: 0; margin-right: 0; padding: 22px 26px; }
  .brand-widget h1 { font-size: 1.5rem; }
  .section-title { font-size: 1.05rem; }

  /* ---- Song list becomes a browsable card grid ---- */
  #songList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
  }
  #songList .song-card {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    margin-bottom: 0;
  }
  #songList .song-card-img-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 0 12px;
  }
  #songList .song-info { width: 100%; }
  #songList .song-action-btn { align-self: flex-end; }

  /* ---- Stats: hero + weekly chart on the left, achievements on the right ---- */
  .stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
    gap: 16px;
    align-items: start;
  }
  .stats-card:nth-child(1) { grid-column: 1 / 2; }
  .stats-card:nth-child(2) { grid-column: 1 / 2; }
  .stats-card:nth-child(3) { grid-column: 2 / 3; grid-row: 1 / 3; }

  /* ---- Playlists: each playlist as a card in a multi-column grid ---- */
  #plListContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    align-items: start;
  }
  #plListContainer > .stats-card { margin-bottom: 0 !important; }

  /* ---- Settings: readable centered column instead of edge-to-edge ---- */
  #tab-set-view { max-width: 720px; margin: 0 auto; }

  /* ---- Mini player becomes a full-width now-playing bar ---- */
  .mini-player {
    position: absolute;
    margin: 0;
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    height: 78px;
    border-radius: 0;
    padding: 0 32px;
    border: none;
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -10px 30px rgba(0, 102, 255, 0.08);
  }
  #mimg { width: 56px; height: 56px; }
  .mini-info b { font-size: 0.94rem; }
  .mini-btn { width: 46px; height: 46px; font-size: 1.05rem; }

  /* ---- Full player: split view — artwork left, controls/lyrics right ---- */
  /* IMPORTANT: stays display:none until JS adds .active — only the internal
     grid layout is prepared here, visibility is untouched. */
  .full-player {
    grid-template-columns: minmax(280px, 400px) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "topbar topbar"
      "art    lower";
    column-gap: 56px;
    row-gap: 8px;
    padding: 32px 56px 40px calc(var(--sidebar-w) + 32px);
  }
  .full-player.active { display: grid; }
  .full-player.closing { display: grid; }
  .full-topbar { grid-area: topbar; }
  .artwork-container {
    grid-area: art;
    align-self: center;
    margin: 0;
    height: min(46vh, 400px);
  }
  .full-lower {
    grid-area: lower;
    justify-content: center;
    max-width: 640px;
    min-width: 0;    /* prevents long titles/lyrics from overflowing into the artwork column */
    width: 100%;
    overflow: hidden;
  }
  .player-track-info { text-align: left; padding: 0 48px 0 0; margin-top: 0; }
  #ftit { font-size: 1.7rem; }
  #fart { font-size: 1rem; }
  .fav-btn { right: 0; }
  .transport-row { max-width: 420px; }
  .full-lower .spotify-lyrics-card { max-height: 260px; }

  /* ---- Fullscreen lyrics: narrower reading column, bigger type ---- */
  .fs-lyrics-header { padding-left: calc(var(--sidebar-w) + 32px); padding-right: 56px; }
  .fs-lyrics-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 20vh 20px 40vh calc(var(--sidebar-w) + 20px);
  }
  .fs-lyric-line { font-size: 1.7rem; }
  .fs-lyric-line.active { font-size: 2.15rem; }

  /* ---- Add-to-playlist: centered dialog instead of bottom sheet ---- */
  .pl-pick-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 440px;
    max-height: 68vh;
    border-radius: 22px;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.2,0.9,0.25,1.1), opacity 0.2s ease;
  }
  .pl-pick-sheet.show { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
  .pl-pick-handle { display: none; }

  .app-toast { bottom: 108px; }
}

@media (min-width: 900px) and (min-height: 760px) {
  #songList { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ============================================================
   PWA — Install App card, iOS guide sheet, update banner
   ============================================================ */
.pwa-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border-radius: 16px;
  background: var(--bg-main, rgba(127,127,127,0.07));
  margin-bottom: 12px;
}
.pwa-icon {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1fb6ff, #0b74f2);
  color: #fff; font-size: 1.15rem;
}
.pwa-meta { display: flex; flex-direction: column; min-width: 0; }
.pwa-meta b { color: var(--text-primary); font-size: 0.92rem; }
.pwa-meta span { color: var(--text-secondary); font-size: 0.76rem; line-height: 1.35; }

.pwa-perks { display: flex; gap: 8px; margin-bottom: 14px; }
.pwa-perks div {
  flex: 1; text-align: center; font-size: 0.68rem; font-weight: 700;
  color: var(--text-secondary); padding: 10px 4px; border-radius: 12px;
  background: var(--bg-main, rgba(127,127,127,0.07));
}
.pwa-perks i { display: block; font-size: 0.95rem; margin-bottom: 6px; color: var(--spotify-green); }

.pwa-install-btn {
  width: 100%; border: 0; cursor: pointer;
  padding: 13px 18px; border-radius: 999px;
  font-family: inherit; font-weight: 800; font-size: 0.88rem;
  color: #fff; background: linear-gradient(160deg, #1fb6ff, #0b74f2);
  box-shadow: 0 8px 20px rgba(11, 116, 242, 0.28);
  transition: transform .15s ease, opacity .15s ease;
  margin-bottom: 10px;
}
.pwa-install-btn:last-child { margin-bottom: 0; }
.pwa-install-btn i { margin-right: 8px; }
.pwa-install-btn:active { transform: scale(0.97); }
.pwa-install-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.pwa-card[data-state="installed"] .pwa-install-btn {
  background: rgba(127,127,127,0.18); color: var(--text-secondary); box-shadow: none; opacity: 1;
}

.pwa-ios-sheet .pwa-step {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px;
}
.pwa-ios-sheet .pwa-step span {
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1fb6ff, #0b74f2);
  color: #fff; font-size: 0.75rem; font-weight: 800;
}
.pwa-ios-sheet .pwa-step p {
  margin: 3px 0 0; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4;
}
.pwa-ios-sheet .pwa-step b { color: var(--text-primary); }

.pwa-update-bar {
  position: fixed; left: 50%; bottom: -120px; transform: translateX(-50%);
  z-index: 9999; display: flex; align-items: center; gap: 14px;
  padding: 12px 14px 12px 18px; border-radius: 999px;
  background: var(--bg-card, #101418); color: #fff;
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
  font-size: 0.82rem; font-weight: 700;
  transition: bottom .35s cubic-bezier(.22,1,.36,1);
}
.pwa-update-bar.show { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.pwa-update-bar button {
  border: 0; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 0.78rem;
  padding: 8px 16px; border-radius: 999px; color: #fff;
  background: linear-gradient(160deg, #1fb6ff, #0b74f2);
}

/* installed app: respect device safe areas like a native shell */
html.pwa-standalone body { overscroll-behavior-y: none; }
html.pwa-standalone .bottom-nav { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
html.pwa-standalone .header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }

/* ================= AUTH GATE (Google sign-in + username setup) ================= */
#app-container { display: none; }

.auth-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 30% 20%, rgba(0,102,255,0.18), transparent 60%),
              var(--bg-main);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.auth-overlay.show { opacity: 1; pointer-events: auto; }

.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 32px 26px;
  box-shadow: var(--shadow-glow, 0 20px 40px rgba(0,0,0,.12));
  text-align: center;
}
.auth-logo {
  font-size: 1.5rem; font-weight: 800; color: var(--text-primary);
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px;
}
.auth-logo i { color: var(--spotify-green); }
.auth-tagline { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; margin: 0 0 26px; }

.google-signin-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border-subtle);
  background: var(--bg-card); color: var(--text-primary);
  font-family: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.google-signin-btn:active { transform: scale(0.97); background: var(--bg-card-hover); }
.auth-hint { min-height: 16px; font-size: 0.78rem; color: #ef4444; margin-top: 12px; }

.auth-avatar-row { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 22px; }
.auth-avatar-row img {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: var(--bg-card-hover); flex-shrink: 0;
}
.auth-avatar-row b { display: block; font-size: 0.92rem; color: var(--text-primary); }
.auth-avatar-row span { font-size: 0.76rem; color: var(--text-muted); }

.auth-label {
  display: block; text-align: left; font-size: 0.78rem; font-weight: 700;
  color: var(--text-secondary); margin-bottom: 8px;
}
.auth-username-wrap {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px;
  padding: 12px 14px;
}
.auth-username-wrap span { color: var(--text-muted); font-weight: 700; }
.auth-username-wrap input {
  border: 0; background: transparent; outline: none; width: 100%;
  font-family: inherit; font-size: 0.92rem; color: var(--text-primary);
}
.auth-username-status {
  text-align: left; font-size: 0.76rem; min-height: 16px; margin: 8px 0 18px; color: var(--text-muted);
}
.auth-username-status.ok { color: #22c55e; }
.auth-username-status.err { color: #ef4444; }
.auth-username-status.checking { color: var(--text-muted); }

.auth-submit-btn {
  width: 100%; padding: 13px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--spotify-green); color: #fff; font-family: inherit;
  font-weight: 800; font-size: 0.9rem; box-shadow: 0 4px 15px var(--spotify-green-glow);
}
.auth-submit-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.auth-signout-link {
  display: block; width: 100%; margin-top: 12px; background: transparent; border: 0;
  color: var(--text-muted); font-family: inherit; font-size: 0.78rem; cursor: pointer;
}

#authStepLoading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0; }
#authStepLoading i { font-size: 1.8rem; color: var(--spotify-green); }
#authStepLoading span { color: var(--text-secondary); font-size: 0.85rem; }

/* ================= ACCOUNT SETTINGS CARD ================= */
.account-profile-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.account-profile-row img {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--bg-card-hover);
}
.account-profile-info b { display: block; font-size: 0.95rem; color: var(--text-primary); }
.account-profile-info span { font-size: 0.78rem; color: var(--text-muted); }
.acct-signout-btn { background: #ef4444 !important; margin-top: 12px; box-shadow: none !important; }

/* ================= PLAYLIST COVERS (no custom upload — auto mosaic) ================= */
.pl-cover, .pl-cover-empty {
  width: 100%; height: 100%; border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.pl-cover img { width: 100%; height: 100%; object-fit: cover; }
.pl-cover-empty {
  background: linear-gradient(150deg, var(--spotify-green), var(--accent-purple));
  color: #fff; font-size: 1.1rem;
}
.pl-cover-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pl-cover-grid img { width: 100%; height: 100%; object-fit: cover; }
.pl-cover-mini { width: 46px; height: 46px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }

/* ================= PLAYLIST SEARCH RESULTS (Spotify-style) ================= */
.pl-search-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.pl-search-card {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px;
  cursor: pointer; transition: background .15s ease;
}
.pl-search-card:active { background: var(--bg-card-hover); }
.pl-search-card-info { min-width: 0; }
.pl-search-card-info b {
  display: block; font-size: 0.88rem; color: var(--text-primary); font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pl-search-card-info span { font-size: 0.74rem; color: var(--text-muted); }

/* ================= PLAYLIST DETAIL PAGE (Spotify-style) ================= */
.pl-detail-modal {
  position: fixed; inset: 0; z-index: 9500;
  background: var(--bg-main);
  transform: translateY(100%); opacity: 0; pointer-events: none;
  transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .3s ease;
  overflow-y: auto;
}
.pl-detail-modal.active { transform: translateY(0); opacity: 1; pointer-events: auto; }
/* Mini player harus tetap terlihat di atas halaman detail playlist, dan
   isi playlist tidak boleh ketumpuk / ketutup sama mini bar. */
body.mini-on .pl-detail-modal .pl-detail-body { padding-bottom: 110px; }
/* Khusus di playlist detail: mini bar melayang sedikit di atas bawah layar
   (tidak nempel ke bawah) karena bottom nav tertutup modal. */
body.pl-detail-open .mini-player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  max-width: 456px;
  margin: 0 auto;
  z-index: 9650;
}
.pl-detail-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px; background: var(--bg-main);
}
.pl-detail-header b { font-size: 0.8rem; color: var(--text-secondary); letter-spacing: 1px; }
.pl-detail-body { padding: 0 20px 40px; }
.pl-detail-cover {
  width: 180px; height: 180px; margin: 10px auto 20px; border-radius: 16px; overflow: hidden;
  box-shadow: 0 14px 30px rgba(0,0,0,0.18);
}
.pl-detail-name { text-align: center; font-size: 1.4rem; font-weight: 800; color: var(--text-primary); margin: 0 0 10px; }
.pl-detail-owner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 22px;
}
.pl-detail-owner img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.pl-detail-owner i { font-size: 1.3rem; color: var(--text-muted); }
.pl-detail-actions { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.pl-detail-play-btn, .pl-detail-save-btn {
  display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 0.85rem; padding: 12px 26px; border-radius: 999px;
}
.pl-detail-play-btn { background: var(--spotify-green); color: #fff; box-shadow: 0 4px 15px var(--spotify-green-glow); }
.pl-detail-save-btn { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-subtle); }
.pl-detail-songs { display: flex; flex-direction: column; gap: 6px; }

body.dark .auth-overlay { background: radial-gradient(circle at 30% 20%, rgba(0,102,255,0.18), transparent 60%), var(--bg-main); }
body.dark .auth-card, body.dark .google-signin-btn, body.dark .auth-username-wrap, body.dark .pl-search-card { background: var(--bg-surface); }

/* --spotify-green becomes white in dark mode (see body.dark block above), so any
   button/text using it as a background needs dark text here for contrast — same
   pattern already used for .play-btn-circle. */
body.dark .auth-submit-btn,
body.dark .pl-detail-play-btn { color: #191c22; }


/* ============================================================
   PLAYLIST PRIVACY CONTROLS (private / unlisted / public)
   ============================================================ */
.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.privacy-chip i { color: var(--spotify-green); font-size: 0.7rem; }
.privacy-chip:hover { background: rgba(0, 102, 255, 0.06); }

body.dark .privacy-chip:hover { background: rgba(255, 255, 255, 0.06); }

/* ================= SETTINGS: API ACCESS ================= */
.api-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  font-size: .82rem;
  line-height: 1.35;
}
.api-empty i { color: var(--spotify-green); font-size: 1rem; }

.api-key-block { margin-bottom: 12px; }

.api-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.api-key-row code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .76rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.api-key-row code::-webkit-scrollbar { display: none; }

.api-icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--spotify-green);
  color: #fff;
  cursor: pointer;
  font-size: .85rem;
  transition: transform .15s ease, opacity .15s ease;
}
.api-icon-btn:active { transform: scale(.94); }

.api-hint {
  margin: 0;
  font-size: .74rem;
  line-height: 1.4;
  color: var(--text-secondary);
}
.api-hint i { color: #e0a80d; margin-right: 6px; }

.api-docs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

/* ================= API DOCS PAGE ================= */
.docs-body {
  margin: 0;
  display: block;
  height: auto;
  min-height: 100vh;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  overflow-y: auto;
}
.docs-wrap { max-width: 820px; margin: 0 auto; padding: 24px 18px 60px; }
.docs-head h1 {
  margin: 14px 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.docs-head h1 i { color: var(--spotify-green); margin-right: 8px; }
.docs-head p { margin: 0; color: var(--text-secondary); font-size: .9rem; line-height: 1.55; }
.docs-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 700;
}
.docs-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  background: var(--bg-card);
  box-shadow: 0 8px 26px rgba(20, 30, 55, .07);
}
.docs-card h2 { margin: 0 0 10px; font-size: 1.05rem; font-weight: 800; }
.docs-card h3 { margin: 16px 0 6px; font-size: .88rem; font-weight: 700; color: var(--text-secondary); }
.docs-card p { margin: 0 0 10px; font-size: .86rem; line-height: 1.6; color: var(--text-secondary); }
.docs-card p b { color: var(--text-primary); }
.docs-pre {
  margin: 0 0 12px;
  padding: 14px;
  border-radius: 14px;
  background: #12151c;
  color: #e9eef7;
  overflow-x: auto;
}
.docs-pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .76rem;
  line-height: 1.65;
  white-space: pre;
}
.docs-card code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.docs-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: .8rem; }
.docs-table th, .docs-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.docs-table th { font-weight: 700; color: var(--text-primary); }
.docs-table td { color: var(--text-secondary); }
.docs-warn, .docs-note {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(224, 168, 13, .12);
  font-size: .8rem !important;
}
.docs-warn i { color: #e0a80d; margin-right: 6px; }
.docs-note { background: var(--bg-card-hover); }
.docs-foot { margin-top: 22px; text-align: center; }
