/* ============================================
   BJB Player - Premium Music Streaming UI
   Theme: Red & Black | Mobile-First
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --primary: #DC2626;
  --primary-light: #EF4444;
  --primary-dark: #991B1B;
  --primary-glow: rgba(220, 38, 38, 0.35);
  --primary-gradient: linear-gradient(135deg, #DC2626, #EF4444);
  --primary-gradient-v: linear-gradient(180deg, #DC2626, #991B1B);

  --bg-primary: #0A0A0A;
  --bg-secondary: #111111;
  --bg-card: #181818;
  --bg-elevated: #282828;
  --bg-highlight: #333333;
  --bg-hover: rgba(255, 255, 255, 0.06);

  --text-primary: #FFFFFF;
  --text-secondary: #B3B3B3;
  --text-muted: #727272;

  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.06);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-red: 0 4px 24px rgba(220, 38, 38, 0.25);
  --shadow-red-lg: 0 8px 40px rgba(220, 38, 38, 0.35);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --mini-player-h: 64px;
  --bottom-nav-h: 60px;
  --header-h: 56px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow: hidden; height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

button { border: none; background: none; color: inherit; font-family: inherit; cursor: pointer; outline: none; font-size: inherit; }
input[type="text"], input[type="search"] { border: none; outline: none; font-family: inherit; background: none; color: inherit; }
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ---------- App ---------- */
.app { width: 100%; height: 100vh; height: 100dvh; position: relative; overflow: hidden; background: var(--bg-primary); }
.app-container { display: flex; flex-direction: column; height: 100%; position: relative; }

/* ---------- Splash Screen ---------- */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999; background: var(--bg-primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.splash-screen.fade-out { opacity: 0; visibility: hidden; }
.splash-logo-container { width: 100px; height: 100px; }
.splash-logo-svg { width: 100px; height: 100px; filter: drop-shadow(0 0 30px var(--primary-glow)); animation: splash-pulse 2s ease-in-out infinite; }
@keyframes splash-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 30px var(--primary-glow)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 50px var(--primary-glow)); }
}
.splash-text { font-size: 28px; font-weight: 800; letter-spacing: 4px; text-transform: uppercase; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.splash-loading { width: 120px; height: 3px; background: var(--bg-elevated); border-radius: var(--radius-full); overflow: hidden; margin-top: 24px; }
.splash-loading-bar { width: 40%; height: 100%; background: var(--primary-gradient); border-radius: var(--radius-full); animation: splash-load 1.5s ease-in-out infinite; }
@keyframes splash-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; padding-top: calc(12px + var(--safe-top)); min-height: var(--header-h);
  background: linear-gradient(180deg, rgba(10,10,10,0.85) 0%, rgba(10,10,10,0.7) 100%);
  backdrop-filter: blur(30px) saturate(1.5); -webkit-backdrop-filter: blur(30px) saturate(1.5);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.back-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); background: var(--glass-strong); font-size: 18px; transition: var(--transition); }
.back-btn:hover { background: var(--bg-elevated); }
.header-title { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.header-logo { width: 32px; height: 32px; }

/* ---------- Views ---------- */
.views-container { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: calc(var(--mini-player-h) + var(--bottom-nav-h) + var(--safe-bottom) + 8px); scroll-behavior: smooth; }
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Greeting ---------- */
.greeting { font-size: 26px; font-weight: 800; padding: 8px 20px 20px; background: linear-gradient(135deg, var(--text-primary), var(--primary-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ---------- Section ---------- */
.section { margin-bottom: 32px; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 700; }
.section-more { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Song Grid (Horizontal) ---------- */
.song-grid {
  display: flex; gap: 10px; overflow-x: auto; padding: 0 20px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.song-card { flex: 0 0 130px; min-width: 0; max-width: 130px; overflow: hidden; scroll-snap-align: start; cursor: pointer; transition: var(--transition); }
.song-card:active { transform: scale(0.96); }

.song-card-cover {
  width: 130px; height: 130px; border-radius: var(--radius-lg); overflow: hidden;
  position: relative; margin-bottom: 10px; background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.song-card-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.song-card-cover .cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800; color: rgba(255,255,255,0.9);
}

.song-card.playing .song-card-cover { box-shadow: var(--shadow-red); }
.song-card.playing .song-card-cover::after {
  content: ''; position: absolute; inset: 0; border: 2px solid var(--primary); border-radius: var(--radius-lg);
  animation: glow-pulse 2s ease-in-out infinite; z-index: 2;
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: inset 0 0 15px var(--primary-glow); }
  50% { box-shadow: inset 0 0 25px var(--primary-glow); }
}

.song-card-play {
  position: absolute; bottom: 8px; right: 8px; width: 36px; height: 36px;
  border-radius: var(--radius-full); background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-red); opacity: 0; transform: translateY(8px);
  transition: var(--transition); z-index: 3;
}
.song-card:hover .song-card-play, .song-card.playing .song-card-play { opacity: 1; transform: translateY(0); }
.song-card-play svg { width: 16px; height: 16px; fill: white; }

.song-card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.song-card-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; max-width: 100%; }

/* ---------- Category Grid ---------- */
.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0 20px; }

.category-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg); padding: 16px;
  cursor: pointer; transition: var(--transition); position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.category-card::before { content: ''; position: absolute; top: 0; right: 0; width: 60%; height: 100%; background: linear-gradient(135deg, transparent, rgba(220,38,38,0.06)); pointer-events: none; }
.category-card::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg); background: linear-gradient(135deg, transparent 30%, rgba(220,38,38,0.04)); pointer-events: none; opacity: 0; transition: var(--transition); }
.category-card:hover::after { opacity: 1; }
.category-card:active { transform: scale(0.97); }
.category-card:hover { border-color: rgba(220, 38, 38, 0.3); }

