:root {
  --bg: #1f1420;
  --bg2: #2b1826;
  --card: #34182c;
  --border: #55293f;
  --text: #fff0f5;
  --muted: #dba9c0;
  --accent: #ff6fa5;
  --accent2: #ffb6c1;
  --accent3: #d8b384;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(40vmax 40vmax at 15% 10%, rgba(255, 111, 165, 0.35), transparent 60%),
    radial-gradient(45vmax 45vmax at 85% 20%, rgba(216, 179, 132, 0.22), transparent 60%),
    radial-gradient(50vmax 50vmax at 50% 100%, rgba(255, 182, 193, 0.25), transparent 60%);
  pointer-events: none;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top) + 1rem) max(1.25rem, env(safe-area-inset-right))
    max(4rem, env(safe-area-inset-bottom) + 2rem) max(1.25rem, env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.step {
  display: none;
  animation: fadeUp 0.35s ease;
}
.step.is-active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent3);
  font-size: 0.85rem;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.hero {
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  font-weight: 900;
}

.highlight {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  font-size: 1.5rem;
  margin: 0 0 0.35rem;
}

.sub {
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.alert-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin: 1rem 0 1.5rem;
  line-height: 1.5;
}
.alert-title {
  color: var(--accent2);
  font-weight: 800;
  margin: 0 0 0.4rem;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}
.countdown-unit {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.3rem;
  text-align: center;
}
.countdown-unit strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.countdown-unit small {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}
.countdown-footer {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #2b0e1a;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-big {
  width: 100%;
  padding: 1.1rem;
  font-size: 1.1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  margin: 0.5rem 0;
}

.pick-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1rem 0.5rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.pick-card:active { transform: scale(0.97); }
.pick-card.selected {
  border-color: var(--accent);
  background: linear-gradient(160deg, rgba(255,111,165,0.18), rgba(216,179,132,0.12));
}
.fav-img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
}

.other-input, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-size: 1rem;
  margin-top: 0.5rem;
  font-family: inherit;
  resize: vertical;
}
.other-input:focus, textarea:focus { outline: 2px solid var(--accent); }

.hidden { display: none !important; }

.nav-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.nav-row .btn-ghost { flex: 0 0 auto; }
.nav-row .btn-primary { flex: 1; }

.error {
  color: var(--accent2);
  font-weight: 700;
  margin-top: 0.75rem;
  text-align: center;
}

/* GATE */
#gate-form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.gate-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0.6rem 0 0;
}
.gate-label:first-child { margin-top: 0; }
#gate-form .other-input { text-align: center; font-weight: 700; font-size: 1rem; margin-bottom: 0.2rem; }
#gate-submit { margin-top: 0.75rem; }
#gate-continue { margin-top: 1.25rem; }

