:root {
  --bg-0: #12060e;
  --bg-1: #1f0817;
  --gold: #e9c47e;
  --gold-hi: #fff0c8;
  --gold-dk: #b98a45;
  --blush: #f4b9c8;
  --rose: #d9577f;
  --wine: #7b1e3d;
  --cream: #fbf4ea;
  --ink: #3a1626;
  --muted: rgba(251, 244, 234, 0.7);

  --font-script: "Great Vibes", "Lalezar", cursive;
  --font-serif: "Cormorant Garamond", "Baloo Bhaijaan 2", Georgia, serif;
  --font-hand: "Caveat", "Baloo Bhaijaan 2", cursive;
  --font-fa: "Baloo Bhaijaan 2", "Vazirmatn", Tahoma, sans-serif;
  --font-fa-display: "Lalezar", "Baloo Bhaijaan 2", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg-0);
  color: var(--cream);
  font-family: var(--font-serif);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 50% -10%, #4b1431 0%, transparent 62%),
    radial-gradient(800px 700px at 105% 100%, #2c0c38 0%, transparent 60%),
    radial-gradient(700px 600px at -10% 70%, #3a0c22 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
}
body.lock { overflow: hidden; }

/* looping video behind everything; the tint keeps text readable on top of it */
.bg-video {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 45% 50%;
  pointer-events: none;
}
body.has-video::before { display: none; }

#sky, #confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#sky { z-index: -1; }
#confetti { z-index: 60; }

button { font: inherit; color: inherit; }

.scene {
  position: relative;
  padding: 48px 16px;
}

/* ---------- shared type ---------- */

.script {
  font-family: var(--font-script);
  font-weight: 400;
  line-height: 1.05;
  background: linear-gradient(180deg, var(--gold-hi) 10%, var(--gold) 55%, var(--gold-dk) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 22px rgba(233, 196, 126, 0.22));
  margin: 0;
}
.fa-display {
  font-family: var(--font-fa-display);
  font-weight: 400;
  color: var(--gold);
  line-height: 1.6;
  margin: 0;
}
.name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--cream);
  margin: 0;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 16px 34px;
  border-radius: 999px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 60%, #d6a85c);
  box-shadow: 0 10px 30px rgba(233, 196, 126, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(233, 196, 126, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:focus-visible { outline: 3px solid var(--blush); outline-offset: 4px; }
.btn.ghost {
  color: var(--gold-hi);
  background: rgba(233, 196, 126, 0.08);
  box-shadow: inset 0 0 0 1.5px rgba(233, 196, 126, 0.6);
}

/* ---------- login ---------- */

.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding-top: 120px;
}
.login-card {
  position: relative;
  width: min(380px, 100%);
  padding: 30px 24px 26px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffaf2, #f8eddd);
  color: var(--ink);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
  transition: opacity 0.6s, transform 0.6s;
}
.login-card.nudge { animation: nudge 0.5s ease-in-out; }
.login-card.leaving { opacity: 0; transform: translateY(-24px) scale(0.96); }
.login-card .fa-display {
  color: var(--wine);
  font-size: clamp(2rem, 9vw, 2.5rem);
  line-height: 1.5;
}
.login-sub {
  margin: 0 0 20px;
  font-size: 1.15rem;
  line-height: 1.4;
  color: rgba(58, 22, 38, 0.72);
}

/* the three kittens sit on the top edge of the card, paws over the rim */
.login-kittens {
  position: absolute;
  left: 50%;
  top: 14px;
  width: min(300px, 86%);
  translate: -50% -100%;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}
.login-kitten { flex: 1; }
.login-kitten:nth-child(2) { flex: 1.18; margin: 0 -6px 2px; position: relative; z-index: 1; }
.login-kitten svg { display: block; width: 100%; height: auto; overflow: visible; }
.k-look {
  transform: translate(var(--look-x, 0px), var(--look-y, 0px));
  transition: transform 0.2s ease-out;
}
.k-paw {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 0.4s cubic-bezier(0.3, 0.7, 0.3, 1.25);
}
.login-kittens.shy .k-paw.l { transform: translate(11px, -30px) rotate(-32deg) scale(1.55); }
.login-kittens.shy .k-paw.r { transform: translate(-11px, -30px) rotate(32deg) scale(1.55); }
.login-kittens.shy.peeking .k-paw.l { transform: translate(9px, -15px) rotate(-24deg) scale(1.4); }
.login-kittens.shy.peeking .k-paw.r { transform: translate(-9px, -15px) rotate(24deg) scale(1.4); }
.login-kittens.sad .login-kitten { animation: kitten-sad 0.6s ease-in-out; }
@keyframes kitten-sad {
  30% { transform: translateY(8px) rotate(-6deg); }
  65% { transform: translateY(8px) rotate(6deg); }
}
.login-kittens.cheer .login-kitten { animation: kitten-jump 0.5s ease-out 2; }
.login-kittens.cheer .login-kitten:nth-child(2) { animation-delay: 0.1s; }
.login-kittens.cheer .login-kitten:nth-child(3) { animation-delay: 0.2s; }
@keyframes kitten-jump { 50% { transform: translateY(-18px); } }

.field {
  display: block;
  margin: 0 0 14px;
  text-align: left;
}
.field > span:first-child {
  display: block;
  margin: 0 0 6px 4px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--wine);
}
.field input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid rgba(123, 30, 61, 0.2);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: 500 1.05rem/1.2 system-ui, sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  border-color: var(--gold-dk);
  box-shadow: 0 0 0 4px rgba(233, 196, 126, 0.35);
}
.pw { position: relative; display: block; }
.pw input { padding-right: 52px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  translate: 0 -50%;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.pw-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: rgba(123, 30, 61, 0.7);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.login-error {
  min-height: 1.5em;
  margin: 2px 0 10px;
  font-size: 1.05rem;
  color: var(--rose);
}
.login-card .btn { width: 100%; }

/* ---------- intro ---------- */

.intro {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 4px;
}
.intro h1 { margin: 0; font-weight: 400; }
.intro .fa-display {
  font-size: clamp(4rem, 18vw, 8.5rem);
  line-height: 1.25;
  text-wrap: balance;
  margin-bottom: 0.15em;
  background: linear-gradient(180deg, var(--gold-hi) 10%, var(--gold) 55%, var(--gold-dk) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 22px rgba(233, 196, 126, 0.22));
}
.intro .script { display: block; font-size: clamp(4rem, 18vw, 8.5rem); padding: 0 0.1em; }
.intro .name { display: block; font-size: clamp(2.1rem, 9vw, 3.8rem); margin-top: 0.1em; }
.lead {
  font-size: clamp(1.15rem, 4.4vw, 1.45rem);
  color: var(--muted);
  max-width: 28ch;
  margin: 22px auto 34px;
  line-height: 1.5;
}
.intro .btn { position: relative; }
.intro .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 10px 46px rgba(233, 196, 126, 0.55), 0 0 0 6px rgba(233, 196, 126, 0.08);
  opacity: 0;
  pointer-events: none;
  animation: glow 2.6s ease-in-out 3s infinite;
}

