/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
  --bg:            #07070f;
  --accent:        #a855f7;
  --accent-2:      #ec4899;
  --accent-glow:   rgba(168, 85, 247, 0.35);
  --glass-bg:      rgba(255, 255, 255, 0.04);
  --glass-border:  rgba(255, 255, 255, 0.08);
  --text:          #ffffff;
  --text-muted:    rgba(255, 255, 255, 0.45);
  --text-dim:      rgba(255, 255, 255, 0.18);

  --line-h:        80px;    /* lyric row height – keep in sync with JS LINE_HEIGHT */
  --radius:        22px;
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --transition:    0.55s var(--ease);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   PARTICLE CANVAS (background layer)
   ============================================================ */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============================================================
   FLOATING ORBS
   ============================================================ */
.orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: orb-float 24s ease-in-out infinite;
}

.orb-1 {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #6d28d9 0%, transparent 70%);
  top: -15%;
  left: -12%;
  opacity: 0.22;
  animation-duration: 28s;
}

.orb-2 {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, #db2777 0%, transparent 70%);
  bottom: -12%;
  right: -10%;
  opacity: 0.2;
  animation-duration: 22s;
  animation-delay: -9s;
}

.orb-3 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #0e7490 0%, transparent 70%);
  top: 38%;
  left: 58%;
  opacity: 0.18;
  animation-duration: 18s;
  animation-delay: -4s;
}

@keyframes orb-float {
  0%,  100% { transform: translate(0,  0)   scale(1); }
  33%        { transform: translate(28px, -36px) scale(1.08); }
  66%        { transform: translate(-22px, 28px) scale(0.93); }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 32px 16px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

/* ============================================================
   TRACK HEADER (album + meta)
   ============================================================ */
.track-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: 100%;
}

/* --- Vinyl record art --- */
.album-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-art {
  width: 192px;
  height: 192px;
  border-radius: 50%;
  position: relative;
  background:
    radial-gradient(circle at 50% 50%,
      #1e0a3c 0%,
      #0e0520 45%,
      #180b30 100%);
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.07),
    0 24px 64px rgba(0,0,0,0.65);
  flex-shrink: 0;
  overflow: hidden;
}

/* vinyl groove rings */
.album-art::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at center,
    transparent 12px,
    rgba(255,255,255,0.025) 13px,
    transparent 14px,
    transparent 22px
  );
}

/* shine highlight */
.album-art::after {
  content: '';
  position: absolute;
  top: 9%;
  left: 9%;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.13), transparent 70%);
  pointer-events: none;
}

/* spinning state */
.album-art.spinning { animation: vinyl-spin 8s linear infinite; }

@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* center dot */
.vinyl-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  z-index: 2;
  box-shadow: 0 0 22px rgba(168,85,247,0.6);
}

.vinyl-center::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #07070f;
}

/* pulsing glow ring around album */
.album-glow {
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  z-index: -1;
  animation: glow-pulse 3.2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%,  100% { opacity: 0.5; transform: scale(1); }
  50%        { opacity: 0.85; transform: scale(1.06); }
}

.track-meta { text-align: center; }

.track-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 5px;
}

.track-artist {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ============================================================
   LYRICS DISPLAY
   ============================================================ */
.lyrics-section {
  width: 100%;
  position: relative;
}

/* Subtle center highlight behind active line */
.lyrics-section::before {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  height: var(--line-h);
  background: radial-gradient(ellipse 70% 100% at center, rgba(168,85,247,0.07) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* The visible window – exactly 3 lines tall */
.lyrics-viewport {
  height: calc(var(--line-h) * 3);
  overflow: hidden;
  position: relative;
  /* Fade top and bottom edges */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent  0%,
    black       22%,
    black       78%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent  0%,
    black       22%,
    black       78%,
    transparent 100%
  );
}

/* The scrollable track holding all lines */
.lyrics-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--line-h) 0; /* top/bottom padding lets first & last lines center */
  transition: transform var(--transition);
  will-change: transform;
}

/* Each lyric row */
.lyric-line {
  height: var(--line-h);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-dim);
  opacity: 0.2;
  transform: scale(0.82);
  transition:
    opacity      var(--transition),
    transform    var(--transition),
    font-size    var(--transition),
    font-weight  var(--transition),
    color        var(--transition),
    text-shadow  var(--transition);
  cursor: default;
  line-height: 1.35;
  user-select: none;
  will-change: transform, opacity;
  position: relative;
  z-index: 1;
}

/* ── Distance-based states ── */

.lyric-line.near-2 {
  font-size: 0.92rem;
  font-weight: 400;
  color: rgba(255,255,255,0.22);
  opacity: 0.35;
  transform: scale(0.86);
}

.lyric-line.near-1 {
  font-size: 1.15rem;
  font-weight: 500;
  color: rgba(255,255,255,0.48);
  opacity: 0.6;
  transform: scale(0.93);
}

.lyric-line.active {
  font-size: 1.62rem;
  font-weight: 700;
  color: #ffffff;
  opacity: 1;
  transform: scale(1.04);
  text-shadow:
    0 0  20px rgba(200, 130, 255, 0.85),
    0 0  50px rgba(168,  85, 247, 0.5),
    0 0 100px rgba(168,  85, 247, 0.25);
  letter-spacing: -0.01em;
}

/* ============================================================
   GLASS PLAYER CARD
   ============================================================ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.player {
  width: 100%;
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Progress ── */
.progress-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 34px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.time:last-child { text-align: right; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.09);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: height 0.18s ease;
}

.progress-bar:hover { height: 7px; }

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  width: 0%;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  transition:
    left   0.1s linear,
    transform 0.18s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  pointer-events: none;
}

.progress-bar:hover .progress-thumb { transform: translate(-50%, -50%) scale(1); }

/* ── Controls ── */
.controls-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  outline: none;
}

.ctrl-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

.ctrl-btn:active { transform: scale(0.9); }

.ctrl-btn.toggled { color: var(--accent); }

/* Play/Pause */
.play-btn {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #a855f7, #ec4899) !important;
  color: #fff !important;
  border-radius: 50% !important;
  box-shadow:
    0 0 0 0 rgba(168,85,247,0),
    0 6px 24px rgba(168,85,247,0.42);
  transition: transform 0.18s ease, box-shadow 0.18s ease !important;
}

.play-btn:hover {
  transform: scale(1.09) !important;
  box-shadow:
    0 0 0 8px rgba(168,85,247,0.12),
    0 8px 32px rgba(168,85,247,0.55) !important;
}

.play-btn:active { transform: scale(0.93) !important; }

/* ── Volume ── */
.volume-section {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.volume-section svg { flex-shrink: 0; }

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.09);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: transform 0.15s ease;
}

.volume-slider:hover::-webkit-slider-thumb { transform: scale(1.2); }

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* ── No-audio notice ── */
.no-audio-notice {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
  line-height: 1.5;
  padding: 4px 0 0;
  letter-spacing: 0.01em;
}

.no-audio-notice span { color: rgba(168,85,247,0.7); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 400px) {
  .app { padding: 24px 12px 28px; gap: 28px; }
  .album-art { width: 160px; height: 160px; }
  .track-title { font-size: 1.3rem; }
  .lyric-line.active { font-size: 1.38rem; }
  .lyric-line.near-1 { font-size: 1rem; }
}

@media (min-width: 600px) {
  .app { max-width: 520px; }
  .album-art { width: 210px; height: 210px; }
  .track-title { font-size: 1.75rem; }
  .lyric-line.active { font-size: 1.8rem; }
  .lyric-line.near-1 { font-size: 1.25rem; }
}