.category-card-icon {
  width: 32px; height: 32px; margin-bottom: 10px;
  color: var(--primary-light); display: flex; align-items: center; justify-content: center;
}
.category-card-icon svg { width: 28px; height: 28px; fill: currentColor; }
.category-card-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.category-card-count { font-size: 12px; color: var(--text-muted); }

/* ---------- Song List ---------- */
.song-list { padding: 0 12px; }
.song-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 8px;
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast); position: relative;
}
.song-item:hover { background: var(--bg-hover); }
.song-item:active { transform: scale(0.99); }
.song-item.playing { background: rgba(220, 38, 38, 0.08); }
.song-item.playing .song-item-title { color: var(--primary-light); }

.song-item-cover {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; position: relative; background: var(--bg-card);
}
.song-item-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.song-item-cover .cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: rgba(255,255,255,0.85);
}
.song-item-cover .playing-indicator {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); z-index: 2;
}

.playing-bars { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.playing-bar { width: 3px; background: var(--primary-light); border-radius: 2px; animation: equalizer 1s ease-in-out infinite; }
.playing-bar:nth-child(1) { animation-delay: 0s; height: 8px; }
.playing-bar:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.playing-bar:nth-child(3) { animation-delay: 0.4s; height: 10px; }
.playing-bar:nth-child(4) { animation-delay: 0.1s; height: 16px; }
@keyframes equalizer { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

.song-item-info { flex: 1; min-width: 0; }
.song-item-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: var(--transition); }
.song-item-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.song-item-more {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); color: var(--text-muted); flex-shrink: 0;
  transition: var(--transition); font-size: 18px;
}
.song-item-more:hover { color: var(--text-primary); background: var(--glass-strong); }

/* ---------- Search View ---------- */
.search-view { padding: 0; }
.search-container { position: sticky; top: 0; z-index: 10; padding: 8px 20px 16px; background: var(--bg-primary); }
.search-input-wrapper { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 14px; color: var(--text-muted); font-size: 18px; pointer-events: none; display: flex; }
.search-icon svg { width: 18px; height: 18px; stroke: var(--text-muted); }
.search-input { width: 100%; height: 46px; padding: 0 16px 0 44px; background: var(--bg-elevated); border-radius: var(--radius-full); font-size: 15px; color: var(--text-primary); border: 1px solid transparent; transition: var(--transition); }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--primary); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.search-clear { position: absolute; right: 12px; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--bg-highlight); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-secondary); transition: var(--transition); }
.search-clear:hover { background: var(--bg-hover); }
.search-results { padding: 0 0 20px; }
.search-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); text-align: center; }
.search-placeholder-icon { margin-bottom: 16px; opacity: 0.4; color: var(--text-muted); }
.search-placeholder-icon svg { width: 48px; height: 48px; }
.search-placeholder-text { font-size: 16px; font-weight: 500; }
.search-result-section { margin-bottom: 24px; }
.search-result-heading { font-size: 14px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.5px; padding: 0 20px; margin-bottom: 12px; }

/* ---------- Library View ---------- */
.library-header { display: flex; flex-direction: column; gap: 16px; padding: 8px 20px 12px; }
.library-header h2 { font-size: 26px; font-weight: 800; }
.library-header-actions { display: flex; gap: 10px; }
.library-content { padding: 0 20px 40px; }

.create-playlist-btn, .add-songs-btn {
  display: flex; align-items: center; gap: 6px; padding: 11px 18px;
  background: var(--glass-strong); border: 1px solid var(--border); border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; color: var(--text-primary); transition: var(--transition);
}
.create-playlist-btn:hover, .add-songs-btn:hover { background: var(--primary); border-color: var(--primary); box-shadow: var(--shadow-red); }