.reveal { opacity: 0; animation: rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.reveal:nth-child(1) { animation-delay: 0.2s; }
h1 .reveal:nth-child(1) { animation-delay: 0.55s; }
h1 .reveal:nth-child(2) { animation-delay: 1.05s; }
.lead.reveal { animation-delay: 1.5s; }
.btn.reveal { animation-delay: 1.9s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes glow { 50% { opacity: 1; } }

/* ---------- gifts ---------- */

.gifts { padding-top: 72px; }
.gifts-head { text-align: center; }
.gifts-head .script { font-size: clamp(3rem, 13vw, 5rem); }
.hint {
  margin: 6px 0 18px;
  font-size: 1.2rem;
  color: var(--muted);
  transition: color 0.4s;
}
.hint.done { color: var(--gold-hi); }
.progress {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--blush);
}
.progress .bar {
  width: 140px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.progress .bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gift-grid {
  --cols: 2;
  --gapx: 18px;
  list-style: none;
  margin: 0 auto;
  padding: 64px 4px 24px;
  max-width: 1040px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 70px var(--gapx);
}
@media (min-width: 640px) {
  .gift-grid { --cols: 3; --gapx: 40px; row-gap: 88px; }
}
@media (min-width: 980px) {
  .gift-grid { --cols: 4; --gapx: 48px; }
}

.gift {
  position: relative;
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gapx)) / var(--cols));
  animation: drop 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
  animation-delay: calc(var(--i) * 90ms + 150ms);
}
.gift.busy { z-index: 5; }
@keyframes drop {
  from { opacity: 0; transform: translateY(-50px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

.gift-btn {
  all: unset;
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--ar, 1 / 1.08);
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
}
.gift-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 10px; border-radius: 14px; }
@media (hover: hover) {
  .gift-btn:hover { transform: rotate(var(--tilt, 0deg)) translateY(-6px); }
}
/* floor shadow */
.gift-btn::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -14px;
  height: 22px;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55), transparent 70%);
  transition: opacity 0.5s;
}
.gift.opened .gift-btn::after { opacity: 0.6; }

