:root {
  --bg: #121212;
  --raised: #242424;
  --white: #fff;
  --grey: #a7a7a7;
  --page: 440px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
}

/* Phone first: on wider screens the page stays phone-width, centred */
html {
  background: #000;
}

body {
  max-width: var(--page);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  color: var(--white);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

/* Dialogs take focus themselves, so no button shows a ring on open */
dialog:focus-visible {
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Photos keep their own colour */
.photo,
.hero-photo,
.thumb,
.cover {
  display: block;
  background-color: #333;
  background-size: cover;
  background-position: center;
}

.empty {
  background-image: linear-gradient(135deg, #4a4a4a, #1c1c1c);
}

/* Header */
.hero {
  position: relative;
  height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-photo {
  position: absolute;
  inset: 0;
}

/* Fade the photo into the page */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, transparent 30%, rgba(18, 18, 18, 0.2) 55%, var(--bg) 100%);
}

.topbar,
.hero-text {
  position: relative;
  z-index: 1;
  padding: 12px 16px;
}

.round-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
}

.round-btn svg {
  width: 20px;
  height: 20px;
}

.verified {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.verified svg {
  width: 18px;
  height: 18px;
  padding: 3px;
  border-radius: 50%;
  background: var(--white);
  fill: var(--bg);
}

h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-top: 6px;
}

/* Under the header */
main {
  padding: 0 16px;
}

.listeners {
  color: var(--grey);
  font-size: 0.875rem;
  padding-top: 4px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
}

.spacer {
  flex: 1;
}

.icon-btn {
  color: var(--grey);
  display: grid;
}

.follow {
  border: 1px solid #7c7c7c;
  border-radius: 999px;
  padding: 5px 15px;
  font-size: 0.875rem;
  font-weight: 700;
}

.big-play {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--white);
  color: #000;
}

.big-play:active,
.track:active,
.pick:active,
.release:active {
  transform: scale(0.97);
}

section {
  padding-top: 32px;
}

h2 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.sub {
  display: block;
  color: var(--grey);
  font-size: 0.8125rem;
}

/* Artist pick: a banner, because the birthday single is the point of the page */
.pick {
  position: relative;
  display: block;
  width: 100%;
  height: 208px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 160ms var(--ease-out);
}

.pick .cover {
  position: absolute;
  inset: 0;
  background-position: center 82%;
}

/* Darken the bottom so the title reads on any photo */
.pick::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 30%, rgba(0, 0, 0, 0.85) 100%);
}

.pick-text {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 1;
}

.pick-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #d0d0d0;
}

.pick-note .thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.pick-title {
  display: block;
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 2px 0 4px;
}

.pick .sub {
  color: #d0d0d0;
}

.pick-play {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--white);
  color: #000;
}

/* Popular */
.tracks {
  list-style: none;
  padding: 0;
}

.track {
  display: grid;
  grid-template-columns: 20px 48px 1fr 24px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 0;
}

.rank {
  color: var(--grey);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Three small bars stand in for the number while a track plays */
.bars {
  display: none;
  height: 14px;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}

.bars i {
  width: 3px;
  height: 100%;
  background: var(--white);
  transform-origin: bottom;
  animation: bar 900ms ease-in-out infinite alternate;
}

.bars i:nth-child(2) {
  animation-duration: 620ms;
}

.bars i:nth-child(3) {
  animation-duration: 760ms;
}

@keyframes bar {
  from { transform: scaleY(0.25); }
  to { transform: scaleY(1); }
}

.track.playing .rank-number {
  display: none;
}

.track.playing .bars {
  display: flex;
}

.track.paused .bars i {
  animation-play-state: paused;
}

.track .thumb {
  width: 48px;
  height: 48px;
}

.track-title {
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track.playing .track-title {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.track .icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Discography */
.disco {
  list-style: none;
  padding: 0 16px;
  margin: 0 -16px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: none;
}

.disco li {
  flex: 0 0 148px;
  scroll-snap-align: start;
}

.release {
  display: block;
  width: 100%;
}

.release .cover {
  width: 148px;
  height: 148px;
  margin-bottom: 8px;
}

.release-title {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* On tour */
.gig {
  display: flex;
  gap: 14px;
  align-items: center;
}

.gig-date {
  width: 56px;
  flex-shrink: 0;
  text-align: center;
  background: var(--raised);
  border-radius: 6px;
  padding: 6px 0;
}

.gig-month {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grey);
}

.gig-day {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}

.gig-title {
  display: block;
  font-weight: 600;
}

/* Playlist */
#playlist iframe {
  width: 100%;
  height: 352px;
  border: 0;
  border-radius: 12px;
}

/* About card */
.about-card {
  border-radius: 8px;
  overflow: hidden;
  background: var(--raised);
}

.about-card .photo {
  height: 300px;
  background-position: center 40%;
}

.about-text {
  padding: 16px;
}

.about-listeners {
  color: var(--grey);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.about-quote {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-top: 10px;
}

/* Numbers as rows: label left, number right */
.about-rows {
  list-style: none;
  padding: 0;
  margin-top: 16px;
  border-top: 1px solid #3a3a3a;
}

.about-rows li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #3a3a3a;
  font-size: 0.9375rem;
}

.about-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.about-heading {
  font-weight: 700;
  margin-top: 22px;
}

.about-heading + .about-rows {
  margin-top: 8px;
}

/* Now playing bar */
.mini {
  position: fixed;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(min(100vw, var(--page)) - 16px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #3a3a3a;
  overflow: hidden;
  z-index: 5;
}

.mini[hidden] {
  display: none;
}

.mini-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mini .thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
}

.mini-text {
  min-width: 0;
}

.mini-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-artist {
  display: block;
  font-size: 0.8125rem;
  color: var(--grey);
}

.mini-play {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
}

.mini-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
}

.mini-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--white);
}

