:root {
  --bg: #fff8f6;
  --bg-tint: #fdeef0;
  --card: #ffffff;
  --ink: #4a2c33;
  --muted: #8a6870;
  --rose: #e2728a;
  --rose-deep: #c94f6d;
  --blush: #f7d6dc;
  --gold: #d9a85b;
  --shadow: 0 10px 30px rgba(201, 79, 109, 0.15);
  --radius: 20px;
  --script: "Dancing Script", cursive;
  --sans: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.script { font-family: var(--script); font-weight: 700; color: var(--rose-deep); line-height: 1.15; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--muted); margin: 0 0 .5rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34rem; margin: 1rem auto 1.5rem; }

.btn {
  font: inherit; font-weight: 700;
  border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: #fff;
  padding: .85rem 1.6rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 48px;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.97); }
.btn-ghost { background: #fff; color: var(--rose-deep); border: 2px solid var(--blush); }

/* ---------- Floating hearts & confetti ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
#hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.heart {
  position: absolute; bottom: -40px;
  font-size: 20px; opacity: .5;
  animation: floatUp linear forwards;
}
@keyframes floatUp {
  to { transform: translateY(-115vh) rotate(25deg); opacity: 0; }
}

/* ---------- Gate ---------- */
.gate {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 30% 20%, #ffe3e8, var(--bg) 60%);
  position: relative; z-index: 2;
}
.gate-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.25rem 1.5rem;
  max-width: 420px; width: 100%;
  text-align: center;
}
.gate-card h1 { font-size: 2.2rem; margin: .25rem 0 1.25rem; }
.lock { font-size: 2.5rem; }
#gate-form { display: flex; flex-direction: column; gap: .75rem; }
#gate-input {
  font: inherit; padding: .85rem 1rem;
  border: 2px solid var(--blush); border-radius: 14px;
  outline: none; text-align: center; min-height: 48px;
}
#gate-input:focus { border-color: var(--rose); }
select#gate-input {
  appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'><path d='M1 1l6 7 6-7' fill='none' stroke='%23c94f6d' stroke-width='2'/></svg>") no-repeat right 1rem center;
  padding-right: 2.5rem; color: var(--ink); cursor: pointer; width: 100%;
}
.hint { min-height: 1.5em; color: var(--rose-deep); margin: 1rem 0 0; }
.shake { animation: shake .4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.gate.leaving { animation: fadeOut .7s forwards; }
@keyframes fadeOut { to { opacity: 0; transform: scale(1.05); } }

/* ---------- Layout ---------- */
main { position: relative; z-index: 1; }
.section { padding: 4.5rem 16px; text-align: center; }
.section > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.section-tint { background: var(--bg-tint); }
.section h2 { font-size: clamp(2.2rem, 7vw, 3.2rem); margin: 0 0 .25rem; }
.section-sub { color: var(--muted); margin: 0 auto 2.25rem; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px;
  background: radial-gradient(circle at 50% 30%, #ffe3e8, var(--bg) 65%);
  position: relative;
}
.hero-title { font-size: clamp(3rem, 13vw, 6rem); margin: .25rem 0; }
.hero-title span { color: var(--rose); }
.scroll-cue {
  position: absolute; bottom: 24px;
  font-size: 2rem; color: var(--rose); text-decoration: none;
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); } }

