:root {
  --bg: #f6eadb;
  --paper: #fff7ed;
  --paper-deep: #ead8c4;
  --ink: #3f2b21;
  --wine: #8c2630;
  --wine-dark: #671c24;
  --gold: #c79b65;
  --line: #cdb197;
  --shadow: 0 22px 48px rgba(70, 44, 28, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #211915;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 30% 8%, rgba(255, 255, 255, 0.82), transparent 28rem),
    linear-gradient(135deg, #f7eadc, #f3e0cd 62%, #f8eddf);
  font-family: "Cormorant Garamond", Georgia, serif;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app {
  position: relative;
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.72), transparent 16rem),
    radial-gradient(circle at 16% 78%, rgba(255, 255, 255, 0.5), transparent 14rem),
    var(--bg);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 17% 23%, rgba(102, 65, 39, 0.08) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(104deg, rgba(255, 255, 255, 0.3) 0 1px, transparent 1px 5px);
}

.hero > .grain,
.cover-page > .grain {
  pointer-events: none;
}

.hero,
.cover-page {
  position: relative;
  min-height: 100svh;
  padding: max(46px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
}

.hero::before,
.hero::after,
.cover-page::before,
.cover-page::after,
.letter::before,
.letter::after,
.gift-page::before,
.gift-page::after,
.quiz-page::before,
.quiz-page::after,
.video-page::before,
.video-page::after,
.envelope-page::before,
.envelope-page::after {
  content: "♡";
  position: absolute;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
}

.hero::before {
  right: 19px;
  top: 58%;
  font-size: 39px;
  transform: rotate(13deg);
}

.cover-page {
  display: none;
}

.cover-page.is-visible {
  display: flex;
  animation: pageIn 0.8s ease both;
}

.cover-page::before {
  right: 19px;
  top: 58%;
  font-size: 39px;
  transform: rotate(13deg);
}

.cover-page::after {
  left: 30px;
  bottom: 20%;
  width: 150px;
  height: 150px;
  color: transparent;
  border: 2px solid rgba(140, 38, 48, 0.26);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.hero::after {
  left: 30px;
  bottom: 20%;
  width: 150px;
  height: 150px;
  color: transparent;
  border: 2px solid rgba(140, 38, 48, 0.26);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.sparkles span {
  --size: 18px;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
  animation: sparkle 3.2s ease-in-out var(--d) infinite;
}

.sparkles span::before,
.sparkles span::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: #fff;
  border-radius: 999px;
}

.sparkles span::before {
  width: 2px;
  height: 100%;
}

.sparkles span::after {
  width: 100%;
  height: 2px;
}

.hero__top {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-top: 62px;
}

.hand-heart {
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 43px;
  transform: rotate(-10deg);
  animation: floatHeart 3.8s ease-in-out infinite;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  margin-top: 18px;
  font-size: clamp(58px, 17vw, 82px);
  line-height: 0.86;
  color: #3b281e;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.divider {
  position: relative;
  width: min(210px, 62vw);
  height: 30px;
  margin: 28px auto 0;
  color: var(--wine);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Marck Script", cursive;
  font-size: 29px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--line));
}

.divider::after {
  background: linear-gradient(90deg, var(--line), transparent);
}

.divider span {
  padding: 0 16px;
}

.card-stage,
.cover-card-stage {
  position: relative;
  z-index: 2;
  height: min(43svh, 390px);
  min-height: 320px;
  margin-top: 8px;
  display: grid;
  place-items: center;
  perspective: 1100px;
}

.cover-card-stage {
  height: min(45svh, 390px);
  min-height: 342px;
  margin-top: 0;
}

.cover-card-image {
  position: relative;
  z-index: 1;
  width: min(76vw, 300px);
  height: auto;
  display: block;
  filter: drop-shadow(0 26px 28px rgba(70, 44, 28, 0.2));
  transform: translateY(-8px);
  animation: cardBreathe 5s ease-in-out infinite;
}

.card-preview {
  position: relative;
  width: min(70vw, 286px);
  height: min(92vw, 378px);
  transform: rotateX(6deg) rotateZ(-1deg);
  filter: drop-shadow(0 28px 30px rgba(70, 44, 28, 0.22));
  animation: cardBreathe 4.8s ease-in-out infinite;
}

.paper {
  position: absolute;
  border-radius: 3px;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.72), transparent 45%),
    var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(188, 151, 109, 0.22),
    var(--shadow);
}