.gate-anim {
  position: relative;
  height: clamp(140px, 38vw, 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0 0.5rem;
  overflow: hidden;
}

.gate-cow {
  position: absolute;
  font-size: clamp(3.25rem, 16vw, 5.5rem);
  line-height: 1;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
  transform: scale(0);
  will-change: transform;
}
.gate-anim.celebrating .gate-cow {
  animation: cowPopIn 0.9s cubic-bezier(.22, .9, .32, 1.2) forwards;
}
@keyframes cowPopIn {
  0%   { transform: scale(0) rotate(-8deg); }
  60%  { transform: scale(1.15) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.gate-heart {
  position: absolute;
  font-size: clamp(1.3rem, 6vw, 2rem);
  opacity: 0;
  will-change: transform, opacity;
}
.gate-heart-1 { left: 20%; top: 60%; }
.gate-heart-2 { left: 75%; top: 55%; }
.gate-heart-3 { left: 50%; top: 70%; }
.gate-anim.celebrating .gate-heart-1 { animation: heartPop 0.9s ease-out 0.15s forwards; }
.gate-anim.celebrating .gate-heart-2 { animation: heartPop 0.9s ease-out 0.3s forwards; }
.gate-anim.celebrating .gate-heart-3 { animation: heartPop 0.9s ease-out 0.45s forwards; }
@keyframes heartPop {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  40%  { opacity: 1; transform: translateY(-20px) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.9); }
}

.impact-flash {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 182, 193, 0.95), rgba(255, 111, 165, 0.55) 45%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.gate-anim.impact .impact-flash {
  animation: flashPop 0.5s ease-out forwards;
}
@keyframes flashPop {
  0% { opacity: 0; transform: scale(0.2); }
  30% { opacity: 1; transform: scale(4); }
  100% { opacity: 0; transform: scale(6); }
}

.wrap.shake { animation: screenShake 0.35s ease; }
@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* QUIZ */
.quiz-q {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.quiz-answers {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.quiz-btn {
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.quiz-btn:active { transform: scale(0.96); }
.quiz-answers-even { gap: 1rem; }
.quiz-btn-even { font-size: 1rem; padding: 0.8rem 1.4rem; flex: 1; }
.quiz-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #2b0e1a;
  opacity: 1;
}
.quiz-reaction {
  margin: 0.6rem 0 0;
  color: var(--accent3);
  font-weight: 700;
  font-size: 0.9rem;
}

/* QUIZ 4 — dodge game */
.dodge-wrap {
  position: relative;
  height: 170px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.dodge-btn {
  position: absolute;
  left: 8px;
  top: 8px;
  transition: left 0.22s cubic-bezier(.34, 1.4, .64, 1), top 0.22s cubic-bezier(.34, 1.4, .64, 1);
  min-width: 88px;
}
.dodge-tara {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  min-width: 96px;
  border-color: var(--accent);
}

/* PHOTOS (reveal-a-thought) */
.photo-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0.5rem 0;
}
.photo-tile {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.photo-tile:active { transform: scale(0.98); }
.photo-tile.revealed { border-color: var(--accent); }
.photo-img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
}
.photo-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}
.photo-caption {
  margin: 0.5rem 0 0;
  padding: 0 0.2rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

/* FAVORITE PHOTO GAME */
.fav-message {
  text-align: center;
  font-weight: 700;
  margin: 1rem 0 0;
  color: var(--muted);
}
.fav-message.fav-win {
  color: var(--accent);
  font-size: 1.1rem;
}

/* SONGS */
.song-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.song-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
}
.song-title { font-weight: 700; }
.song-artist { color: var(--muted); font-size: 0.85rem; }
.song-card-teaser {
  border-style: dashed;
  opacity: 0.75;
}

/* DONE */
.letter-card p {
  margin: 0 0 0.9rem;
}
.letter-card p:last-child {
  margin: 0;
  font-weight: 800;
  color: var(--accent2);
}

.done-hearts {
  position: relative;
  height: 50px;
  margin: -0.25rem 0 0.5rem;
  overflow: visible;
  pointer-events: none;
}
.done-hearts span {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1.5rem;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}
.done-hearts.bursting span { animation: heartBurst 1.5s ease-out forwards; }
.done-hearts.bursting span:nth-child(1) { animation-delay: 0s; --dx: -75px; }
.done-hearts.bursting span:nth-child(2) { animation-delay: 0.08s; --dx: -45px; }
.done-hearts.bursting span:nth-child(3) { animation-delay: 0.16s; --dx: -15px; }
.done-hearts.bursting span:nth-child(4) { animation-delay: 0.24s; --dx: 15px; }
.done-hearts.bursting span:nth-child(5) { animation-delay: 0.32s; --dx: 45px; }
.done-hearts.bursting span:nth-child(6) { animation-delay: 0.4s; --dx: 75px; }
@keyframes heartBurst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  20%  { opacity: 1; transform: translate(calc(-50% + var(--dx, 0px)), -80%) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px) * 1.4), -260%) scale(0.9); }
}
