:root {
  color-scheme: dark;
  --background: #05070b;
  --text: #f5f7fb;
  --muted: rgba(245, 247, 251, 0.46);
  --muted-soft: rgba(245, 247, 251, 0.18);
  --accent: #0b1714;
  --button-bg: #f5f7fb;
  --button-bg-hover: #ffffff;
  --button-text: #07110f;
  --ring: rgba(111, 255, 216, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background-color: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  transition: background-color 720ms ease;
}

button {
  font: inherit;
}

.app-shell,
.player {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.player {
  position: relative;
  isolation: isolate;
}

.track-panel {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 4;
  max-width: min(54vw, 560px);
  pointer-events: auto;
}

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

.cover-art {
  width: clamp(46px, 6vw, 68px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.track-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.track-panel h1 {
  margin: 0;
  color: rgba(245, 247, 251, 0.74);
  font-size: clamp(0.86rem, 1.45vw, 1.06rem);
  font-weight: 650;
  line-height: 1.25;
}

.status-panel {
  position: fixed;
  top: max(86px, calc(env(safe-area-inset-top) + 86px));
  left: 50%;
  z-index: 6;
  width: min(calc(100vw - 36px), 560px);
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(10, 14, 22, 0.86);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  color: rgba(245, 247, 251, 0.9);
  text-align: center;
  transform: translateX(-50%);
}

.status-panel p {
  margin: 0;
  font-size: clamp(0.92rem, 2.4vw, 1.04rem);
  font-weight: 680;
  line-height: 1.35;
}

.status-panel.is-error {
  border-color: rgba(255, 135, 135, 0.34);
}

.status-panel.is-warning {
  border-color: rgba(255, 218, 121, 0.34);
}

.lyrics-panel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 min(6vw, 72px);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 247, 251, 0.22) transparent;
}

.lyrics-panel::-webkit-scrollbar {
  width: 8px;
}

.lyrics-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(245, 247, 251, 0.22);
}

.lyrics-list {
  width: min(100%, 1050px);
  margin: 0 auto;
  padding: 42dvh 0;
}

.lyrics-loading {
  margin: 0;
  color: rgba(245, 247, 251, 0.72);
  font-size: clamp(1.35rem, 4vw, 4rem);
  font-weight: 760;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
  animation: loadingPulse 1400ms ease-in-out infinite;
}

.lyric-line {
  display: block;
  width: 100%;
  margin: 0;
  padding: clamp(8px, 1.7dvh, 22px) 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: clamp(1.35rem, 4.4vw, 4.7rem);
  font-weight: 780;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.lyric-line:hover {
  color: rgba(245, 247, 251, 0.74);
  transform: scale(1.02);
}

.lyric-word {
  display: inline-block;
  border-radius: 6px;
  cursor: pointer;
  transition:
    color 160ms ease,
    transform 160ms ease,
    text-shadow 160ms ease;
}

.lyric-word:hover {
  color: var(--text);
  text-shadow: 0 0 22px rgba(245, 247, 251, 0.28);
  transform: translateY(-0.04em);
}

.lyric-line:focus-visible {
  border-radius: 8px;
  outline: 3px solid var(--ring);
  outline-offset: 4px;
}

.lyric-line.active {
  color: var(--text);
  transform: scale(1.06);
}

.lyric-line.is-near {
  color: rgba(245, 247, 251, 0.62);
}

.lyric-line.is-far {
  color: var(--muted-soft);
  transform: scale(0.9);
}

.lyrics-list.plain {
  width: min(100%, 760px);
  min-height: 100%;
  transform: none;
}

.lyrics-list.plain .lyric-line {
  cursor: default;
  color: rgba(245, 247, 251, 0.82);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 500;
  line-height: 1.45;
  pointer-events: none;
  text-align: left;
  white-space: pre-wrap;
}

.lyrics-list.plain .lyric-line:hover {
  transform: none;
}

.listen-button {
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  z-index: 5;
  display: inline-grid;
  min-width: clamp(188px, 34vw, 280px);
  max-width: calc(100vw - 36px);
  min-height: clamp(72px, 11vw, 96px);
  padding: 0 clamp(30px, 6vw, 52px);
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: var(--button-bg);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  color: var(--button-text);
  cursor: pointer;
  font-size: clamp(1.18rem, 3vw, 1.6rem);
  font-weight: 760;
  transform: translate(-50%, -50%);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

body.has-track .listen-button {
  top: auto;
  bottom: max(22px, env(safe-area-inset-bottom));
  min-width: 168px;
  min-height: 52px;
  padding: 0 24px;
  font-size: 0.95rem;
  transform: translateX(-50%);
}

.listen-label {
  white-space: nowrap;
}

.listen-button:hover {
  background: var(--button-bg-hover);
  border-color: #ffffff;
  box-shadow: 0 26px 68px rgba(0, 0, 0, 0.42);
}

.listen-button:active {
  transform: translate(-50%, -50%) scale(0.98);
}

body.has-track .listen-button:active {
  transform: translateX(-50%) scale(0.98);
}

.listen-button:disabled {
  cursor: default;
  opacity: 1;
}

@keyframes loadingPulse {
  0%,
  100% {
    opacity: 0.42;
    transform: translateY(0);
  }

  50% {
    opacity: 0.9;
    transform: translateY(-4px);
  }
}

.listen-button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 4px;
}

.equalizer {
  display: none;
  align-items: center;
  gap: 6px;
  height: 36px;
}

.equalizer span {
  width: 5px;
  height: calc(7px + (25px * var(--bar-level, 0.12)));
  border-radius: 999px;
  background: var(--accent);
  transition: height 70ms linear;
}

.listen-button.is-listening .listen-label {
  display: none;
}

.listen-button.is-listening .equalizer {
  display: inline-flex;
}

@media (prefers-reduced-motion: reduce) {
  .lyric-line,
  .listen-button,
  .lyrics-loading {
    animation: none;
    transition: none;
  }

  .lyrics-panel {
    scroll-behavior: auto;
  }

  body {
    transition: none;
  }
}

@media (max-width: 720px) {
  .track-panel {
    max-width: calc(100vw - 36px);
    top: 18px;
  }

  .lyrics-panel {
    padding-inline: 20px;
  }

  .status-panel {
    top: 82px;
  }

  .cover-art {
    width: 46px;
  }

  .listen-button {
    min-width: 190px;
  }

  body.has-track .listen-button {
    min-width: 156px;
  }
}
