:root {
  --ink: #4d261f;
  --muted: #8c5948;
  --cream: #fff4dd;
  --paper: #ffe9c2;
  --paper-deep: #efbd80;
  --rose: #bc3f36;
  --rose-dark: #812119;
  --gold: #ffd36b;
  --peach: #ff9f79;
  --violet: #7d58d8;
  --aqua: #68ddd2;
  --mx: 0px;
  --my: 0px;
}

@font-face {
  font-family: "BirthdayPoem";
  src: url("assets/fonts/birthday-poem.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  font-family: "BirthdayPoem", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: #f5c08f;
}

.birthday-stage {
  position: relative;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(28px, 5vw, 72px);
  isolation: isolate;
}

.bg-photo,
.warm-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-photo {
  z-index: -3;
  background-image: url("assets/images/couple-bg.png");
  background-position: center;
  background-size: cover;
  filter: blur(15px) saturate(1.08);
  transform: scale(1.08);
}

.warm-veil {
  z-index: -2;
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 229, 177, 0.84), transparent 32%),
    radial-gradient(circle at 78% 24%, rgba(255, 166, 134, 0.54), transparent 30%),
    radial-gradient(circle at 50% 76%, rgba(126, 62, 38, 0.46), transparent 40%),
    linear-gradient(135deg, rgba(255, 242, 220, 0.56), rgba(255, 178, 124, 0.28));
  box-shadow: inset 0 0 120px rgba(90, 32, 20, 0.3);
}

.birthday-stage::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black, transparent 74%);
  opacity: 0.35;
}

.music-toggle {
  position: fixed;
  left: clamp(16px, 3vw, 32px);
  top: clamp(16px, 3vw, 30px);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 96px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(100, 47, 26, 0.18);
  border-radius: 999px;
  color: #3a2219;
  background: rgba(255, 239, 210, 0.72);
  box-shadow:
    0 12px 28px rgba(92, 35, 16, 0.18),
    inset 0 1px rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.music-toggle:hover {
  transform: translateY(-2px);
  background: rgba(255, 231, 188, 0.86);
  box-shadow:
    0 15px 32px rgba(92, 35, 16, 0.22),
    inset 0 1px rgba(255, 255, 255, 0.7);
}

.music-toggle:active {
  transform: translateY(0) scale(0.98);
}

.music-bars {
  display: inline-flex;
  align-items: end;
  gap: 3px;
  width: 20px;
  height: 18px;
}

.music-bars i {
  display: block;
  width: 4px;
  height: 9px;
  border-radius: 999px;
  background: #2c1b14;
}

.music-bars i:nth-child(2) {
  height: 15px;
}

.music-bars i:nth-child(3) {
  height: 11px;
}

.music-toggle.playing .music-bars i {
  animation: musicBeat 0.82s ease-in-out infinite;
}

.music-toggle.playing .music-bars i:nth-child(2) {
  animation-delay: -0.22s;
}

.music-toggle.playing .music-bars i:nth-child(3) {
  animation-delay: -0.42s;
}

.envelope-scene {
  position: relative;
  width: min(86vw, 860px);
  min-height: clamp(420px, 58vw, 610px);
  transform: translate3d(calc(var(--mx) * 0.18), calc(var(--my) * 0.16), 0) rotate(-3.5deg);
  transform-origin: center;
  outline: none;
  animation: sceneFloat 7s ease-in-out infinite;
}

.wax-seal:focus-visible {
  outline: none;
  box-shadow: none;
  filter:
    brightness(1.04)
    drop-shadow(0 0 10px rgba(255, 228, 138, 0.72))
    drop-shadow(0 14px 18px rgba(117, 42, 22, 0.18));
}

.letter-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vw, 630px);
  height: clamp(270px, 35vw, 390px);
  transform: translate(-50%, -46%);
  filter: drop-shadow(0 38px 48px rgba(81, 31, 16, 0.28));
}

