/* ===================================================================
   FOR DEENA — aged-parchment / old-manuscript theme
   No emoji, no heart iconography — everything is hand-drawn in CSS/SVG.
   =================================================================== */

:root {
  --parchment-1: #ece0c2;
  --parchment-2: #ddc48b;
  --parchment-3: #c7a565;
  --ink: #2b1d10;
  --ink-light: #4a3621;
  --wood: #4a2f1a;
  --wood-dark: #241508;
  --gold: #a9802f;
  --burgundy: #6e1f2a;
  --burgundy-dark: #450f17;
  --rose: #b85a6a;
  --blush: #e7a8a6;
  --lavender: #aa8daf;
  --sage: #81966f;
  --shadow: rgba(10, 5, 2, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* scrolling is fully controlled by JS, not the browser */
  background: var(--parchment-1);
  color: var(--ink);
  font-family: 'IM Fell English', serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------
   Aged paper background — layered gradients, foxing stains,
   fiber texture, grain and a soft vignette for depth.
   --------------------------------------------------------------- */
body {
  background-image:
    /* foxing / age spots */
    radial-gradient(circle at 10% 20%, rgba(110, 72, 30, 0.14) 0%, transparent 7%),
    radial-gradient(circle at 82% 12%, rgba(110, 72, 30, 0.10) 0%, transparent 6%),
    radial-gradient(circle at 70% 88%, rgba(110, 72, 30, 0.15) 0%, transparent 8%),
    radial-gradient(circle at 22% 80%, rgba(110, 72, 30, 0.11) 0%, transparent 6%),
    radial-gradient(circle at 46% 48%, rgba(110, 72, 30, 0.07) 0%, transparent 9%),
    /* soft sheen */
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.22), transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(0,0,0,0.14), transparent 55%),
    /* paper fiber */
    repeating-linear-gradient(0deg, rgba(120,90,45,0.05) 0px, rgba(120,90,45,0.05) 1px, transparent 2px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(120,90,45,0.03) 0px, rgba(120,90,45,0.03) 1px, transparent 2px, transparent 5px),
    /* base tone */
    linear-gradient(135deg, var(--parchment-1), var(--parchment-2) 45%, var(--parchment-3));
  background-blend-mode: multiply, multiply, multiply, multiply, multiply, multiply, multiply, normal, normal, normal;
}

body::before {
  /* vignette */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(20, 10, 4, 0.38) 100%);
}

body::after {
  /* subtle grain */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  z-index: 5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
}

h1, h2, .old-font {
  font-family: 'MedievalSharp', cursive;
  color: var(--ink);
  text-shadow: 1px 1px 0 rgba(255,255,255,0.3), 2px 2px 3px rgba(0,0,0,0.25);
}

/* ---------------------------------------------------------------
   Ornamental page frame — thin gold double-line border + corners
   --------------------------------------------------------------- */
.page-frame {
  position: fixed;
  inset: 10px;
  z-index: 50;
  pointer-events: none;
  border: 1px solid rgba(169, 128, 47, 0.55);
  box-shadow: inset 0 0 0 4px rgba(36, 21, 8, 0.12), inset 0 0 0 5px rgba(169, 128, 47, 0.35);
}
.corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid var(--gold);
  opacity: 0.8;
}
.corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ---------------------------------------------------------------
   Desktop / big-screen block
   --------------------------------------------------------------- */
#desktop-block {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--parchment-2);
  text-align: center;
  padding: 2rem;
}
.desktop-block-card {
  max-width: 480px;
  padding: 3rem 2rem;
  border: 3px solid var(--wood);
  border-radius: 8px;
  background: var(--parchment-1);
  box-shadow: 0 0 0 6px var(--parchment-3), 0 20px 40px var(--shadow);
}
.desktop-block-card .phone-icon { color: var(--wood-dark); margin-bottom: 1rem; }
.desktop-block-card h1 { font-size: 1.6rem; margin: 0 0 1rem; }
.desktop-block-card p { font-size: 1.1rem; color: var(--ink-light); }

