*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #08101e;
  font-family: 'Instrument Sans', sans-serif;
}

/* ── Canvas — full screen ────────────────────────────────── */
#canvas {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

/* ── Lyrics — left half only ─────────────────────────────── */
#lyrics {
  position: fixed;
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  padding: 0 5vw;
}

#lyric-line {
  display: block;
  text-align: center;
  font-family: 'Instrument Sans', sans-serif;
  /* font-size set per-line by JS */
  font-weight: 600;
  font-style: italic;
  text-transform: lowercase;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #F0784A;
  opacity: 0;
  transition: opacity 0.42s ease, font-size 0.3s ease;
  text-shadow:
    0 0 40px rgba(220, 80, 20, 0.9),
    0 0 80px rgba(180, 50, 10, 0.45),
    0 2px 16px rgba(0, 0, 0, 0.96);
}

#lyric-line.chorus {
  color: #F5905A;
}

#lyric-line.small {
  font-weight: 400;
  color: #C86040;
}

#lyric-line.visible { opacity: 1; }

/* ── Tap sync overlay ───────────────────────────────────────── */
#sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(4, 7, 16, 0.90);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font-family: 'Instrument Sans', sans-serif;
}
#sync-overlay.hidden { display: none; }
#sync-hint {
  font-size: 0.62rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: rgba(240,120,74,0.45);
}
#sync-progress {
  font-family: 'SF Mono', monospace;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.2em;
}
#sync-line {
  font-size: clamp(2rem, 5.5vw, 5rem);
  font-weight: 600;
  font-style: italic;
  color: #F0784A;
  text-shadow: 0 0 40px rgba(220,80,20,0.65);
  transition: color 0.1s;
  text-align: center;
  padding: 0 8vw;
}
#sync-next {
  font-size: clamp(0.9rem, 1.8vw, 1.4rem);
  font-style: italic;
  color: rgba(240,120,74,0.28);
  text-align: center;
}

/* ── Offset HUD ─────────────────────────────────────────────── */
#offset-hud {
  position: fixed;
  top: 18px; right: 20px;
  z-index: 20;
  font-family: 'SF Mono', monospace;
  font-size: 0.68rem;
  color: rgba(240,120,74,0.85);
  background: rgba(4,7,16,0.72);
  padding: 4px 10px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#offset-hud.visible { opacity: 1; }

/* ── Intro ──────────────────────────────────────────────── */
#intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.85);
  backdrop-filter: blur(10px);
  transition: opacity 1.1s ease, visibility 1.1s ease;
}
#intro.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

#intro-inner {
  text-align: center;
  animation: rise 1.6s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

#intro-cover {
  width: clamp(140px, 20vw, 200px);
  height: clamp(140px, 20vw, 200px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(240, 120, 74, 0.28);
  box-shadow:
    0 0 50px rgba(220, 80, 20, 0.38),
    0 0 110px rgba(180, 50, 10, 0.18),
    0 0 0 8px rgba(240, 120, 74, 0.05);
  margin-bottom: 30px;
  animation: spin-intro 22s linear infinite;
}
@keyframes spin-intro {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#intro-title {
  font-size: clamp(3.5rem, 11vw, 9rem);
  font-weight: 700;
  font-style: italic;
  text-transform: lowercase;
  line-height: 0.92;
  color: #F0784A;
  text-shadow: 0 0 80px rgba(220,80,20,0.7), 0 4px 24px rgba(0,0,0,0.9);
  margin-bottom: 12px;
}

#intro-sub {
  font-style: italic;
  font-weight: 400;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: #C89060;
  margin-bottom: 52px;
  opacity: 0.75;
}

#big-play {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 1.5px solid rgba(240,120,74,0.4);
  background: rgba(240,120,74,0.12);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  color: #F0784A;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
#big-play svg { width: 26px; height: 26px; transform: translateX(2px); }
#big-play:hover { background: rgba(240,120,74,0.28); border-color: rgba(240,120,74,0.7); transform: scale(1.06); }
#big-play:active { transform: scale(0.96); }

/* ── Player — floating centered pill ────────────────────── */
#player {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(18px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px 14px 14px;
  background: rgba(5, 9, 20, 0.88);
  backdrop-filter: blur(28px);
  border: 1px solid rgba(240, 120, 74, 0.10);
  border-radius: 50px;
  width: min(680px, 92vw);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(240, 120, 74, 0.03);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