/* Quick cards grid (All Songs / Recent) */
.lib-quick-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px;
}
.lib-quick-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition);
  min-width: 0;
}
.lib-quick-card:hover { background: var(--bg-elevated); border-color: rgba(220,38,38,0.3); transform: translateY(-1px); }
.lib-quick-cover {
  width: 48px; height: 48px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.9);
}
.lib-quick-cover svg { width: 22px; height: 22px; fill: currentColor; }
.lib-quick-info { min-width: 0; flex: 1; }
.lib-quick-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-quick-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Section header */
.lib-section-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.lib-section-title { font-size: 18px; font-weight: 700; }
.lib-section-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* Playlist list */
.lib-playlist-list { display: flex; flex-direction: column; gap: 4px; }
.lib-playlist-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px;
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast);
}
.lib-playlist-item:hover { background: var(--bg-hover); }
.lib-playlist-item:active { transform: scale(0.99); }
.lib-playlist-cover {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden; color: rgba(255,255,255,0.85);
  box-shadow: var(--shadow-sm);
}
.lib-playlist-cover svg { width: 24px; height: 24px; fill: currentColor; }
.lib-playlist-info { flex: 1; min-width: 0; }
.lib-playlist-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-playlist-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.lib-playlist-delete {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); color: var(--text-muted); transition: var(--transition); flex-shrink: 0;
}
.lib-playlist-delete:hover { color: var(--primary-light); background: rgba(220, 38, 38, 0.1); }

/* Empty state for no playlists */
.lib-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 20px; gap: 6px;
}
.lib-empty-icon { color: var(--text-muted); opacity: 0.4; margin-bottom: 8px; }
.lib-empty-icon svg { width: 48px; height: 48px; fill: currentColor; }
.lib-empty-text { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.lib-empty-sub { font-size: 13px; color: var(--text-muted); }

/* ---------- Legacy playlist-item (still used in search results & modals) ---------- */
.playlist-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px;
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast);
}
.playlist-item:hover { background: var(--bg-hover); }
.playlist-item:active { transform: scale(0.99); }
.playlist-item-cover {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative; overflow: hidden; color: rgba(255,255,255,0.85);
}
.playlist-item-cover svg { width: 24px; height: 24px; fill: currentColor; }
.playlist-item-info { flex: 1; min-width: 0; }
.playlist-item-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.playlist-item-delete {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); color: var(--text-muted); transition: var(--transition); flex-shrink: 0;
}
.playlist-item-delete:hover { color: var(--primary-light); background: rgba(220, 38, 38, 0.1); }

/* ---------- Detail View ---------- */
.detail-view { padding: 0; }
.detail-header {
  position: relative; padding: 40px 20px 28px; text-align: center; overflow: hidden;
}
.detail-header::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(220,38,38,0.12), transparent 60%),
              radial-gradient(circle at 30% 80%, rgba(220,38,38,0.06), transparent 40%),
              linear-gradient(180deg, rgba(18,18,18,0) 0%, var(--bg-primary) 100%);
  pointer-events: none;
}
.detail-header::after {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(220,38,38,0.04), transparent 50%);
  animation: detail-bg-rotate 20s linear infinite; pointer-events: none;
}
@keyframes detail-bg-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.detail-cover {
  width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 24px;
  position: relative; z-index: 1;
}
/* Animated gradient ring */
.detail-cover::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(from 0deg, #991B1B, #DC2626, #EF4444, #DC2626, #991B1B);
  animation: ring-spin 4s linear infinite; z-index: -1;
}
.detail-cover::after {
  content: ''; position: absolute; inset: 2px; border-radius: 50%;
  background: var(--bg-primary); z-index: -1;
}
@keyframes ring-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.detail-cover-inner {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.detail-cover-inner svg {
  width: 44px; height: 44px; fill: currentColor;
  color: var(--primary-light); filter: drop-shadow(0 0 12px var(--primary-glow));
}

.detail-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; border-radius: 50%; }
.detail-cover .cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 56px; font-weight: 800; color: rgba(255,255,255,0.9); border-radius: 50%;
}
.detail-cover .cover-fallback svg { width: 44px; height: 44px; fill: currentColor; color: var(--primary-light); filter: drop-shadow(0 0 12px var(--primary-glow)); }

.detail-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; position: relative; z-index: 1; }
.detail-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; position: relative; z-index: 1; }