/* ---------------------------------------------------------------
   Intro overlay + envelope
   --------------------------------------------------------------- */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, var(--parchment-2), var(--parchment-3) 120%);
  transition: opacity 1s ease, visibility 1s ease;
  cursor: pointer;
}
#intro-overlay.opened {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.intro-card { text-align: center; padding: 2rem; }

.envelope {
  position: relative;
  width: 220px;
  height: 150px;
  margin: 0 auto 1.6rem;
  perspective: 900px;
  filter: drop-shadow(0 14px 18px var(--shadow));
}
.env-back {
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease 0.35s;
}
.env-back svg { width: 100%; height: 100%; display: block; }

.env-flap {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 63.3%; /* 95 / 150 */
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(.4,0,.2,1);
  backface-visibility: hidden;
}
.env-flap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.envelope.opening .env-flap { transform: rotateX(165deg); }

.env-seal {
  position: absolute;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #a8475a, var(--burgundy) 55%, var(--burgundy-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(0,0,0,0.45), inset 0 1px 2px rgba(255,255,255,0.3), inset 0 -2px 3px rgba(0,0,0,0.35);
  transition: transform 0.5s ease 0.2s, opacity 0.5s ease 0.2s;
  z-index: 3;
}
.env-seal::before {
  /* a small wax drip trailing below the seal */
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 9px;
  height: 13px;
  background: var(--burgundy-dark);
  border-radius: 0 0 50% 50% / 0 0 65% 65%;
  transform: translateX(-50%);
  z-index: -1;
  box-shadow: 0 2px 2px rgba(0,0,0,0.3);
}
.env-seal::after {
  /* glossy highlight */
  content: "";
  position: absolute;
  top: 7px;
  left: 10px;
  width: 13px;
  height: 7px;
  background: rgba(255,255,255,0.38);
  border-radius: 50%;
  filter: blur(1px);
}
.envelope.opening .env-seal { transform: translate(-50%, -50%) scale(1.6) rotate(10deg); opacity: 0; }
.env-seal-letter {
  font-family: 'Great Vibes', cursive;
  color: var(--parchment-1);
  font-size: 1.35rem;
  line-height: 1;
  transform: translateY(-1px);
}

.intro-title { font-size: 2rem; margin: 0.4rem 0 0.3rem; }
.intro-sub { font-style: italic; color: var(--ink-light); letter-spacing: 1px; }
.intro-notice {
  margin: 1.1rem auto 0;
  font-size: 0.75rem;
  color: var(--ink-light);
  opacity: 0.65;
  font-style: italic;
  max-width: 220px;
  text-align: center;
}

/* ---------------------------------------------------------------
   Music requirement gate — blocks the letter whenever playback stops
   --------------------------------------------------------------- */
.music-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 12, 4, 0.72);
  padding: 1.5rem;
}

/* ---------------------------------------------------------------
   Header / music player
   --------------------------------------------------------------- */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.08) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #5a3b22, var(--wood) 45%, var(--wood-dark));
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 12px var(--shadow), inset 0 2px 3px rgba(255,255,255,0.08), inset 0 -3px 6px rgba(0,0,0,0.5);
}
#site-header::before, #site-header::after {
  /* brass rivets */
  content: "";
  position: absolute;
  top: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e8c572, var(--gold) 70%, #6b4e1a 100%);
  box-shadow: 0 1px 1px rgba(0,0,0,0.5);
}
#site-header::before { left: 8px; }
#site-header::after { right: 8px; }

