:root {
  --ink: #3f342f;
  --pink: #ef7295;
  --deep-pink: #dd4f79;
  --cream: #fff8ee;
  --yellow: #ffd36c;
  --sage: #9db89d;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,.9), transparent 25%),
    radial-gradient(circle at 85% 82%, rgba(250,195,172,.25), transparent 28%),
    #fff4e8;
  font-family: "DM Sans", sans-serif;
  cursor: none;
}

button, a { cursor: none; }

.paper-noise {
  position: fixed;
  inset: 0;
  opacity: .13;
  pointer-events: none;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
}

.topbar {
  position: fixed;
  top: 25px;
  left: 50%;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translateX(-50%);
  color: #89766c;
  font-family: "Gaegu", cursive;
  font-size: 17px;
  letter-spacing: .02em;
}

.heart { color: var(--pink); animation: heartbeat 1.5s ease-in-out infinite; }

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.intro { z-index: 3; transition: opacity .55s ease, transform .55s ease; }
.eyebrow {
  margin: 0 0 2px;
  color: #a16f71;
  font-family: "Gaegu", cursive;
  font-size: clamp(17px, 2vw, 21px);
}

h1, h2 {
  margin: 0;
  font-family: "Gaegu", cursive;
  font-weight: 700;
  line-height: .92;
}

h1 { font-size: clamp(54px, 8vw, 88px); letter-spacing: -.045em; }
h1 em { color: var(--pink); font-style: normal; position: relative; }
h1 em::after {
  content: "";
  position: absolute;
  left: 4%; right: 0; bottom: -3px;
  height: 8px;
  border-top: 3px solid var(--pink);
  border-radius: 50%;
  transform: rotate(-2deg);
}