.detail-actions { display: flex; align-items: center; justify-content: center; gap: 16px; position: relative; z-index: 1; }
.detail-play-btn {
  width: 52px; height: 52px; border-radius: var(--radius-full);
  background: var(--primary-gradient);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(220,38,38,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: var(--spring);
}
.detail-play-btn:hover { transform: scale(1.06); box-shadow: 0 8px 32px rgba(220,38,38,0.5); }
.detail-play-btn:active { transform: scale(0.95); }
.detail-play-btn svg { width: 22px; height: 22px; fill: white; }

.detail-shuffle-btn {
  width: 42px; height: 42px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
  color: var(--text-secondary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.detail-shuffle-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
.detail-shuffle-btn svg { width: 20px; height: 20px; fill: currentColor; }
.detail-songs { padding: 0 4px; }

/* ---------- Mini Player ---------- */
.mini-player {
  position: fixed; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  left: 8px; right: 8px; height: var(--mini-player-h);
  background: rgba(18, 14, 14, 0.4);
  backdrop-filter: blur(40px) saturate(1.6); -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border-radius: var(--radius-lg); z-index: 200; overflow: hidden;
  cursor: pointer; border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -2px 30px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: var(--transition);
}
.mini-player:active { transform: scale(0.98); }
.mini-player-progress { position: absolute; top: 0; left: 0; height: 2px; background: var(--primary-gradient); transition: width 0.3s linear; border-radius: 2px; }
.mini-player-content { display: flex; align-items: center; justify-content: space-between; height: 100%; padding: 0 12px 0 10px; }
.mini-player-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

.mini-cover {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; position: relative; background: var(--bg-card);
}
.mini-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.mini-cover .cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: rgba(255,255,255,0.85);
}

.mini-details { flex: 1; min-width: 0; }
.mini-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-controls { display: flex; align-items: center; gap: 4px; }
.mini-controls button { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); transition: var(--transition); color: var(--text-primary); }
.mini-controls button:hover { background: var(--glass-strong); }
.mini-controls button svg { width: 20px; height: 20px; fill: currentColor; }
.mini-play-btn svg { width: 24px; height: 24px; }

/* ---------- Full Player ---------- */
.full-player {
  position: fixed; inset: 0; z-index: 500; background: var(--bg-primary);
  transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto; overscroll-behavior: contain;
}
.full-player.show { transform: translateY(0); }
.full-player-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(220,38,38,0.12), transparent 70%); pointer-events: none; }
.full-player-content { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 100%; padding: 0 24px; padding-top: calc(16px + var(--safe-top)); padding-bottom: calc(32px + var(--safe-bottom)); }

.full-player-header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 8px 0 24px; }
.full-player-close { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); transition: var(--transition); color: var(--text-secondary); }
.full-player-close:hover { background: var(--glass-strong); color: var(--text-primary); }
.full-player-now { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); }
.full-player-more { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); transition: var(--transition); color: var(--text-secondary); }
.full-player-more:hover { background: var(--glass-strong); }

.full-player-cover {
  width: min(75vw, 320px); height: min(75vw, 320px); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow), 0 0 60px rgba(220,38,38,0.15);
  margin-bottom: 36px; transition: var(--transition-slow); position: relative; background: var(--bg-card);
}
.full-player-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.full-player-cover .cover-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 72px; font-weight: 900; color: rgba(255,255,255,0.9);
}

.full-player-info { width: 100%; text-align: center; margin-bottom: 28px; }
.full-player-song { font-size: 22px; font-weight: 800; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.full-player-artist { font-size: 14px; color: var(--text-secondary); }

/* Progress */
.full-player-progress { width: 100%; margin-bottom: 24px; }
.progress-slider { width: 100%; height: 4px; border-radius: 2px; outline: none; }
.progress-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--bg-elevated); }
.progress-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text-primary); margin-top: -5px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); transition: var(--transition-fast); }
.progress-slider:hover::-webkit-slider-thumb { transform: scale(1.3); background: var(--primary-light); }
.progress-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--bg-elevated); border: none; }
.progress-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text-primary); border: none; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.progress-times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Controls */
.full-player-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 32px; width: 100%; }
.control-btn { display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); transition: var(--transition); color: var(--text-primary); }
.control-btn:active { transform: scale(0.9); }
.control-btn.shuffle-btn, .control-btn.repeat-btn { width: 40px; height: 40px; color: var(--text-muted); position: relative; }
.control-btn.shuffle-btn.active, .control-btn.repeat-btn.active { color: var(--primary-light); }
.control-btn.shuffle-btn.active::after, .control-btn.repeat-btn.active::after { content: ''; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary-light); }
.control-btn.prev-btn, .control-btn.next-btn { width: 48px; height: 48px; }
.control-btn.prev-btn svg, .control-btn.next-btn svg { width: 28px; height: 28px; fill: currentColor; }
.control-btn.play-btn { width: 64px; height: 64px; background: var(--primary); box-shadow: var(--shadow-red-lg); transition: var(--spring); }
.control-btn.play-btn:hover { transform: scale(1.06); }
.control-btn.play-btn:active { transform: scale(0.94); }
.control-btn.play-btn svg { width: 30px; height: 30px; fill: white; }
.control-btn svg { width: 22px; height: 22px; fill: currentColor; }

/* Extra controls */
.full-player-extra { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 8px; }
.extra-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); color: var(--text-muted); transition: var(--transition); }
.extra-btn:hover { color: var(--text-primary); background: var(--glass-strong); }
.extra-btn.active { color: var(--primary-light); }
.extra-btn svg { width: 20px; height: 20px; }
.volume-container { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 160px; margin: 0 12px; }
.volume-icon { color: var(--text-muted); display: flex; }
.volume-icon svg { width: 18px; height: 18px; }
.volume-slider { flex: 1; height: 4px; }
.volume-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--bg-elevated); }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text-primary); margin-top: -4px; }
.volume-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--bg-elevated); border: none; }
.volume-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text-primary); border: none; }

