*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold: #d4b07a;
  --wine: #3d1014;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-script: "Great Vibes", cursive;
  --font-sans: "Outfit", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-sans);
  background: #3d1014;
  color: #f3ead8;
  -webkit-tap-highlight-color: transparent;
}

.wash {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(61, 16, 20, 0.2) 0%,
      rgba(61, 16, 20, 0.62) 48%,
      #3d1014 86%
    ),
    radial-gradient(ellipse at 70% 60%, rgba(184, 96, 88, 0.22), transparent 50%),
    url("../assets/invite-mood.jpg") center 22% / cover no-repeat,
    #3d1014;
}

.petals {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.petals span {
  position: absolute;
  top: -10%;
  color: #d4b07a;
  animation: fall linear infinite;
}

@keyframes fall {
  to {
    transform: translateY(120vh) rotate(40deg);
  }
}

body.mood-happy .wash {
  background:
    linear-gradient(180deg, rgba(106, 58, 28, 0.35), rgba(61, 16, 20, 0.7) 70%),
    url("../assets/invite-mood.jpg") center 22% / cover no-repeat,
    #3d1014;
}

body.mood-sad .wash {
  background:
    linear-gradient(180deg, rgba(74, 32, 48, 0.4), rgba(42, 11, 14, 0.75) 70%),
    url("../assets/invite-mood.jpg") center 22% / cover no-repeat,
    #2a0b0e;
}

body.mood-fight .wash {
  background:
    linear-gradient(180deg, rgba(106, 24, 40, 0.38), rgba(61, 16, 20, 0.72) 70%),
    url("../assets/invite-mood.jpg") center 22% / cover no-repeat,
    #3d1014;
}

body.mood-miss .wash,
body.mood-hug .wash,
body.mood-remember .wash {
  background:
    linear-gradient(180deg, rgba(92, 36, 56, 0.35), rgba(61, 16, 20, 0.72) 70%),
    url("../assets/invite-mood.jpg") center 22% / cover no-repeat,
    #3d1014;
}

body.mood-laugh .wash {
  background:
    linear-gradient(180deg, rgba(106, 72, 32, 0.38), rgba(61, 16, 20, 0.72) 70%),
    url("../assets/invite-mood.jpg") center 22% / cover no-repeat,
    #3d1014;
}

.scene {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(4rem + var(--safe-top)) 1.2rem calc(2rem + var(--safe-bottom));
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  background: transparent;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.scene.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

#hub {
  justify-content: flex-start;
}

.from {
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  text-align: center;
}

.lead {
  max-width: 22rem;
  text-align: center;
  margin: 0.7rem 0 1.6rem;
  opacity: 0.7;
  line-height: 1.5;
  font-weight: 300;
}

.envelopes {
  width: min(420px, 100%);
  display: grid;
  gap: 0.85rem;
}

.env-card {
  text-align: left;
  border: 1px solid rgba(212, 176, 122, 0.45);
  background: linear-gradient(180deg, #f7efe2 0%, #ead8c2 100%);
  color: #3d1014;
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.85rem;
  row-gap: 0.15rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.env-card:active {
  transform: scale(0.98);
}

.env-card .stamp {
  grid-row: 1 / span 2;
  font-size: 1.6rem;
  align-self: center;
}

.env-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.55;
}

.env-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
}

.env-card.happy,
.env-card.sad,
.env-card.fight,
.env-card.miss,
.env-card.laugh,
.env-card.hug {
  background: linear-gradient(180deg, #f7efe2 0%, #ead8c2 100%);
}

.env-card.remember {
  background: linear-gradient(180deg, #f3e6d0 0%, #e0c8a4 100%);
  border-color: rgba(201, 160, 86, 0.7);
}

.quiz-card {
  width: min(420px, 100%);
  text-align: center;
}

.quiz-card h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  margin-bottom: 1.2rem;
}

.quiz-stage {
  position: relative;
  min-height: 220px;
  margin: 0 auto;
  width: 100%;
}

.btn-yes,
.btn-back {
  font-family: var(--font-sans);
  border: 0;
  cursor: pointer;
  color: #2a1810;
  background: linear-gradient(135deg, #f0d189, #d4a24a);
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  min-height: 48px;
  font-size: 1rem;
}

.btn-yes {
  position: relative;
  z-index: 2;
  margin-top: 0.4rem;
}

.btn-no {
  position: absolute;
  left: 50%;
  top: 88px;
  transform: translateX(-50%);
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #f7efe8;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  min-width: 72px;
  cursor: default;
  transition: left 0.12s linear, top 0.12s linear;
}

.quiz-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  opacity: 0.5;
}

#letter {
  justify-content: flex-start;
}

.open-stage {
  perspective: 1200px;
  width: 100%;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}

.mail {
  position: relative;
  width: 260px;
  height: 168px;
  transform-style: preserve-3d;
  transform: translateY(24px) scale(0.96);
}

.mail-lid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 86px;
  transform-origin: top center;
  transform-style: preserve-3d;
  z-index: 6;
}

.mail-lid-face {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #f6dc9a 0%, #d7a84c 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  box-shadow: 0 8px 16px rgba(80, 50, 10, 0.18);
}

.mail-sheet {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 8px;
  height: 210px;
  background: linear-gradient(180deg, #fffdf8, #f3ebe0);
  border-radius: 3px 3px 0 0;
  z-index: 2;
  transform: translateY(78px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.mail-face {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 38%, #e8bc5a 38.2%, #c49232 100%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0.85rem 1.05rem;
  text-align: center;
  border-radius: 6px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.mail-to {
  font-family: var(--font-script);
  font-size: 1.55rem;
  color: #4a3018;
  line-height: 1;
}

.mail-when {
  font-family: var(--font-serif);
  font-size: 0.72rem;
  color: #5c4428;
  opacity: 0.85;
  margin-top: 0.2rem;
}

#letter.lit {
  background: transparent !important;
}

.paper {
  background: #faf6f0;
  color: #3a3028;
  padding: 2rem 1.7rem;
  border-radius: 6px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  margin-bottom: 1.4rem;
  visibility: hidden;
}

.paper-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 0.4rem;
}

.paper-head {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.paper-body {
  font-size: 0.98rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.video-wrap {
  margin-top: 1.2rem;
}

.video-wrap.hidden {
  display: none;
}

.video-note {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  margin-bottom: 0.75rem;
}

.video-play {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: #f7efe8;
  background: #2a4a6a;
}

.video-play.hidden {
  display: none;
}

.letter-video {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: #1a1a1a;
}

.letter-video.hidden {
  display: none;
}

.paper-sign {
  font-family: var(--font-script);
  font-size: 2rem;
  margin-top: 1.5rem;
  text-align: right;
  color: #5c2d35;
  white-space: pre-line;
  transform: rotate(-4deg);
  transform-origin: right center;
}

.ps {
  font-family: var(--font-script);
  font-size: 1.35rem;
  line-height: 1.35;
  margin-top: 1.35rem;
  color: #6b2d35;
}

.call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.4rem;
  min-height: 48px;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: #f7efe8;
  background: #2a4a6a;
}

.call-btn.hidden {
  display: none;
}

.home-link {
  position: fixed;
  top: calc(0.75rem + var(--safe-top));
  left: 0.75rem;
  z-index: 50;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.mute-btn {
  position: fixed;
  top: calc(0.65rem + var(--safe-top));
  right: 0.65rem;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  animation: confetti-fall 2.4s ease-out forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}