.paper--back {
  inset: 24px -18px 18px 40px;
  transform: rotate(0.4deg);
  padding: 74px 24px 20px;
  overflow: hidden;
}

.paper--back::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(188, 151, 109, 0.34);
  border-radius: 17px;
}

.paper--back p {
  margin: 0 0 14px;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 24px;
}

.paper--back span {
  display: block;
  font-family: "Marck Script", cursive;
  font-size: 16px;
  line-height: 1.65;
  opacity: 0.85;
}

.mini-photo {
  position: absolute;
  right: 18px;
  bottom: 24px;
  width: 78px;
  height: 110px;
  border: 5px solid #f6eadd;
  background: url("assets/inside-reference.png") -13px -382px / 430px auto;
  box-shadow: 0 8px 16px rgba(70, 44, 28, 0.18);
  transform: rotate(3deg);
}

.paper--front {
  inset: 0 32px 0 0;
  transform-origin: left center;
  transform: rotateY(-10deg) rotateZ(-2deg);
}

.cover-heart {
  position: absolute;
  inset: 27% 0 auto;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 82px;
  text-align: center;
  transform: rotate(-9deg);
}

.branch,
.botanical {
  position: absolute;
  left: 24%;
  bottom: 19%;
  width: 118px;
  height: 148px;
  border-left: 2px solid rgba(183, 145, 101, 0.58);
  border-radius: 50%;
  transform: rotate(28deg);
}

.branch i,
.botanical i {
  position: absolute;
  width: 38px;
  height: 1px;
  background: rgba(183, 145, 101, 0.55);
  transform-origin: left center;
}

.branch i::after,
.botanical i::after {
  content: "";
  position: absolute;
  right: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(183, 145, 101, 0.55);
  border-radius: 50%;
  background: rgba(255, 248, 238, 0.9);
}

.branch i:nth-child(1),
.botanical i:nth-child(1) { left: 12px; top: 26px; transform: rotate(-36deg); }
.branch i:nth-child(2),
.botanical i:nth-child(2) { left: 14px; top: 54px; transform: rotate(-20deg); }
.branch i:nth-child(3),
.botanical i:nth-child(3) { left: 23px; top: 76px; transform: rotate(18deg); }
.branch i:nth-child(4),
.botanical i:nth-child(4) { left: 30px; top: 100px; transform: rotate(-28deg); }
.branch i:nth-child(5),
.botanical i:nth-child(5) { left: 41px; top: 121px; transform: rotate(22deg); }
.branch i:nth-child(6),
.botanical i:nth-child(6) { left: 50px; top: 142px; transform: rotate(-18deg); }

.swirl {
  position: absolute;
  border: 2px solid rgba(140, 38, 48, 0.25);
  border-radius: 50%;
}

.swirl--left {
  width: 116px;
  height: 116px;
  left: 4px;
  top: 34px;
  border-right-color: transparent;
  transform: rotate(30deg);
}

.swirl--right {
  width: 250px;
  height: 120px;
  right: -60px;
  bottom: 4px;
  border-left-color: transparent;
  border-top-color: transparent;
  transform: rotate(-16deg);
}

