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

:root {
  --cream: #f3ead8;
  --maroon: #5c1c22;
  --wine: #3d1014;
  --gold: #d4b07a;
  --pink-soft: #c9a0a4;
  --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;
  overflow: hidden;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background:
    radial-gradient(ellipse at 50% 0%, #5c1c22 0%, #3d1014 55%, #2a0b0e 100%);
  color: #f3ead8;
  padding: var(--safe-top) 0 var(--safe-bottom);
}

.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%
    ),
    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);
  }
}

#stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.stars-on #stars {
  opacity: 1;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #d4b07a;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.9;
  }
}

.scene {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
}

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

.scene.scene--scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  padding-top: 2rem;
}

.cream-bg {
  position: absolute;
  inset: 0;
  background: var(--cream);
  z-index: -1;
}

.scene-dark,
.scene-purple {
  background: transparent;
}

.bokeh-field,
.flower-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bokeh {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  animation: float-bokeh 12s ease-in-out infinite;
}

@keyframes float-bokeh {
  50% {
    transform: translate(12px, -18px);
  }
}

.flower {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.55;
  animation: float-flower 8s ease-in-out infinite;
}

@keyframes float-flower {
  50% {
    transform: translateY(-10px);
  }
}

.intro-hint {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--gold);
  animation: pulse 2s ease-in-out infinite;
  cursor: pointer;
  z-index: 1;
}

@keyframes pulse {
  50% {
    opacity: 1;
  }
}

.bow-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--maroon);
  font-weight: 400;
  margin-bottom: 1.5rem;
  text-align: center;
  z-index: 1;
}

.bow-title em {
  font-style: italic;
}

.heart-stage {
  position: relative;
  width: min(220px, 55vw);
  height: min(220px, 55vw);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0 2.5rem;
  z-index: 1;
}

.heart-glow {
  position: absolute;
  width: 140%;
  height: 140%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 80, 100, 0.35) 0%, transparent 70%);
}

.heart-3d {
  font-size: clamp(5rem, 18vw, 7rem);
  filter: drop-shadow(0 8px 16px rgba(180, 40, 60, 0.35));
}

.heart-3d.hit {
  transform: scale(1.08);
}

.arrow-hit[hidden] {
  display: none !important;
}

.arrow-hit {
  position: absolute;
  width: 100px;
  transform: rotate(-38deg) translate(18px, -8px);
  animation: arrow-stick 0.35s ease forwards;
}

@keyframes arrow-stick {
  from {
    opacity: 0;
    transform: rotate(-38deg) translate(40px, 30px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: rotate(-38deg) translate(18px, -8px) scale(1);
  }
}

.arrow-svg {
  display: block;
  width: 100%;
}

#scene-bow:not(.active) .bow-widget,
#scene-bow:not(.active) .pull-hint {
  visibility: hidden;
  pointer-events: none;
}

.bow-widget {
  position: absolute;
  left: 8%;
  bottom: calc(18% + var(--safe-bottom));
  width: 100px;
  height: 80px;
  touch-action: none;
  z-index: 3;
}

.bow-widget.is-done {
  visibility: hidden;
}

.bow-svg {
  width: 100%;
  height: auto;
  display: block;
}

.bow-string {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 2px;
  height: 0;
  background: #5c2a2a;
  transform-origin: top center;
}

.bow-arrow {
  position: absolute;
  left: 55%;
  top: 38%;
  display: flex;
  align-items: center;
  transform-origin: left center;
  pointer-events: none;
}

.arrow-shaft {
  display: block;
  width: 36px;
  height: 2px;
  background: #5c2a2a;
}

.arrow-tip {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 10px solid #5c2a2a;
}

.arrow-tip.heart-tip {
  border: none;
  font-size: 14px;
  line-height: 1;
  color: #c44;
}

.bow-arrow.flying {
  z-index: 10;
}

.pull-hint {
  position: absolute;
  bottom: calc(8% + var(--safe-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--maroon);
  z-index: 1;
}

.unwrap-card {
  text-align: center;
  padding: 2rem 2.5rem;
  border: 1px solid rgba(255, 220, 180, 0.25);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 1.5rem;
  max-width: 340px;
}

.gift-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.unwrap-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

.unwrap-name {
  font-family: var(--font-script);
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  color: var(--gold);
  margin: 0.5rem 0;
}

.unwrap-from {
  font-size: 0.8rem;
  opacity: 0.55;
  margin-top: 1rem;
}

.btn-gradient {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.9rem 2.5rem;
  min-height: 48px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8d09a 0%, #c9a056 100%);
  color: #3d1014;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(201, 160, 86, 0.32);
}

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

.tap-magic,
.tap-letter {
  font-size: 0.75rem;
  opacity: 0.45;
  margin-top: 1.25rem;
}

.section-serif {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  margin-bottom: 2rem;
}

.section-serif.light {
  color: rgba(255, 255, 255, 0.95);
}

.progress-wrap {
  width: min(280px, 80vw);
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink-soft), #e8a0c0);
  transition: width 0.15s linear;
}

.loading-text {
  font-size: 0.85rem;
  opacity: 0.6;
}

.cake-wrap {
  margin: 1rem 0 1.5rem;
}

.cake {
  position: relative;
  width: 140px;
  margin: 0 auto;
}

