/*
  lyrics.css
  The full-screen lyric video in lyrics.html.
  Order: background · top bar · lyric lines · player · lyrics sheet · start screen · sync panel
*/

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
}

.hide-on-phone {
  display: inline-block;
}

/* ===================== Background ===================== */

.backdrop > * {
  position: fixed;
  pointer-events: none;
}

.backdrop__photo {
  inset: -6%;
  width: 112%;
  max-width: none;
  height: 112%;
  object-fit: cover;
  object-position: center 42%;
  filter: brightness(0.46) saturate(1.1);   /* set once, never animated */
  transform: scale(1.04);
  will-change: transform;
}

/* The circle of bars that reacts to the music */
.backdrop__rings {
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
}

/* Black layer that gets lighter on the beat */
.backdrop__dim {
  inset: 0;
  background: var(--bg-deep);
  opacity: 0.3;
  will-change: opacity;
}

/* Red glow that gets stronger on the beat */
.backdrop__glow {
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 52%, rgba(255, 31, 61, 0.4), rgba(255, 31, 61, 0) 70%);
  opacity: 0.12;
  will-change: opacity;
}

.backdrop__shade {
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 3, 4, 0.75) 0%, rgba(5, 3, 4, 0) 22%, rgba(5, 3, 4, 0) 70%, rgba(5, 3, 4, 0.92) 100%);
}

/* Quick white flash on big beats (body gets .is-hit for a moment) */
.backdrop__flash {
  inset: 0;
  background: #fff;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.is-hit .backdrop__flash {
  opacity: 0.07;
  transition: none;
}

/* ===================== Top bar ===================== */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 5% 14px;
}

.top-bar__back {
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.top-bar__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===================== Lyric lines ===================== */

.video {
  position: fixed;
  inset: 0;
  z-index: 3;
  cursor: pointer;
}

/*
  Two .line boxes take turns: the old line zooms out while the new one
  zooms in. Font size is set by lyrics.js so each line fills the screen.
*/
.line {
  position: absolute;
  left: 0;
  right: 0;
  top: 12%;
  bottom: 22%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 0 0.26em;
  padding: 0 6vw;
  text-align: center;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.86) translateY(5%);
  transition: opacity 0.5s ease, transform 0.7s var(--ease-out);
  will-change: transform, opacity;
}

.line.is-in {
  opacity: 1;
  transform: none;
}

.line.is-out {
  opacity: 0;
  transform: scale(1.25) translateY(-6%);
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.4, 0, 0.6, 1);
}

/* One word. Starts faint, lights up when it's sung. */
.word {
  display: inline-block;
  color: var(--ink);
  opacity: 0.2;
  transform: translateY(0.28em) scale(0.96);
  transition: opacity 0.22s ease, transform 0.5s cubic-bezier(0.2, 1.5, 0.35, 1), color 0.2s;
}

.word.is-sung {
  opacity: 1;
  transform: none;
}

.word.is-current {
  color: #ffe9ec;
  text-shadow: 0 0 22px rgba(255, 59, 78, 0.6);
}

/* Big words (scare, pretend, dead, bed) in red italic with a slam */
.word--key {
  padding: 0 0.04em;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 1.32em;
  letter-spacing: 0;
  line-height: 0.85;
  color: var(--red-light);
}

.word--key.is-sung {
  animation: slam 0.75s cubic-bezier(0.2, 1.4, 0.35, 1) both;
  text-shadow: 0 0 30px rgba(255, 31, 61, 0.8);
}

@keyframes slam {
  0% { opacity: 0; transform: scale(2.1) rotate(-6deg); }
  45% { opacity: 1; transform: scale(0.92) rotate(1.5deg); }
  70% { transform: scale(1.05) rotate(-0.5deg); }
  100% { transform: none; }
}

.up-next {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 4;
  margin: 0;
  padding: 0 8%;
  text-align: center;
  font-size: 14px;
  color: rgba(245, 237, 238, 0.42);
  pointer-events: none;
}

.up-next b {
  font-weight: 700;
  color: rgba(245, 237, 238, 0.6);
}

.paused-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s, transform 0.35s;
  pointer-events: none;
}

.is-paused .paused-icon {
  opacity: 1;
  transform: none;
}

/* ===================== Player ===================== */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 0 5% calc(16px + env(safe-area-inset-bottom));
}

.progress {
  position: relative;
  display: flex;
  align-items: center;
  height: 18px;
  cursor: pointer;
  touch-action: none;
}

.progress i,
.progress b {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px;
}