.old-btn {
  font-family: 'MedievalSharp', cursive;
  background: linear-gradient(160deg, #8a5a33, #5a3b22 60%, #3a2414);
  color: var(--parchment-1);
  border: 2px solid var(--wood-dark);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 2px rgba(255,255,255,0.15), inset 0 -3px 4px rgba(0,0,0,0.5), 0 3px 4px var(--shadow);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.old-btn::before {
  /* worn / scratched texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(35deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-50deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 9px);
  mix-blend-mode: overlay;
  pointer-events: none;
}
.old-btn:active { transform: translateY(1px); }

.play-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
#play-icon { position: relative; z-index: 1; }

.vinyl {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #222 0 8px, #111 9px 14px, #000 15px 40%, #1a1a1a 41% 100%);
  display: flex; align-items: center; justify-content: center;
  animation: spin 2.2s linear infinite;
  box-shadow: 0 0 0 2px var(--gold);
  overflow: hidden;
}
.vinyl::before {
  /* an asymmetric light-reflection streak so the spin is actually visible —
     a perfectly radial-symmetric record would look static while rotating */
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(from 20deg, rgba(255,255,255,0.3) 0deg, transparent 35deg, transparent 325deg, rgba(255,255,255,0.3) 360deg);
}
.vinyl-label {
  position: relative;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--burgundy);
  display: block;
}
.vinyl-label::after {
  /* off-center tick mark so rotation reads clearly even up close */
  content: "";
  position: absolute;
  top: -13px; left: 50%;
  width: 2px; height: 9px;
  background: rgba(255,255,255,0.55);
  transform: translateX(-50%);
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.player-controls { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }

.now-playing {
  min-width: 0;
  max-width: 190px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--parchment-1);
}
.mini-toggle {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(169, 128, 47, 0.18);
  border: 1px solid rgba(232, 197, 114, 0.6);
  color: var(--parchment-1);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.mini-toggle:active { transform: scale(0.92); }
.album-cover {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid rgba(232, 197, 114, 0.75);
  box-shadow: 0 2px 5px rgba(0,0,0,0.55);
}
.track-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.track-title,
.track-artist {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-title {
  font-size: 0.74rem;
  color: #fff6dd;
}
.track-meta {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  margin-top: 0.2rem;
}
.track-artist {
  font-size: 0.65rem;
  color: var(--parchment-2);
  opacity: 0.86;
}
.track-counter {
  font-size: 0.6rem;
  color: var(--gold);
  opacity: 0.9;
  white-space: nowrap;
}
.track-countdown {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.6rem;
  color: var(--parchment-2);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.lang-select { display: flex; gap: 0.3rem; }
.lang-btn {
  font-family: 'MedievalSharp', cursive;
  font-size: 0.7rem;
  background: var(--wood-dark);
  color: var(--parchment-2);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}
.lang-btn.active { background: var(--gold); color: var(--wood-dark); }

@media (max-width: 390px) {
  #site-header { padding-inline: 0.6rem; }
  .player-controls { gap: 0.35rem; }
  .now-playing { max-width: 156px; gap: 0.35rem; }
  .album-cover { width: 34px; height: 34px; flex-basis: 34px; }
  .track-title { font-size: 0.68rem; }
  .lang-select { gap: 0.2rem; }
  .lang-btn { padding-inline: 0.32rem; }
}

/* hidden youtube iframe */
#yt-player-holder {
  position: fixed;
  width: 2px; height: 2px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  bottom: 0; right: 0;
}

/* ---------------------------------------------------------------
   Popup modal
   --------------------------------------------------------------- */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 12, 4, 0.55);
  padding: 1.5rem;
}
.popup-card {
  background: var(--parchment-1);
  border: 3px solid var(--wood);
  border-radius: 10px;
  box-shadow: 0 0 0 5px var(--parchment-3), 0 18px 30px var(--shadow);
  padding: 1.5rem;
  max-width: 320px;
  text-align: center;
  animation: pop-in 0.35s ease;
}
@keyframes pop-in {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.popup-card p { font-size: 1.1rem; margin: 0 0 1rem; }
.popup-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.toast {
  position: fixed;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  background: var(--wood-dark);
  color: var(--parchment-1);
  border: 1px solid var(--gold);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  z-index: 900;
  font-style: italic;
  font-size: 0.9rem;
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------------------------
   Track / slides (locked scroll, JS-driven)
   --------------------------------------------------------------- */
#site { height: 100%; position: relative; }
#track {
  height: 100%;
  width: 100%;
  transition: transform 0.9s cubic-bezier(.65,0,.35,1);
  will-change: transform;
}
.slide {
  position: relative;
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.2rem 2rem;
}
#slide-finale {
  height: auto;
  min-height: 100vh;
  align-items: flex-start;
  padding-top: 6rem;
  padding-bottom: 5rem;
}
/* Once she reaches the finale there's nothing left to protect by locking
   scroll — a long letter should scroll like a normal page. Releasing the
   fixed height (not just overflow) lets the document genuinely grow
   taller as the letter is typed, rather than scrolling inside a
   same-size nested box. */
body.finale-reached,
html.finale-reached {
  overflow: auto;
  height: auto;
}
.slide::before {
  /* soft ambient candlelight glow behind the letter */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 40%, rgba(255, 196, 120, 0.22), transparent 55%);
  animation: glow-pulse 6s ease-in-out infinite;
  z-index: 0;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.parchment-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background:
    radial-gradient(circle at 12% 18%, rgba(110, 72, 30, 0.12), transparent 12%),
    radial-gradient(circle at 86% 78%, rgba(110, 72, 30, 0.1), transparent 15%),
    repeating-linear-gradient(0deg, rgba(94, 59, 22, 0.035) 0 1px, transparent 1px 4px),
    linear-gradient(145deg, #f3e8ca, var(--parchment-1) 52%, #d9bd82);
  border: 3px double rgba(74, 47, 26, 0.9);
  border-radius: 5px;
  padding: 2.25rem 1.7rem;
  text-align: center;
  box-shadow:
    0 0 0 4px rgba(199, 165, 101, 0.95),
    0 0 0 7px rgba(74, 47, 26, 0.88),
    0 0 0 9px rgba(169, 128, 47, 0.75),
    0 28px 50px rgba(8, 4, 1, 0.65),
    0 10px 18px rgba(8, 4, 1, 0.4),
    inset 0 0 44px rgba(120, 80, 30, 0.13);
  transition: transform 0.6s ease, opacity 0.6s ease;
}
.parchment-box::before {
  /* torn / deckled paper edge peeking out behind the clean writing surface */
  content: "";
  position: absolute;
  inset: -13px;
  background: var(--parchment-3);
  filter: url(#rough-edge);
  z-index: -2;
  transform: rotate(-0.6deg);
}
.parchment-box::after {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(169, 128, 47, 0.8);
  box-shadow:
    inset 0 0 0 3px rgba(74, 47, 26, 0.09),
    0 0 0 1px rgba(255, 247, 218, 0.4);
  background:
    linear-gradient(135deg, var(--gold) 0 6px, transparent 6px) top left / 22px 22px no-repeat,
    linear-gradient(225deg, var(--gold) 0 6px, transparent 6px) top right / 22px 22px no-repeat,
    linear-gradient(45deg, var(--gold) 0 6px, transparent 6px) bottom left / 22px 22px no-repeat,
    linear-gradient(315deg, var(--gold) 0 6px, transparent 6px) bottom right / 22px 22px no-repeat;
}
.parchment-box > * {
  position: relative;
  z-index: 3;
}
.parchment-box.dissolving {
  transform: scale(1.08);
  opacity: 0;
}

.whisper-label {
  font-style: italic;
  color: var(--ink-light);
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

/* ---------------------------------------------------------------
   Face reaction — rendered by React (react-kawaii, MIT licensed);
   this wrapper only owns the pulse/shake feedback animation.
   --------------------------------------------------------------- */
.face {
  width: 110px;
  height: 110px;
  margin: 0 auto 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.2));
}
.face.pulse { animation: face-pulse 0.35s ease; }
@keyframes face-pulse {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.face.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-3deg); }
  40% { transform: translateX(8px) rotate(3deg); }
  60% { transform: translateX(-6px) rotate(-2deg); }
  80% { transform: translateX(6px) rotate(2deg); }
}