.letter-note {
  position: absolute;
  left: 50%;
  top: -3%;
  z-index: 1;
  width: 78%;
  min-height: 218px;
  padding: 30px 38px 34px;
  transform: translateX(-50%) translateY(94px) rotate(1.2deg);
  color: #6b3329;
  background:
    linear-gradient(145deg, rgba(255, 253, 240, 0.98), rgba(255, 238, 207, 0.97)),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(197, 124, 79, 0.11) 31px 32px);
  border: 1px solid rgba(151, 88, 48, 0.26);
  border-radius: 8px;
  box-shadow: 0 18px 32px rgba(102, 48, 22, 0.14);
  isolation: isolate;
  overflow: hidden;
  opacity: 0.72;
  transition:
    top 980ms cubic-bezier(0.19, 1, 0.22, 1),
    width 980ms cubic-bezier(0.19, 1, 0.22, 1),
    min-height 980ms cubic-bezier(0.19, 1, 0.22, 1),
    padding 980ms cubic-bezier(0.19, 1, 0.22, 1),
    transform 980ms cubic-bezier(0.19, 1, 0.22, 1),
    opacity 680ms ease,
    box-shadow 980ms ease;
}

.letter-kicker {
  position: relative;
  z-index: 3;
  margin-bottom: 10px;
  color: #a05a3a;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.letter-copy {
  position: relative;
  z-index: 3;
  height: calc(100% - 74px);
}

.letter-vines {
  position: absolute;
  inset: 10px 12px;
  z-index: 1;
  opacity: 0.74;
  pointer-events: none;
  transition: opacity 680ms ease;
}

.vine-line {
  position: absolute;
  display: block;
  border-color: rgba(94, 128, 68, 0.58);
  filter: drop-shadow(0 1px 0 rgba(255, 245, 212, 0.62));
}

.vine-top {
  left: 8%;
  top: 8px;
  width: 74%;
  height: 42px;
  border-top: 2px solid rgba(96, 129, 71, 0.62);
  border-radius: 54% 46% 0 0;
  transform: rotate(-1.6deg);
}

.vine-left {
  left: 9px;
  top: 13%;
  width: 44px;
  height: 68%;
  border-left: 2px solid rgba(96, 129, 71, 0.58);
  border-radius: 64% 0 0 48%;
  transform: rotate(1.5deg);
}

.vine-right {
  right: 8px;
  top: 12%;
  width: 46px;
  height: 69%;
  border-right: 2px solid rgba(96, 129, 71, 0.6);
  border-radius: 0 60% 52% 0;
  transform: rotate(-1.2deg);
}

.vine-bottom {
  left: 12%;
  bottom: 9px;
  width: 72%;
  height: 40px;
  border-bottom: 2px solid rgba(96, 129, 71, 0.52);
  border-radius: 0 0 52% 48%;
  transform: rotate(1.1deg);
}

.vine-leaf {
  position: absolute;
  width: clamp(12px, 1.7vw, 18px);
  height: clamp(20px, 2.5vw, 28px);
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, rgba(139, 172, 94, 0.92), rgba(92, 139, 83, 0.88));
  box-shadow: inset 1px 1px 0 rgba(255, 255, 218, 0.34);
}

.leaf-a {
  left: 16%;
  top: 1%;
  transform: rotate(48deg);
}

.leaf-b {
  left: 36%;
  top: 4%;
  transform: rotate(-132deg);
}

.leaf-c {
  right: 6%;
  top: 29%;
  transform: rotate(-44deg);
}

.leaf-d {
  left: 2%;
  bottom: 24%;
  transform: rotate(128deg);
}

.leaf-e {
  right: 18%;
  bottom: 3%;
  transform: rotate(-118deg);
}

.leaf-f {
  left: 30%;
  bottom: 2%;
  transform: rotate(58deg);
}

.vine-flower,
.vine-bud {
  position: absolute;
  display: block;
  filter: drop-shadow(0 4px 5px rgba(119, 58, 35, 0.12));
}

.vine-flower {
  width: clamp(26px, 3.4vw, 38px);
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 50% 50%, #ffd07a 0 14%, transparent 15%),
    radial-gradient(ellipse at 50% 8%, rgba(255, 155, 148, 0.92) 0 25%, transparent 26%),
    radial-gradient(ellipse at 91% 50%, rgba(255, 155, 148, 0.88) 0 25%, transparent 26%),
    radial-gradient(ellipse at 50% 92%, rgba(255, 155, 148, 0.9) 0 25%, transparent 26%),
    radial-gradient(ellipse at 9% 50%, rgba(255, 155, 148, 0.88) 0 25%, transparent 26%);
}

