:root {
  --bg: #000000;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.font-syne {
  --font-main: 'Syne', sans-serif;
}

body.font-jakarta {
  --font-main: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: #000000;
  color: #ffffff;
  font-family: var(--font-main);
  overflow: hidden;
}

/* Main 3D Stage */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000000;
  overflow: hidden;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage.mirrored {
  transform: scaleX(-1);
}

/* Subtle Ambient Aura from Album Art */
.ambient-aura {
  position: absolute;
  width: 65vw;
  height: 65vw;
  max-width: 780px;
  max-height: 780px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-size: cover;
  background-position: center;
  border-radius: 50%;
  filter: blur(130px) saturate(180%);
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
  animation: auraBreathe 14s ease-in-out infinite alternate;
  transition: background-image 1.5s ease, opacity 1.5s ease;
}

@keyframes auraBreathe {
  0% {
    transform: translate(-52%, -48%) scale(0.92) rotate(0deg);
  }
  100% {
    transform: translate(-48%, -52%) scale(1.12) rotate(12deg);
  }
}

/* Fluid Wave & Particle Canvas */
.wave-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Modern Minimal Track Header */
.track-header {
  position: absolute;
  top: 34px;
  left: 42px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 5;
  opacity: 0.78;
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.track-header.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.cover-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

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

.track-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.track-title {
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.92);
}