.open-button {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 80px;
  border: 2px solid #f6d59b;
  border-radius: 19px;
  color: #fff8ee;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    linear-gradient(135deg, var(--wine), var(--wine-dark));
  box-shadow:
    inset 0 0 0 3px rgba(255, 239, 194, 0.38),
    0 20px 36px rgba(103, 28, 36, 0.23);
  font-size: clamp(30px, 9vw, 41px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.open-button:active {
  transform: translateY(2px) scale(0.99);
}

.open-button span:last-child {
  color: #ffe3ac;
  font-family: "Marck Script", cursive;
  font-size: 42px;
  transform: rotate(10deg);
}

.opening {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(246, 234, 219, 0.86);
  opacity: 0;
  pointer-events: none;
  perspective: 1200px;
  transition: opacity 0.35s ease;
}

.opening__card {
  position: relative;
  width: min(74vw, 300px);
  height: min(96vw, 390px);
  transform-style: preserve-3d;
}

.opening__inside,
.opening__cover {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
}

.opening__inside {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 44px;
  text-align: center;
  font-size: 28px;
}

.opening__inside strong {
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 46px;
  font-weight: 400;
}

.opening__cover {
  transform-origin: left center;
  display: grid;
  place-items: center;
}

.opening__cover span {
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 100px;
  transform: rotate(-8deg);
}

.app.is-opening .opening {
  opacity: 1;
  pointer-events: auto;
}

.app.is-opening .opening__cover {
  animation: openCover 1.45s cubic-bezier(0.2, 0.8, 0.18, 1) forwards;
}

.letter {
  position: relative;
  display: none;
  min-height: 100svh;
  padding: max(34px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  isolation: isolate;
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.72), transparent 15rem),
    radial-gradient(circle at 16% 62%, rgba(255, 255, 255, 0.56), transparent 13rem),
    var(--bg);
}

.letter.is-visible,
.gift-page.is-visible {
  display: block;
  animation: pageIn 0.8s ease both;
}

.letter::before {
  right: 27px;
  top: 33%;
  font-size: 56px;
  transform: rotate(13deg);
}

.letter::after {
  left: 18px;
  top: 11%;
  content: "✦";
  color: var(--gold);
  font-size: 22px;
}

.letter__date {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 31px;
  line-height: 1;
  margin-bottom: 18px;
}

.divider--small {
  width: 156px;
  margin-top: 8px;
  height: 23px;
  font-size: 24px;
}

.photo-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.photo-grid--top {
  margin-top: 14px;
  align-items: end;
}

.photo-grid--bottom {
  margin-top: 28px;
  padding-bottom: 22px;
}

.photo {
  --r: 0deg;
  --from-x: 0px;
  --from-y: 34px;
  --delay: 0s;
  margin: 0;
  min-height: 152px;
  border: 5px solid rgba(255, 247, 237, 0.88);
  border-radius: 10px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  box-shadow: 0 12px 22px rgba(70, 44, 28, 0.16);
  overflow: hidden;
  transform: rotate(var(--r));
}

.letter.is-visible .photo {
  animation:
    photoFlyIn 0.92s cubic-bezier(0.16, 0.95, 0.24, 1.08) var(--delay) both,
    photoFloat 6s ease-in-out calc(var(--delay) + 1s) infinite;
}

.photo--one {
  --r: -3deg;
  --from-x: -78px;
  --from-y: -18px;
  --delay: 0.08s;
  height: 160px;
  background-image: url("photo/1.jpg");
  background-position: center;
}

.photo--two {
  --from-y: -64px;
  --delay: 0.18s;
  height: 172px;
  background-image: url("photo/2.jpg");
  background-position: center;
}

.photo--three {
  --r: 3deg;
  --from-x: 78px;
  --from-y: -18px;
  --delay: 0.28s;
  height: 160px;
  background-image: url("photo/3.jpg");
  background-position: center;
}

.photo--left,
.photo--right {
  position: absolute;
  z-index: 1;
  width: 78px;
  height: 150px;
  min-height: 0;
  top: 560px;
}

.photo--left {
  --r: -4deg;
  --from-x: -72px;
  --from-y: 6px;
  --delay: 0.44s;
  left: -18px;
  background-image: url("photo/4.jpg");
  background-position: center;
}

.photo--right {
  --r: 3deg;
  --from-x: 72px;
  --from-y: 6px;
  --delay: 0.5s;
  right: -18px;
  background-image: url("photo/7.jpg");
  background-position: center;
}

.photo--four {
  --from-x: -72px;
  --from-y: 38px;
  --delay: 0.62s;
  height: 164px;
  background-image: url("photo/6.jpg");
  background-position: center 38%;
}

.photo--five {
  --from-y: 62px;
  --delay: 0.72s;
  height: 164px;
  background-image: url("photo/8.jpg");
  background-position: center 28%;
}

.photo--six {
  --from-x: 72px;
  --from-y: 38px;
  --delay: 0.82s;
  height: 164px;
  background-image: url("photo/5.jpg");
  background-position: center;
}

.letter__title {
  position: relative;
  z-index: 2;
  margin: 32px auto 20px;
  text-align: center;
}

.letter__title h2 {
  font-size: clamp(44px, 13vw, 58px);
  line-height: 0.84;
  font-weight: 500;
  text-transform: uppercase;
}

.letter__title p {
  margin: 0;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 48px;
  line-height: 0.98;
}

.message {
  position: relative;
  z-index: 2;
  width: min(100%, 252px);
  margin: 0 auto;
  padding: 0 2px;
  font-family: "Marck Script", cursive;
  font-size: 18px;
  line-height: 1.56;
  text-align: left;
}

.message p {
  margin: 0 0 20px;
}

.message .signature {
  margin-top: 8px;
  color: var(--wine);
  font-size: 22px;
  text-align: right;
}

.botanical {
  left: 20px;
  bottom: 247px;
  width: 72px;
  height: 112px;
  opacity: 0.82;
  transform: rotate(26deg) scale(0.78);
}

.divider--footer {
  width: 160px;
  margin-top: 0;
}

.app.is-open .hero {
  display: none;
}

.gift-page {
  position: relative;
  display: none;
  min-height: 100svh;
  padding: max(34px, env(safe-area-inset-top)) 24px max(34px, env(safe-area-inset-bottom));
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.76), transparent 16rem),
    radial-gradient(circle at 18% 82%, rgba(255, 255, 255, 0.54), transparent 13rem),
    var(--bg);
}