.vine-flower-a {
  left: 4%;
  top: 3%;
  transform: rotate(-18deg);
}

.vine-flower-b {
  right: 2%;
  top: 11%;
  width: clamp(22px, 3vw, 32px);
  transform: rotate(17deg);
}

.vine-flower-c {
  right: 10%;
  bottom: 1%;
  width: clamp(24px, 3.1vw, 34px);
  transform: rotate(-9deg);
}

.vine-bud {
  width: clamp(11px, 1.6vw, 16px);
  height: clamp(16px, 2.2vw, 22px);
  border-radius: 70% 70% 64% 64%;
  background: linear-gradient(160deg, #ffb1a4, #ee7f78);
}

.vine-bud::after {
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 14px;
  height: 8px;
  content: "";
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent 0 18%, #6d9a63 18% 42%, transparent 42% 58%, #6d9a63 58% 82%, transparent 82%);
}

.bud-a {
  left: 62%;
  top: 3%;
  transform: rotate(18deg);
}

.bud-b {
  right: 2%;
  bottom: 26%;
  transform: rotate(-18deg);
}

.bud-c {
  left: 5%;
  bottom: 8%;
  transform: rotate(12deg);
}

.letter-page {
  margin: 0;
  padding: 0 4px;
  font-size: clamp(18px, 2.05vw, 25px);
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: 0;
  white-space: pre-line;
  overflow: hidden;
}

.letter-page-top {
  height: 7.55em;
  text-align: left;
}

.letter-page-side {
  height: calc(100% - 7.55em - 2px);
  margin-top: 2px;
  margin-right: 4px;
  margin-left: clamp(170px, 22vw, 226px);
  text-align: left;
}

.letter-page.typing::after {
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 4px;
  content: "";
  transform: translateY(0.12em);
  background: rgba(108, 47, 34, 0.7);
  animation: caretBlink 0.8s steps(1) infinite;
}

.letter-page.typed::after {
  opacity: 0;
}

.page-measurer {
  position: absolute;
  left: -9999px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
}

.letter-page-top.page-measurer {
  width: 100%;
}

.letter-page-side.page-measurer {
  width: calc(100% - clamp(170px, 22vw, 226px) - 4px);
}

.letter-photo {
  position: absolute;
  left: clamp(24px, 4vw, 44px);
  bottom: clamp(18px, 2.6vw, 30px);
  width: clamp(128px, 16vw, 172px);
  aspect-ratio: 1.18;
  object-fit: cover;
  object-position: center 42%;
  border: 1px solid rgba(150, 82, 45, 0.2);
  border-radius: 8px;
  box-shadow:
    0 12px 24px rgba(104, 44, 20, 0.18),
    inset 0 1px rgba(255, 255, 255, 0.72);
  opacity: 0;
  transform: translateY(12px) rotate(-4deg);
  transition: opacity 620ms ease 860ms, transform 620ms ease 860ms;
}

.letter-signature {
  position: absolute;
  right: clamp(28px, 5vw, 56px);
  bottom: clamp(28px, 4vw, 42px);
  z-index: 6;
  color: #7f3d2e;
  font-size: clamp(19px, 2.2vw, 28px);
  font-weight: 900;
  letter-spacing: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transform: translateY(12px) rotate(-2deg);
  transition: opacity 620ms ease 980ms, color 220ms ease, filter 220ms ease, transform 620ms ease 980ms;
}

.letter-signature.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) rotate(-2deg);
}

.letter-signature.visible:hover {
  color: #b45a3a;
  filter: drop-shadow(0 4px 6px rgba(131, 57, 28, 0.16));
  transform: translateY(-2px) rotate(-3deg);
}

.letter-signature:focus-visible {
  outline: none;
  color: #b45a3a;
  text-shadow: 0 0 10px rgba(255, 207, 134, 0.86);
}

