/* ================= Fairy baby card: pink fantasy theme ================= */
:root {
  --ink: #5b2a55;          /* plum text */
  --rose: #e24d8f;
  --rose-deep: #b8336f;
  --blush: #ffd3e6;
  --petal: #ffe8f2;
  --gold: #f3c057;
  --gold-soft: #ffe8a8;
  --lilac: #c9a7ff;
  --paper: #fffafc;
  --script: 'Great Vibes', cursive;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --ui: 'Quicksand', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: #ffd0e3; color: var(--ink); font-family: var(--ui);
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; height: 100dvh; touch-action: none; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ---------- sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(180deg, #f7a3c8 0%, #ffc9df 38%, #ffe3ee 72%, #fff2f7 100%);
}
.sky-night {
  position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(180deg, #3b1846 0%, #6e2c6c 40%, #c25591 78%, #f39cc3 100%);
}
.moon {
  position: absolute; top: max(5vh, 28px); right: 9vw; width: clamp(46px, 9vw, 84px); aspect-ratio: 1; border-radius: 50%;
  box-shadow: inset -14px 8px 0 0 #fff6dc, 0 0 40px 10px rgba(255, 246, 220, .55);
  transform: rotate(-18deg);
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

.rays {
  position: fixed; left: 50%; top: 48%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 240, 248, .7) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 50%); mask: radial-gradient(circle, #000 0, transparent 50%);
  opacity: 0; pointer-events: none; z-index: 2;
}

/* ---------- hills + castle ---------- */
.land {
  position: fixed; left: 0; right: 0; bottom: 0; height: min(32vh, 280px); z-index: 2; pointer-events: none;
}
.land svg { width: 100%; height: 100%; display: block; }
.land-far, .land-mid, .land-near { will-change: transform; }

/* ---------- envelope screen ---------- */
.scene {
  position: fixed; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.scene-eyebrow {
  margin: 0; font: 400 clamp(1.7rem, 7vw, 2.5rem)/1.1 var(--script); color: var(--rose-deep); text-align: center;
  text-shadow: 0 2px 12px rgba(255, 255, 255, .8);
}
.fairy-spot { width: min(400px, 82vw, 60vh); height: var(--fh, 170px); }
.env-float { animation: envFloat 4.5s ease-in-out infinite; }
@keyframes envFloat { 50% { transform: translateY(-12px); } }

.envelope { position: relative; width: min(400px, 82vw, 60vh); aspect-ratio: 3 / 2; cursor: pointer; }
.env-back, .pocket, .flap, .lace { position: absolute; inset: 0; border-radius: 12px; }
.env-back {
  background: linear-gradient(160deg, #ffd6e8, #f9b5d2);
  box-shadow: 0 22px 46px rgba(150, 50, 110, .35), 0 0 0 1px rgba(255, 255, 255, .6) inset;
}
.letter {
  position: absolute; left: 7%; top: 7%; width: 86%; height: 86%; z-index: 1; border-radius: 8px;
  background: var(--paper); box-shadow: 0 4px 14px rgba(150, 50, 110, .15);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 7%;
}
.letter-star { color: var(--gold); font-size: 1.5rem; line-height: 1; text-shadow: 0 0 10px rgba(243, 192, 87, .8); }
.letter-line { width: 60%; height: 5px; border-radius: 3px; background: var(--blush); }
.letter-line.short { width: 38%; }
.pocket {
  z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, #ffc4de, #f7a0c6);
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 100%, 0 100%);
}
.lace {               /* little dotted lace along the pocket edges */
  z-index: 3; pointer-events: none; border-radius: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 1.5px), rgba(255, 255, 255, .85) calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px)) left bottom / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1.5px), rgba(255, 255, 255, .85) calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px)) right bottom / 50% 100% no-repeat;
  clip-path: polygon(0 40%, 50% 100%, 100% 40%, 100% 100%, 0 100%); opacity: .55;
}
.flap {
  z-index: 4; transform-origin: 50% 0; pointer-events: none;
  background: linear-gradient(180deg, #ffb6d5, #f48fbc);
  clip-path: polygon(0 0, 100% 0, 50% 60%);
  filter: drop-shadow(0 3px 3px rgba(150, 50, 110, .2));
}
.seal {
  position: absolute; z-index: 6; left: calc(50% - 32px); top: calc(60% - 32px);
  width: 64px; height: 64px; border: 0; padding: 12px; cursor: pointer; border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #ff8fbf, var(--rose) 58%, #a3245d);
  box-shadow: inset 0 -4px 7px rgba(0, 0, 0, .22), inset 0 3px 6px rgba(255, 255, 255, .35), 0 4px 10px rgba(120, 20, 70, .3);
  animation: sealGlow 2.2s ease-in-out infinite;
}
.seal svg { width: 100%; height: 100%; display: block; }
.seal:disabled { cursor: progress; filter: saturate(.6); animation: none; }
@keyframes sealGlow {
  50% { box-shadow: inset 0 -4px 7px rgba(0,0,0,.22), inset 0 3px 6px rgba(255,255,255,.35), 0 0 0 10px rgba(226,77,143,.18), 0 0 30px 8px rgba(255,220,240,.95); }
}
.hint { margin: 0; font-weight: 700; letter-spacing: .02em; text-align: center; color: var(--ink); min-height: 1.4em; }
.hint a { color: var(--rose-deep); }

/* ---------- characters ---------- */
.actor { position: fixed; left: 0; top: 0; pointer-events: none; will-change: transform; }
.actor svg { width: 100%; height: 100%; display: block; overflow: visible; }

.fairy { z-index: 40; width: var(--fw, 170px); aspect-ratio: 220 / 270; opacity: 0; }
.fairy-flip, .fairy-bob { width: 100%; height: 100%; }
.fairy-bob { animation: fairyBob 2.6s ease-in-out infinite; }
@keyframes fairyBob { 50% { transform: translateY(-7px) rotate(-1.5deg); } }
.fairy .f-wing { transform-box: fill-box; }
.fairy .f-wing-near { transform-origin: 100% 60%; animation: wingNear .32s ease-in-out infinite alternate; }
.fairy .f-wing-far { transform-origin: 0% 60%; animation: wingFar .32s ease-in-out infinite alternate; }
@keyframes wingNear { to { transform: scaleX(.55) skewY(4deg); } }
@keyframes wingFar { to { transform: scaleX(.6) skewY(-4deg); } }
.fairy .f-hair-back { transform-box: fill-box; transform-origin: 80% 0; animation: hairSway 3s ease-in-out infinite; }
@keyframes hairSway { 50% { transform: rotate(4deg); } }
.fairy .f-skirt { transform-box: fill-box; transform-origin: 50% 0; animation: skirtSway 2.6s ease-in-out infinite; }
@keyframes skirtSway { 50% { transform: skewX(-5deg) scaleY(1.03); } }
.fairy .f-leg { transform-box: fill-box; transform-origin: 50% 0; animation: legSwing 2.6s ease-in-out infinite; }
.fairy .f-leg-2 { animation-delay: -1.3s; }
@keyframes legSwing { 50% { transform: rotate(9deg); } }
.fairy .f-star-glow { transform-box: fill-box; transform-origin: center; animation: starPulse 1.4s ease-in-out infinite; }
@keyframes starPulse { 50% { transform: scale(1.35); opacity: .7; } }
.fairy.flying .f-wing-near, .fairy.flying .f-wing-far { animation-duration: .12s; }

.butterfly { z-index: 41; width: var(--bw, 46px); height: var(--bw, 46px); opacity: 0; }
.butterfly .b-wing { transform-box: view-box; transform-origin: 0 0; }   /* (0,0) = the body centre in the drawing */
.butterfly .b-wing-r { animation: bflapR var(--flap, .16s) ease-in-out infinite alternate; }
.butterfly .b-wing-l { animation: bflapL var(--flap, .16s) ease-in-out infinite alternate; }
@keyframes bflapR { from { transform: scaleX(1); } to { transform: scaleX(.18); } }
@keyframes bflapL { from { transform: scale(-1, 1); } to { transform: scale(-.18, 1); } }
.butterfly.resting .b-wing-r { animation: bRestR 2.6s ease-in-out infinite; }
.butterfly.resting .b-wing-l { animation: bRestL 2.6s ease-in-out infinite; }
@keyframes bRestR { 0%, 60%, 100% { transform: scaleX(1); } 75% { transform: scaleX(.25); } 88% { transform: scaleX(.9); } }
@keyframes bRestL { 0%, 60%, 100% { transform: scale(-1, 1); } 75% { transform: scale(-.25, 1); } 88% { transform: scale(-.9, 1); } }
.mini-fly { position: fixed; left: 0; top: 0; z-index: 42; width: 26px; height: 26px; pointer-events: none; }
.mini-fly .b-wing { transform-box: view-box; transform-origin: 0 0; }   /* (0,0) = the body centre in the drawing */
.mini-fly .b-wing-r { animation: bflapR .14s ease-in-out infinite alternate; }
.mini-fly .b-wing-l { animation: bflapL .14s ease-in-out infinite alternate; }

.unicorn { z-index: 15; width: var(--uw, 280px); aspect-ratio: 310 / 250; opacity: 0; }
.unicorn .u-leg { transform-box: fill-box; transform-origin: 50% 6%; }
.unicorn.running .u-runner { animation: gallopBody .42s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }
.unicorn.running .u-leg-fn { animation: legF .42s ease-in-out infinite; }
.unicorn.running .u-leg-ff { animation: legF .42s ease-in-out infinite; animation-delay: -.07s; }
.unicorn.running .u-leg-bn { animation: legB .42s ease-in-out infinite; animation-delay: -.2s; }
.unicorn.running .u-leg-bf { animation: legB .42s ease-in-out infinite; animation-delay: -.27s; }
.unicorn.running .u-mane { animation: maneFlow .42s ease-in-out infinite; transform-box: fill-box; transform-origin: 100% 0; }
.unicorn.running .u-tail { animation: tailFlow .42s ease-in-out infinite; transform-box: fill-box; transform-origin: 100% 20%; }
@keyframes gallopBody { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes legF { 0%, 100% { transform: rotate(-38deg); } 50% { transform: rotate(30deg); } }
@keyframes legB { 0%, 100% { transform: rotate(34deg); } 50% { transform: rotate(-32deg); } }
@keyframes maneFlow { 50% { transform: skewX(8deg) translateX(-3px); } }
@keyframes tailFlow { 50% { transform: rotate(-10deg) skewY(5deg); } }

.flash {
  position: fixed; left: 50%; top: 50%; z-index: 50; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 30%, rgba(255, 220, 238, .9) 55%, rgba(255, 200, 225, 0) 72%);
  opacity: 0; pointer-events: none;
}

/* ---------- the story ---------- */
.story { position: relative; z-index: 20; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }
.sec {
  min-height: 82vh; min-height: 82svh; display: grid; place-items: center; align-content: center; gap: 14px;
  padding: 40px 0; max-width: 620px; margin: 0 auto; text-align: center;
}
.intro { min-height: 100vh; min-height: 100svh; padding-top: calc(70px + env(safe-area-inset-top)); position: relative; }
.eyebrow { margin: 0; font: italic 600 clamp(1.3rem, 5vw, 1.7rem)/1.2 var(--serif); color: var(--rose-deep); letter-spacing: .02em; }
.eyebrow .ch, .note-text .ch { display: inline-block; white-space: pre; }
.intro h1 {
  margin: 0; font: 400 clamp(3rem, 13vw, 5.4rem)/1.02 var(--script); color: var(--rose);
  text-shadow: 0 3px 18px rgba(255, 255, 255, .7);
}
.intro h1 .w { display: inline-block; white-space: nowrap; }
.intro h1 .ch { display: inline-block; will-change: transform; }
.intro h1.shimmer .ch {
  background: linear-gradient(100deg, var(--rose) 0 40%, #fff1b8 50%, var(--rose) 60% 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 3.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
.baby-name {
  margin: 4px 0 0; font: 600 clamp(1.1rem, 4.4vw, 1.4rem)/1.2 var(--ui); letter-spacing: .32em; text-transform: uppercase;
  color: var(--ink); padding: 8px 22px; border-radius: 999px; background: rgba(255, 250, 252, .75);
  box-shadow: 0 6px 20px rgba(180, 60, 120, .15);
}
.baby-name::before, .baby-name::after { content: "✦"; color: var(--gold); margin: 0 .6em; letter-spacing: 0; }
.scroll-cue {
  position: absolute; left: 50%; bottom: calc(min(32vh, 280px) * .35 + 18px); translate: -50% 0;
  display: grid; justify-items: center; gap: 6px; font-weight: 700; font-size: .9rem; color: var(--ink); opacity: 0;
  background: rgba(255, 250, 252, .78); padding: 8px 16px 10px; border-radius: 999px; white-space: nowrap;
}
.scroll-cue i { width: 12px; height: 12px; border-right: 2.5px solid var(--rose); border-bottom: 2.5px solid var(--rose); rotate: 45deg; animation: cue 1.4s ease-in-out infinite; }
@keyframes cue { 50% { translate: 0 5px; } }

/* paper note (one per message slide) */
.note {
  position: relative; width: min(540px, 100%); padding: 38px 30px 34px; border-radius: 18px;
  background:
    radial-gradient(circle at 0 0, rgba(255, 211, 230, .55), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(201, 167, 255, .25), transparent 45%),
    var(--paper);
  box-shadow: 0 24px 50px rgba(150, 40, 100, .22), 0 1px 0 #fff inset;
  transform-origin: 50% 50%;
}
.note::before {                      /* gold inner border */
  content: ""; position: absolute; inset: 9px; border-radius: 12px; pointer-events: none;
  border: 1.5px solid rgba(243, 192, 87, .55);
}
.note::after {                       /* little flourish at the top */
  content: "❦"; position: absolute; top: -16px; left: 50%; translate: -50% 0; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--rose); color: #fff; font-size: 1.05rem;
  box-shadow: 0 4px 10px rgba(180, 40, 100, .3);
}
.note-text {
  margin: 0; font: 500 clamp(1.3rem, 4.8vw, 1.6rem)/1.45 var(--serif); color: var(--ink); white-space: pre-line;
}
.note-text .wd { display: inline-block; white-space: pre; }
.note.unfurl { padding-top: 46px; padding-bottom: 44px; }
.note.unfurl::before { border-style: dashed; }
.rod {                               /* rolled scroll ends for the "unfurl" style */
  position: absolute; left: -10px; right: -10px; height: 16px; border-radius: 10px; z-index: 2;
  background: linear-gradient(180deg, #ffe7a8, #f3c057 50%, #c98f2a);
  box-shadow: 0 3px 6px rgba(120, 60, 20, .25);
}
.rod.top { top: -6px; } .rod.bottom { bottom: -6px; }
.note.glow .note-text { color: #7a2b6a; }

/* photo */
.photo-sec { gap: 0; }
.ribbon-hang { width: 3px; height: 70px; background: linear-gradient(var(--rose), #ff9fc8); border-radius: 2px; transform-origin: 50% 0; }
.polaroid {
  position: relative; margin: -6px 0 0; width: min(78vw, 46vh, 320px);
  background: #fff; padding: 12px 12px 0; border-radius: 4px;
  box-shadow: 0 16px 34px rgba(120, 30, 80, .3), 0 1px 3px rgba(0, 0, 0, .12);
  transform-origin: 50% -70px;
}
.polaroid::before {                  /* bow on top */
  content: "🎀"; position: absolute; top: -26px; left: 50%; translate: -50% 0; font-size: 2rem; z-index: 2;
}
.polaroid .frame {
  display: block; position: relative; width: 100%; padding: 0; border: 0; background: #3b1846;
  cursor: zoom-in; overflow: hidden; aspect-ratio: 1;
}
.polaroid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.polaroid .shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .65) 48%, transparent 62%);
  transform: translateX(-120%);
}
.polaroid figcaption { font: 400 1.9rem/1 var(--script); color: var(--ink); padding: 10px 6px 14px; min-height: 40px; }

/* panels: details, wishes, closing */
.panel {
  position: relative; width: min(540px, 100%); padding: 30px 24px; border-radius: 22px;
  background: rgba(255, 250, 252, .92); box-shadow: 0 24px 50px rgba(120, 30, 90, .25);
  display: grid; gap: 16px; justify-items: center;
}
.panel h2 { margin: 0; font: 400 clamp(2.4rem, 10vw, 3.2rem)/1 var(--script); color: var(--rose); }
.tags { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; width: 100%; }
.tag {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 12px 18px; border-radius: 14px; transform-origin: 0 50%;
  background: linear-gradient(90deg, #ffe1ee, #fff4f9); border-left: 5px solid var(--rose);
}
.tag .ic { font-size: 1.5rem; flex: none; width: 36px; text-align: center; }
.tag small { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--rose-deep); }
.tag b { display: block; font: 600 1.25rem/1.25 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn {
  font: 700 .95rem var(--ui); color: var(--ink); text-decoration: none; cursor: pointer;
  background: #fff; border: 1.5px solid #ffc4de; border-radius: 999px; padding: 11px 18px;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(180, 60, 120, .12);
}
.btn:hover { border-color: var(--rose); }
.small-link { font-size: .85rem; font-weight: 600; color: var(--rose-deep); }

.wish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; width: 100%; }
.wish { display: flex; align-items: center; gap: 14px; text-align: left; font: italic 600 clamp(1.2rem, 4.6vw, 1.45rem)/1.3 var(--serif); }
.wish .star {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, #fff6cf, #f3c057); color: #fff; font-size: 1rem; font-style: normal;
  box-shadow: 0 0 0 4px rgba(243, 192, 87, .2), 0 0 18px rgba(243, 192, 87, .7);
}

.closing-line { margin: 0; font: italic 600 1.3rem/1.3 var(--serif); }
.from { margin: 0; font: 400 clamp(2.2rem, 9vw, 2.8rem)/1.1 var(--script); color: var(--rose-deep); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* voice button (floats bottom-left once the card is open) */
.voice-fab {
  position: fixed; z-index: 70; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  font: 700 .92rem var(--ui); color: #fff; background: var(--rose); padding: 11px 16px; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(180, 40, 100, .35);
}
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; height: 40%; background: currentColor; border-radius: 2px; }
.playing .eq i { animation: eq .8s ease-in-out infinite; }
.playing .eq i:nth-child(2) { animation-delay: -.3s; }
.playing .eq i:nth-child(3) { animation-delay: -.55s; }
@keyframes eq { 50% { height: 100%; } }

.preview-banner {
  position: fixed; z-index: 90; top: calc(10px + env(safe-area-inset-top)); left: 50%; translate: -50% 0;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .85rem; padding: 7px 14px; border-radius: 999px;
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px 16px;
  background: rgba(60, 20, 60, .75); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lightbox figure { margin: 0; background: #fff; padding: 12px 12px 0; border-radius: 4px; max-width: min(560px, 100%); box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.lightbox img { display: block; max-width: 100%; max-height: 70dvh; margin: auto; }
.lightbox figcaption { font: 400 2rem/1 var(--script); text-align: center; padding: 12px 0 14px; color: var(--ink); }
.lightbox .close {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 1.1rem; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; top: calc(18px + env(safe-area-inset-top)); z-index: 120; translate: -50% -20px;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .3s, translate .3s;
}
.toast.show { opacity: 1; translate: -50% 0; }

:focus-visible { outline: 3px solid #8a3fc9; outline-offset: 3px; }

@media (max-width: 480px) {
  .note { padding: 34px 20px 30px; }
  .panel { padding: 26px 16px; }
}

/* calm version: no movement */
@media (prefers-reduced-motion: reduce) {
  .env-float, .seal, .intro h1.shimmer .ch, .fairy-bob, .fairy .f-wing, .fairy .f-hair-back, .fairy .f-skirt,
  .fairy .f-leg, .fairy .f-star-glow, .butterfly .b-wing, .scroll-cue i { animation: none !important; }
}