.gift-page.is-visible,
.quiz-page.is-visible,
.video-page.is-visible,
.envelope-page.is-visible {
  display: grid;
}

.gift-page::before {
  right: 29px;
  top: 16%;
  font-size: 48px;
  transform: rotate(14deg);
}

.gift-page::after {
  left: 22px;
  bottom: 16%;
  width: 190px;
  height: 130px;
  color: transparent;
  border: 2px solid rgba(140, 38, 48, 0.22);
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-22deg);
}

.gift-card {
  position: relative;
  z-index: 2;
  width: min(100%, 342px);
  min-height: 470px;
  padding: 74px 28px 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), transparent 48%),
    linear-gradient(180deg, #fff8ee, #f6e7d4);
  box-shadow:
    inset 0 0 0 1px rgba(188, 151, 109, 0.26),
    inset 0 0 0 10px rgba(255, 255, 255, 0.25),
    0 28px 54px rgba(70, 44, 28, 0.18);
  overflow: hidden;
  animation: cardBreathe 5.2s ease-in-out infinite;
}

.gift-card::before {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(188, 151, 109, 0.36);
  border-radius: 18px;
  pointer-events: none;
}

.gift-card::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 42px;
  height: 100%;
  background: linear-gradient(90deg, rgba(140, 38, 48, 0.02), rgba(140, 38, 48, 0.12), rgba(140, 38, 48, 0.02));
  transform: translateX(-50%);
  pointer-events: none;
}

.gift-ribbon {
  position: absolute;
  left: 50%;
  top: 42px;
  width: 128px;
  height: 70px;
  transform: translateX(-50%);
}

.gift-ribbon::before,
.gift-ribbon::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 58px;
  height: 48px;
  border: 3px solid var(--wine);
  border-radius: 54% 46% 50% 50%;
  opacity: 0.92;
}

.gift-ribbon::before {
  left: 4px;
  transform: rotate(-25deg);
}