.letter-egg-note {
  position: absolute;
  right: clamp(70px, 10vw, 126px);
  bottom: clamp(78px, 9vw, 112px);
  z-index: 5;
  color: rgba(128, 61, 44, 0.76);
  font-size: clamp(16px, 1.75vw, 22px);
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) rotate(-2deg);
  transition: opacity 520ms ease 780ms, transform 520ms ease 780ms;
}

.letter-egg-note.visible {
  opacity: 1;
  transform: translateY(0) rotate(-2deg);
}

.letter-easter {
  position: absolute;
  inset: clamp(32px, 4vw, 48px) clamp(34px, 5vw, 58px);
  z-index: 8;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) rotate(-0.8deg) scale(0.98);
  transition: opacity 680ms ease, transform 780ms cubic-bezier(0.19, 1, 0.22, 1);
}

.easter-title {
  z-index: 2;
  margin: 4px 0 18px;
  color: #7f3d2e;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(255, 229, 184, 0.82);
}

.easter-photo {
  z-index: 2;
  width: min(88%, 590px);
  max-height: min(55vh, 370px);
  aspect-ratio: 1.28;
  object-fit: cover;
  object-position: center 46%;
  border-radius: 12px;
  box-shadow:
    0 18px 34px rgba(108, 47, 24, 0.22),
    0 0 0 8px rgba(255, 249, 231, 0.78);
  transform: rotate(-3.5deg);
}

.easter-flower {
  position: absolute;
  z-index: 1;
  width: clamp(42px, 5vw, 64px);
  aspect-ratio: 1;
  opacity: 0.82;
  filter: drop-shadow(0 8px 10px rgba(129, 54, 28, 0.12));
  background:
    radial-gradient(circle at 50% 50%, #ffd278 0 14%, transparent 15%),
    radial-gradient(ellipse at 50% 10%, rgba(255, 154, 148, 0.92) 0 24%, transparent 25%),
    radial-gradient(ellipse at 90% 50%, rgba(255, 154, 148, 0.92) 0 24%, transparent 25%),
    radial-gradient(ellipse at 50% 90%, rgba(255, 154, 148, 0.92) 0 24%, transparent 25%),
    radial-gradient(ellipse at 10% 50%, rgba(255, 154, 148, 0.92) 0 24%, transparent 25%);
}

.flower-a {
  left: 3%;
  top: 11%;
  transform: rotate(-18deg);
}

.flower-b {
  right: 5%;
  top: 16%;
  width: clamp(34px, 4vw, 52px);
  transform: rotate(16deg);
}

.flower-c {
  left: 10%;
  bottom: 11%;
  width: clamp(32px, 4vw, 50px);
  transform: rotate(22deg);
}

.flower-d {
  right: 9%;
  bottom: 8%;
  transform: rotate(-10deg);
}

.envelope-scene.easter-open .letter-kicker,
.envelope-scene.easter-open .letter-copy,
.envelope-scene.easter-open .letter-photo,
.envelope-scene.easter-open .letter-signature,
.envelope-scene.easter-open .letter-egg-note,
.envelope-scene.easter-open .page-next {
  opacity: 0;
  pointer-events: none;
}

.envelope-scene.easter-open .letter-easter {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) rotate(-0.8deg) scale(1);
}

.page-next {
  position: absolute;
  right: clamp(30px, 5vw, 58px);
  bottom: clamp(25px, 3.4vw, 40px);
  z-index: 4;
  display: grid;
  width: clamp(62px, 6vw, 82px);
  height: clamp(40px, 4vw, 54px);
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 5px 5px rgba(75, 36, 18, 0.18));
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.18, 1.25, 0.4, 1), filter 220ms ease;
}

.page-next[hidden] {
  display: none;
}

.page-next:hover {
  filter: drop-shadow(8px 6px 0 rgba(126, 64, 36, 0.13));
  transform: translateX(7px) rotate(-4deg) scale(1.06);
}

.page-next:active {
  transform: translateX(12px) rotate(-4deg) scale(0.98);
}

.page-next span {
  position: relative;
  display: block;
  width: clamp(44px, 5vw, 62px);
  height: 3px;
  border-radius: 999px;
  background: #241812;
  transform: rotate(-3deg);
}