.music-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: #fff; box-shadow: var(--shadow);
  font-size: 1.4rem; cursor: pointer;
}
.music-btn.playing { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0 auto; position: relative; text-align: left; }
.timeline::before {
  content: ""; position: absolute; left: 14px; top: 0; bottom: 0;
  width: 3px; background: linear-gradient(var(--blush), var(--rose), var(--blush));
  border-radius: 3px;
}
.tl-item { position: relative; padding-left: 44px; margin-bottom: 2rem; }
.tl-item::before {
  content: "💗"; position: absolute; left: 2px; top: 6px; font-size: 1.1rem;
}
.tl-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tl-photo { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--blush); }
.tl-placeholder {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: linear-gradient(135deg, #ffd9e0, #ffeef1);
  font-size: 3rem;
}
.tl-body { padding: 1.1rem 1.25rem 1.35rem; }
.tl-date { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.tl-title { font-family: var(--script); font-size: 1.8rem; color: var(--rose-deep); margin: .1rem 0 .4rem; }
.tl-text { margin: 0; color: var(--ink); }

@media (min-width: 760px) {
  .timeline::before { left: 50%; transform: translateX(-50%); }
  .tl-item { width: 50%; padding-left: 0; padding-right: 40px; }
  .tl-item::before { left: auto; right: -12px; }
  .tl-item:nth-child(even) { margin-left: 50%; padding-right: 0; padding-left: 40px; }
  .tl-item:nth-child(even)::before { left: -12px; right: auto; }
}

/* ---------- Reasons ---------- */
.reason-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2.5rem 1.5rem; max-width: 520px;
}
.reason-count { color: var(--gold); font-weight: 700; margin: 0; font-size: .9rem; }
.reason-text {
  font-family: var(--script); font-size: clamp(1.7rem, 6vw, 2.3rem);
  color: var(--rose-deep); min-height: 4.5em;
  display: flex; align-items: center; justify-content: center;
  margin: .5rem 0 1.25rem;
}
.pop { animation: pop .45s ease; }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- Quiz ---------- */
.quiz-box {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem 1.25rem; max-width: 560px;
}
.quiz-progress { height: 8px; background: var(--blush); border-radius: 8px; overflow: hidden; margin-bottom: 1.25rem; }
.quiz-progress span { display: block; height: 100%; background: var(--rose); transition: width .4s; }
.quiz-q { font-weight: 700; font-size: 1.2rem; margin: 0 0 1.25rem; }
.quiz-options { display: grid; gap: .65rem; }
.quiz-opt {
  font: inherit; text-align: left;
  padding: .9rem 1.1rem; min-height: 48px;
  background: var(--bg); border: 2px solid var(--blush); border-radius: 14px;
  cursor: pointer; color: var(--ink);
  transition: border-color .15s, background .15s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--rose); }