.pw-input {
  width: 100%;
  font-family: 'MedievalSharp', cursive;
  font-size: 1.3rem;
  text-align: center;
  padding: 0.6rem;
  background: var(--parchment-2);
  border: 2px solid var(--wood);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  letter-spacing: 1px;
}
.pw-input:focus { box-shadow: 0 0 0 3px var(--gold) inset; }

#submit2 { margin-top: 0.9rem; }

.hint-bubble {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
}
.hint-bubble.whisper {
  color: var(--ink-light);
  font-style: italic;
  opacity: 0.85;
  background: transparent;
  animation: whisper-fade 1.8s ease;
  letter-spacing: 0.5px;
}
@keyframes whisper-fade {
  0% { opacity: 0; transform: translateY(4px) scale(0.96); }
  15% { opacity: 0.85; transform: translateY(0) scale(1); }
  80% { opacity: 0.85; }
  100% { opacity: 0.6; }
}
.hint-bubble.sad {
  color: var(--parchment-1);
  background: var(--burgundy);
  font-weight: bold;
}

.verify-mark {
  position: absolute;
  top: 38%;
  left: 50%;
  width: 150px;
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}
.verify-mark-path {
  fill: none;
  stroke: var(--burgundy);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-dashoffset 1s cubic-bezier(.65,0,.35,1);
}