.page-next span::before,
.page-next span::after {
  position: absolute;
  right: -2px;
  width: 20px;
  height: 3px;
  content: "";
  border-radius: 999px;
  background: #241812;
  transform-origin: right center;
}

.page-next span::before {
  top: 0;
  transform: rotate(35deg);
}

.page-next span::after {
  bottom: 0;
  transform: rotate(-35deg);
}

.page-next::before,
.page-next::after {
  position: absolute;
  content: "";
  background: #241812;
  opacity: 0;
  transition: opacity 180ms ease, transform 220ms ease;
}

.page-next::before {
  left: 2px;
  top: 6px;
  width: 12px;
  height: 2px;
  transform: translateX(8px) rotate(-16deg);
}

.page-next::after {
  left: 7px;
  bottom: 8px;
  width: 16px;
  height: 2px;
  transform: translateX(8px) rotate(10deg);
}

.page-next:hover::before,
.page-next:hover::after {
  opacity: 0.65;
  transform: translateX(0) rotate(var(--slash-rotate, -16deg));
}

.page-next:hover::after {
  --slash-rotate: 10deg;
}

.envelope-scene.opened .letter-note {
  top: 50%;
  z-index: 7;
  width: min(90vw, 760px);
  height: min(84vh, 560px);
  min-height: min(84vh, 560px);
  padding: clamp(34px, 4vw, 52px) clamp(34px, 5vw, 62px);
  transform: translate(-50%, -50%) rotate(1deg);
  opacity: 1;
  box-shadow:
    0 30px 70px rgba(84, 29, 12, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.82);
}

.envelope-scene.opened .letter-photo {
  opacity: 1;
  transform: translateY(0) rotate(-4deg);
}

.envelope-scene.opened.easter-open .letter-kicker,
.envelope-scene.opened.easter-open .letter-copy,
.envelope-scene.opened.easter-open .letter-photo,
.envelope-scene.opened.easter-open .letter-signature,
.envelope-scene.opened.easter-open .letter-egg-note,
.envelope-scene.opened.easter-open .page-next {
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.envelope {
  position: absolute;
  inset: 16% 0 0;
  z-index: 2;
  overflow: hidden;
  border: 1px solid rgba(130, 67, 35, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 248, 230, 0.94), rgba(255, 224, 176, 0.98) 54%, rgba(238, 178, 117, 0.97)),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.72),
    inset 0 -18px 44px rgba(178, 95, 41, 0.18),
    0 32px 70px rgba(85, 28, 14, 0.26);
  transition:
    transform 900ms cubic-bezier(0.19, 1, 0.22, 1),
    opacity 760ms ease,
    filter 760ms ease;
}

.envelope-scene.opened .envelope {
  transform: translateY(58px) scale(0.94);
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
}

.paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.25;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(118, 55, 30, 0.16) 0 1px, transparent 1.5px),
    radial-gradient(circle at 76% 66%, rgba(118, 55, 30, 0.14) 0 1px, transparent 1.5px);
  background-size: 27px 31px, 37px 29px;
}

.flap {
  position: absolute;
  border: 1px solid rgba(121, 63, 34, 0.2);
  background: linear-gradient(145deg, rgba(255, 244, 218, 0.86), rgba(236, 175, 111, 0.72));
}

.flap-top {
  left: 50%;
  top: -47%;
  width: 76%;
  height: 82%;
  transform: translateX(-50%) rotate(45deg);
  transform-origin: center;
  transition: transform 740ms cubic-bezier(0.19, 1, 0.22, 1), opacity 740ms ease, filter 740ms ease;
}

.flap-left {
  left: -27%;
  bottom: -34%;
  width: 66%;
  height: 92%;
  transform: rotate(45deg);
}

.flap-right {
  right: -27%;
  bottom: -34%;
  width: 66%;
  height: 92%;
  transform: rotate(45deg);
}

.flap-bottom {
  left: 50%;
  bottom: -57%;
  z-index: 3;
  width: 86%;
  height: 118%;
  transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(145deg, rgba(255, 232, 188, 0.96), rgba(225, 151, 91, 0.88));
}

.envelope-scene.opened .flap-top {
  transform: translateX(-50%) translateY(-26%) rotate(45deg) scaleY(0.58);
  opacity: 0.62;
  filter: brightness(1.05);
}