/* Full-screen sheet: takes its colour from the cover photo (set from app.js as --sheet) */
.lyrics {
  width: 100%;
  max-width: var(--page);
  height: 100%;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: var(--sheet, #2a2a2a);
  color: var(--white);
  transition: background-color 500ms ease, opacity 200ms ease;
}

/* The sheet fades in while its cover grows out of the one that was tapped */
.lyrics[open] {
  animation: sheet-in 240ms ease-out;
}

.lyrics.closing {
  opacity: 0;
}

.lyrics::backdrop {
  background: #000;
}

@keyframes sheet-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lyrics-top {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--sheet, #2a2a2a);
  transition: background-color 500ms ease;
  z-index: 1;
}

.round-btn.dark {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
}

.lyrics-head {
  flex: 1;
  text-align: center;
  padding-right: 44px;
}

.lyrics-meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.lyrics-title {
  font-weight: 700;
}

/* The big cover. It starts on top of the small one and grows into place. */
.lyrics-art {
  width: 62%;
  aspect-ratio: 1;
  margin: 8px auto 22px;
  border-radius: 6px;
  transform-origin: top left;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.lyrics-art[hidden] {
  display: none;
}

.lyrics-body {
  padding: 8px 20px 64px;
}

.lyrics-body p {
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

/* Lines arrive one after another, just after the cover lands */
.lyrics-body > * {
  animation: line-in 420ms var(--ease-out) backwards;
  animation-delay: calc(var(--n, 0) * 35ms + 140ms);
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.lyrics-body .gap {
  height: 8px;
  margin: 0;
}

.lyrics-body .speaker {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0;
}

.lyrics-body video {
  display: block;
  width: 100%;
  max-height: 60vh;
  margin-bottom: 20px;
  border-radius: 8px;
  background: #000;
}

.lyrics-body .section-tag {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 4px;
}

/* Progress line under the sheet header, only for the birthday message */
.lyrics-progress {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.lyrics-progress span {
  display: block;
  height: 100%;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0ms linear;
}

.lyrics.synced .lyrics-progress {
  display: block;
}

/* Synced: waiting lines are soft and dim, the current line snaps sharp, read lines stay readable */
.lyrics.synced .lyrics-body {
  padding-bottom: 45vh;
}

.lyrics.synced .lyrics-body > * {
  animation: none;
}

.lyrics.synced .lyrics-body p {
  opacity: 0.3;
  filter: blur(1.6px);
  transform: scale(0.985);
  transform-origin: left center;
  transition: opacity 500ms ease, filter 500ms ease, transform 500ms var(--ease-out);
}

.lyrics.synced .lyrics-body p.sung {
  opacity: 0.55;
  filter: none;
}

.lyrics.synced .lyrics-body p.now,
.lyrics.synced.done .lyrics-body p {
  opacity: 1;
  filter: none;
  transform: scale(1);
}

.go-artist {
  display: block;
  margin: 28px auto 0;
  padding: 12px 26px;
  border-radius: 999px;
  background: var(--white);
  color: #000;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease, transform 160ms var(--ease-out);
}

.lyrics.done .go-artist {
  opacity: 1;
  pointer-events: auto;
}

.go-artist:active {
  transform: scale(0.97);
}

/* Release card: the first thing she sees */
.drop {
  width: 100%;
  max-width: var(--page);
  height: 100%;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: #000;
  color: var(--white);
  overflow: hidden;
}

.drop::backdrop {
  background: #000;
}

.drop .cover {
  position: absolute;
  inset: 0;
  background-position: center bottom;
}

/* Fade the photo to black where the title sits */
.drop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.05) 30%, rgba(0, 0, 0, 0.2) 55%, #000 92%);
  pointer-events: none;
}

.drop-skip {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 16px;
  z-index: 1;
}

.drop-bottom {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(36px + env(safe-area-inset-bottom));
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.drop-kicker {
  font-size: 0.9375rem;
  font-weight: 600;
}

.drop-name {
  font-size: 11rem;
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.06em;
  margin: 6px 0 14px -0.04em;
}

.drop .sub {
  color: #d0d0d0;
}

.drop .big-play {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  transition: transform 160ms var(--ease-out);
}

.drop .big-play svg {
  width: 32px;
  height: 32px;
}

/* One arrival sequence: photo, then the title, then the play button */
.drop[open] .cover {
  animation: arrive-photo 900ms ease both;
}

.drop[open] .drop-text {
  animation: arrive-up 600ms var(--ease-out) 250ms both;
}

.drop[open] .big-play {
  animation: arrive-up 600ms var(--ease-out) 450ms both;
}

@keyframes arrive-photo {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes arrive-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .lyrics-body > *,
  .bars i,
  .lyrics[open],
  .drop[open] .cover,
  .drop[open] .drop-text,
  .drop[open] .big-play {
    animation: none;
  }

  .lyrics.synced .lyrics-body p {
    filter: none;
    transform: none;
  }
}