.gift-ribbon::after {
  right: 4px;
  transform: rotate(25deg);
}

.gift-heart {
  position: relative;
  z-index: 2;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 58px;
  line-height: 1;
  text-align: center;
  transform: rotate(-8deg);
  animation: floatHeart 3.8s ease-in-out infinite;
}

.gift-card .divider {
  position: relative;
  z-index: 2;
  margin: 10px auto 26px;
}

.gift-card p {
  position: relative;
  z-index: 2;
  margin: 0;
  color: #473127;
  font-family: "Marck Script", cursive;
  font-size: 26px;
  line-height: 1.58;
  text-align: center;
}

.gift-sparkles span {
  --size: 20px;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  animation: sparkle 3s ease-in-out var(--d) infinite;
}

.gift-sparkles span::before,
.gift-sparkles span::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.gift-sparkles span::before {
  width: 2px;
  height: 100%;
}

.gift-sparkles span::after {
  width: 100%;
  height: 2px;
}

.quiz-page {
  position: relative;
  display: none;
  min-height: 100svh;
  padding: max(34px, env(safe-area-inset-top)) 24px max(34px, env(safe-area-inset-bottom));
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.78), transparent 15rem),
    radial-gradient(circle at 16% 82%, rgba(255, 255, 255, 0.5), transparent 12rem),
    var(--bg);
}

.quiz-page::before {
  right: 26px;
  top: 15%;
  font-size: 46px;
  transform: rotate(12deg);
}

.quiz-page::after {
  left: 20px;
  bottom: 15%;
  content: "✦";
  color: var(--gold);
  font-size: 24px;
}

.quiz-card {
  position: relative;
  z-index: 2;
  width: min(100%, 344px);
  min-height: 520px;
  padding: 42px 24px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), transparent 48%),
    linear-gradient(180deg, #fff8ee, #f6e7d4);
  box-shadow:
    inset 0 0 0 1px rgba(188, 151, 109, 0.26),
    inset 0 0 0 10px rgba(255, 255, 255, 0.22),
    0 28px 54px rgba(70, 44, 28, 0.18);
  overflow: hidden;
}

.quiz-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(188, 151, 109, 0.36);
  border-radius: 18px;
  pointer-events: none;
}

.quiz-heart {
  position: relative;
  z-index: 2;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 46px;
  line-height: 1;
  text-align: center;
  transform: rotate(-8deg);
}

.quiz-question {
  position: relative;
  z-index: 2;
  margin: 16px 0 28px;
  color: #3f2b21;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.08;
  text-align: center;
}

.quiz-answers {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 13px;
}

.quiz-answers button {
  min-height: 58px;
  padding: 12px 16px;
  border: 2px solid #f6d59b;
  border-radius: 15px;
  color: #fff8ee;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    linear-gradient(135deg, var(--wine), var(--wine-dark));
  box-shadow:
    inset 0 0 0 3px rgba(255, 239, 194, 0.26),
    0 12px 22px rgba(103, 28, 36, 0.16);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  line-height: 1.08;
  cursor: pointer;
  transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

.quiz-answers button:active {
  transform: translateY(2px) scale(0.985);
}

.quiz-answers button.is-correct {
  filter: brightness(1.06);
  box-shadow:
    inset 0 0 0 3px rgba(255, 239, 194, 0.36),
    0 16px 28px rgba(103, 28, 36, 0.24);
}

.quiz-result {
  position: relative;
  z-index: 2;
  min-height: 42px;
  margin-top: 24px;
  color: var(--wine);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.34s ease, transform 0.34s ease;
}

.quiz-page.is-answered .quiz-result {
  opacity: 1;
  transform: none;
}

.quiz-page.is-wrong .quiz-result {
  color: #6f1f25;
  opacity: 1;
  transform: none;
}

.video-page {
  position: relative;
  display: none;
  min-height: 100svh;
  padding: max(34px, env(safe-area-inset-top)) 24px max(34px, env(safe-area-inset-bottom));
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.78), transparent 15rem),
    radial-gradient(circle at 18% 82%, rgba(255, 255, 255, 0.5), transparent 12rem),
    var(--bg);
}

