:root {
  --bg-deep: #060212;
  --bg-nebula-violet: #17072e;
  --bg-nebula-cyan: #062b3d;
  
  --glass-card: rgba(22, 16, 43, 0.65);
  --glass-card-hover: rgba(33, 24, 61, 0.8);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-focus: rgba(56, 189, 248, 0.5);
  
  --accent-cyan: #38bdf8;
  --accent-violet: #a855f7;
  --accent-pink: #ec4899;
  --glow-cyan: rgba(56, 189, 248, 0.45);
  --glow-violet: rgba(168, 85, 247, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --safe-top: env(safe-area-inset-top, 16px);
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  padding-bottom: var(--safe-bottom);
}

/* Cosmic Nebula Background & Animations */
.cosmic-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #150930 0%, #060212 70%);
}

.nebula-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  pointer-events: none;
}

.glow-1 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #7e22ce 0%, transparent 70%);
  top: -60px;
  right: -80px;
  animation: floatNebula 18s ease-in-out infinite alternate;
}

.glow-2 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #0284c7 0%, transparent 70%);
  bottom: 10%;
  left: -70px;
  animation: floatNebula 22s ease-in-out infinite alternate-reverse;
}

.glow-3 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, #db2777 0%, transparent 70%);
  top: 35%;
  right: 20%;
  opacity: 0.35;
  animation: pulseGlow 14s ease-in-out infinite alternate;
}

.stars-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 100px 150px, #e2e8f0, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 240px 90px, #38bdf8, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 320px 280px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 360px, #c084fc, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 380px 380px;
  opacity: 0.55;
}

@keyframes floatNebula {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 40px) scale(1.15); }
  100% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes pulseGlow {
  0% { opacity: 0.25; transform: scale(0.9); }
  100% { opacity: 0.5; transform: scale(1.1); }
}

/* Header */
header {
  padding: calc(var(--safe-top) + 8px) 20px 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 2, 18, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  box-shadow: 0 0 14px var(--glow-cyan);
  animation: pulseOrb 3s ease-in-out infinite alternate;
}

@keyframes pulseOrb {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 1; }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.brand-sub {
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
}

.glass-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 7px 15px;
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.glass-pill:active {
  transform: scale(0.96);
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* Main Layout */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 12px 18px 24px 18px;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

/* Vinyl & Orbit Stage */
.stage-container {
  position: relative;
  width: min(72vw, 290px);
  height: min(72vw, 290px);
  margin: 10px 0 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.orbit-ring-outer {
  inset: -16px;
  border: 1px dashed rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.2), inset 0 0 20px rgba(168, 85, 247, 0.15);
  animation: rotateClockwise 60s linear infinite;
}

.orbit-ring-inner {
  inset: -8px;
  border: 1px solid rgba(168, 85, 247, 0.2);
  animation: rotateCounter 45s linear infinite;
}

@keyframes rotateClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotateCounter {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

.vinyl-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, #181524 0%, #0d0a17 65%, #05040a 100%);
  border: 4px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.8),
    0 0 35px var(--glow-cyan),
    inset 0 0 15px rgba(255, 255, 255, 0.05);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.4s ease;
}

.vinyl-disc.playing {
  animation: spinRecord 22s linear infinite;
}

@keyframes spinRecord {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vinyl-grooves {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    transparent 0,
    transparent 3px,
    rgba(255, 255, 255, 0.02) 4px,
    transparent 5px
  );
  pointer-events: none;
}

.vinyl-center {
  width: 58%;
  height: 58%;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.9);
}

.artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.center-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.9);
}

/* Glass Player Card */
.player-card {
  width: 100%;
  background: var(--glass-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 
    0 20px 48px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.category-badge {
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
}

.number-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

/* Track Typography */
.track-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-title {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.track-meta {
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-weight: 600;
  color: var(--accent-cyan);
}

.meta-sep {
  color: var(--text-muted);
}

.track-album {
  color: var(--text-muted);
}

/* Timeline & Scrubber */
.timeline-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-wrapper {
  position: relative;
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
}

.timeline-bar {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  outline: none;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.timeline-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 0 10px var(--accent-cyan), 0 2px 4px rgba(0, 0, 0, 0.6);
  border: 2px solid var(--accent-cyan);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.timeline-bar::-webkit-slider-thumb:hover,
.timeline-bar:active::-webkit-slider-thumb {
  transform: scale(1.3);
}

.timeline-progress-fill {
  position: absolute;
  left: 0;
  top: 9px;
  height: 6px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 8px var(--glow-cyan);
  width: 0%;
}

.timeline-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  font-weight: 500;
  padding: 0 2px;
}

/* Playback Controls Row */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
}

.control-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:active {
  transform: scale(0.9);
  color: var(--accent-cyan);
}

.control-btn.active {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan);
}

.play-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #7e22ce 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 8px 24px var(--glow-cyan),
    0 0 20px var(--glow-violet);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.play-btn:active {
  transform: scale(0.92);
  box-shadow: 0 4px 14px var(--glow-cyan);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 4px;
}

.glass-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.glass-action-btn:active {
  transform: scale(0.97);
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

/* Modals & Drawers */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

.drawer.open {
  pointer-events: auto;
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 500px;
  margin: 0 auto;
  height: 85vh;
  background: rgba(14, 10, 28, 0.94);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 32px 32px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.8);
}

.drawer.open .drawer-panel {
  transform: translateY(0);
}

.drawer-header {
  padding: 20px 20px 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.drawer-subtitle {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

/* Lyrics Body */
.lyrics-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #e2e8f0;
  white-space: pre-line;
  font-weight: 400;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  padding-bottom: 60px;
}

.lyrics-body p {
  margin-bottom: 1.5rem;
}

.lyrics-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 40px;
}

/* Filter Controls in Library */
.filter-section {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 14px;
  border-radius: 12px;
  color: var(--text-muted);
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.cat-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-tab.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #060212;
  font-weight: 700;
  box-shadow: 0 0 12px var(--glow-cyan);
}

.artist-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.artist-chip {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
  color: #d8b4fe;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.artist-chip.active {
  background: #a855f7;
  color: #ffffff;
}

/* Track List Items */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 40px;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.track-item:active {
  transform: scale(0.98);
  background: rgba(56, 189, 248, 0.1);
}

.track-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
}

.track-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: #110d20;
}

.track-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.track-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-item.active .track-item-title {
  color: var(--accent-cyan);
}

.track-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-item-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}
