:root {
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.65);
  --text-faint: rgba(255, 255, 255, 0.38);
  --red: #ff3b30;
  --bg-fallback-1: #0d1b1e;
  --bg-fallback-2: #060a0b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #050708;
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- stage: full screen on phones, phone-frame on desktop ---------- */
.stage {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

@media (min-width: 560px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
      radial-gradient(ellipse 80% 60% at 50% 30%, #101c1f 0%, #050708 70%);
  }
  .stage {
    width: 400px;
    min-height: 0;
    height: min(850px, 94vh);
    border-radius: 40px;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 40px 90px rgba(0, 0, 0, 0.75);
  }
}

/* ---------- background from mp3 cover ---------- */
.bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, var(--bg-fallback-1) 0%, var(--bg-fallback-2) 70%);
}
.bg__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.bg__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(5, 8, 9, 0.35) 0%,
      rgba(5, 8, 9, 0.05) 18%,
      rgba(5, 8, 9, 0.15) 38%,
      rgba(6, 10, 11, 0.78) 58%,
      rgba(6, 10, 11, 0.96) 78%,
      #05080a 100%);
}
.bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- app column ---------- */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100dvh;
  padding: calc(14px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 560px) {
  .app { min-height: 0; }
}

.flex-space { flex: 1 1 auto; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  opacity: 0.9;
}

.icon-btn {
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 100%; height: 100%; fill: currentColor; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn[hidden] { display: none; }

.icon-btn--like.is-liked {
  color: var(--red);
  animation: likePop 0.35s ease;
}
.icon-btn--like.is-liked:hover { background: transparent; cursor: default; }
@keyframes likePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------- meta ---------- */
.meta {
  text-align: center;
  margin-bottom: 26px;
  padding: 0 8px;
}
.meta__title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
.meta__artist {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
}

/* ---------- play + waveform ---------- */
.playzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.playzone__wave {
  flex: 1 1 0;
  min-width: 0;
  max-width: 130px;
  height: 46px;
}

.play {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.play svg { width: 40%; height: 40%; fill: currentColor; }
.play:active { transform: scale(0.94); }

/* ---------- time + seek ---------- */
.time {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
}
.time__sep { margin: 0 3px; opacity: 0.6; }

.seek {
  padding: 6px 0 14px;
  cursor: pointer;
  touch-action: none;
  width: min(300px, 82%);
  margin: 0 auto;
}
.seek__bar {
  position: relative;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
}
.seek__filled {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  border-radius: 3px;
  background: #fff;
}
.seek__handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  margin-bottom: 8px;
}
.controls .icon-btn {
  width: 42px;
  height: 42px;
  padding: 9px;
  color: var(--text);
}
.icon-btn--repeat { position: relative; color: var(--text-dim); }
.icon-btn--repeat.is-active { color: var(--text); }
.icon-btn--repeat.is-active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- lyrics ---------- */
.lyrics {
  position: relative;
  height: 118px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
}
.lyrics__scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 40px 14px;
  text-align: center;
  scrollbar-width: none;
}
.lyrics__scroll::-webkit-scrollbar { display: none; }
.lyrics__line {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.75;
  color: var(--text-faint);
  transition: color 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
  opacity: 0.55;
}
.lyrics__line.is-active {
  color: var(--text);
  opacity: 1;
  transform: scale(1.03);
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.5);
}
.lyrics__line.is-past { opacity: 0.3; }
.lyrics__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- info overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 7, 0.55);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.overlay.is-open { opacity: 1; }
.overlay[hidden] { display: none; }

.overlay__panel {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 26px 24px 22px;
}
.overlay__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay__close svg { width: 100%; height: 100%; fill: currentColor; }
.overlay__close:hover { color: var(--text); }

.overlay__title {
  margin: 0 28px 18px 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}
.overlay__rows {
  display: flex;
  flex-direction: column;
}
.overlay__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.overlay__label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  flex: 0 0 auto;
}
.overlay__value {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}