/* ---------- Install Button (header) ---------- */
.install-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 16px;
  background: var(--primary-gradient); color: white;
  border-radius: var(--radius-full); font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-red); transition: var(--spring); white-space: nowrap;
}
.install-btn:hover { transform: scale(1.05); }
.install-btn:active { transform: scale(0.95); }

/* ---------- Category Selector (Add Songs modal) ---------- */
.category-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.category-chip {
  padding: 10px 16px; border-radius: var(--radius-full);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  transition: var(--transition); cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.category-chip:hover { background: var(--bg-highlight); border-color: rgba(220,38,38,0.3); }
.category-chip.active { background: var(--primary-gradient); color: white; border-color: transparent; box-shadow: var(--shadow-red); }
.category-chip svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgba(14,14,14,0.8), rgba(8,8,8,0.9));
  backdrop-filter: blur(32px) saturate(1.5); -webkit-backdrop-filter: blur(32px) saturate(1.5);
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: space-around; z-index: 300;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 20px; border-radius: var(--radius-md); transition: var(--transition); color: var(--text-muted); position: relative; }
.nav-item.active { color: var(--primary-light); }
.nav-item.active::after { content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); width: 20px; height: 2px; background: var(--primary); border-radius: var(--radius-full); }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.nav-icon svg { width: 24px; height: 24px; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center; animation: modal-bg-in 0.3s ease;
}
@keyframes modal-bg-in { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 480px; max-height: 85vh; background: var(--bg-secondary); border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; overflow: hidden; animation: modal-slide-up 0.4s cubic-bezier(0.32, 0.72, 0, 1); display: flex; flex-direction: column; }
@keyframes modal-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 36px; height: 4px; background: var(--bg-highlight); border-radius: var(--radius-full); margin: 12px auto 8px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 16px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); background: var(--glass-strong); color: var(--text-secondary); font-size: 16px; transition: var(--transition); }
.modal-close:hover { background: var(--bg-elevated); }
.modal-body { padding: 0 20px 24px; overflow-y: auto; flex: 1; }
.modal-input { width: 100%; height: 48px; padding: 0 16px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 15px; color: var(--text-primary); margin-bottom: 16px; transition: var(--transition); }
.modal-input::placeholder { color: var(--text-muted); }
.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.modal-btn { width: 100%; height: 48px; background: var(--primary-gradient); color: white; border-radius: var(--radius-lg); font-size: 15px; font-weight: 700; transition: var(--spring); box-shadow: 0 4px 16px rgba(220,38,38,0.3); display: flex; align-items: center; justify-content: center; }
.modal-btn:hover { transform: scale(1.02); box-shadow: 0 6px 24px rgba(220,38,38,0.4); }
.modal-btn:active { transform: scale(0.98); }
.modal-btn.secondary { background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: none; margin-top: 0; color: var(--text-primary); }

/* ---------- Context Menu (Spotify-style Glass Bottom Sheet) ---------- */
.context-menu {
  position: fixed; inset: 0; z-index: 950;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.context-menu.show { opacity: 1; visibility: visible; }

.context-sheet {
  width: 100%; max-width: 480px;
  background: rgba(20, 20, 20, 0.72);
  backdrop-filter: blur(40px) saturate(1.6); -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
  touch-action: none;
}
.context-menu.show .context-sheet { transform: translateY(0); }

.context-sheet-handle-wrap { display: flex; justify-content: center; padding: 12px 0 4px; cursor: grab; }
.context-sheet-handle { width: 40px; height: 4px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.22); transition: var(--transition-fast); }
.context-sheet-handle-wrap:active .context-sheet-handle { background: rgba(255, 255, 255, 0.35); }

.context-sheet-header { display: flex; align-items: center; gap: 14px; padding: 10px 20px 16px; }
.context-sheet-cover {
  width: 52px; height: 52px; border-radius: var(--radius-md); flex-shrink: 0;
  overflow: hidden; position: relative; background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.context-sheet-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.context-sheet-cover .cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: rgba(255,255,255,0.9); }
.context-sheet-meta { flex: 1; min-width: 0; }
.context-sheet-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context-sheet-artist { font-size: 13px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.context-sheet-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 2px 20px 6px; }

.context-sheet-actions { padding: 4px 8px 12px; }
.context-sheet-item {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 12px;
  border-radius: var(--radius-md); font-size: 15px; font-weight: 500; color: var(--text-primary);
  text-align: left; transition: var(--transition-fast); cursor: pointer; touch-action: manipulation;
}
.context-sheet-item:hover { background: rgba(255,255,255,0.06); }
.context-sheet-item:active { background: rgba(255,255,255,0.1); transform: scale(0.99); }
.context-sheet-item .ctx-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--primary-light); }
.context-sheet-item .ctx-icon svg { width: 20px; height: 20px; fill: currentColor; }
.context-sheet-item .ctx-label { flex: 1; }