.video-page::before {
  right: 28px;
  top: 16%;
  font-size: 48px;
  transform: rotate(14deg);
}

.video-page::after {
  left: 22px;
  bottom: 16%;
  content: "✦";
  color: var(--gold);
  font-size: 24px;
}

.video-card {
  position: relative;
  z-index: 2;
  width: min(100%, 344px);
  padding: 36px 22px 28px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), transparent 48%),
    linear-gradient(180deg, #fff8ee, #f6e7d4);
  box-shadow:
    inset 0 0 0 1px rgba(188, 151, 109, 0.26),
    inset 0 0 0 10px rgba(255, 255, 255, 0.22),
    0 28px 54px rgba(70, 44, 28, 0.18);
}

.video-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(188, 151, 109, 0.36);
  border-radius: 18px;
  pointer-events: none;
}

.video-heart {
  position: relative;
  z-index: 2;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 52px;
  line-height: 1;
  text-align: center;
  transform: rotate(-8deg);
}

.video-card .divider {
  position: relative;
  z-index: 2;
  margin: 8px auto 16px;
}

.video-title {
  position: relative;
  z-index: 2;
  margin: 0 0 22px;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 30px;
  line-height: 1.18;
  text-align: center;
}

.video-frame {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 6px solid rgba(255, 247, 237, 0.9);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.64), transparent 9rem),
    linear-gradient(180deg, #ead8c4, #d8bea5);
  box-shadow: 0 16px 30px rgba(70, 44, 28, 0.16);
}

.final-video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  object-fit: cover;
}

.final-video:fullscreen,
.final-video:-webkit-full-screen {
  width: 100%;
  height: 100%;
  opacity: 1;
  background: #000;
  object-fit: contain;
  pointer-events: auto;
}

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 86px;
  border: 2px solid #f6d59b;
  border-radius: 50%;
  color: #ffe5b6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    linear-gradient(135deg, rgba(140, 38, 48, 0.96), rgba(103, 28, 36, 0.98));
  box-shadow:
    inset 0 0 0 4px rgba(255, 239, 194, 0.22),
    0 18px 34px rgba(103, 28, 36, 0.2);
  transform: translate(-50%, -50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}

.video-play::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 232, 178, 0.36);
  border-radius: 50%;
}

.video-play::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff3d1;
  box-shadow: 0 0 12px rgba(255, 235, 184, 0.8);
}

.video-play span {
  position: absolute;
  left: 35px;
  top: 27px;
  width: 0;
  height: 0;
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-left: 23px solid currentColor;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.12));
}

.video-play:active {
  transform: translate(-50%, -50%) scale(0.96);
  filter: brightness(1.05);
}

.video-page.is-playing .video-play {
  opacity: 0;
  pointer-events: none;
}

.envelope-page {
  position: relative;
  display: none;
  min-height: 100svh;
  padding: max(34px, env(safe-area-inset-top)) 24px max(34px, env(safe-area-inset-bottom));
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.78), transparent 15rem),
    radial-gradient(circle at 18% 82%, rgba(255, 255, 255, 0.52), transparent 12rem),
    var(--bg);
}

.envelope-page::before {
  right: 28px;
  top: 15%;
  font-size: 48px;
  transform: rotate(14deg);
}

.envelope-page::after {
  left: 22px;
  bottom: 16%;
  content: "✦";
  color: var(--gold);
  font-size: 24px;
}

.envelope-scene {
  position: relative;
  z-index: 2;
  width: min(100%, 350px);
  min-height: 560px;
  display: grid;
  align-content: center;
  justify-items: center;
}

.envelope-title {
  margin: 0 0 42px;
  color: var(--wine);
  font-family: "Marck Script", cursive;
  font-size: 48px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62);
}

.envelope-button {
  position: relative;
  width: 292px;
  height: 238px;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
}