.box {
  position: absolute;
  inset: 0;
}
.gift.wiggle:not(.opened):not(.busy) .box { animation: idle 0.9s ease-in-out; }
@keyframes idle {
  0%, 100% { transform: none; }
  20% { transform: rotate(-3deg) translateY(-3px); }
  45% { transform: rotate(3deg) translateY(-3px); }
  70% { transform: rotate(-1.5deg); }
  88% { transform: rotate(1deg); }
}
.gift.shake .box { animation: shake 0.4s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: rotate(-6deg) scale(1.04); }
  40% { transform: rotate(6deg) scale(1.06); }
  60% { transform: rotate(-4deg) scale(1.05); }
  80% { transform: rotate(3deg) scale(1.03); }
}

/* what's inside */
.inside {
  position: absolute;
  inset: 0;
  padding: 5px;
  border-radius: 10px;
  background: var(--cream);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.inside .media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  background: #2a1020;
}
.inside .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.inside .play span {
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(20, 6, 14, 0.55);
  backdrop-filter: blur(4px);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75);
}
.inside .play svg { width: 42%; fill: #fff; margin-left: 8%; }
.inside .cap {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  padding: 22px 8px 6px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(transparent, rgba(20, 5, 12, 0.78));
  font-family: var(--font-hand);
  font-size: max(1rem, 10cqw);
  line-height: 1.1;
  text-align: center;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift.tear .inside { animation: pop 0.7s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes pop {
  from { transform: scale(0.9); box-shadow: 0 0 0 rgba(233, 196, 126, 0); }
  50% { box-shadow: 0 0 60px rgba(233, 196, 126, 0.7); }
  to { transform: none; }
}

/* the wrapping */
.wrap { position: absolute; inset: 0; pointer-events: none; }
.gift.opened .wrap { display: none; }

.half {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.gift.tear .half { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); }
.half.l { transform-origin: 0% 100%; }
.half.r { transform-origin: 100% 100%; }
.sheet {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: inset 0 -8px 14px rgba(0, 0, 0, 0.16);
}
.sheet::after, .lid::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.24), transparent 34%, transparent 66%, rgba(0, 0, 0, 0.2)),
    linear-gradient(180deg, transparent 80%, rgba(0, 0, 0, 0.16));
}
.gift.tear .half.l { animation: tearL 0.9s cubic-bezier(0.45, 0, 0.6, 1) forwards; }
.gift.tear .half.r { animation: tearR 0.9s cubic-bezier(0.45, 0, 0.6, 1) forwards; }
@keyframes tearL {
  0% { transform: none; }
  18% { transform: translateX(-5%) rotate(-3deg); }
  55% { opacity: 1; }
  100% { transform: translate(-95%, 30%) rotate(-32deg); opacity: 0; }
}
@keyframes tearR {
  0% { transform: none; }
  18% { transform: translateX(5%) rotate(3deg); }
  55% { opacity: 1; }
  100% { transform: translate(95%, 36%) rotate(28deg); opacity: 0; }
}

