@font-face {
  font-family: "Great Vibes";
  src: url("../fonts/GreatVibes-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --pink: #ff5fa2;
  --pink-deep: #e0286f;
  --text-size: clamp(44px, 14vw, 110px);
  --vh: 1vh;
}

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

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: calc(var(--vh) * 100);
  height: 100dvh;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- stage: photos / clips ---------- */
#stage {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  transform-origin: 50% 40%;
}
.layer.on { opacity: 1; }
.layer.on.kb { animation: kenburns var(--dur, 3s) linear forwards; }

@keyframes kenburns {
  from { transform: scale(1); }
  to   { transform: scale(var(--zoom, 1.08)); }
}

/* ---------- lyric caption ---------- */
#caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10vh);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.22em;
  padding: 0 16px;
  font-family: "Great Vibes", "Snell Roundhand", "Apple Chancery", cursive;
  font-size: var(--text-size);
  line-height: 1.1;
  color: #fff;
  text-align: center;
  text-shadow:
    3px 3px 6px rgba(0, 0, 0, 0.75),
    0 0 14px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
#caption.on { opacity: 1; }
#caption .emo {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 0.72em;
  line-height: 1;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
}
#caption .emo:empty { display: none; }
#caption.long { font-size: calc(var(--text-size) * 0.8); }
#caption.xlong { font-size: calc(var(--text-size) * 0.64); }

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 24px)
    24px
    calc(env(safe-area-inset-bottom, 0px) + 24px);
  background:
    radial-gradient(120% 90% at 50% 0%, #ff8fc2 0%, #ff4f98 45%, #b8155a 100%);
  transition: opacity 0.6s ease;
  z-index: 10;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18) 0 6px, transparent 7px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.14) 0 4px, transparent 5px),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,0.16) 0 5px, transparent 6px),
    radial-gradient(circle at 30% 85%, rgba(255,255,255,0.12) 0 3px, transparent 4px);
  pointer-events: none;
}

.card {
  position: relative;
  width: min(100%, 420px);
  text-align: center;
}
.card .big {
  font-size: clamp(64px, 22vw, 120px);
  line-height: 1;
  margin-bottom: 18px;
  animation: beat 1.4s ease-in-out infinite;
  display: inline-block;
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.14); }
  55%      { transform: scale(1); }
}
.card h1 {
  font-family: "Great Vibes", cursive;
  font-weight: 400;
  font-size: clamp(48px, 15vw, 88px);
  line-height: 1.1;
  margin-bottom: 10px;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}
.card p {
  font-size: clamp(16px, 4.6vw, 20px);
  line-height: 1.5;
  opacity: 0.95;
  margin: 0 0 8px;
}
.card .hint { font-size: 15px; opacity: 0.8; margin-top: 4px; }
.card .msg {
  font-family: "Great Vibes", cursive;
  font-size: clamp(30px, 9vw, 48px);
  line-height: 1.25;
  margin: 10px 0 18px;
  white-space: normal;
}

.btn {
  appearance: none;
  border: 0;
  margin-top: 22px;
  padding: 16px 38px;
  min-height: 56px;
  border-radius: 999px;
  background: #fff;
  color: var(--pink-deep);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.96); }
.btn[disabled] { opacity: 0.55; }
.status { font-size: 14px; opacity: 0.85; margin-top: 14px; min-height: 1.4em; }

/* progress bar (thin, top) */
#bar {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  height: 3px;
  width: 0;
  background: rgba(255,255,255,0.85);
  z-index: 5;
  pointer-events: none;
  transition: width 0.1s linear;
}

/* landscape phones: keep caption above the bottom bar */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --text-size: clamp(36px, 9vh, 72px); }
  #caption { bottom: calc(env(safe-area-inset-bottom, 0px) + 6vh); }
}