.envelope-button:active .envelope {
  transform: translateY(4px) scale(0.985);
}

.envelope {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 292px;
  height: 184px;
  transform: translateX(-50%);
  transform-style: preserve-3d;
  filter: drop-shadow(0 24px 30px rgba(70, 44, 28, 0.2));
  transition: transform 0.48s cubic-bezier(0.16, 0.95, 0.24, 1);
}

.envelope__back,
.envelope__paper,
.envelope__front,
.envelope__flap {
  position: absolute;
  inset: 0;
  border-radius: 8px;
}

.envelope__back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7), transparent 48%),
    linear-gradient(180deg, #fff8ee, #ecd8bf);
  box-shadow: inset 0 0 0 1px rgba(188, 151, 109, 0.38);
}

.envelope__paper {
  left: 22px;
  right: 22px;
  top: 24px;
  bottom: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), transparent 50%),
    #fffaf1;
  border: 1px solid rgba(188, 151, 109, 0.3);
  border-radius: 6px;
  transform: translateY(30px);
  transition: transform 0.58s cubic-bezier(0.16, 0.95, 0.24, 1);
}

.envelope__front {
  overflow: hidden;
  background:
    linear-gradient(145deg, transparent 49.5%, rgba(198, 159, 113, 0.5) 50%, transparent 50.7%),
    linear-gradient(35deg, transparent 49.5%, rgba(198, 159, 113, 0.5) 50%, transparent 50.7%),
    linear-gradient(180deg, #f7eadb, #ead2b8);
  clip-path: polygon(0 28%, 50% 72%, 100% 28%, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(188, 151, 109, 0.34);
  z-index: 4;
}

.envelope__flap {
  height: 112px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.62), transparent 48%),
    linear-gradient(180deg, #fff7ed, #e9d2b8);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  z-index: 5;
  box-shadow: inset 0 0 0 1px rgba(188, 151, 109, 0.36);
  transition: transform 0.62s cubic-bezier(0.16, 0.95, 0.24, 1);
}

.envelope__seal {
  position: absolute;
  left: 50%;
  top: 82px;
  z-index: 6;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 2px solid #f6d59b;
  border-radius: 50%;
  color: #ffe5b6;
  background: linear-gradient(135deg, var(--wine), var(--wine-dark));
  font-family: "Marck Script", cursive;
  font-size: 32px;
  line-height: 1;
  transform: translateX(-50%) rotate(-8deg);
  box-shadow:
    inset 0 0 0 3px rgba(255, 239, 194, 0.24),
    0 8px 16px rgba(103, 28, 36, 0.18);
  transition: opacity 0.3s ease, transform 0.44s ease;
}

.certificate {
  position: absolute;
  left: 50%;
  bottom: 62px;
  z-index: 3;
  width: min(89vw, 354px);
  aspect-ratio: 572 / 351;
  display: block;
  overflow: hidden;
  border: 5px solid rgba(255, 247, 237, 0.98);
  border-radius: 10px;
  color: var(--wine);
  background: #fffaf5;
  box-shadow:
    0 22px 34px rgba(70, 44, 28, 0.24),
    0 0 0 1px rgba(188, 151, 109, 0.2);
  font-family: "Cormorant Garamond", Georgia, serif;
  opacity: 0;
  transform: translate(-50%, 92px) scale(0.58) rotate(-4deg);
  transition: none;
}

.certificate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.26), transparent 44%),
    linear-gradient(180deg, transparent 72%, rgba(246, 234, 219, 0.12));
  pointer-events: none;
}

.certificate img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.certificate-code {
  position: absolute;
  right: 5.9%;
  top: 9.5%;
  z-index: 3;
  padding: 2px 8px 3px;
  border: 1px solid rgba(35, 35, 35, 0.54);
  border-radius: 999px;
  color: #171717;
  background: rgba(255, 255, 255, 0.78);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 2px 8px rgba(70, 44, 28, 0.08);
}

.certificate span {
  z-index: 1;
}

