:root {
  --wine: #2a0f18;
  --wine2: #4a1a2a;
  --ivory: #f7f0e4;
  --paper: #f3eadb;
  --ink: #3b2a22;
  --gold: #c9a45c;
  --blush: #f3dcd8;
  --rose: #c98b97;
  --foil: linear-gradient(100deg, #9c7124 0%, #e8cd85 22%, #b8862f 40%, #f6e3a6 58%, #a77a2a 78%, #e2c071 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #120609; overflow: hidden; }
body { font-family: "Cormorant Garamond", Georgia, serif; color: var(--ink); display: grid; place-items: center; }

#stage {
  position: relative; width: 100vw; height: 100dvh; overflow: hidden;
  background: var(--wine); user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
@media (min-width: 600px) {
  #stage { width: 400px; height: min(860px, 94dvh); border-radius: 34px; box-shadow: 0 30px 90px #000a, 0 0 0 1px #ffffff14; }
}

/* top chrome */
.top { position: absolute; inset: 0 0 auto 0; z-index: 20; padding: calc(10px + env(safe-area-inset-top)) 16px 0; pointer-events: none; }
.bars { display: flex; gap: 4px; }
.bars i { flex: 1; height: 2px; border-radius: 2px; background: #ffffff33; transition: background .4s; }
.bars i.on { background: var(--gold); }
.meta { display: flex; justify-content: space-between; margin-top: 8px; font: 600 9px/1 "Cinzel", serif; letter-spacing: .22em; color: #ffffffaa; mix-blend-mode: difference; }
.tap { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); width: 100%; text-align: center; z-index: 20;
  font: 600 9px/1 "Cinzel", serif; letter-spacing: .3em; color: #ffffff88; mix-blend-mode: difference; pointer-events: none;
  animation: breathe 2.4s ease-in-out infinite; transition: opacity .4s; }
.tap.hide { opacity: 0; animation: none; }
@keyframes breathe { 50% { opacity: .35; } }

/* screens */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 26px 56px; opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility 0s .7s; }
.screen.active { opacity: 1; visibility: visible; transition: opacity .7s ease; }
.paper { background: radial-gradient(120% 90% at 50% 30%, #fbf6ec 0%, var(--paper) 60%, #e9dcc6 100%); }
.paper::before, .s-letter .sheet::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .3  0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.blush { background: radial-gradient(110% 80% at 50% 20%, #fff4f0 0%, var(--blush) 55%, #e8c3bf 100%); }
.wine { background: radial-gradient(120% 80% at 50% 10%, #5a2234 0%, var(--wine) 70%); }

.script { font-family: "Pinyon Script", cursive; font-weight: 400; line-height: 1; }
.gold, .gold-text { background: var(--foil); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.big { font-size: clamp(76px, 24vw, 104px); padding: 0 .12em .12em; }
.small-serif { font-size: 24px; font-style: italic; letter-spacing: .02em; }
.serif-line { font-size: 21px; text-align: center; line-height: 1.3; }
.serif-line.light { color: #f3e6d6; }
.small-caps { font: 600 13px/1.4 "Cinzel", serif; letter-spacing: .28em; text-transform: uppercase; text-align: center; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--gold); margin: 4px 0 10px; font-size: 12px; }
.divider span { width: 54px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* entrance */
.rise { opacity: 0; transform: translateY(14px); }
.active .rise { animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; }
.d1 { animation-delay: .25s !important; } .d2 { animation-delay: .6s !important; } .d3 { animation-delay: .95s !important; }
.d4 { animation-delay: 1.3s !important; } .d5 { animation-delay: 1.65s !important; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* 1 envelope */
.s-envelope { background: radial-gradient(90% 70% at 50% 45%, #5c2335 0%, #2a0f18 65%, #16070c 100%); }
.env-wrap { display: flex; flex-direction: column; align-items: center; gap: 34px; perspective: 900px; }
.envelope { position: relative; width: min(300px, 78vw); aspect-ratio: 1.45; filter: drop-shadow(0 22px 30px #0008); }
.env-back { position: absolute; inset: 0; background: #e9dcc5; border-radius: 6px; }
.env-front { position: absolute; inset: 0; border-radius: 6px; z-index: 3;
  background: linear-gradient(160deg, #f8f1e4, #eadcc3);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%); }
.env-front::after { content: ""; position: absolute; inset: 8px; border: 1px solid #c9a45c88; border-radius: 3px; clip-path: inherit; }
.env-flap { position: absolute; inset: 0 0 auto 0; height: 58%; z-index: 4; transform-origin: top center;
  background: linear-gradient(180deg, #efe4d0, #e2d2b6); clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .9s cubic-bezier(.5,0,.3,1), z-index 0s .45s; }
.env-letter { position: absolute; left: 7%; right: 7%; top: 8%; height: 84%; z-index: 2; border-radius: 4px;
  background: #fffaf1; box-shadow: 0 2px 10px #0002; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform 1.1s cubic-bezier(.3,.7,.2,1) .7s; }
.env-letter .script { font-size: 44px; padding: 0 .1em .1em; }
.env-letter small { font: italic 15px "Cormorant Garamond", serif; color: #8a6f55; }
.seal { position: absolute; left: 50%; top: 52%; width: 74px; height: 74px; transform: translate(-50%, -50%); z-index: 5;
  border: 0; background: none; cursor: pointer; animation: pulse 2.2s ease-in-out infinite; }
.seal .half { position: absolute; top: 0; width: 50%; height: 100%; overflow: hidden; transition: transform .7s cubic-bezier(.4,0,.2,1), opacity .7s; }
.seal .half.l { left: 0; } .seal .half.r { right: 0; }
.seal .half i { position: absolute; top: 0; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  font: 38px/1 "Pinyon Script", cursive; font-style: normal; color: #e8c97c; text-shadow: 0 1px 0 #3a0710, 0 -1px 0 #ffb3a855;
  background: radial-gradient(circle at 38% 32%, #c2394d 0%, #8e1a2c 45%, #5e0d1b 100%);
  box-shadow: inset 0 0 0 5px #7a1424, inset 0 0 0 7px #a52a3e, 0 4px 10px #0007; }
.seal .half.l i { left: 0; } .seal .half.r i { right: 0; }
@keyframes pulse { 50% { transform: translate(-50%, -50%) scale(1.06); } }
.envelope.open .seal { animation: none; pointer-events: none; }
.envelope.open .seal .half.l { transform: translate(-30px, 40px) rotate(-35deg); opacity: 0; }
.envelope.open .seal .half.r { transform: translate(30px, 46px) rotate(30deg); opacity: 0; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-letter { transform: translateY(-80%); z-index: 2; }
.envelope.open .env-front { z-index: 3; }
.env-hint { font: italic 19px "Cormorant Garamond", serif; color: #f0dcc4cc; animation: breathe 2.4s ease-in-out infinite; transition: opacity .5s; }

/* 2 portrait */
.s-portrait { gap: 4px; }
.arch { width: min(230px, 60vw); aspect-ratio: .78; border-radius: 999px 999px 10px 10px; padding: 6px; background: var(--foil);
  box-shadow: 0 18px 40px #6b4a2a40; margin-bottom: 18px; opacity: 0; transform: scale(.96); }
.active .arch { animation: rise 1.1s ease forwards; }
.arch img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: inherit; display: block; }

/* 3 years */
.s-years { justify-content: flex-start; padding-top: 92px; }
.top-line { font-size: 25px; }
.fan { position: relative; width: 100%; flex: 1; margin-top: 10px; }
.pol { position: absolute; left: 50%; top: 50%; width: 47%; background: #fffdf8; padding: 9px 9px 0; box-shadow: 0 14px 30px #7a3b3b33;
  opacity: 0; }
.pol img { width: 100%; aspect-ratio: .82; object-fit: cover; object-position: 50% 25%; display: block; }
.pol figcaption { text-align: center; font-size: 30px; color: #9a6b2f; padding: 6px 0 8px; }
.active .p1 { animation: drop1 .9s cubic-bezier(.2,.8,.2,1) .9s forwards; }
.active .p2 { animation: drop2 .9s cubic-bezier(.2,.8,.2,1) 1.6s forwards; }
.active .p3 { animation: drop3 .9s cubic-bezier(.2,.8,.2,1) 2.3s forwards; }
@keyframes drop1 { from { opacity: 0; transform: translate(-50%, -80%) rotate(-25deg) scale(1.2); } to { opacity: 1; transform: translate(-94%, -104%) rotate(-8deg); } }
@keyframes drop2 { from { opacity: 0; transform: translate(-50%, -80%) rotate(20deg) scale(1.2); } to { opacity: 1; transform: translate(-8%, -80%) rotate(7deg); } }
@keyframes drop3 { from { opacity: 0; transform: translate(-50%, -30%) rotate(-12deg) scale(1.2); } to { opacity: 1; transform: translate(-48%, 14%) rotate(-2deg); } }

/* 4 family */
.s-family { gap: 2px; }
.s-family .small-caps { font-size: 14px; }
.collage { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 20px; }
.frame { padding: 4px; background: var(--foil); border-radius: 4px; box-shadow: 0 12px 28px #0007; }
.frame img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 2px; }
.frame.wide { grid-column: span 2; aspect-ratio: 1.33; }
.frame:not(.wide) { aspect-ratio: .72; }
.frame:not(.wide) img { object-position: 50% 35%; }

/* 5 letter */
.s-letter { background: radial-gradient(120% 90% at 50% 20%, #6a2a3c 0%, var(--wine) 75%); }
.sheet { position: relative; width: 100%; max-width: 340px; min-height: 66%; padding: 34px 26px 30px; background: #fbf5ea; border-radius: 3px;
  box-shadow: 0 20px 50px #0009; transform: rotate(-1deg); }
.sheet::after { content: ""; position: absolute; inset: 9px; border: 1px solid #c9a45c77; pointer-events: none; }
.sprig { position: absolute; right: -14px; top: -22px; width: 92px; height: 92px; transform: rotate(8deg); }
.hand { font-family: "Caveat", cursive; font-size: 25px; line-height: 1.32; color: #3b2a50; white-space: pre-wrap; min-height: 1em; }
.hand .caret { display: inline-block; width: 1px; height: 1em; background: #3b2a50; margin-left: 1px; vertical-align: -3px; animation: breathe 1s steps(1) infinite; }
.sign { margin-top: 18px; text-align: right; color: #8b2f45; opacity: 0; transition: opacity 1s; }
.sign.show { opacity: 1; }

/* 6 cake */
.s-cake { padding: 0; background: radial-gradient(100% 70% at 50% 60%, #4b1c2b 0%, #240c14 70%, #14060a 100%); }
#cake { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.cake-ui { position: absolute; inset: 70px 22px auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; pointer-events: none; }
.cake-title { font-size: 54px; padding: 0 .1em .1em; }
.cake-sub { font-size: 19px; font-style: italic; color: #f1e2cf; max-width: 300px; min-height: 2.6em; }
.btn { pointer-events: auto; font: 600 12px/1 "Cinzel", serif; letter-spacing: .2em; text-transform: uppercase; color: #2a0f18;
  background: var(--foil); border: 0; border-radius: 999px; padding: 14px 22px; box-shadow: 0 8px 22px #0006; cursor: pointer; }
.btn.ghost { background: none; color: #9a7b3c; box-shadow: none; border: 1px solid #c9a45c; margin-top: 16px; }
.btn[hidden], .meter[hidden] { display: none; }
.meter { width: 160px; height: 4px; border-radius: 4px; background: #ffffff22; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--foil); transition: width .08s linear; }

/* 7 final */
.s-final { gap: 2px; }
.oval { width: min(190px, 50vw); aspect-ratio: .8; border-radius: 50%; padding: 5px; background: var(--foil); margin-bottom: 14px; box-shadow: 0 16px 36px #6b4a2a44; }
.oval img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: 50%; display: block; }
.final-hb { margin-top: 14px; color: #9a7b3c; }
.petals { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.petal { position: absolute; top: -30px; width: 12px; height: 10px; border-radius: 80% 10% 80% 10%; opacity: .85;
  animation: fall linear infinite; }
@keyframes fall { to { transform: translate(var(--dx), 110dvh) rotate(var(--r)); } }

@media (prefers-reduced-motion: reduce) {
  .gold, .gold-text, .tap, .env-hint, .seal { animation: none !important; }
  .petal { display: none; }
}
@media (max-height: 700px) {
  .arch { width: 190px; } .big { font-size: 72px; } .collage { gap: 8px; } .hand { font-size: 22px; }
}
