/* ==========================================================================
   Design System & Premium Aesthetics (Spotify Clone - OpenLoFi)
   ========================================================================== */

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

:root {
  /* Theme Colors */
  --bg-primary: #09090b;       /* Deep Onyx */
  --bg-secondary: #121215;     /* Dark Charcoal */
  --bg-tertiary: #1c1c22;      /* Lighter Slate */
  
  --accent: #10b981;           /* Emerald Green */
  --accent-glow: rgba(16, 185, 129, 0.25);
  --accent-hover: #34d399;
  
  --text-primary: #f4f4f5;     /* Pure white-ish */
  --text-secondary: #a1a1aa;   /* Muted zinc */
  --text-muted: #52525b;       /* Dark zinc */
  
  /* Glassmorphism */
  --glass-bg: rgba(18, 18, 21, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-glow: rgba(255, 255, 255, 0.02);
  
  /* Layout Dimensions */
  --sidebar-width: 260px;
  --player-height: 90px;
  --mobile-nav-height: 65px;
  
  /* System Values */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ==========================================================================
   Base & Resets
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height fixes the mobile bottom-bar shift */
  width: 100vw;
  user-select: none;
}

button {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

input {
  font-family: inherit;
  outline: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Lock Screen / Passcode Overlay
   ========================================================================== */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #18181b 0%, #09090b 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#lock-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  width: 340px;
  padding: 40px 30px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: pulse-glow 3s infinite alternate;
}

.lock-logo {
  width: 70px;
  height: 70px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.lock-card h1 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.lock-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.passcode-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 30px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  border: 2px solid var(--text-muted);
  transition: var(--transition);
}

.dot.active {
  background-color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.dot.error {
  background-color: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 12px #ef4444;
  animation: shake 0.3s ease-in-out;
}

/* Keypad Grid */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 260px;
  margin: 0 auto;
}

.key {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 22px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition);
}

.key:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.key:active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(0.95);
}

.key.backspace {
  font-size: 16px;
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */
#app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr var(--player-height);
  height: 100vh;
  height: 100dvh; /* dynamic viewport height fixes the mobile bottom-bar shift */
  width: 100vw;
}

/* Sidebar navigation */
aside {
  grid-row: 1;
  grid-column: 1;
  background-color: #040405;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-left: 8px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 5px var(--accent-glow));
}

.brand-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  text-decoration: none;
}

.nav-item i {
  font-size: 18px;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding-left: 13px;
}

.sidebar-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 16px 0;
}

.playlist-menu {
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playlist-menu-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.add-playlist-btn:hover {
  color: var(--accent);
}

.playlist-menu-item {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: left;
}

.playlist-menu-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.02);
}

.lock-app-btn {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: #f87171;
  transition: var(--transition);
}

.lock-app-btn:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
main {
  grid-row: 1;
  grid-column: 2;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

/* Top bar / Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  position: sticky;
  top: 0;
  background-color: rgba(18, 18, 21, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 90;
}

.search-container {
  position: relative;
  width: 320px;
}

.search-container i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background-color: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.header-settings-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
}

.header-settings-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.06);
}

.profile-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background-color: var(--bg-tertiary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
}

.profile-name {
  font-size: 14px;
  font-weight: 500;
}

/* Page Views */
.view-content {
  padding: 32px;
  display: none;
  flex-direction: column;
  gap: 32px;
}

.view-content.active {
  display: flex;
  animation: fadeIn 0.4s ease-in-out;
}

/* Home View components */
.hero-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hero-info {
  max-width: 500px;
  z-index: 2;
}

.hero-tag {
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-title);
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.hero-btn {
  background-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--accent-glow);
}

.hero-art {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transform: rotate(6deg);
  transition: var(--transition);
  z-index: 2;
}

.hero-card:hover .hero-art {
  transform: rotate(0deg) scale(1.05);
}

/* Category grid scrollable row */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
}

.scroll-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.category-pill {
  flex-shrink: 0;
  padding: 10px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.category-pill:hover, .category-pill.active {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.category-pill.active {
  background-color: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* Song Card Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.song-card {
  background-color: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.song-card:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-4px);
}

.card-art-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  background-color: var(--bg-tertiary);
}

.card-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.song-card:hover .card-art {
  transform: scale(1.05);
}

.card-play-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
  color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition);
}

.song-card:hover .card-play-btn {
  opacity: 1;
  transform: translateY(0);
}