.ribbon-fill-v {
  background: linear-gradient(90deg, var(--rb-dk), var(--rb) 22%, var(--rb-hi) 48%, var(--rb) 74%, var(--rb-dk));
}
.ribbon {
  position: absolute;
  transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}
.ribbon.v {
  z-index: 3;
  top: 0;
  bottom: 0;
  left: 43%;
  width: 14%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.28);
}
.ribbon.h {
  z-index: 2;
  left: 0;
  right: 0;
  top: 57%;
  height: 12%;
  background: linear-gradient(180deg, var(--rb-dk), var(--rb) 22%, var(--rb-hi) 48%, var(--rb) 74%, var(--rb-dk));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}
.gift.untie .ribbon.v { transform: translateY(45%) scaleY(0.5); opacity: 0; }
.gift.untie .ribbon.h { transform: translateX(70%) scaleX(0.3); opacity: 0; }

.lid {
  position: absolute;
  z-index: 4;
  left: -5%;
  right: -5%;
  top: -3%;
  height: 25%;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.65s cubic-bezier(0.3, 0.6, 0.4, 1), opacity 0.45s 0.2s;
}
.lid .ribbon-fill-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: calc(14% / 1.1);
  translate: -50% 0;
  z-index: 1;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.lid::after { z-index: 2; pointer-events: none; }
.gift.lift .lid { transform: translate(-6%, -190%) rotate(-18deg); opacity: 0; }

.bow {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  width: 50%;
  translate: -50% -58%;
  overflow: visible;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.35));
}
.bow .main { fill: var(--rb); }
.bow .dark { fill: var(--rb-dk); }
.bow .hi { fill: none; stroke: var(--rb-hi); stroke-width: 3; stroke-linecap: round; opacity: 0.85; }

.tag {
  position: absolute;
  z-index: 5;
  top: 29%;
  left: 62%;
  width: 34%;
  transform: rotate(-9deg);
  transform-origin: 0% 50%;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
  transition: transform 0.45s ease-in, opacity 0.45s ease-in;
}
.tag::before {
  content: "";
  position: absolute;
  right: 92%;
  top: 46%;
  width: 22%;
  height: 1.5px;
  background: var(--gold-hi);
  transform: rotate(28deg);
  transform-origin: 100% 50%;
}
.tag .card {
  display: grid;
  place-items: center;
  aspect-ratio: 1.55;
  padding-left: 18%;
  background:
    radial-gradient(circle at 14% 50%, rgba(58, 22, 38, 0.55) 0 5%, transparent 6%),
    var(--cream);
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 50%);
  color: var(--wine);
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: max(0.95rem, 12cqw);
  line-height: 1;
  white-space: nowrap;
}
.gift.untie .tag { transform: translateY(120%) rotate(50deg); opacity: 0; }

