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

:root {
  --pink: #f8b4c0;
  --deep-pink: #e8768a;
  --cream: #fdf8f0;
  --lavender: #d8b4fe;
  --rose-gold: #c9a27e;
  --text-dark: #6b3050;
  --text-mid: #a05070;
}

body {
  font-family: 'Lato', sans-serif;
  background: var(--cream);
  overflow-x: hidden;
}

/* ── Sections ── */
.section {
  display: none;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.section.active { display: flex; }

/* ── Progress dots ── */
.progress {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 200;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(200, 100, 130, 0.25);
  transition: all 0.3s ease;
}
.dot.active {
  background: var(--deep-pink);
  transform: scale(1.3);
}

/* ── Typography ── */
h1 {
  font-family: 'Playfair Display', serif;
  color: var(--text-dark);
  font-size: 2.4rem;
  text-align: center;
  margin-bottom: 0.6rem;
}
.subtitle {
  color: var(--text-mid);
  font-size: 1.05rem;
  text-align: center;
}

/* ── Floating hearts ── */
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.heart-float {
  position: absolute;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0%   { transform: translateY(105vh) rotate(0deg);   opacity: 0.5; }
  100% { transform: translateY(-10vh)  rotate(360deg); opacity: 0;   }
}

/* ── Falling petals ── */
.petal {
  position: absolute;
  pointer-events: none;
  animation: fall linear infinite;
}
@keyframes fall {
  0%   { transform: translateY(-5vh)  rotate(0deg);   opacity: 0.8; }
  100% { transform: translateY(108vh) rotate(720deg); opacity: 0;   }
}

/* ──────────────────────────────
   SECTION 1 — Landing
────────────────────────────── */
#section-1 { background: linear-gradient(135deg, #fce4ec 0%, #f8b4c0 50%, #e8d5f5 100%); }

.main-heart {
  font-size: 8rem;
  cursor: pointer;
  margin: 1.5rem 0;
  display: inline-block;
  animation: pulse 1.6s ease-in-out infinite;
  user-select: none;
  transition: filter 0.2s;
}
.main-heart:hover { filter: brightness(1.15); }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.09); }
}
.main-heart.clicked {
  animation: heartBurst 0.6s ease forwards;
}
@keyframes heartBurst {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.6); opacity: 1; filter: brightness(1.8); }
  100% { transform: scale(0);   opacity: 0; }
}

/* ──────────────────────────────
   SECTION 2 — Puzzle
────────────────────────────── */
#section-2 { background: linear-gradient(135deg, #fdf8f0, #f3e8ff, #fce4ec); }

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 2rem 0 1rem;
}

.flower-bud {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a27e, #e8b89a);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 2.4rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: transform 0.2s;
  position: relative;
}
.flower-bud:hover { transform: scale(1.06); }

.bud-icon   { font-size: 2rem; }
.bloom-icon { display: none; font-size: 2.4rem; }

.flower-bud.bloomed {
  background: linear-gradient(135deg, #f8b4c0, #d8b4fe);
  animation: bloom 0.5s ease;
  cursor: default;
}
.flower-bud.bloomed .bud-icon   { display: none; }
.flower-bud.bloomed .bloom-icon { display: block; }

@keyframes bloom {
  0%   { transform: scale(0.75) rotate(-15deg); }
  60%  { transform: scale(1.2)  rotate(8deg);  }
  100% { transform: scale(1)    rotate(0deg);  }
}

/* ──────────────────────────────
   SECTION 3 — Hidden message
────────────────────────────── */
#section-3 { background: linear-gradient(135deg, #e8d5f5, #fce4ec, #fdf8f0); }

.envelope {
  font-size: 8rem;
  cursor: pointer;
  display: inline-block;
  margin: 1.5rem 0;
  animation: wiggle 2.2s ease-in-out infinite;
  user-select: none;
  transition: filter 0.2s;
}
.envelope:hover { filter: brightness(1.15); }
@keyframes wiggle {
  0%, 100% { transform: rotate(-6deg); }
  50%       { transform: rotate(6deg);  }
}
.envelope.opened {
  animation: openEnv 0.7s ease forwards;
}
@keyframes openEnv {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.35) rotate(12deg); }
  100% { transform: scale(0.7); opacity: 0; }
}

.hidden-message { display: none; text-align: center; }
.hidden-message.revealed {
  display: block;
  animation: fadeInUp 0.8s ease forwards;
}

.reveal-quote {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.9rem;
  color: var(--text-dark);
  margin: 1.5rem 0 1rem;
  line-height: 1.4;
}
.reveal-sub {
  color: var(--text-mid);
  font-size: 1rem;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ──────────────────────────────
   SECTION 4 — Final letter
────────────────────────────── */
#section-4 { background: linear-gradient(135deg, #fce4ec, #f3e8ff, #fdf8f0); }

.letter-card {
  background: #fff;
  border-radius: 22px;
  padding: 3rem 2.5rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 12px 48px rgba(200, 90, 130, 0.18);
  border: 1px solid var(--pink);
  position: relative;
  animation: letterReveal 0.9s ease forwards;
}
@keyframes letterReveal {
  from { opacity: 0; transform: scale(0.92) translateY(24px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.letter-stamp {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3.2rem;
}

.letter-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #5a3a4a;
}
.letter-body p { margin-bottom: 1rem; }

.signature {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--deep-pink);
  font-size: 1.3rem;
  margin-top: 1.6rem;
}

/* ──────────────────────────────
   Shared: Buttons & utilities
────────────────────────────── */
.btn {
  background: linear-gradient(135deg, var(--deep-pink), var(--rose-gold));
  color: #fff;
  border: none;
  padding: 14px 34px;
  border-radius: 50px;
  font-size: 1rem;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(232, 118, 138, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(232, 118, 138, 0.45);
}
.btn.hidden { display: none; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem;   }
.mt-3 { margin-top: 1.5rem; }

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

/* ── Confetti ── */
.confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-5vh)  rotate(0deg);   opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  h1 { font-size: 1.7rem; }
  .main-heart, .envelope { font-size: 5.5rem; }
  .flower-bud { width: 76px; height: 76px; font-size: 2rem; }
  .puzzle-grid { gap: 12px; }
  .letter-card { padding: 2.2rem 1.4rem; }
  .reveal-quote { font-size: 1.5rem; }
}