.card-play-btn:hover {
  background-color: var(--accent-hover);
  transform: scale(1.1);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-category {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Playlist / Detail View Header */
.detail-header {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

.detail-art {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  background-color: var(--bg-tertiary);
}

.detail-info h2 {
  font-family: var(--font-title);
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1;
}

.detail-meta {
  color: var(--text-secondary);
  font-size: 14px;
}

.tracklist-container {
  display: flex;
  flex-direction: column;
  margin-top: 24px;
}

.track-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 60px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.track-row:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.track-row.active {
  color: var(--accent);
}

.track-num {
  color: var(--text-secondary);
  font-size: 14px;
}

.track-row.active .track-num {
  color: var(--accent);
}

.track-title-cell {
  font-size: 14px;
  font-weight: 500;
}

.track-cat-cell {
  font-size: 13px;
  color: var(--text-secondary);
}

.track-action-cell {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.favorite-btn:hover {
  color: #ef4444;
}

.favorite-btn.active {
  color: #ef4444;
}

/* Settings View styling */
.settings-section {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.settings-info h4 {
  font-weight: 600;
  margin-bottom: 4px;
}

.settings-info p {
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.settings-btn:hover {
  background-color: var(--text-muted);
  color: var(--text-primary);
}

.theme-swatch-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.theme-swatch:hover {
  transform: scale(1.08);
}

.theme-swatch.active {
  border-color: #fff;
}

.settings-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.scroll-row .mini-card {
  width: 150px;
  flex-shrink: 0;
}

/* Animated "now playing" bars — classic music-app indicator */
.eq-indicator {
  display: none;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
}

.eq-indicator span {
  width: 3px;
  background: var(--accent);
  border-radius: 1px;
  transform-origin: bottom;
  animation: eqBounce 0.9s ease-in-out infinite;
}

.eq-indicator span:nth-child(1) {
  height: 40%;
  animation-delay: 0s;
}

.eq-indicator span:nth-child(2) {
  height: 100%;
  animation-delay: 0.2s;
}

.eq-indicator span:nth-child(3) {
  height: 65%;
  animation-delay: 0.4s;
}

@keyframes eqBounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

.card-art-container .eq-indicator {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 5px;
  border-radius: 4px;
}

.song-card.playing .card-art-container .eq-indicator {
  display: flex;
}

.track-num {
  position: relative;
}

.track-row.active .track-num .track-num-text {
  display: none;
}

.track-row.active .track-num .eq-indicator {
  display: flex;
}

.settings-btn.active {
  background-color: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.bento-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.bento-grid.compact .song-card {
  padding: 10px;
}

.bento-grid.compact .card-title {
  font-size: 12px;
}

.bento-grid.compact .card-category {
  font-size: 11px;
}

/* Reduce Motion: kill decorative animation without touching layout */
.reduce-motion .fs-ambient-glow,
.reduce-motion .eq-indicator span {
  animation: none !important;
}

.reduce-motion .eq-indicator span {
  transform: scaleY(0.7) !important;
}

/* ==========================================================================
   Account sign-in / sign-up
   ========================================================================== */
#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  /* Translucent so the galaxy layer behind the app still shows through —
     signing in should feel like the same product, not a separate page. */
  background: radial-gradient(circle at center, rgba(24,24,27,0.72) 0%, rgba(9,9,11,0.92) 100%);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  overflow-y: auto;
}

#auth-screen.hidden { display: none; }

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Icon-prefixed field with an optional trailing reveal button */
.auth-field { position: relative; display: flex; align-items: center; }

.auth-field > i {
  position: absolute;
  left: 15px;
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition);
}

.auth-field:focus-within > i { color: var(--accent); }
.auth-field .auth-input { padding-left: 40px; padding-right: 44px; }

.auth-eye {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13px;
  transition: var(--transition);
}

.auth-eye:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.07); }

/* Password strength bar — three segments that fill as the score climbs */
.auth-strength {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: -4px 2px 2px;
}

.auth-strength span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.25s ease, background 0.25s ease;
}

.auth-strength[data-score="1"] span { width: 33%; background: #f43f5e; }
.auth-strength[data-score="2"] span { width: 66%; background: #f59e0b; }
.auth-strength[data-score="3"] span { width: 100%; background: var(--accent); }

.auth-submit:disabled { opacity: 0.75; cursor: default; }

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.auth-card.shake { animation: authShake 0.4s ease; }
.reduce-motion .auth-card.shake { animation: none; }

/* ==========================================================================
   Waiting-for-approval card + the admin's approve queue
   ========================================================================== */
.auth-pending,
.auth-verify { text-align: center; padding: 6px 0 2px; }
.auth-pending.hidden,
.auth-verify.hidden { display: none; }

.auth-verify > i,
.auth-pending > i {
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 14px;
  display: block;
}

.auth-verify h2,
.auth-pending h2 {
  font-family: var(--font-title);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Big, spaced digits — this is the one field people read back off a phone.
   Scoped to .auth-verify so it outranks .auth-input, which is defined further
   down the file and would otherwise win on source order. */
.auth-verify .verify-input {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  margin-bottom: 12px;
}

.auth-verify form { margin-bottom: 14px; }

.auth-verify p,
.auth-pending p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-pending-actions { display: flex; gap: 10px; justify-content: center; }

.admin-pending {
  margin: 16px 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  border: 1px solid var(--accent);
}

.admin-pending.hidden { display: none; }

.admin-pending-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pending-count,
.admin-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 11px;
  font-weight: 800;
}

.admin-pending-badge { margin-left: 8px; vertical-align: middle; }

.admin-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--glass-border);
}

.admin-pending-row:first-of-type { border-top: none; }

.admin-pending-who { display: flex; flex-direction: column; min-width: 0; }
.admin-pending-who strong { font-size: 14px; font-weight: 600; }
.admin-pending-who span { font-size: 12px; color: var(--text-secondary); }

.admin-pending-actions { display: flex; gap: 8px; flex-shrink: 0; }

.settings-btn.approve {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 700;
}

.settings-btn.approve:hover { background: var(--accent-hover); }
.settings-btn:disabled { opacity: 0.6; cursor: default; }

/* ==========================================================================
   API key card (Settings -> Connect your apps)
   ========================================================================== */
.settings-hint { font-size: 13px; color: var(--text-muted); margin-top: 10px; }

.apikey-box { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.apikey-box.hidden { display: none; }

.apikey-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.apikey-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 68px;
  flex-shrink: 0;
}

.apikey-row code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: nowrap;
  user-select: all;
}

.apikey-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

.settings-btn.danger { color: #fb7185; border-color: rgba(244, 63, 94, 0.4); }
.settings-btn.danger:hover { background: rgba(244, 63, 94, 0.14); }

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 30px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-card > p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.hidden { display: none; }

.auth-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px; /* >=16px stops iOS auto-zoom on focus */
  transition: var(--transition);
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.auth-submit {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 800;
  font-size: 15px;
  margin-top: 4px;
  transition: var(--transition);
}

.auth-submit:hover { background: var(--accent-hover); }
.auth-submit:disabled { opacity: 0.6; }

.auth-feedback {
  margin-top: 16px;
  font-size: 13px;
  min-height: 18px;
  color: #f87171;
}

.auth-feedback.success { color: var(--accent); }

/* ==========================================================================
   Admin access panel
   ========================================================================== */
.admin-people { display: flex; flex-direction: column; gap: 8px; }

.admin-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.admin-person-main { min-width: 0; flex: 1; }
.admin-person-main h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.admin-person-main p { font-size: 12px; color: var(--text-secondary); }

.admin-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  margin-left: 8px;
}

.admin-person-actions { display: flex; gap: 8px; flex-shrink: 0; }

.admin-editor {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-editor.hidden { display: none; }

.admin-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-editor-head h4 { font-size: 16px; font-weight: 700; }
.admin-editor-head p { font-size: 12px; color: var(--text-secondary); }

.admin-mode-row { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-mode-row .settings-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.admin-picker { display: flex; flex-direction: column; gap: 12px; }
.admin-picker.hidden { display: none; }

/* Categories / Artists / Songs tabs inside the access picker */
.admin-pick-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
  padding: 4px;
}

.admin-pick-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}

.admin-pick-tab:hover { color: var(--text-primary); }

.admin-pick-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.admin-pick-pane { display: flex; flex-direction: column; gap: 12px; }
.admin-pick-pane.hidden { display: none; }

.admin-picker-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-picker-bar .settings-input { flex: 1; min-width: 160px; margin: 0; }

.admin-cat-list { display: flex; flex-wrap: wrap; gap: 8px; }

.admin-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.admin-cat.on {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.admin-track-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px;
}

.admin-track {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.admin-track:hover { background: rgba(255, 255, 255, 0.04); }
.admin-track input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.admin-track-main { min-width: 0; flex: 1; }
.admin-track-main .t { font-size: 13px; font-weight: 500; }
.admin-track-main .a { font-size: 11px; color: var(--text-secondary); }
.admin-track.by-category { opacity: 0.55; }

.admin-save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Spotify import
   ========================================================================== */
.spi-result { margin-top: 16px; }
.spi-err { color: #f87171; font-size: 13px; }
.spi-summary { font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.spi-hit { color: var(--accent); font-weight: 600; }
.spi-miss { color: var(--text-secondary); }

.spi-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 14px;
}

.spi-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}

.spi-row i { color: var(--accent); font-size: 12px; flex-shrink: 0; }
.spi-row .t { font-size: 13px; font-weight: 500; }
.spi-row .a { font-size: 11px; color: var(--text-secondary); }

/* ==========================================================================
   Library view (playlists + Spotify import — the mobile route in)
   ========================================================================== */
.library-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.library-spotify-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  background: #1db954;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  transition: var(--transition);
}

.library-spotify-btn:hover {
  background: #1ed760;
  transform: translateY(-2px);
}

.library-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.library-row:hover { background: rgba(255, 255, 255, 0.04); }

.library-art {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.library-main { flex: 1; min-width: 0; }
.library-name { font-size: 15px; font-weight: 600; }
.library-sub { font-size: 12px; color: var(--text-secondary); }

/* ==========================================================================
   Artist profile
   ========================================================================== */
.artist-hero {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--glass-border);
}

.artist-avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.artist-hero-info { min-width: 0; }

.artist-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.artist-label i { color: var(--accent); }

.artist-hero-info h2 {
  font-family: var(--font-title);
  font-size: 46px;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 10px;
}

.artist-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

.artist-section-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  margin: 26px 0 10px;
}