.finale-box {
  max-width: 460px;
  position: relative;
  transform: translateY(70px) scaleX(0.08);
  transform-origin: center;
  opacity: 0;
}
.finale-box::before {
  /* accordion fold-crease lines, visible while still folded, fading once open */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.16) 0,
    rgba(0, 0, 0, 0.16) 1px,
    transparent 1px,
    transparent 16.6%
  );
  transition: opacity 0.6s ease;
  z-index: 2;
}
.finale-box.unfolding {
  animation: letter-rise-unfold 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.finale-box.unfolded::before {
  opacity: 0;
}
@keyframes letter-rise-unfold {
  0% { transform: translateY(70px) scaleX(0.08); opacity: 0; }
  40% { transform: translateY(0) scaleX(0.08); opacity: 1; }
  100% { transform: translateY(0) scaleX(1); opacity: 1; }
}
.finale-title { font-size: 2rem; margin-bottom: 0.6rem; }
.finale-content {
  font-family: 'Caveat', cursive;
  font-size: 1.55rem;
  line-height: 1.55;
  color: #3d3a34;
  text-align: left;
  white-space: pre-wrap;
}
.finale-content p { margin: 0 0 1.1rem; }
.finale-content a.photo-link {
  color: var(--burgundy);
  text-decoration: underline;
  text-decoration-style: wavy;
  cursor: pointer;
}
/* Typed.js's default cursor, restyled to read as a pencil mark rather
   than a text caret */
.typed-cursor {
  font-family: 'IM Fell English', serif;
  color: #4a4740;
  opacity: 0.75;
  font-weight: bold;
  display: inline-block;
  transform: rotate(18deg);
}
.flourish-divider { width: 70%; max-width: 220px; height: 16px; margin-top: 1.2rem; color: var(--gold); }
.finale-signature {
  font-family: 'Great Vibes', cursive;
  font-size: 2.1rem;
  color: var(--ink);
  text-align: right;
  margin-top: 0.4rem;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.finale-signature.revealed { opacity: 1; }

/* ---------------------------------------------------------------
   Flying blossoms (transition between gates) — hand-drawn SVG, no emoji
   --------------------------------------------------------------- */
.petal {
  position: fixed;
  z-index: 700;
  pointer-events: none;
  will-change: transform, opacity;
  animation-name: petal-fly;
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
}
.petal svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
@keyframes petal-fly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  32% { transform: translate(var(--tx1), var(--ty1)) rotate(var(--rot1)) scale(1.08); opacity: 1; }
  100% { transform: translate(var(--tx2), var(--ty2)) rotate(var(--rot2)) scale(0.45); opacity: 0; }
}

/* ---------------------------------------------------------------
   Small screens fine-tuning
   --------------------------------------------------------------- */
@media (max-width: 360px) {
  .intro-title { font-size: 1.6rem; }
}