.quiz-opt.right { background: #e7f7ec; border-color: #5bb67a; }
.quiz-opt.wrong { background: #fde8ea; border-color: var(--rose-deep); }
.quiz-feedback { min-height: 1.6em; margin: 1rem 0 .5rem; font-weight: 700; color: var(--rose-deep); }
.quiz-score { font-family: var(--script); font-size: 3.5rem; color: var(--rose-deep); margin: .25rem 0; }

/* ---------- Open when ---------- */
.envelopes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 640px; }
@media (min-width: 640px) { .envelopes { grid-template-columns: repeat(3, 1fr); } }
.envelope {
  font: inherit; cursor: pointer; border: 0;
  background: linear-gradient(180deg, #fff 0%, #fff6f7 100%);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 1.5rem .75rem 1.1rem; position: relative; overflow: hidden;
  color: var(--ink);
  transition: transform .2s;
}
.envelope::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 46px;
  background: var(--blush);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.envelope:hover { transform: translateY(-4px) rotate(-1deg); }
.envelope .env-emoji { font-size: 2rem; position: relative; display: block; margin-top: .5rem; }
.envelope .env-label { font-size: .85rem; color: var(--muted); display: block; margin-top: .25rem; }
.envelope .env-label strong { display: block; color: var(--rose-deep); font-size: 1rem; }
.envelope.opened { opacity: .75; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(74, 44, 51, .45);
  display: grid; place-items: center; padding: 16px;
  animation: fadeIn .25s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  background: #fffdf9; border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 480px; width: 100%; padding: 2rem 1.5rem; position: relative;
  text-align: left; animation: pop .35s ease;
  max-height: 85vh; overflow-y: auto;
}
.modal-card h3 { font-size: 2.1rem; margin: 0 0 1rem; }
.modal-close {
  position: absolute; top: 8px; right: 12px; border: 0; background: none;
  font-size: 2rem; color: var(--muted); cursor: pointer; width: 44px; height: 44px;
}

/* ---------- Coupons ---------- */
.coupon-grid { display: grid; gap: 16px; grid-template-columns: 1fr; max-width: 760px; }
@media (min-width: 600px) { .coupon-grid { grid-template-columns: 1fr 1fr; } }
.coupon {
  display: flex; align-items: stretch;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; position: relative; text-align: left;
}
.coupon-stub {
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: #fff; font-size: 2rem; display: grid; place-items: center;
  min-width: 78px; border-right: 3px dashed #fff;
}
.coupon-body { padding: 1rem 1.1rem; flex: 1; }
.coupon-title { font-weight: 700; margin: 0; }
.coupon-note { color: var(--muted); font-size: .9rem; margin: .15rem 0 .65rem; }
.coupon-btn {
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
  border: 2px solid var(--rose); color: var(--rose-deep); background: #fff;
  border-radius: 999px; padding: .4rem 1rem; min-height: 40px;
}
.coupon.redeemed .coupon-btn { display: none; }
.coupon .stamp {
  display: none; position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%) rotate(-14deg);
  border: 3px solid var(--rose-deep); color: var(--rose-deep);
  padding: .2rem .6rem; border-radius: 8px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: .8rem;
  background: rgba(255,255,255,.85);
}
.coupon.redeemed .stamp { display: block; animation: pop .35s; }
.coupon-grid.locked .coupon { filter: blur(3px) grayscale(.4); pointer-events: none; user-select: none; }
.coupon-toast { margin-top: 1.25rem; color: var(--rose-deep); font-weight: 700; min-height: 1.5em; }

/* ---------- Final letter ---------- */
.letter {
  background: #fffdf9;
  background-image: repeating-linear-gradient(transparent 0 31px, #f4dfe2 31px 32px);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem 1.5rem; text-align: left; max-width: 620px;
  font-size: 1.08rem; line-height: 32px;
}
.letter p { margin: 0 0 32px; }
.letter p:first-child { font-family: var(--script); font-size: 1.9rem; color: var(--rose-deep); }
.signature { font-size: 1.8rem; text-align: right; margin: 0; }

/* ---------- Cake ---------- */
.cake-wrap { margin-top: 3rem; }
.cake {
  position: relative; width: 160px; height: 180px; margin: 0 auto;
  border: 0; background: none; cursor: pointer; display: block;
}
.cake-body {
  position: absolute; bottom: 0; left: 10px; width: 140px; height: 70px;
  background: linear-gradient(#f9c5cf, #e88aa0); border-radius: 12px 12px 18px 18px;
}
.cake-top {
  position: absolute; bottom: 60px; left: 5px; width: 150px; height: 26px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 6px 0 -2px #fff;
}
.candle-stick {
  position: absolute; bottom: 84px; left: 72px; width: 16px; height: 56px;
  background: repeating-linear-gradient(45deg, #fff 0 6px, var(--rose) 6px 12px);
  border-radius: 4px;
}
.flame {
  position: absolute; bottom: 138px; left: 68px; width: 24px; height: 36px;
  background: radial-gradient(circle at 50% 70%, #fff6c2, #ffb02e 55%, #ff7a2e);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker .25s ease-in-out infinite alternate;
  transform-origin: bottom center;
  box-shadow: 0 0 24px 6px rgba(255, 176, 46, .5);
}
@keyframes flicker { to { transform: scale(1.06, .94) rotate(2deg); } }
.cake.out .flame { animation: blowOut .6s forwards; }
@keyframes blowOut { to { transform: scale(0); opacity: 0; } }
.wish-msg { font-family: var(--script); font-size: 2rem; color: var(--rose-deep); min-height: 1.5em; }

.footer { text-align: center; padding: 2.5rem 16px 5rem; color: var(--muted); font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