.progress i {
  background: rgba(255, 255, 255, 0.16);
}

/* Filled part, grown with scaleX so it never triggers layout */
.progress b {
  background: var(--red);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.player__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.player__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.play-btn {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}

.play-btn .icon-pause,
.is-playing .play-btn .icon-play {
  display: none;
}

.is-playing .play-btn .icon-pause {
  display: block;
}

.player__title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player__title .serif {
  white-space: nowrap;
  font-size: 20px;
  line-height: 1.1;
}

.player__title small {
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.player__right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.volume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.volume__btn {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.volume__btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.volume__btn .icon-muted,
.volume.is-muted .icon-sound {
  display: none;
}

.volume.is-muted .icon-muted {
  display: block;
}

/* --level is set by lyrics.js so the filled part of the track matches */
.volume__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 4px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--ink) var(--level, 80%), rgba(255, 255, 255, 0.2) var(--level, 80%));
}

.volume__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.volume__slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.volume__slider:focus-visible {
  outline: 2px solid var(--red-light);
  outline-offset: 4px;
}

.volume.is-muted .volume__slider {
  opacity: 0.35;
}

/* ===================== Full lyrics sheet ===================== */

.lyrics-sheet {
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow-y: auto;
  padding: calc(84px + env(safe-area-inset-top)) 6% 140px;
  background: rgba(5, 3, 4, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}

.lyrics-sheet.is-open {
  opacity: 1;
  visibility: visible;
}

.lyrics-sheet__inner {
  max-width: 620px;
  margin: 0 auto;
}

.lyrics-sheet h2 {
  margin: 0 0 4px;
  font-size: clamp(42px, 8vw, 68px);
  line-height: 1;
}

.lyrics-sheet__inner > p {
  margin: 0 0 26px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.45;
  color: #ede3e5;
}

.lyrics-sheet__inner > .lyrics-sheet__by {
  margin-bottom: 30px;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 14px;
  color: var(--muted);
}

.lyrics-sheet__listen {
  margin: 36px 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.lyrics-sheet .apps {
  margin-bottom: 40px;
}

.lyrics-sheet__close {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 5%;
  z-index: 16;
}

/* ===================== Start screen ===================== */

.start {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: rgba(5, 3, 4, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.8s ease, visibility 0.8s, transform 0.8s;
}

.start.is-gone {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.08);
}

.start__title {
  margin: 0;
  font-size: clamp(64px, 15vw, 170px);
  line-height: 0.85;
}

.start p {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.start small {
  font-size: 12px;
  color: #8f8286;
}

.start__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 118px;
  height: 118px;
  margin-top: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  cursor: pointer;
  box-shadow: 0 0 60px rgba(255, 31, 61, 0.5);
}

/* Two rings that ripple out from the play button */
.start__btn::before,
.start__btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 59, 78, 0.75);
  border-radius: 50%;
  animation: ripple 2.2s ease-out infinite;
}

.start__btn::after {
  animation-delay: 1.1s;
}

@keyframes ripple {
  from { opacity: 0.9; transform: scale(1); }
  to { opacity: 0; transform: scale(1.9); }
}

/* ===================== Sync panel (?sync=1) ===================== */

.sync-panel {
  position: fixed;
  top: 70px;
  right: 12px;
  z-index: 30;
  width: min(340px, 92vw);
  padding: 14px;
  border: 1px solid var(--red-light);
  border-radius: 14px;
  background: #140c10;
  font-size: 12px;
}

.sync-panel button {
  margin: 6px 6px 0 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.sync-panel textarea {
  width: 100%;
  height: 120px;
  margin-top: 8px;
  border: 1px solid #333;
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--ink);
  font: 12px monospace;
}

/* ===================== Phones ===================== */

@media (max-width: 700px) {
  .hide-on-phone {
    display: none;
  }

  .top-bar__back {
    font-size: 12px;
  }

  .top-bar .pill {
    padding: 8px 12px;
  }

  .line {
    top: 13%;
    bottom: 24%;
    padding: 0 5vw;
  }

  .player__title .serif {
    font-size: 17px;
  }

  .volume {
    gap: 6px;
    padding: 4px 10px 4px 4px;
  }

  .volume__slider {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .start__btn::before,
  .start__btn::after,
  .word--key.is-sung {
    animation: none;
  }

  .line,
  .word {
    transition: opacity 0.3s;
  }
}

.lyrics-sheet__inner > .lyrics-sheet__more {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 14px;
  color: var(--muted);
}

.lyrics-sheet__more a {
  color: var(--ink-soft);
}