.cake-tier.bottom {
  width: 140px;
  height: 48px;
  background: linear-gradient(180deg, #f8b4c4 0%, #e890a8 100%);
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.cake-tier.top {
  width: 100px;
  height: 36px;
  background: linear-gradient(180deg, #ffc8d4 0%, #f0a0b8 100%);
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  margin: 0 auto -4px;
}

.candle {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  width: 8px;
  height: 28px;
  background: #fff;
  border-radius: 2px;
}

.flame {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 18px;
  background: radial-gradient(ellipse, #ffe566 0%, #ff9500 70%, transparent 100%);
  border-radius: 50%;
  animation: flicker 0.8s ease-in-out infinite alternate;
}

.flame.out {
  opacity: 0;
  animation: none;
}

@keyframes flicker {
  to {
    transform: translateX(-50%) scale(1.1);
  }
}

.happy-script {
  font-family: var(--font-script);
  font-size: clamp(2.5rem, 12vw, 4rem);
  color: var(--gold);
  text-shadow: 0 0 20px rgba(232, 197, 71, 0.5);
  margin-bottom: 1.5rem;
}

.wish-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  cursor: pointer;
}

.balloon-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 2rem);
  margin-bottom: 0.5rem;
}

.balloon-sub {
  font-size: 0.85rem;
  opacity: 0.65;
  margin-bottom: 1.5rem;
  text-align: center;
}

.balloon-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.balloon {
  width: 56px;
  height: 68px;
  border: none;
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  cursor: pointer;
  animation: bob 2.5s ease-in-out infinite;
}

.balloon:nth-child(1) {
  background: #f4a4b8;
}
.balloon:nth-child(2) {
  background: #a8d4f0;
  animation-delay: 0.3s;
}
.balloon:nth-child(3) {
  background: #f5c878;
  animation-delay: 0.6s;
}
.balloon:nth-child(4) {
  background: #c8a8f0;
}
.balloon:nth-child(5) {
  background: #f0a898;
  animation-delay: 0.4s;
}

@keyframes bob {
  50% {
    transform: translateY(-8px);
  }
}

.balloon.popped {
  animation: pop 0.35s ease forwards;
  pointer-events: none;
}

@keyframes pop {
  to {
    transform: scale(1.4);
    opacity: 0;
  }
}

.reason-list {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.reason-card {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 197, 71, 0.35);
  background: rgba(255, 255, 255, 0.06);
  animation: slide-up 0.45s ease forwards;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.reason-badge {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: 0.35rem;
}

.memory-title {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  margin-bottom: 0.35rem;
}

.memory-sub {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-bottom: 1.5rem;
}

.polaroid-track-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin-bottom: 1rem;
}

.clothesline {
  position: absolute;
  top: 12px;
  left: 5%;
  right: 5%;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
}

.polaroid-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2rem 1rem 1rem;
  scrollbar-width: none;
}

.polaroid-track::-webkit-scrollbar {
  display: none;
}

.polaroid {
  flex: 0 0 82%;
  scroll-snap-align: center;
  background: #faf8f5;
  padding: 0.65rem 0.65rem 2.5rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transform: rotate(-2deg);
}

.polaroid img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
}

.polaroid figcaption {
  font-family: var(--font-script);
  font-size: 1.15rem;
  color: #444;
  text-align: center;
  margin-top: 0.65rem;
}

.dots {
  display: flex;
  gap: 6px;
  margin-bottom: 1.25rem;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.dot.active {
  background: var(--gold);
}

.letter-heading {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  margin-bottom: 0.5rem;
}

.letter-sub {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 2rem;
}

.envelope-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1rem;
}

.envelope {
  position: relative;
  width: 160px;
  height: 110px;
}

.env-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #f5d76e 0%, #e8b84a 100%);
  border-radius: 4px;
}

.env-letter {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 18%;
  height: 55%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.5s ease;
}

.envelope.open .env-letter {
  transform: translateY(-45px);
}

.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(180deg, #f0c850 0%, #e0a830 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transition: transform 0.5s ease;
}

.envelope.open .env-flap {
  transform: rotateX(180deg);
}

.paper {
  background: #faf6f0;
  color: #3a3028;
  padding: 2rem 1.75rem;
  border-radius: 4px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  margin-bottom: 1.5rem;
  user-select: text;
}

.paper-dear {
  font-family: var(--font-script);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

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

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

.paper-sign {
  font-family: var(--font-script);
  font-size: 1.35rem;
  margin-top: 1.25rem;
  text-align: right;
}

.finale {
  text-align: center;
}

.finale-small {
  font-family: var(--font-serif);
  letter-spacing: 0.35em;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.finale-name {
  font-family: var(--font-script);
  font-size: clamp(3rem, 14vw, 5rem);
  color: var(--gold);
}

.finale-heart {
  margin-top: 2rem;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
}

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

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

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

.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;
}

@media (max-width: 767px) {
  .bow-widget {
    left: 6%;
    bottom: calc(20% + var(--safe-bottom));
    width: 110px;
    height: 88px;
  }

  .heart-stage {
    margin-bottom: 2rem;
  }
}

@media (min-width: 768px) {
  .bow-widget {
    left: 12%;
    bottom: 22%;
    transform: scale(1.15);
    transform-origin: bottom left;
  }
}