.track-artist {
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

/* 3D Floating Lyrics Chamber */
.lyrics-chamber {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  z-index: 3;
  padding: 0 8vw;
  pointer-events: none;
}

.lyrics-world {
  position: relative;
  width: 100%;
  max-width: 1180px;
  height: 76vh;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Lyric Line 3D Container */
.lyric-line {
  position: absolute;
  width: 100%;
  text-align: center;
  line-height: 1.24;
  letter-spacing: -0.025em;
  padding: 0 20px;
  will-change: transform, opacity, filter;
  transform-style: preserve-3d;
  transition:
    transform 1.15s cubic-bezier(0.19, 1, 0.22, 1),
    opacity 1.05s cubic-bezier(0.19, 1, 0.22, 1),
    filter 1.05s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Continuous organic zero-gravity drift wrapper */
.lyric-float-inner {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.28em;
  transform-style: preserve-3d;
  animation: liquidFloat 8s ease-in-out infinite alternate;
}

@keyframes liquidFloat {
  0% {
    transform: translate3d(-5px, -6px, 0px) rotateZ(-0.3deg) rotateY(-1.2deg);
  }
  50% {
    transform: translate3d(6px, 4px, 22px) rotateZ(0.25deg) rotateY(1.2deg);
  }
  100% {
    transform: translate3d(-3px, 7px, -6px) rotateZ(-0.15deg) rotateY(-0.6deg);
  }
}

/* Individual 3D Words for Staggered Fluid Wave */
.lyric-word {
  display: inline-block;
  will-change: transform, opacity, color, text-shadow, filter;
  transition:
    transform 0.68s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.45s ease,
    opacity 0.55s ease,
    text-shadow 0.55s ease,
    filter 0.65s ease;
  transition-delay: calc(var(--w-idx, 0) * 38ms);
}

/* ACTIVE LINE: Fluid Modern Spotlight */
.lyric-line.active {
  font-size: clamp(2.1rem, 4.6vw, 4rem);
  font-weight: 600;
  opacity: 1;
  filter: blur(0px);
  transform: translate3d(0, 0px, 45px) rotateX(0deg) scale(1);
  z-index: 10;
}

body.font-syne .lyric-line.active {
  font-size: clamp(2rem, 4.3vw, 3.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* Word states inside the active line */
.lyric-line.active .lyric-word {
  color: rgba(255, 255, 255, 0.38);
  transform: translate3d(0, 8px, -12px) scale(0.96);
}

.lyric-line.active .lyric-word.sung {
  color: rgba(255, 255, 255, 0.96);
  transform: translate3d(0, 0px, 8px) scale(1);
  text-shadow: 0 0 26px rgba(255, 255, 255, 0.32);
  transition-delay: 0ms;
}

.lyric-line.active .lyric-word.singing {
  color: #ffffff;
  transform: translate3d(0, -5px, 28px) scale(1.055);
  text-shadow:
    0 0 22px rgba(255, 255, 255, 0.75),
    0 0 58px rgba(190, 225, 255, 0.38);
  transition-delay: 0ms;
}

/* PREVIOUS LINES: Receding smoothly upward & deep into the glass chamber */
.lyric-line.prev-1 {
  font-size: clamp(1.45rem, 2.9vw, 2.45rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.42);
  opacity: 0.32;
  filter: blur(3px);
  transform: translate3d(0, -130px, -170px) rotateX(16deg) scale(0.86);
  z-index: 5;
}

.lyric-line.prev-1 .lyric-word {
  color: rgba(255, 255, 255, 0.55);
  transform: translate3d(0, -6px, 0) scale(1);
}

.lyric-line.prev-2 {
  font-size: clamp(1.2rem, 2.2vw, 1.85rem);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.2);
  opacity: 0.11;
  filter: blur(8px);
  transform: translate3d(0, -230px, -340px) rotateX(26deg) scale(0.72);
  z-index: 2;
}

/* NEXT LINES: Emerging from the lower 3D depth */
.lyric-line.next-1 {
  font-size: clamp(1.45rem, 2.9vw, 2.45rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.46);
  opacity: 0.36;
  filter: blur(2.5px);
  transform: translate3d(0, 132px, -150px) rotateX(-14deg) scale(0.88);
  z-index: 5;
}

.lyric-line.next-1 .lyric-word {
  color: rgba(255, 255, 255, 0.55);
  transform: translate3d(0, 12px, -18px) scale(0.95);
}

.lyric-line.next-2 {
  font-size: clamp(1.2rem, 2.2vw, 1.85rem);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.22);
  opacity: 0.13;
  filter: blur(7px);
  transform: translate3d(0, 232px, -310px) rotateX(-24deg) scale(0.75);
  z-index: 2;
}

/* Far lines smoothly dissolved in deep space */
.lyric-line.far-prev {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  opacity: 0;
  filter: blur(16px);
  transform: translate3d(0, -320px, -500px) rotateX(32deg) scale(0.58);
}

.lyric-line.far-next {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  opacity: 0;
  filter: blur(16px);
  transform: translate3d(0, 320px, -500px) rotateX(-32deg) scale(0.58);
}

/* Standby Minimal Clock */
.standby-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  animation: liquidFloat 10s ease-in-out infinite alternate;
}

.standby-clock {
  font-size: clamp(3.8rem, 8.5vw, 6.8rem);
  font-weight: 200;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 45px rgba(255, 255, 255, 0.2);
}

.standby-sub {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.34);
}

/* Ultra-thin Progress Hairline */
.progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 6;
}

.progress-container.hidden {
  opacity: 0;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.85));
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
  transition: width 0.2s linear;
}

/* Auto-Hide HUD Dock */
.hud {
  position: fixed;
  bottom: 24px;
  right: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.hud.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.hud-pill,
.hud-btn,
.hud-group {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.85);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.2s, border-color 0.2s;
}

.hud-group {
  padding: 4px 8px;
  gap: 6px;
}

.hud-mini {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
}

.hud-mini:hover {
  background: rgba(255, 255, 255, 0.25);
}

.hud-label {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.75);
  min-width: 36px;
  text-align: center;
}

.hud-pill:hover,
.hud-btn:hover,
.hud-btn.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.status-dot.connected {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  padding: 26px;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-desc {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.5;
  margin-bottom: 16px;
}

.steps-box {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 12px 16px 12px 28px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  margin-bottom: 16px;
}

.steps-box code {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 0.78rem;
  color: #a7f3d0;
  user-select: text;
  -webkit-user-select: text;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.modal-form input,
.search-bar input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.search-bar input {
  flex: 1;
}

.search-results {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.2s;
}

.result-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.result-item img {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
}

.result-info {
  flex: 1;
  overflow: hidden;
}

.result-title {
  font-size: 0.88rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-artist {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.5);
}
