:root {
  color-scheme: dark;
  --bg: #080a0f;
  --surface: #111620;
  --surface-strong: #18202c;
  --text: #f4f7fb;
  --muted: #93a0b4;
  --dim: #586273;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #1ed760;
  --accent-strong: #35f178;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at 18% 0%, rgba(30, 215, 96, 0.13), transparent 26rem),
    linear-gradient(145deg, #080a0f 0%, #0b1018 44%, #090b10 100%);
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #061009;
  background: var(--accent);
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1120px, calc(100% - 2rem));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 2rem 0;
  display: grid;
  grid-template-rows: auto minmax(22rem, 1fr);
  gap: 1rem;
}

.player-panel,
.lyrics-panel,
.callback-card {
  border: 1px solid var(--line);
  background: rgba(17, 22, 32, 0.88);
  box-shadow: var(--shadow);
}

.player-panel {
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 3px solid rgba(30, 215, 96, 0.35);
  outline-offset: 3px;
}

.button.primary {
  color: #031107;
  background: var(--accent);
  font-weight: 700;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.ghost {
  border-color: var(--line);
  color: var(--muted);
}

.button.hidden,
.hidden {
  display: none !important;
}

.status {
  min-height: 1.5rem;
  margin: 1rem 0;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.now-playing {
  min-height: 8.5rem;
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.cover {
  width: 7.5rem;
  aspect-ratio: 1;
  border-radius: 0.4rem;
  object-fit: cover;
  background: var(--surface-strong);
}

.track-meta {
  min-width: 0;
}

.track-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3rem;
  gap: 0.75rem;
  align-items: center;
}

.track-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.3vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
}

.play-toggle {
  width: 3rem;
  height: 3rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(30, 215, 96, 0.34);
  border-radius: 50%;
  color: #031107;
  background: var(--accent);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.play-toggle:hover {
  background: var(--accent-strong);
  transform: translateY(-1px) scale(1.02);
}

.play-toggle:focus-visible {
  outline: 3px solid rgba(30, 215, 96, 0.35);
  outline-offset: 3px;
}

.play-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.track-artist {
  margin: 0.3rem 0 1.25rem;
  color: var(--muted);
  font-size: 1rem;
}

.progress-row {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) 3.2rem;
  gap: 0.75rem;
  align-items: center;
}

.time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

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

.progress-track {
  height: 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 120ms linear;
}

.lyrics-panel {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}

.lyrics-container {
  height: 100%;
  max-height: calc(100dvh - 17rem);
  min-height: 22rem;
  overflow-y: auto;
  padding: 18vh clamp(1rem, 4vw, 3rem);
  scroll-behavior: smooth;
}

.lyric-line {
  width: min(100%, 860px);
  margin: 0 auto 1rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.4rem;
  color: var(--dim);
  font-size: clamp(1.35rem, 3vw, 2.65rem);
  font-weight: 750;
  line-height: 1.22;
  text-align: center;
  cursor: pointer;
  transition: color 220ms ease, opacity 220ms ease, transform 220ms ease, background 160ms ease;
}

.lyric-line:hover {
  background: rgba(255, 255, 255, 0.055);
}

.lyric-line:focus-visible {
  outline: 3px solid rgba(30, 215, 96, 0.35);
  outline-offset: 3px;
}

.lyric-line.past {
  color: #778196;
  opacity: 0.58;
}

.lyric-line.active {
  color: var(--text);
  opacity: 1;
  transform: scale(1.035);
  text-shadow: 0 0 22px rgba(30, 215, 96, 0.18);
}

.lyric-line.future {
  opacity: 0.38;
}

.plain-lyrics {
  width: min(100%, 760px);
  margin: 0 auto;
  color: var(--text);
  font-size: 1.15rem;
  white-space: pre-wrap;
}

.empty-lyrics {
  width: min(100%, 680px);
  margin: 5rem auto;
  color: var(--muted);
  font-size: 1.25rem;
  text-align: center;
}

.callback-page {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.callback-card {
  width: min(100%, 34rem);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 1rem, 1120px);
    padding: 0.5rem 0;
    gap: 0.5rem;
  }

  .player-panel {
    padding: 1rem;
  }

  .topbar,
  .auth-actions {
    display: grid;
    justify-content: stretch;
  }

  .button {
    width: 100%;
  }

  .now-playing {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    min-height: 6.5rem;
  }

  .cover {
    width: 5.5rem;
  }

  .track-title {
    font-size: 1.25rem;
  }

  .track-heading {
    grid-template-columns: minmax(0, 1fr) 2.75rem;
  }

  .play-toggle {
    width: 2.75rem;
    height: 2.75rem;
  }

  .track-artist {
    margin-bottom: 0.85rem;
  }

  .progress-row {
    grid-template-columns: 2.8rem minmax(0, 1fr) 2.8rem;
    gap: 0.5rem;
  }

  .lyrics-container {
    max-height: calc(100dvh - 19rem);
    padding: 16vh 1rem;
  }

  .lyric-line {
    font-size: clamp(1.25rem, 7vw, 2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