@media (min-width: 768px) {
  .context-sheet { margin: 0 12px 12px; border-radius: 28px; border: 1px solid rgba(255,255,255,0.08); border-bottom: 1px solid rgba(255,255,255,0.08); }
  .context-menu { align-items: flex-end; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(var(--mini-player-h) + var(--bottom-nav-h) + var(--safe-bottom) + 20px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated); color: var(--text-primary); padding: 12px 24px;
  border-radius: var(--radius-full); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  opacity: 0; pointer-events: none; transition: var(--transition); z-index: 1000; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Empty State ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state-icon { margin-bottom: 16px; opacity: 0.4; color: var(--text-muted); }
.empty-state-icon svg { width: 48px; height: 48px; }
.empty-state-text { font-size: 15px; font-weight: 500; }
.empty-state-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Gradients ---------- */
.gradient-1 { background: linear-gradient(135deg, #991B1B, #DC2626, #EF4444); }
.gradient-2 { background: linear-gradient(135deg, #7F1D1D, #B91C1C, #DC2626); }
.gradient-3 { background: linear-gradient(135deg, #450A0A, #991B1B, #B91C1C); }
.gradient-4 { background: linear-gradient(135deg, #DC2626, #991B1B, #450A0A); }
.gradient-5 { background: linear-gradient(135deg, #1A1A2E, #16213E, #DC2626); }
.gradient-6 { background: linear-gradient(135deg, #0F0F0F, #2D1F1F, #DC2626); }
.gradient-7 { background: linear-gradient(135deg, #1C1C1C, #DC2626, #7F1D1D); }

/* ---------- Animations ---------- */
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: slide-up 0.4s ease forwards; }
.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }

.song-item { opacity: 0; animation: slide-up 0.3s ease forwards; }
.song-item:nth-child(1) { animation-delay: 0.02s; }
.song-item:nth-child(2) { animation-delay: 0.04s; }
.song-item:nth-child(3) { animation-delay: 0.06s; }
.song-item:nth-child(4) { animation-delay: 0.08s; }
.song-item:nth-child(5) { animation-delay: 0.1s; }
.song-item:nth-child(6) { animation-delay: 0.12s; }
.song-item:nth-child(7) { animation-delay: 0.14s; }
.song-item:nth-child(8) { animation-delay: 0.16s; }
.song-item:nth-child(9) { animation-delay: 0.18s; }
.song-item:nth-child(10) { animation-delay: 0.2s; }
.song-item:nth-child(n+11) { animation-delay: 0.22s; }

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .song-card { flex: 0 0 160px; max-width: 160px; }
  .song-card-cover { width: 160px; height: 160px; }
  .full-player-cover { width: 340px; height: 340px; }
  .modal { border-radius: var(--radius-2xl); margin-bottom: 20px; max-height: 70vh; }
  .views-container { max-width: 800px; margin: 0 auto; }
}

@media (min-width: 1024px) {
  .category-grid { grid-template-columns: repeat(4, 1fr); }
  .views-container { max-width: 960px; }
}

@media (display-mode: standalone) {
  .header { padding-top: calc(16px + var(--safe-top)); }
  .full-player-content { padding-top: calc(20px + var(--safe-top)); }
}
@media (display-mode: fullscreen) {
  .header { padding-top: calc(16px + var(--safe-top)); }
  .full-player-content { padding-top: calc(20px + var(--safe-top)); }
}

/* ---------- Auth Screen ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.auth-screen.fade-out { opacity: 0; visibility: hidden; }
.auth-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(220,38,38,0.12), transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(220,38,38,0.06), transparent 50%);
  animation: auth-bg-pulse 6s ease-in-out infinite;
}
@keyframes auth-bg-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
.auth-container {
  position: relative; text-align: center; padding: 40px 32px;
  width: min(380px, 90vw);
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--border); border-radius: var(--radius-2xl);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.auth-logo { margin-bottom: 20px; filter: drop-shadow(0 0 30px var(--primary-glow)); }
.auth-title { font-size: 28px; font-weight: 800; letter-spacing: 2px; margin-bottom: 6px; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-input-wrapper { position: relative; display: flex; align-items: center; }
.auth-lock-icon { position: absolute; left: 16px; color: var(--text-muted); pointer-events: none; }
.auth-input {
  width: 100%; height: 52px; padding: 0 16px 0 44px; font-size: 15px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); color: var(--text-primary); transition: var(--transition);
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.auth-input.shake { animation: shake 0.4s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.auth-btn {
  height: 52px; border-radius: var(--radius-lg); background: var(--primary-gradient);
  color: white; font-size: 16px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; gap: 8px; box-shadow: var(--shadow-red-lg);
  transition: var(--spring); cursor: pointer;
}
.auth-btn:hover { transform: scale(1.02); box-shadow: 0 12px 40px rgba(220,38,38,0.4); }
.auth-btn:active { transform: scale(0.98); }
.auth-error { color: var(--primary-light); font-size: 13px; margin-top: 16px; font-weight: 500; animation: fadeIn 0.3s ease; }

/* ---------- Library Header Actions ---------- */
.library-header-actions { display: flex; gap: 8px; }
.add-songs-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: var(--primary-gradient); border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; color: white;
  box-shadow: 0 2px 12px rgba(220,38,38,0.3); transition: var(--spring);
}
.add-songs-btn:hover { transform: scale(1.03); }
.add-songs-btn:active { transform: scale(0.97); }
.add-songs-btn svg { width: 14px; height: 14px; }

/* ---------- Personal Song Badge ---------- */
.song-item-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 4px; margin-left: 6px;
  background: rgba(220,38,38,0.15); color: var(--primary-light); flex-shrink: 0;
}

/* ---------- Floating Lyrics Overlay (single synced line) ---------- */
.floating-lyrics {
  width: 100%; max-width: 360px; margin: 0 auto 14px;
  text-align: center; opacity: 0; transform: translateY(-6px);
  max-height: 0; overflow: hidden; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}
.floating-lyrics.visible { opacity: 1; transform: translateY(0); max-height: 76px; }
.floating-lyrics-text {
  font-size: 17px; font-weight: 800; line-height: 1.4; color: #fff;
  padding: 0 12px; text-shadow: 0 2px 18px rgba(0,0,0,0.5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.floating-lyrics.fl-swapping .floating-lyrics-text { opacity: 0; transform: translateY(-8px); }

/* ---------- Lyrics Preview Card (expandable) ---------- */
.lyrics-preview-card {
  --lpc-tint: rgba(153, 27, 27, 0.30);
  width: 100%; max-width: 440px; margin: 22px auto 4px;
  border-radius: 28px; overflow: hidden; position: relative;
  background: linear-gradient(160deg, var(--lpc-tint), rgba(10, 10, 10, 0.62));
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  touch-action: manipulation;
}
.lyrics-preview-card:active { transform: scale(0.985); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.lpc-header { display: flex; align-items: center; gap: 8px; padding: 16px 22px 2px; }
.lpc-icon { color: var(--primary-light); display: flex; }
.lpc-icon svg { width: 18px; height: 18px; fill: currentColor; }
.lpc-title { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255, 255, 255, 0.78); }
.lpc-body {
  height: 138px; padding: 4px 22px; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 86%, transparent 100%);
}
.lpc-lines {
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
.lpc-line {
  padding: 9px 0; font-size: 15px; font-weight: 600; line-height: 1.45; text-align: center;
  color: rgba(255, 255, 255, 0.34); cursor: pointer;
  transition: color 0.35s ease, font-size 0.35s ease, font-weight 0.25s ease;
}
.lpc-line:hover { color: rgba(255, 255, 255, 0.5); }
.lpc-line.active { color: #fff; font-size: 19px; font-weight: 800; text-shadow: 0 0 18px rgba(255, 255, 255, 0.25); }
.lpc-line.past { color: rgba(255, 255, 255, 0.14); }
.lpc-footer {
  text-align: center; padding: 2px 22px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px; color: rgba(255, 255, 255, 0.42);
}

/* ---------- Full Lyrics Page (fullscreen) ---------- */
.full-lyrics-page {
  --flp-tint: rgba(153, 27, 27, 0.42);
  position: fixed; inset: 0; z-index: 550;
  background: var(--bg-primary);
  transform: translateY(100%); opacity: 1; pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden; display: flex; flex-direction: column;
}
.full-lyrics-page.show { transform: translateY(0); pointer-events: auto; }
.flp-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: blur(64px) saturate(1.7) brightness(0.5);
  transform: scale(1.35);
}
.flp-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.5) 0%, var(--flp-tint) 50%, rgba(10, 10, 10, 0.88) 100%);
}
.flp-content {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  height: 100%; padding-top: calc(12px + var(--safe-top));
}
.flp-header {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px 14px;
}
.flp-mini-cover {
  width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  position: relative; background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.flp-mini-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.flp-mini-cover .cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; color: rgba(255, 255, 255, 0.9); }
.flp-mini-info { flex: 1; min-width: 0; }
.flp-mini-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flp-mini-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.flp-close {
  width: 40px; height: 40px; border-radius: var(--radius-full); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.06); color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08); transition: var(--transition);
}
.flp-close:hover { background: rgba(255, 255, 255, 0.12); }
.flp-close:active { transform: scale(0.9); }
.flp-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth;
  padding: 16px 0 calc(40vh + 16px); /* extra bottom space so last line can reach center */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
}
.flp-scroll::-webkit-scrollbar { width: 0; }
.flp-lines { padding: 0 24px; }
.flp-line {
  padding: 13px 0; font-size: 22px; font-weight: 700; line-height: 1.45; text-align: center;
  color: rgba(255, 255, 255, 0.32); cursor: pointer; opacity: 0.92;
  transition: color 0.4s ease, font-size 0.4s ease, font-weight 0.3s ease, transform 0.4s ease;
  will-change: color, font-size, transform;
}
.flp-line:hover { color: rgba(255, 255, 255, 0.5); }
.flp-line.active {
  color: #fff; font-size: 30px; font-weight: 800; transform: scale(1.03);
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.35);
}
.flp-line.past { color: rgba(255, 255, 255, 0.18); }

/* Lyrics Toggle Button Active State */
.lyrics-toggle-btn.active { color: var(--primary-light) !important; }

/* ---------- Lyrics Editor ---------- */
.lyrics-editor { display: flex; flex-direction: column; gap: 16px; }
.lyrics-editor-tabs { display: flex; gap: 4px; background: var(--bg-elevated); border-radius: var(--radius-md); padding: 3px; }
.lyrics-editor-tab {
  flex: 1; padding: 8px; border-radius: calc(var(--radius-md) - 2px);
  font-size: 12px; font-weight: 600; text-align: center; cursor: pointer;
  transition: var(--transition); color: var(--text-muted);
}
.lyrics-editor-tab.active { background: var(--primary-gradient); color: white; }

.lyrics-textarea {
  width: 100%; min-height: 200px; padding: 16px; border-radius: var(--radius-lg);
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary);
  font-family: 'Inter', monospace; font-size: 14px; line-height: 1.8; resize: vertical;
}
.lyrics-textarea::placeholder { color: var(--text-muted); }
.lyrics-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220,38,38,0.1); }

.lyrics-sync-controls {
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--bg-elevated); border-radius: var(--radius-lg); border: 1px solid var(--border);
}
.lyrics-sync-line {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius-md); transition: var(--transition);
}
.lyrics-sync-line.current { background: rgba(220,38,38,0.15); }
.lyrics-sync-line.synced { opacity: 0.5; }
.lyrics-sync-time {
  min-width: 48px; font-size: 11px; font-weight: 600; color: var(--primary-light);
  font-family: monospace;
}
.lyrics-sync-text { flex: 1; font-size: 13px; }

.sync-tap-btn {
  width: 100%; padding: 16px; border-radius: var(--radius-lg);
  background: var(--primary-gradient); color: white;
  font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 20px rgba(220,38,38,0.3); transition: var(--spring);
}
.sync-tap-btn:hover { transform: scale(1.01); }
.sync-tap-btn:active { transform: scale(0.98); }

/* Sync Mode playback toolbar (seek + play/pause + time) */
.lyrics-sync-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-elevated); border-radius: var(--radius-lg);
  border: 1px solid var(--border); margin-bottom: 12px;
}
.sync-seek-btn {
  display: flex; align-items: center; gap: 4px; padding: 6px 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: 12px; font-weight: 700; cursor: pointer; transition: var(--transition);
}
.sync-seek-btn:hover { background: rgba(220,38,38,0.1); border-color: var(--primary); color: var(--primary-light); }
.sync-seek-btn:active { transform: scale(0.95); }
.sync-seek-btn span { font-family: monospace; }
.sync-play-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary-gradient); color: white; display: flex;
  align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(220,38,38,0.3);
  transition: var(--transition);
}
.sync-play-btn:hover { transform: scale(1.05); }
.sync-play-btn:active { transform: scale(0.95); }
.sync-time-display {
  margin-left: auto; padding: 6px 12px; background: var(--bg-card);
  border-radius: var(--radius-md); font-family: monospace; font-size: 14px;
  font-weight: 700; color: var(--primary-light); min-width: 56px; text-align: center;
}

.lyrics-hint { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.5; }

/* ---------- Add Song Form ---------- */
.add-song-form { display: flex; flex-direction: column; gap: 14px; }
.add-song-dropzone {
  padding: 32px 16px; border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-lg); text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg-card);
}
.add-song-dropzone:hover { border-color: var(--primary); background: rgba(220,38,38,0.05); }
.add-song-dropzone svg { margin: 0 auto 8px; color: var(--text-muted); }
.add-song-dropzone p { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.add-song-dropzone .primary-text { color: var(--primary-light); font-weight: 600; font-size: 14px; }

.add-song-file-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.add-song-file-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-elevated); border-radius: var(--radius-md); border: 1px solid var(--border);
}
.add-song-file-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--primary-gradient); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.add-song-file-icon svg { width: 18px; height: 18px; fill: white; }
.add-song-file-info { flex: 1; min-width: 0; }
.add-song-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-song-file-size { font-size: 11px; color: var(--text-muted); }
.add-song-file-remove { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: var(--transition); }
.add-song-file-remove:hover { color: var(--primary-light); background: rgba(220,38,38,0.1); }