#player.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#player.fade    { opacity: 0; transform: translateX(-50%) translateY(18px); }

/* Vinyl disc wrapper */
#vinyl-wrap {
  flex-shrink: 0;
  position: relative;
  width: 76px;
  height: 76px;
}
#player-cover {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(240, 120, 74, 0.20);
  box-shadow:
    0 0 20px rgba(220, 80, 20, 0.12),
    inset 0 0 0 1px rgba(255,255,255,0.04);
  animation: spin-cover 10s linear infinite;
  animation-play-state: paused;
  display: block;
}
#player-cover.playing { animation-play-state: running; }
@keyframes spin-cover {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
#vinyl-hole {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #070c1a;
  border: 1.5px solid rgba(240, 120, 74, 0.35);
  pointer-events: none;
}

/* Center: title + waveform */
#player-mid {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#player-title {
  font-size: 0.70rem;
  font-style: italic;
  color: rgba(240, 120, 74, 0.58);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#prog-track {
  position: relative;
  height: 44px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}
#wave-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Right controls */
#player-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Time + mini equalizer stacked */
#time-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
#time-vis {
  display: block;
  width: 48px;
  height: 18px;
}
#time {
  font-family: 'SF Mono', monospace;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.32);
  text-align: center;
  white-space: nowrap;
}
#play-btn {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(240, 120, 74, 0.36);
  background: rgba(240, 120, 74, 0.10);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #F0784A;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}
#play-btn:hover  {
  background: rgba(240, 120, 74, 0.26);
  box-shadow: 0 0 14px rgba(240,120,74,0.28);
  transform: scale(1.06);
}
#play-btn:active { transform: scale(0.93); }
#play-btn svg { width: 14px; height: 14px; }
#icon-play { transform: translateX(1.5px); }

#export-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: none; background: none; cursor: pointer;
  color: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
#export-btn:hover { color: rgba(255, 255, 255, 0.55); }
#export-btn svg { width: 11px; height: 11px; }
#export-btn.recording { color: #E84040; }
#export-btn.recording svg { animation: pulse-rec 1s ease-in-out infinite; }
@keyframes pulse-rec { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

#fs-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: none; background: none; cursor: pointer;
  color: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
#fs-btn:hover { color: rgba(255, 255, 255, 0.6); }
#fs-btn svg { width: 13px; height: 13px; }

/* ── Footer note ────────────────────────────────────────────── */
#footer-note {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  font-style: italic;
  color: rgba(255, 255, 255, 0.70);
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.80);
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* Lyrics: full width, clear space for bottom player */
  #lyrics {
    width: 100%;
    padding: 0 7vw 115px;
  }

  #lyric-line {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Sync overlay text */
  #sync-line {
    padding: 0 5vw;
  }

  /* Intro cover — smaller */
  #intro-cover {
    width: clamp(110px, 30vw, 150px);
    height: clamp(110px, 30vw, 150px);
    margin-bottom: 20px;
  }

  /* Intro title already uses clamp, just tighten bottom margin */
  #intro-sub { margin-bottom: 36px; }

  /* Player pill — compact */
  #player {
    bottom: 34px;
    width: 94vw;
    padding: 9px 13px 9px 9px;
    gap: 10px;
  }

  /* Smaller vinyl */
  #vinyl-wrap,
  #player-cover {
    width: 54px;
    height: 54px;
  }
  #vinyl-hole {
    width: 10px;
    height: 10px;
  }

  /* Shorter waveform track */
  #prog-track { height: 34px; }

  #player-title { font-size: 0.65rem; }

  /* Tighter right-side controls */
  #player-controls { gap: 7px; }
  #time-wrap { gap: 2px; }
  #time-vis  { width: 34px; height: 13px; }
  #time      { font-size: 0.57rem; }

  #play-btn            { width: 34px; height: 34px; }
  #play-btn svg        { width: 12px; height: 12px; }

  #export-btn,
  #fs-btn              { width: 22px; height: 22px; }
  #export-btn svg      { width: 10px; height: 10px; }
  #fs-btn svg          { width: 11px; height: 11px; }
}