/* wrapping papers */
.p1 {
  --paper:
    radial-gradient(circle, #e7c27f 0 3px, transparent 3.6px) 0 0 / 22px 22px,
    radial-gradient(circle, #e7c27f 0 3px, transparent 3.6px) 11px 11px / 22px 22px,
    #efaebf;
  --rb: #8e1f43; --rb-hi: #d0587f; --rb-dk: #5c0f2a;
}
.p2 {
  --paper:
    repeating-linear-gradient(45deg, rgba(233, 196, 126, 0.6) 0 2px, transparent 2px 13px),
    #7b1e3d;
  --rb: #e3b96c; --rb-hi: #fff2cc; --rb-dk: #a37838;
}
.p3 {
  --paper:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-12 -12 48 48'%3E%3Cpath fill='%23cf4772' d='M12 21.4 10.6 20C5.4 15.4 2 12.3 2 8.5 2 5.4 4.4 3 7.5 3c1.7 0 3.4.8 4.5 2.1C13.1 3.8 14.8 3 16.5 3 19.6 3 22 5.4 22 8.5c0 3.8-3.4 6.9-8.6 11.5L12 21.4z'/%3E%3C/svg%3E") 0 0 / 36px 36px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-12 -12 48 48'%3E%3Cpath fill='%23e9a5b8' d='M12 21.4 10.6 20C5.4 15.4 2 12.3 2 8.5 2 5.4 4.4 3 7.5 3c1.7 0 3.4.8 4.5 2.1C13.1 3.8 14.8 3 16.5 3 19.6 3 22 5.4 22 8.5c0 3.8-3.4 6.9-8.6 11.5L12 21.4z'/%3E%3C/svg%3E") 18px 18px / 36px 36px,
    #f8eee2;
  --rb: #7b1e3d; --rb-hi: #c0476f; --rb-dk: #4d0c24;
}
.p4 {
  --paper:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='-14 -14 52 52'%3E%3Cpath fill='%23e9c47e' d='M12 2l2.9 6.9 7.1.6-5.4 4.7 1.6 7-6.2-3.8-6.2 3.8 1.6-7L2 9.5l7.1-.6z'/%3E%3C/svg%3E") 0 0 / 32px 32px,
    radial-gradient(circle, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.6px) 16px 16px / 32px 32px,
    #1f2a4f;
  --rb: #e3b96c; --rb-hi: #fff2cc; --rb-dk: #a37838;
}
.p5 {
  --paper:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 2px, transparent 2.6px) 0 0 / 16px 16px,
    #b7a0d8;
  --rb: #f8f1ff; --rb-hi: #ffffff; --rb-dk: #cdbfe3;
}
.p6 {
  --paper:
    repeating-linear-gradient(-45deg, #e7c27f 0 12px, #f3dca8 12px 24px),
    #e7c27f;
  --rb: #9a2047; --rb-hi: #d6507b; --rb-dk: #600f2c;
}
.p7 {
  --paper:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.24) 0 9px, transparent 9px 18px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0 9px, transparent 9px 18px),
    #d65a82;
  --rb: #fff4e2; --rb-hi: #ffffff; --rb-dk: #e8d3b8;
}
.p8 {
  --paper:
    radial-gradient(circle, rgba(70, 40, 10, 0.18) 0 1px, transparent 1.6px) 0 0 / 7px 7px,
    radial-gradient(circle, rgba(255, 255, 255, 0.16) 0 1px, transparent 1.6px) 3px 4px / 9px 9px,
    #c39a6b;
  --rb: #b4233f; --rb-hi: #e8607a; --rb-dk: #730f25;
}

/* ---------- viewer ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 64px 12px 88px;
}
.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 3, 9, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.35s;
}
.viewer.show .viewer-backdrop { opacity: 1; }
.viewer-card {
  position: relative;
  margin: 0;
  padding: 10px 10px 0;
  border-radius: 6px;
  background: var(--cream);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: scale(0.9) rotate(-2deg);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15), opacity 0.3s;
}
.viewer.show .viewer-card { opacity: 1; transform: none; }
.viewer-card.swap { animation: swap 0.35s ease-out; }
@keyframes swap {
  from { opacity: 0.2; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}
.viewer-media img,
.viewer-media video {
  display: block;
  max-width: min(calc(100vw - 44px), 960px);
  max-height: calc(100svh - 230px);
  width: auto;
  height: auto;
  border-radius: 3px;
  background: #140810;
}
.viewer-media video { min-width: min(260px, calc(100vw - 44px)); }
.viewer-card figcaption {
  width: 0;
  min-width: 100%;
  padding: 8px 8px 12px;
  font-family: var(--font-hand);
  font-size: 1.7rem;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
}
.viewer-card figcaption:empty { padding: 0 0 10px; }

.v-close, .v-nav {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(251, 244, 234, 0.12);
  box-shadow: inset 0 0 0 1px rgba(251, 244, 234, 0.25);
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.v-close:hover, .v-nav:hover { background: rgba(251, 244, 234, 0.22); }
.v-close svg, .v-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--cream);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.v-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
}
.v-bar {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 18px;
}
.v-nav:disabled { opacity: 0.3; cursor: default; }
.v-count {
  min-width: 64px;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--muted);
}

/* ---------- envelope & letter ---------- */