.wax-seal {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 5;
  display: grid;
  width: clamp(150px, 19vw, 202px);
  height: clamp(122px, 15vw, 158px);
  place-items: end center;
  padding: 0;
  transform: translate(-50%, -50%) rotate(3deg);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  color: #8a4435;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  box-shadow: none;
  animation: cakeButtonFloat 3.8s ease-in-out infinite;
  transition: transform 220ms ease, filter 220ms ease;
}

.wax-seal:hover {
  filter:
    brightness(1.05)
    saturate(1.04)
    drop-shadow(0 14px 16px rgba(91, 35, 15, 0.12));
  transform: translate(-50%, -50%) rotate(-2deg) scale(1.04);
}

.wax-seal:active {
  transform: translate(-50%, -48%) rotate(1deg) scale(0.98);
}

.wax-seal::before {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 0;
  height: 52%;
  content: "";
  border: 0;
  border-radius: 0 0 26px 26px;
  background:
    radial-gradient(circle at 18% 36%, rgba(255, 246, 219, 0.68) 0 7px, transparent 8px),
    radial-gradient(circle at 47% 42%, rgba(255, 246, 219, 0.62) 0 8px, transparent 9px),
    radial-gradient(circle at 76% 36%, rgba(255, 246, 219, 0.64) 0 7px, transparent 8px),
    linear-gradient(180deg, #ffb8a0 0 23%, #f27d62 24% 55%, #d95244 56% 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.36),
    inset 0 -10px 18px rgba(132, 41, 28, 0.16),
    0 8px 14px rgba(126, 50, 28, 0.16);
}

.wax-seal::after {
  position: absolute;
  left: 50%;
  top: 28%;
  width: 86%;
  height: 25%;
  content: "";
  transform: translateX(-50%);
  border-radius: 999px 999px 14px 14px;
  background:
    radial-gradient(circle at 14% 70%, #fff3cf 0 12px, transparent 13px),
    radial-gradient(circle at 36% 70%, #fff3cf 0 13px, transparent 14px),
    radial-gradient(circle at 58% 70%, #fff3cf 0 13px, transparent 14px),
    radial-gradient(circle at 80% 70%, #fff3cf 0 12px, transparent 13px),
    linear-gradient(180deg, #fff7dc 0%, #ffe4a4 100%);
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.65),
    0 4px 9px rgba(140, 64, 31, 0.14);
}

.wax-seal span {
  position: relative;
  z-index: 5;
  width: 4.8em;
  margin-bottom: clamp(15px, 1.6vw, 20px);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 240, 195, 0.72),
    0 2px 5px rgba(120, 42, 21, 0.18);
}

.cake-layer,
.cake-candle,
.cake-cream {
  position: absolute;
  z-index: 4;
  display: block;
  pointer-events: none;
}

.cake-layer-top {
  left: 13%;
  right: 13%;
  top: 38%;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff87a2, #ffd166, #ff87a2);
  box-shadow: 0 2px 0 rgba(132, 52, 31, 0.12);
}

.cake-layer-bottom {
  left: 11%;
  right: 11%;
  bottom: 27%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 244, 202, 0.72);
}

.cake-candle {
  left: 50%;
  top: -4px;
  width: 15px;
  height: 42px;
  transform: translateX(-50%);
  border-radius: 8px;
  border: 0;
  background: repeating-linear-gradient(135deg, #fff4bd 0 8px, #ff7891 8px 14px);
  box-shadow: 0 6px 10px rgba(117, 48, 25, 0.08);
}

.cake-candle::before {
  position: absolute;
  left: 50%;
  top: -16px;
  width: 15px;
  height: 18px;
  content: "";
  transform: translateX(-50%) rotate(8deg);
  border-radius: 50% 50% 50% 0;
  background: #ffc84f;
  box-shadow: 0 0 16px rgba(255, 194, 79, 0.72);
}

.cake-cream {
  left: 16%;
  right: 16%;
  top: 24%;
  height: 20px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #fff9df, #ffe7ab);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.78);
}

.gold-thread {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 4;
  width: 108%;
  height: 2px;
  transform: translate(-50%, -50%) rotate(0deg);
  background: linear-gradient(90deg, transparent, rgba(255, 216, 113, 0.76), transparent);
}

.thread-two {
  transform: translate(-50%, -50%) rotate(90deg);
  width: 70%;
}

.character {
  position: absolute;
  z-index: 4;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
  filter:
    drop-shadow(0 22px 28px rgba(77, 27, 13, 0.24))
    drop-shadow(0 0 18px rgba(255, 224, 162, 0.34));
  animation: characterDrift 6.2s ease-in-out infinite;
  transition: opacity 640ms ease, filter 640ms ease;
}

.character-left {
  left: clamp(-116px, -8vw, -54px);
  top: 19%;
  width: clamp(290px, 33vw, 430px);
  transform: rotate(-7deg);
}

.character-right {
  right: clamp(-92px, -5vw, -34px);
  bottom: 0;
  width: clamp(330px, 36vw, 480px);
  transform: rotate(7deg);
  animation-delay: -2.3s;
}

.envelope-scene.opened .character {
  z-index: 2;
  opacity: 0;
  filter: blur(6px);
}

.blessing-icons {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.birthday-icon {
  position: absolute;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(86, 34, 16, 0.16));
  animation: iconDrift 8s ease-in-out infinite;
}

.balloon {
  width: 34px;
  height: 44px;
  border-radius: 50% 50% 48% 48%;
  background: linear-gradient(145deg, #ffbea5, #ef6e61);
}

.balloon::after {
  position: absolute;
  left: 50%;
  top: 42px;
  width: 1px;
  height: 34px;
  content: "";
  background: rgba(119, 59, 37, 0.55);
}

.gift {
  width: 44px;
  height: 38px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 42%, #ffe49e 42% 58%, transparent 58%),
    linear-gradient(#ff8f76 0 44%, #e35d53 44%);
}

.gift::before {
  position: absolute;
  left: 50%;
  top: -11px;
  width: 34px;
  height: 18px;
  content: "";
  transform: translateX(-50%);
  border: 5px solid #ffe49e;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

.cake {
  width: 50px;
  height: 38px;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 46%, #ffdb75 46% 54%, transparent 54%),
    linear-gradient(#fff1c7 0 35%, #ff9f7c 35% 62%, #d95a4d 62%);
}

.cake::before {
  position: absolute;
  left: 50%;
  top: -21px;
  width: 8px;
  height: 19px;
  content: "";
  transform: translateX(-50%);
  border-radius: 5px;
  background: #fff0ac;
  box-shadow: 0 -7px 0 -2px #ff7b4c;
}

.star,
.sparkle {
  width: 24px;
  aspect-ratio: 1;
  background: #ffdf77;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
}

.heart {
  width: 30px;
  height: 28px;
  transform: rotate(-45deg);
  background: #ff897c;
}

.heart::before,
.heart::after {
  position: absolute;
  width: 30px;
  height: 28px;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.heart::before {
  top: -15px;
}

.heart::after {
  left: 15px;
}

.ribbon {
  width: 56px;
  height: 34px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ffdf7b 0 18%, #ff9378 18% 50%, #e65e54 50% 82%, #ffd56e 82%);
  clip-path: polygon(0 50%, 16% 10%, 48% 34%, 50% 2%, 52% 34%, 84% 10%, 100% 50%, 84% 90%, 52% 66%, 50% 98%, 48% 66%, 16% 90%);
}

.ribbon::before,
.ribbon::after {
  display: none;
}

.candle {
  width: 16px;
  height: 48px;
  border-radius: 7px;
  background: repeating-linear-gradient(135deg, #fff3be 0 8px, #ff9a80 8px 15px);
}

.candle::before {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 14px;
  height: 18px;
  content: "";
  transform: translateX(-50%);
  border-radius: 50% 50% 50% 0;
  background: #ffc34f;
  box-shadow: 0 0 20px rgba(255, 191, 79, 0.75);
}

.icon-a {
  left: 9%;
  top: 22%;
}

.icon-b {
  right: 11%;
  top: 18%;
  animation-delay: -2s;
}

.icon-c {
  left: 13%;
  bottom: 17%;
  animation-delay: -4.2s;
}

.icon-d {
  right: 21%;
  bottom: 14%;
  animation-delay: -1.2s;
}

.icon-e {
  left: 24%;
  top: 13%;
  animation-delay: -3.5s;
}

.icon-f {
  right: 8%;
  bottom: 32%;
  animation-delay: -5.1s;
}

.icon-g {
  left: 50%;
  top: 9%;
  animation-delay: -2.7s;
}

.icon-h {
  right: 32%;
  top: 10%;
  animation-delay: -6.1s;
}

@keyframes sceneFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -12px;
  }
}

@keyframes characterDrift {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}

@keyframes sealPulse {
  0%,
  100% {
    scale: 1;
  }
  50% {
    scale: 1.045;
  }
}

@keyframes caretBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes iconDrift {
  0%,
  100% {
    translate: 0 0;
    rotate: -4deg;
  }
  50% {
    translate: 10px -18px;
    rotate: 8deg;
  }
}

@keyframes musicBeat {
  0%,
  100% {
    transform: scaleY(0.62);
  }
  50% {
    transform: scaleY(1.18);
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .birthday-stage {
    min-height: 100dvh;
    padding: 26px 14px;
  }

  .envelope-scene {
    width: min(96vw, 560px);
    min-height: 520px;
    transform: translate3d(calc(var(--mx) * 0.08), calc(var(--my) * 0.08), 0) rotate(-2.5deg);
  }

  .letter-wrap {
    top: 52%;
    width: min(92vw, 500px);
    height: 300px;
  }

  .letter-note {
    width: 78%;
    min-height: 216px;
    padding: 22px 24px 26px;
    transform: translateX(-50%) translateY(88px) rotate(1.2deg);
  }

  .envelope-scene.opened .letter-note {
    top: 48%;
    z-index: 7;
    width: min(92vw, 390px);
    height: min(72vh, 500px);
    min-height: min(72vh, 500px);
    padding: 28px 28px 32px;
    transform: translate(-50%, -50%) rotate(1deg);
  }

  .letter-kicker {
    margin-bottom: 8px;
  }

  .letter-copy {
    height: calc(100% - 64px);
  }

  .letter-page {
    font-size: clamp(16px, 4.6vw, 20px);
    line-height: 1.42;
  }

  .letter-page-top {
    height: 7.55em;
  }

  .letter-page-side {
    height: calc(100% - 7.55em - 2px);
    margin-top: 2px;
    margin-right: 4px;
    margin-left: 144px;
  }

  .letter-page-side.page-measurer {
    width: calc(100% - 148px);
  }

  .letter-photo {
    left: 22px;
    bottom: 20px;
    width: 116px;
  }

  .letter-signature {
    right: 24px;
    bottom: 30px;
    font-size: clamp(17px, 5vw, 22px);
  }

  .letter-egg-note {
    right: 34px;
    bottom: 76px;
    font-size: clamp(14px, 4.2vw, 18px);
  }

  .letter-easter {
    inset: 30px 22px 34px;
  }

  .easter-title {
    margin-bottom: 14px;
    font-size: clamp(30px, 9vw, 42px);
  }

  .easter-photo {
    width: min(94%, 330px);
    max-height: min(42vh, 285px);
    aspect-ratio: 1.05;
    border-radius: 10px;
    box-shadow:
      0 14px 26px rgba(108, 47, 24, 0.2),
      0 0 0 6px rgba(255, 249, 231, 0.78);
  }

  .easter-flower {
    width: 38px;
  }

  .flower-a {
    left: -2%;
    top: 10%;
  }

  .flower-b {
    right: -1%;
    top: 20%;
  }

  .flower-c {
    left: 2%;
    bottom: 14%;
  }

  .flower-d {
    right: 2%;
    bottom: 10%;
  }

  .page-next {
    right: 25px;
    bottom: 22px;
    width: 62px;
    height: 42px;
  }

  .character-left {
    left: -74px;
    top: 14%;
    width: 236px;
  }

  .character-right {
    right: -22px;
    bottom: 6%;
    width: 256px;
  }

  .birthday-icon {
    scale: 0.76;
  }

  .icon-e,
  .icon-f,
  .icon-h {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