.envelope-page.is-tap-1 .envelope {
  transform: translateX(-50%) translateY(-6px) scale(1.035) rotate(-1deg);
}

.envelope-page.is-tap-1 .envelope__flap {
  transform: rotateX(46deg);
}

.envelope-page.is-tap-2 .envelope {
  transform: translateX(-50%) translateY(-12px) scale(1.08) rotate(1deg);
}

.envelope-page.is-tap-2 .envelope__flap {
  transform: rotateX(132deg);
}

.envelope-page.is-tap-2 .envelope__paper {
  transform: translateY(-12px);
}

.envelope-page.is-tap-2 .envelope__seal,
.envelope-page.is-opened .envelope__seal {
  opacity: 0;
  transform: translateX(-50%) translateY(18px) scale(0.72) rotate(10deg);
}

.envelope-page.is-opened .envelope {
  transform: translateX(-50%) translateY(26px) scale(0.98);
}

.envelope-page.is-opened .envelope__flap {
  transform: rotateX(176deg);
}

.envelope-page.is-opened .envelope__paper {
  transform: translateY(-18px);
}

.envelope-page.is-opened .certificate {
  animation: certificateFlyOut 1.05s cubic-bezier(0.16, 0.95, 0.24, 1.08) both;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0.28;
    transform: scale(0.7) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.15) rotate(22deg);
  }
}

@keyframes floatHeart {
  0%, 100% { transform: translateY(0) rotate(-10deg); }
  50% { transform: translateY(-8px) rotate(-5deg); }
}

@keyframes cardBreathe {
  0%, 100% { transform: translateY(0) rotateX(6deg) rotateZ(-1deg); }
  50% { transform: translateY(-8px) rotateX(7deg) rotateZ(1deg); }
}

@keyframes openCover {
  0% {
    transform: rotateY(0deg);
  }
  52% {
    transform: rotateY(-132deg);
  }
  100% {
    transform: rotateY(-178deg);
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes photoFlyIn {
  from {
    opacity: 0;
    transform: translate(var(--from-x), var(--from-y)) scale(0.84) rotate(calc(var(--r) - 8deg));
  }
  70% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(var(--r));
  }
}

@keyframes photoFloat {
  0%, 100% {
    transform: translateY(0) rotate(var(--r));
  }
  50% {
    transform: translateY(-4px) rotate(var(--r));
  }
}

@keyframes certificateFlyOut {
  0% {
    opacity: 0;
    transform: translate(-50%, 96px) scale(0.58) rotate(-4deg);
  }
  48% {
    opacity: 1;
    transform: translate(-50%, -84px) scale(1.08) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -154px) scale(1.04) rotate(-2deg);
  }
}

@media (max-width: 374px) {
  .hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .card-stage {
    min-height: 290px;
  }

  .open-button {
    min-height: 70px;
  }

  .message {
    width: min(100%, 250px);
    font-size: 20px;
  }

  .gift-card {
    min-height: 440px;
    padding-left: 22px;
    padding-right: 22px;
  }

  .gift-card p {
    font-size: 23px;
  }

  .quiz-card {
    min-height: 500px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .quiz-question {
    font-size: 30px;
  }

  .quiz-answers button {
    font-size: 20px;
  }

  .video-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  .envelope-title {
    font-size: 44px;
  }

  .envelope-button,
  .envelope {
    width: 270px;
  }
}

.hero {
  min-height: 100svh;
  padding: 0;
  display: block;
  background: url("assets/cover-reference.png") center / 100% 100% no-repeat;
}

.hero > .grain,
.hero::before,
.hero::after {
  display: none;
}

.hero .open-button {
  position: absolute;
  z-index: 5;
  left: 6.1%;
  right: 6.1%;
  bottom: max(6.8%, env(safe-area-inset-bottom));
  width: auto;
  min-height: 0;
  height: 8.6%;
  border: 0;
  border-radius: 18px;
  color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 0;
  -webkit-tap-highlight-color: transparent;
}

.hero .open-button span {
  opacity: 0;
}

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