.letter-scene {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding-top: 80px;
  padding-bottom: 80px;
}
.envelope-wrap {
  display: grid;
  justify-items: center;
  gap: 26px;
  transition: opacity 0.6s, transform 0.6s;
}
.letter-scene.reading .envelope-wrap {
  opacity: 0;
  transform: translateY(-30px) scale(0.9);
  pointer-events: none;
}
.envelope {
  all: unset;
  position: relative;
  width: min(340px, 82vw);
  aspect-ratio: 1.55;
  cursor: pointer;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
}
.envelope:focus-visible { outline: 3px solid var(--gold); outline-offset: 10px; border-radius: 8px; }
.envelope > span { position: absolute; display: block; }
.env-back {
  inset: 0;
  border-radius: 8px;
  background: #e4cfb4;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
}
.env-paper {
  left: 7%;
  right: 7%;
  top: 8%;
  bottom: 6%;
  z-index: 1;
  display: grid !important;
  place-items: center;
  border-radius: 4px;
  background:
    repeating-linear-gradient(180deg, transparent 0 17px, rgba(123, 30, 61, 0.09) 17px 18px),
    #fffaf2;
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.3, 1) 0.55s;
}
.env-paper .fa-display { color: var(--wine); font-size: clamp(1.3rem, 6vw, 1.8rem); }
.env-pocket {
  inset: 0;
  z-index: 2;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.25), transparent 50%),
    #f2e2cb;
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.env-pocket::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent 49.6%, rgba(0, 0, 0, 0.07) 50%, transparent 50.6%),
              linear-gradient(to top left, transparent 49.6%, rgba(0, 0, 0, 0.07) 50%, transparent 50.6%);
}
.env-flap {
  left: 0;
  right: 0;
  top: 0;
  height: 60%;
  z-index: 3;
  background: linear-gradient(180deg, #ead7bc, #dcc3a2);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 8px 8px 0 0;
  transform-origin: 50% 0;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.3, 1) 0.15s, z-index 0s 0.45s;
}
.seal {
  z-index: 4;
  left: 50%;
  top: 60%;
  width: 22%;
  aspect-ratio: 1;
  translate: -50% -50%;
  display: grid !important;
  place-items: center;
  border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #b9365f, #7b1e3d 60%, #560f29);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 0 0 4px rgba(0, 0, 0, 0.12), inset 0 0 0 6px rgba(255, 255, 255, 0.06);
  transition: transform 0.4s cubic-bezier(0.5, -0.4, 0.6, 1), opacity 0.3s;
}
.seal svg { width: 46%; fill: rgba(255, 220, 230, 0.85); }
.seal .seal-lock { display: none; }
.envelope.locked .seal { filter: saturate(0.25) brightness(0.8); }
.envelope.locked .seal-heart { display: none; }
.envelope.locked .seal-lock { display: block; }
.envelope:not(.locked):not(.open) { animation: beckon 2.4s ease-in-out infinite; }
.envelope:not(.locked):not(.open) .env-back { box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5), 0 0 36px rgba(233, 196, 126, 0.4); }
@keyframes beckon {
  0%, 100% { transform: none; }
  50% { transform: translateY(-6px); }
}
.envelope.nudge { animation: nudge 0.5s ease-in-out; }
@keyframes nudge {
  0%, 100% { transform: none; }
  25% { transform: translateX(-8px) rotate(-2deg); }
  50% { transform: translateX(8px) rotate(2deg); }
  75% { transform: translateX(-4px); }
}
.envelope.open .seal { transform: scale(1.4) translateY(-40%); opacity: 0; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-paper { transform: translateY(-62%); }

.env-label {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--blush);
  text-align: center;
}
.env-label.flash { animation: flash 0.6s; }
@keyframes flash { 50% { color: var(--gold-hi); transform: scale(1.06); } }