.artist-rank {
  width: 26px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.top-track {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.top-track:hover { background: rgba(255, 255, 255, 0.04); }
.top-track.playing .top-track-title { color: var(--accent); }
.top-track.playing .artist-rank { color: var(--accent); }

.top-track-art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.top-track-main { flex: 1; min-width: 0; }
.top-track-title { font-size: 14px; font-weight: 600; }
.top-track-sub { font-size: 12px; color: var(--text-secondary); }
.top-track-plays { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

.artist-link { cursor: pointer; }
.artist-link:hover { color: var(--text-primary); text-decoration: underline; }

.artist-chip-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }

.artist-chip {
  flex-shrink: 0;
  width: 116px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.artist-chip:hover { transform: translateY(-3px); }

.artist-chip img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 8px;
  background: var(--bg-tertiary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.artist-chip .n { font-size: 13px; font-weight: 600; }
.artist-chip .c { font-size: 11px; color: var(--text-secondary); }

@media (max-width: 768px) {
  .artist-hero { flex-direction: column; align-items: center; text-align: center; gap: 18px; }
  .artist-avatar { width: 140px; height: 140px; }
  .artist-hero-info h2 { font-size: 32px; }
  .artist-actions { justify-content: center; }
}

/* ==========================================================================
   Performance Mode
   Every rule here is scoped to .perf-mode, so with the toggle OFF the app
   renders exactly as it did before. The targets are the things that keep the
   GPU busy every single frame — an animated 50px blur is the worst offender.
   Features are all still present; they just stop repainting continuously.
   ========================================================================== */
body.perf-mode .fs-ambient-glow {
  animation: none !important;          /* was: blur(50px) + scale, 6s forever */
  filter: none !important;
  opacity: 0.35;
  transform: none !important;
}

body.perf-mode .eq-indicator span {
  animation: none !important;          /* static bars, still shows what's playing */
  transform: scaleY(0.7);
}

body.perf-mode .lock-card {
  animation: none !important;          /* pulsing box-shadow */
}

/* Any remaining live blur is costly on a phone; drop them all in perf mode. */
body.perf-mode .glass,
body.perf-mode header,
body.perf-mode #player-bar,
body.perf-mode .olf-modal,
body.perf-mode .olf-modal-overlay,
body.perf-mode .fs-player {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Hover/scale transitions force repaints on scroll-heavy lists. */
body.perf-mode .song-card,
body.perf-mode .song-card .card-art,
body.perf-mode .artist-chip,
body.perf-mode .library-row,
body.perf-mode .top-track {
  transition: none !important;
}

body.perf-mode .song-card:hover,
body.perf-mode .artist-chip:hover,
body.perf-mode .song-card:hover .card-art {
  transform: none !important;
}

.fs-lyrics-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px auto 0;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
}

.fs-lyrics-search:hover { background: rgba(255, 255, 255, 0.12); }

/* ==========================================================================
   Equalizer
   ========================================================================== */
.eq-sliders {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 10px;
  padding: 18px 8px 6px;
  margin-top: 4px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.eq-sliders.disabled { opacity: 0.4; pointer-events: none; }

.eq-band { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.eq-slider {
  -webkit-appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 26px;
  height: 110px;
  accent-color: var(--accent);
  touch-action: none;
}

.eq-val { font-size: 11px; font-weight: 700; color: var(--accent); min-height: 14px; }
.eq-hz { font-size: 11px; color: var(--text-secondary); }
.eq-preset.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* ==========================================================================
   Duplicate finder
   ========================================================================== */
.dupe-none { font-size: 13px; color: var(--text-secondary); }

.dupe-group {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.02);
}

.dupe-head {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.dupe-why {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.dupe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  font-size: 12px;
  cursor: pointer;
}

.dupe-row input { width: 16px; height: 16px; accent-color: #ef4444; flex-shrink: 0; }
.dupe-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dupe-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ==========================================================================
   Polish
   Cheap effects only — opacity/transform, which the compositor handles without
   repainting. Nothing here animates blur, size or colour, so it stays off the
   main thread. All of it is disabled by Performance Mode and Reduce Motion.
   ========================================================================== */

/* Views fade up instead of snapping in */
.view-content.active {
  animation: viewIn 0.26s cubic-bezier(0.22, 0.9, 0.3, 1);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cards arrive in a gentle stagger — capped at 12 so a 290-song grid
   doesn't spend a second and a half dealing itself out */
.bento-grid .song-card {
  animation: cardIn 0.3s backwards cubic-bezier(0.22, 0.9, 0.3, 1);
}

.bento-grid .song-card:nth-child(1)  { animation-delay: 0.00s; }
.bento-grid .song-card:nth-child(2)  { animation-delay: 0.02s; }
.bento-grid .song-card:nth-child(3)  { animation-delay: 0.04s; }
.bento-grid .song-card:nth-child(4)  { animation-delay: 0.06s; }
.bento-grid .song-card:nth-child(5)  { animation-delay: 0.08s; }
.bento-grid .song-card:nth-child(6)  { animation-delay: 0.10s; }
.bento-grid .song-card:nth-child(7)  { animation-delay: 0.12s; }
.bento-grid .song-card:nth-child(8)  { animation-delay: 0.14s; }
.bento-grid .song-card:nth-child(9)  { animation-delay: 0.16s; }
.bento-grid .song-card:nth-child(10) { animation-delay: 0.18s; }
.bento-grid .song-card:nth-child(11) { animation-delay: 0.20s; }
.bento-grid .song-card:nth-child(n+12) { animation-delay: 0.22s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Rows and queue items too */
.track-row, .olf-queue-row, .top-track, .library-row {
  animation: rowIn 0.22s backwards ease-out;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Art fades in rather than popping once it decodes */
.card-art, .top-track-art, .artist-chip img, .player-art, .fs-art {
  animation: artIn 0.35s ease-out;
}

@keyframes artIn { from { opacity: 0; } to { opacity: 1; } }

/* Buttons acknowledge a press — matters most on touch, where there's no hover */
.hero-btn:active, .settings-btn:active, .category-pill:active,
.card-play-btn:active, .control-btn:active, .auth-submit:active,
.library-spotify-btn:active, .fs-lyrics-btn:active {
  transform: scale(0.95);
}

.hero-btn, .settings-btn, .category-pill, .card-play-btn,
.auth-submit, .library-spotify-btn, .fs-lyrics-btn {
  transition: transform 0.12s ease, background-color 0.2s ease, color 0.2s ease;
}

/* The play button gets a soft halo while audio is actually running */
#play-pause-btn { transition: transform 0.15s ease, box-shadow 0.3s ease; }
body.is-playing #play-pause-btn { box-shadow: 0 0 0 6px var(--accent-glow); }

/* Momentum scrolling + no scrollbar flicker on the horizontal rails */
.scroll-row, .artist-chip-row, .admin-track-list, .spi-list, .olf-queue {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Now-playing row reads instantly */
.track-row.active, .olf-queue-row.current {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Sliders feel less twitchy under a thumb */
.slider-fill, .slider-handle { transition: width 0.12s linear, left 0.12s linear; }
.slider-wrapper:active .slider-handle { transform: translateY(-50%) translateX(-50%) scale(1.35); }

/* Toast eases rather than jumping */
.olf-toast { transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 0.9, 0.3, 1); }

/* Respect both escape hatches — these must win over everything above */
body.perf-mode .view-content.active,
body.perf-mode .bento-grid .song-card,
body.perf-mode .track-row,
body.perf-mode .olf-queue-row,
body.perf-mode .top-track,
body.perf-mode .library-row,
body.perf-mode .card-art,
body.perf-mode .top-track-art,
body.perf-mode .artist-chip img,
body.perf-mode .player-art,
body.perf-mode .fs-art,
body.reduce-motion .view-content.active,
body.reduce-motion .bento-grid .song-card,
body.reduce-motion .track-row,
body.reduce-motion .olf-queue-row,
body.reduce-motion .top-track,
body.reduce-motion .library-row,
body.reduce-motion .card-art,
body.reduce-motion .top-track-art,
body.reduce-motion .artist-chip img,
body.reduce-motion .player-art,
body.reduce-motion .fs-art {
  animation: none !important;
}

body.perf-mode .scroll-row,
body.perf-mode .artist-chip-row,
body.reduce-motion .scroll-row,
body.reduce-motion .artist-chip-row { scroll-behavior: auto; }

body.perf-mode #play-pause-btn { box-shadow: none !important; }

@media (prefers-reduced-motion: reduce) {
  .view-content.active, .bento-grid .song-card, .track-row,
  .olf-queue-row, .top-track, .library-row, .card-art {
    animation: none !important;
  }
}

/* ==========================================================================
   Request board
   ========================================================================== */
.req-search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 6px;
}

.req-search-bar .settings-input { flex: 1; min-width: 200px; margin: 0; }

.req-results { display: flex; flex-direction: column; gap: 4px; }

.req-hit, .req-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.req-hit:hover { background: rgba(255, 255, 255, 0.04); }
.req-hit.owned { opacity: 0.6; cursor: pointer; }

.req-hit img, .req-row img {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.req-hit-main, .req-main { flex: 1; min-width: 0; }
.req-hit .t, .req-row .t { font-size: 14px; font-weight: 600; }
.req-hit .a, .req-row .a { font-size: 12px; color: var(--text-secondary); }
.req-by { color: var(--text-muted); }

.req-have {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 9px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.req-row {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
}

.req-row.done { opacity: 0.5; }
.req-row.done .t { text-decoration: line-through; }

.req-vote {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: var(--transition);
}

.req-vote:hover { color: var(--text-primary); border-color: var(--text-muted); }

.req-vote.voted {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.req-admin { display: flex; gap: 6px; flex-shrink: 0; }

/* ==========================================================================
   Benify Code
   ========================================================================== */
.benify-code-modal { width: 340px; text-align: center; }

.bc-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.bc-brand img { width: 22px; height: 22px; }

.bc-brand span {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.bc-frame {
  background: #0b0b0d;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 0 0 1px var(--accent-glow), 0 12px 30px rgba(0, 0, 0, 0.5);
}

.bc-frame img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }

.bc-label { font-size: 16px; font-weight: 700; }
.bc-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.bc-hint { margin: 10px 0 14px !important; font-size: 12px !important; }
.bc-actions { justify-content: center; }
.bc-actions .settings-btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }

.req-artist { border-bottom: 1px solid var(--glass-border); }
.req-artist-pic { border-radius: 50% !important; }

@media (max-width: 768px) {
  .req-admin { flex-direction: column; }
  .req-hit img, .req-row img { width: 40px; height: 40px; }
}

/* ==========================================================================
   Listening stats
   ========================================================================== */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.stat-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
}

.stat-big {
  font-family: var(--font-title);
  font-size: 30px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-small {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ==========================================================================
   Offline downloads
   ========================================================================== */
.offline-list {
  margin-top: 12px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px;
}

.offline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.offline-row i { color: var(--accent); font-size: 12px; flex-shrink: 0; }

/* Badge on any song that's been saved to the device.
   Bottom-LEFT deliberately: bottom-right is the play button, and the badge was
   sitting directly underneath it. */
.song-card.saved-offline .card-art-container::after {
  content: "\f019";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* ==========================================================================
   Playlist covers — mosaic of the art actually inside the playlist
   ========================================================================== */
.library-art.has-art, .detail-art.playlist-cover.has-art {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.library-art.has-art.mosaic, .detail-art.playlist-cover.has-art.mosaic {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.library-art.has-art img, .detail-art.playlist-cover.has-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-art.playlist-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.detail-art.playlist-cover > i { font-size: 56px; color: rgba(255, 255, 255, 0.85); }

/* ==========================================================================
   Lyrics editor
   ========================================================================== */
.fs-lyrics-edit {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 2;
}

.fs-lyrics-edit:hover { color: var(--text-primary); background: rgba(0, 0, 0, 0.7); }

.lyr-editor { display: flex; flex-direction: column; gap: 12px; }

.lyr-editor textarea {
  width: 100%;
  min-height: 190px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.lyr-editor textarea:focus { border-color: var(--accent); outline: none; }

.lyr-sync-stage {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.lyr-sync-now {
  font-size: 19px;
  font-weight: 700;
  min-height: 30px;
  margin-bottom: 4px;
  line-height: 1.35;
}

.lyr-sync-next { font-size: 13px; color: var(--text-secondary); min-height: 20px; }

.lyr-sync-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.lyr-tap-btn {
  width: 100%;
  padding: 18px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 800;
  font-size: 16px;
  margin-top: 10px;
}

.lyr-tap-btn:active { transform: scale(0.97); }
.lyr-tap-btn:disabled { opacity: 0.5; }

/* ==========================================================================
   Sort control + smart playlists
   ========================================================================== */
.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  flex-shrink: 0;
}

.sort-control select {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.sort-control select:hover { border-color: var(--text-muted); }
.sort-control select:focus { border-color: var(--accent); }

.library-art.smart-art {
  background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 0, 0, 0.45) 130%);
  color: var(--bg-primary);
  font-size: 22px;
}

@media (max-width: 768px) {
  .section-header { flex-wrap: wrap; gap: 10px; }
  .sort-control select { font-size: 16px; }  /* >=16px stops iOS zooming on tap */
}

/* ==========================================================================
   New playlist builder
   ========================================================================== */
.newpl-modal { width: 520px; max-width: 92vw; }

.newpl-modal .settings-input {
  width: 100%;
  margin: 0 0 10px;
}

.newpl-name { font-size: 17px !important; font-weight: 700; }

.newpl-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  max-height: 92px;
  overflow-y: auto;
}

.newpl-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
}

.newpl-chip i { font-size: 10px; opacity: 0.8; }
.newpl-chip:hover { background: rgba(239, 68, 68, 0.12); border-color: #f87171; color: #f87171; }

.newpl-results {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 14px;
}

.newpl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.newpl-row:hover { background: rgba(255, 255, 255, 0.05); }
.newpl-row.on { background: var(--accent-glow); }
.newpl-row.on > i { color: var(--accent); }
.newpl-row > i { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }

.newpl-row img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.newpl-main { flex: 1; min-width: 0; }
.newpl-main .t { font-size: 13px; font-weight: 600; }
.newpl-main .a { font-size: 11px; color: var(--text-secondary); }

.newpl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.newpl-create { width: auto !important; padding: 12px 22px !important; }

/* Change Passcode Form */
.settings-change-passcode-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px dashed var(--glass-border);
}

.settings-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 576px) {
  .settings-form-row {
    grid-template-columns: 1fr;
  }
}

.settings-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-form-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.settings-input {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  text-align: center;
  letter-spacing: 0.2em;
}

.settings-input:focus {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.settings-input::placeholder {
  color: var(--text-muted);
  letter-spacing: normal;
}

.settings-feedback {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: none;
  animation: fadeIn 0.3s ease;
}

.settings-feedback.success {
  display: block;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent);
}

.settings-feedback.error {
  display: block;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  animation: shake 0.3s ease-in-out;
}

.settings-save-btn {
  align-self: flex-start;
  background-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 700;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.settings-save-btn:hover {
  background-color: var(--accent-hover);
  color: var(--bg-primary);
  box-shadow: 0 4px 15px var(--accent-glow);
}

/* ==========================================================================
   Persistent Playback Bar
   ========================================================================== */
#player-bar {
  grid-row: 2;
  grid-column: 1 / span 2;
  background-color: #040405;
  border-top: 1px solid var(--glass-border);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 24px;
  z-index: 200;
}

/* Left - track info */
.player-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.player-art-container {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-tertiary);
  position: relative;
}

.player-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-track-details {
  display: flex;
  flex-direction: column;
  max-width: 150px;
}

.player-track-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.player-track-cat {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Center - controls & progress */
.player-controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.playback-buttons {
  display: flex;
  align-items: center;
  gap: 20px;
}

.control-btn {
  font-size: 15px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.control-btn:hover {
  color: var(--text-primary);
  transform: scale(1.05);
}

.control-btn.active {
  color: var(--accent);
}

.control-btn.play-pause {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
}

.control-btn.play-pause:hover {
  background-color: #ffffff;
  transform: scale(1.08);
}

/* Slider Bar styling */
.progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 500px;
}

.time-stamp {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 32px;
}

.slider-wrapper {
  flex: 1;
  height: 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.slider-bar {
  width: 100%;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  position: relative;
}

.slider-fill {
  height: 100%;
  background-color: var(--text-primary);
  border-radius: var(--radius-full);
  width: 0%;
  position: absolute;
  left: 0;
  top: 0;
  transition: width 0.1s linear;
}

.slider-wrapper:hover .slider-fill {
  background-color: var(--accent);
}

.slider-handle {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  left: 0%;
  opacity: 0;
  transition: opacity 0.1s, left 0.1s linear;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.slider-wrapper:hover .slider-handle {
  opacity: 1;
}

/* Right - volume and misc */
.player-misc-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 120px;
}

/* ==========================================================================
   Mobile Nav Bar
   ========================================================================== */
#mobile-nav-bar {
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  grid-row: 3;
  grid-column: 1;
  background-color: #040405;
  border-top: 1px solid var(--glass-border);
  justify-content: space-around;
  align-items: center;
  height: var(--mobile-nav-height);
  overflow: visible;
  z-index: 150;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  padding: 8px 16px;
  text-decoration: none;
}

.mobile-nav-item i {
  font-size: 18px;
}

.mobile-nav-item.active {
  color: var(--accent);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.05); }
  100% { box-shadow: 0 0 35px rgba(16, 185, 129, 0.15); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================================================
   Responsive Styling (Mobile-first adaptions)
   ========================================================================== */
@media (max-width: 768px) {
  #app-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto var(--mobile-nav-height);
  }
  
  aside {
    display: none; /* Hide desktop sidebar */
  }
  
  main {
    grid-column: 1;
    grid-row: 1;
    padding-bottom: 20px;
  }
  
  header {
    /* Clears the Dynamic Island/notch AND iOS's own floating "now playing"
       pill, which otherwise sits right on top of the search bar/profile. */
    padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 16px;
  }
  
  .search-container {
    width: 200px;
  }
  
  .view-content {
    padding: 20px;
  }
  
  .hero-card {
    padding: 24px;
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  
  .hero-art {
    width: 140px;
    height: 140px;
    transform: rotate(0deg);
  }
  
  .hero-info {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .bento-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
  
  .song-card {
    padding: 10px;
  }
  
  .card-play-btn {
    opacity: 1; /* Always visible on mobile touch */
    transform: translateY(0);
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  /* Player bar adaptions for mobile */
  #player-bar {
    grid-row: 2;
    grid-column: 1;
    grid-template-columns: 1fr auto;
    padding: 12px 16px;
    height: 64px;
  }
  
  .player-track-info {
    min-width: 0;
  }
  
  .player-art-container {
    width: 40px;
    height: 40px;
  }
  
  .player-track-details {
    max-width: 160px;
  }
  
  .player-controls-container {
    grid-column: 2;
    align-items: flex-end;
  }
  
  .progress-container {
    display: none; /* Hide progress bar in collapsed bar */
  }
  
  .playback-buttons {
    gap: 12px;
  }
  
  /* Previous/next are essential — keep them on the mini bar. Only shuffle and
     repeat fold away on small screens (both still live in the full player). */
  .control-btn.shuffle, .control-btn.repeat, #queue-btn, #dj-btn {
    display: none;
  }

  .control-btn.prev, .control-btn.next {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    width: 40px;
    height: 40px;
  }
  
  .player-misc-container {
    display: none; /* Hide volume controls */
  }
  
  #mobile-nav-bar {
    display: flex; /* Show bottom nav on mobile */
  }
  
  .track-row {
    grid-template-columns: 30px 1fr 40px;
  }
  
  .track-cat-cell {
    display: none; /* Hide category cell in tracklist on mobile */
  }

  /* Mobile performance + zoom fixes */
  .glass, header, #player-bar, .lock-card, .olf-modal {
    backdrop-filter: none;              /* blur is a major mobile GPU cost */
    -webkit-backdrop-filter: none;
  }
  header { background-color: var(--bg-secondary); }
  .search-input { font-size: 16px; }    /* >=16px stops iOS auto-zoom on focus */
  #mobile-nav-bar { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .lock-card { width: 88vw; max-width: 340px; }
}