.instruction { margin: 15px 0 0; color: #867269; font-size: 13px; letter-spacing: .015em; }

.stage {
  width: min(100%, 1060px);
  min-height: 600px;
  position: relative;
  display: grid;
  place-items: center;
}

.cupcake-wrap {
  position: relative;
  z-index: 5;
  width: 230px;
  height: 365px;
  margin-top: 0;
  filter: drop-shadow(0 24px 18px rgba(91, 61, 48, .11));
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}

.candle {
  position: absolute;
  z-index: 3;
  top: 68px;
  left: 99px;
  width: 32px;
  height: 104px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 5px 5px 2px 2px;
  background: #fae08b;
}

.candle span { position: absolute; width: 50px; height: 12px; left: -9px; background: #f3989f; transform: rotate(-34deg); }
.candle span:nth-child(1) { top: 13px; }
.candle span:nth-child(2) { top: 49px; }
.candle span:nth-child(3) { top: 85px; }

.wick-target {
  position: absolute;
  z-index: 9;
  top: 25px;
  left: 82px;
  width: 66px;
  height: 65px;
  padding: 0;
  border: 0;
  background: transparent;
}

.wick { position: absolute; left: 31px; bottom: 0; width: 4px; height: 17px; border-radius: 5px; background: #493b36; }
.flame {
  position: absolute;
  left: 20px;
  bottom: 12px;
  width: 27px;
  height: 39px;
  opacity: 0;
  border: 2px solid #bc642c;
  border-radius: 52% 48% 53% 47% / 65% 63% 37% 35%;
  background: radial-gradient(circle at 50% 70%, #fff9ae 0 18%, #ffd34e 20% 55%, #f2883b 57%);
  box-shadow: 0 0 22px 8px rgba(255, 183, 46, .58);
  transform: scale(.2) rotate(45deg);
  transition: opacity .2s ease, transform .35s cubic-bezier(.17,.89,.3,1.5);
}

.lit .flame { opacity: 1; transform: scale(1) rotate(2deg); animation: flicker .75s ease-in-out infinite alternate; }

.frosting { position: absolute; z-index: 4; top: 151px; width: 230px; height: 110px; }
.frosting-top, .frosting-mid, .frosting-base { position: absolute; left: 50%; border: 3px solid var(--ink); background: #ffc0cf; transform: translateX(-50%); }
.frosting-top { top: 0; width: 92px; height: 65px; border-radius: 50% 50% 40% 40%; transform: translateX(-50%) rotate(2deg); }
.frosting-mid { top: 31px; width: 157px; height: 62px; border-radius: 52% 48% 36% 34%; }
.frosting-base { top: 65px; width: 215px; height: 48px; border-radius: 50% 50% 22% 22%; }

.sprinkle { position: absolute; z-index: 8; width: 13px; height: 4px; border-radius: 4px; background: var(--deep-pink); }
.s1 { left: 73px; top: 56px; transform: rotate(25deg); } .s2 { left: 112px; top: 29px; transform: rotate(-40deg); background:#5d9c9a; }
.s3 { left: 142px; top: 60px; transform: rotate(8deg); background:#f4ad3e; } .s4 { left: 47px; top: 82px; transform: rotate(-30deg); background:#f4ad3e; }
.s5 { left: 106px; top: 82px; transform: rotate(18deg); background:#fff2a9; } .s6 { left: 168px; top: 88px; transform: rotate(-25deg); background:#5d9c9a; }

.cake {
  position: absolute;
  z-index: 2;
  top: 244px;
  left: 25px;
  width: 180px;
  height: 100px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 3px 3px 29px 29px;
  background: #ec8292;
  clip-path: polygon(0 0, 100% 0, 89% 100%, 11% 100%);
}

.wrapper-lines { height: 100%; background: repeating-linear-gradient(78deg, transparent 0 21px, rgba(139,57,71,.45) 22px 25px); }
.plate { position: absolute; bottom: 7px; left: 9px; width: 212px; height: 23px; border: 3px solid var(--ink); border-radius: 50%; background: #a8cec4; }

.glow {
  position: absolute;
  z-index: 0;
  width: 370px;
  height: 370px;
  opacity: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,211,108,.55), rgba(255,211,108,0) 68%);
  transition: opacity 1s ease, transform 1s ease;
}

.lit .glow { opacity: 1; transform: scale(1.35); }

.collage {
  position: absolute;
  z-index: 6;
  top: 25%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 48px);
  width: min(760px, 92%);
  pointer-events: none;
  transform: translateX(-50%);
}
.photo {
  position: relative;
  flex: 0 1 190px;
  width: 190px;
  margin: 0;
  padding: 10px 10px 28px;
  opacity: 0;
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(80, 52, 39, .17);
  transform: translate(var(--from-x, 0), var(--from-y, 80px)) rotate(0) scale(.2);
  transition: opacity .55s ease var(--delay), transform .9s cubic-bezier(.17,.89,.32,1.2) var(--delay);
}

.memory { width: 100%; aspect-ratio: 1 / 1.08; display: block; overflow: hidden; object-fit: cover; }
.memory span { font-family: "Gaegu", cursive; font-size: 68px; color: rgba(255,255,255,.91); filter: drop-shadow(3px 4px 0 rgba(70,50,45,.12)); }
.memory-sun { background: linear-gradient(145deg, #ffca73, #ef8e86); }
.memory-laugh { background: linear-gradient(145deg, #94c9bd, #579ca0); }
.memory-night { background: linear-gradient(145deg, #7b78a8, #433e6a); }
.memory-flower { background: linear-gradient(145deg, #f7a9bd, #dd678d); }
.memory-party { background: linear-gradient(145deg, #f4bd68, #e47a64); }
.memory-love { background: linear-gradient(145deg, #aacb9e, #6da282); }

.photo-1 { --from-x: 220px; --from-y: 130px; --delay: .08s; }
.photo-2 { --from-x: 0; --from-y: 150px; --delay: .18s; }
.photo-3 { --from-x: -220px; --from-y: 130px; --delay: .28s; }
.lit .photo { opacity: 1; transform: translate(0,0) rotate(var(--r)) scale(1); }

.lit .cupcake-wrap { transform: translateY(205px) scale(.55); }

.reveal-copy {
  position: absolute;
  z-index: 7;
  top: 8%;
  left: 50%;
  width: min(430px, calc(100% - 40px));
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .7s ease 1.05s, transform .7s ease 1.05s;
}

.lit .reveal-copy { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.reveal-copy h1 { color: var(--deep-pink); font-size: clamp(42px, 6vw, 68px); }

.lighter {
  position: fixed;
  z-index: 100;
  top: 0; left: 0;
  width: 47px;
  height: 96px;
  pointer-events: none;
  filter: drop-shadow(5px 7px 5px rgba(50,35,30,.2));
  transform: translate3d(-100px,-100px,0) rotate(-12deg);
  transition: opacity .3s ease;
}

.lighter-head { position: absolute; top: 20px; left: 9px; width: 31px; height: 24px; border: 2px solid #403833; border-radius: 6px 6px 2px 2px; background: #b9b5ae; }
.lighter-head::before { content:""; position:absolute; top:3px; left:3px; width:13px; height:13px; border:2px dotted #514941; border-radius:50%; background:#88847f; }
.lighter-head i { position:absolute; right:3px; top:6px; width:8px; height:5px; background:#514941; border-radius:2px; }
.lighter-body { position:absolute; top:40px; left:5px; width:39px; height:55px; border:2px solid #403833; border-radius:3px 3px 9px 9px; background:#ee7698; }
.lighter-body span { display:block; margin-top:11px; color:#fff2e9; font:700 12px "Gaegu",cursive; transform:rotate(-5deg); }
.lighter-body b { color:#9d3456; font-size:12px; }
.lighter-flame { position:absolute; z-index:3; left:15px; top:-5px; width:20px; height:29px; opacity:0; border:2px solid #b75c28; border-radius:55% 45% 50% 50% / 68% 65% 35% 32%; background:linear-gradient(#ff8b3d,#ffd952); transition:opacity .15s; animation:flicker .55s ease-in-out infinite alternate; }
.lighter.near .lighter-flame { opacity:1; }
.lit .lighter { opacity:0; }

.confetti { position: fixed; inset: 0; z-index: 30; overflow: hidden; pointer-events: none; }
.confetti i { position:absolute; top:-20px; width:9px; height:14px; border-radius:2px; animation:confetti-fall var(--duration) linear var(--delay) forwards; }

@keyframes flicker { from { transform: scale(1) rotate(-4deg); } to { transform: scale(.93,1.07) rotate(5deg); } }
@keyframes heartbeat { 50% { transform: scale(1.28); } }
@keyframes confetti-fall { to { transform: translate3d(var(--drift),105vh,0) rotate(720deg); } }

@media (max-width: 760px) {
  body, button, a { cursor: auto; }
  .lighter { display:none; }
  .hero { padding-inline: 12px; }
  .stage { min-height: 620px; }
  .collage { top: 23%; gap: 9px; width: calc(100% - 20px); }
  .photo { width: 30%; flex-basis: 112px; padding: 6px 6px 17px; }
  .memory span { font-size: 48px; }
  .lit .cupcake-wrap { transform: translateY(180px) scale(.55); }
  .reveal-copy { top: 7%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