.letter {
  position: relative;
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 44px 24px 52px;
  border-radius: 6px;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 70%),
    linear-gradient(180deg, #fffaf2, #f8eddd);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  font-family: var(--font-fa);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.letter.show { opacity: 1; transform: none; }
@media (min-width: 640px) {
  .letter { padding: 60px 64px 68px; }
  .letter-body p { text-align: justify; }
}
.letter h2 {
  text-align: center;
  color: var(--wine);
  font-size: clamp(3rem, 13vw, 5rem);
  line-height: 1.3;
}
.ornament {
  text-align: center;
  color: var(--gold-dk);
  font-size: 1.6rem;
  margin: -4px 0 18px;
}
.letter-body p {
  margin: 0 0 1.3em;
  font-size: clamp(1.2rem, 4.6vw, 1.4rem);
  line-height: 2;
  text-align: start;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.letter-body p.in { opacity: 1; transform: none; }
/* the opening line reads as a greeting */
.letter-body > p:first-child {
  font-family: var(--font-fa-display);
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  line-height: 1.6;
  text-align: center;
  color: var(--wine);
}
/* a poem in [ ] sits centred between two thin gold rules */
.letter-body .poem {
  margin: 0.4em 0 1.6em;
  padding: 1.3em 0 0.3em;
  border-top: 1px solid rgba(185, 138, 69, 0.45);
  border-bottom: 1px solid rgba(185, 138, 69, 0.45);
}
.letter-body .poem p {
  text-align: center;
  color: var(--wine);
  font-weight: 600;
  font-size: clamp(0.98rem, 4.4vw, 1.3rem);
  line-height: 2.2;
  margin-bottom: 1em;
  text-wrap: balance;
}
.signature {
  margin: 34px 0 0;
  text-align: end;
  font-family: var(--font-fa-display);
  font-size: clamp(2rem, 8vw, 2.6rem);
  color: var(--wine);
  line-height: 1.6;
}
.postscript {
  margin: 22px 0 0;
  text-align: center;
  font-size: 1.15rem;
  color: var(--rose);
}

/* ---------- finale ---------- */

.finale {
  min-height: 92svh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding-bottom: 96px;
}
.finale .script { font-size: clamp(3.6rem, 16vw, 7.5rem); }
.finale .name { font-size: clamp(1.9rem, 8vw, 3.2rem); }
.finale .fa-display { font-size: clamp(3.6rem, 16vw, 7.5rem); line-height: 1.3; color: var(--blush); margin: 10px 0 26px; }

/* ---------- music ---------- */

.music-btn {
  position: fixed;
  z-index: 40;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: rgba(233, 196, 126, 0.16);
  box-shadow: inset 0 0 0 1.5px rgba(233, 196, 126, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}
.music-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--gold-hi);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.music-btn.playing svg { animation: bob 1.2s ease-in-out infinite; }
.music-btn.off { opacity: 0.55; }
@keyframes bob { 50% { transform: translateY(-2px) rotate(-6deg); } }

/* ---------- kittens ---------- */

.kitten-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
}
.kitten-layer svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.peeker, .sitter, .walker, .box-peek, .sleepy {
  pointer-events: auto;
  will-change: transform;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.k-eyes {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: blink 4.4s infinite;
}
@keyframes blink {
  0%, 38%, 44%, 66%, 72%, 100% { transform: none; }
  41%, 69% { transform: scaleY(0.1); }
}
.happy svg { animation: kitten-happy 0.45s ease-out 2; }
@keyframes kitten-happy { 50% { transform: translateY(-12%) scale(1.08); } }

/* kittens 1-3 popping up in their box along the bottom */
.box-peek {
  position: absolute;
  bottom: -4px;
  aspect-ratio: 1;
  translate: -50% 0;
  transform: translateY(105%);
  transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.box-peek.show { transform: none; }
.box-peek dotlottie-wc { display: block; width: 100%; height: 100%; }

/* peeking in from the sides and the top; the anchor sits on the edge, rotated to face inward */
.peek-anchor { position: absolute; width: 0; height: 0; }
.peeker {
  position: absolute;
  left: 0;
  bottom: 0;
  translate: -50% 0;
  transform-origin: 50% 100%;
  animation: peek 4.4s cubic-bezier(0.3, 0.7, 0.3, 1) forwards;
}
@keyframes peek {
  0% { transform: translateY(105%); }
  16% { transform: translateY(4%); }
  30% { transform: translateY(4%) rotate(-8deg); }
  46% { transform: translateY(4%) rotate(7deg); }
  60% { transform: translateY(4%) rotate(0deg); }
  84% { transform: translateY(4%); }
  100% { transform: translateY(105%); }
}

/* sitting up at the bottom for a few seconds */
.sitter {
  position: absolute;
  bottom: -3px;
  transform-origin: 50% 100%;
  animation: kitten-sit 6.5s cubic-bezier(0.3, 0.7, 0.3, 1) forwards;
}
.sitter.flip svg { scale: -1 1; }
@keyframes kitten-sit {
  0% { transform: translateY(105%); }
  9% { transform: translateY(-5%); }
  13%, 88% { transform: none; }
  100% { transform: translateY(105%); }
}
.ks-tail {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: kitten-tail 1.6s ease-in-out infinite alternate;
}

/* strolling along the bottom */
.walker {
  position: absolute;
  left: 0;
  bottom: max(2px, env(safe-area-inset-bottom));
  animation: walk var(--dur, 12s) linear forwards;
}
.walker.rtl { animation-name: walk-rtl; }
.walker svg {
  animation: kitten-bob 0.3s ease-in-out infinite alternate;
}
.walker.rtl svg { scale: -1 1; }
@keyframes walk { from { transform: translateX(-110%); } to { transform: translateX(100vw); } }
@keyframes walk-rtl { from { transform: translateX(100vw); } to { transform: translateX(-110%); } }
@keyframes kitten-bob { to { translate: 0 -2px; } }
.kw-leg {
  transform-box: fill-box;
  transform-origin: 50% 10%;
  animation: kitten-step 0.6s ease-in-out infinite;
}
.kw-leg.b { animation-delay: -0.3s; }
@keyframes kitten-step {
  0%, 100% { transform: rotate(18deg); }
  50% { transform: rotate(-18deg); }
}
.kw-tail {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  animation: kitten-tail 1.4s ease-in-out infinite alternate;
}
@keyframes kitten-tail {
  from { transform: rotate(-8deg); }
  to { transform: rotate(10deg); }
}

/* asleep on top of the letter */
.sleepy {
  position: absolute;
  top: 0;
  left: 14px;
  width: 150px;
  translate: 0 -90%;
}
.ks-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: kitten-breathe 3.4s ease-in-out infinite;
}
@keyframes kitten-breathe { 50% { transform: scaleY(1.05); } }
.sleepy .z {
  position: absolute;
  left: 78%;
  top: 0;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--gold-hi);
  opacity: 0;
  animation: kitten-z 3.6s ease-in infinite;
}
.sleepy .z:nth-of-type(2) { animation-delay: 1.2s; }
.sleepy .z:nth-of-type(3) { animation-delay: 2.4s; }
@keyframes kitten-z {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(22px, -44px) scale(1.25) rotate(14deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
