:root {
  --bg: #f7efe7;
  --bg-strong: #f1e1d2;
  --surface: rgba(255, 251, 246, 0.74);
  --surface-strong: rgba(255, 248, 241, 0.92);
  --surface-border: rgba(121, 84, 59, 0.12);
  --text: #3c2a22;
  --text-soft: #6d5547;
  --accent: #b86d5c;
  --accent-strong: #8f4d3d;
  --accent-soft: rgba(184, 109, 92, 0.14);
  --shadow: 0 20px 60px rgba(101, 71, 51, 0.15);
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --container: min(1120px, calc(100vw - 32px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(255, 226, 204, 0.7), transparent 26%),
    linear-gradient(160deg, #fbf5ef 0%, #f7ecdf 46%, #f2e3d5 100%);
  overflow-x: hidden;
}

img {
  display: block;
  width: 100%;
}

button,
audio {
  font: inherit;
}

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

.orb,
.spark {
  position: absolute;
  border-radius: 999px;
}

.orb {
  filter: blur(8px);
  opacity: 0.55;
  animation: drift 16s ease-in-out infinite;
}

.orb-one {
  width: 260px;
  height: 260px;
  background: rgba(255, 214, 196, 0.55);
  top: -40px;
  left: -50px;
}

.orb-two {
  width: 200px;
  height: 200px;
  background: rgba(255, 244, 214, 0.55);
  right: -30px;
  top: 30%;
  animation-delay: -4s;
}

.orb-three {
  width: 240px;
  height: 240px;
  background: rgba(244, 212, 221, 0.5);
  bottom: -40px;
  left: 20%;
  animation-delay: -9s;
}

.spark {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.75);
  animation: float 7s linear infinite;
}

.spark-one {
  top: 18%;
  left: 14%;
}

.spark-two {
  top: 62%;
  left: 78%;
  animation-delay: -3s;
}

.spark-three {
  top: 78%;
  left: 30%;
  animation-delay: -6s;
}

#app {
  position: relative;
  z-index: 1;
}

.section,
.hero,
.gift-screen {
  width: var(--container);
  margin: 0 auto;
}

.gift-screen {
  min-height: 100vh;
  display: grid;
  align-items: center;
  gap: 28px;
  padding: 24px 0 56px;
  position: relative;
}

.gift-card,
.message-card,
.game-shell,
.final-card,
.timeline-card,
.gallery-card,
.hero__content {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
}

.gift-card {
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.gift-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.24), transparent 55%);
  pointer-events: none;
}

.gift-screen h1,
.hero h2,
.section h2 {
  font-family: "Cormorant Garamond", serif;
  line-height: 1.02;
  margin: 12px 0 0;
}

.gift-screen h1 {
  font-size: clamp(2.8rem, 8vw, 4.6rem);
}

.gift-copy,
.lead,
.message-card p,
.section-intro,
.timeline-card p,
.gallery-card p,
.final-card p,
.share-feedback {
  color: var(--text-soft);
  line-height: 1.75;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

.gift-preview {
  min-height: 420px;
  position: relative;
  isolation: isolate;
}

.gift-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(34, 20, 16, 0.02), rgba(34, 20, 16, 0.28)),
    radial-gradient(circle at top, rgba(255, 245, 235, 0.38), transparent 40%);
  z-index: 1;
}

.gift-preview img {
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.gift-preview__badge {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 2;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff8f1;
  background: rgba(58, 40, 32, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gift-box {
  width: min(190px, 46vw);
  aspect-ratio: 1 / 1;
  justify-self: center;
  position: relative;
  background: linear-gradient(180deg, #d48677 0%, #bf6d5d 100%);
  border-radius: 28px;
  box-shadow: 0 40px 80px rgba(132, 77, 65, 0.25);
  transform: perspective(900px) rotateX(14deg);
  position: absolute;
  inset: auto 50% 28px auto;
  transform: translateX(50%) perspective(900px) rotateX(14deg);
  z-index: 2;
}

.gift-box__lid {
  position: absolute;
  inset: -22px 0 auto;
  height: 84px;
  background: linear-gradient(180deg, #e7a396 0%, #cf7e6f 100%);
  border-radius: 28px;
  transform-origin: center bottom;
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.8s ease;
}

.gift-box__ribbon {
  position: absolute;
  background: rgba(255, 244, 233, 0.88);
}

.gift-box__ribbon--vertical {
  inset: 0 44%;
}

.gift-box__ribbon--horizontal {
  inset: 44% 0;
}

.gift-button {
  margin-top: 28px;
  border: 0;
  background: linear-gradient(140deg, #a04d42 0%, #d78573 100%);
  color: #fff9f4;
  width: min(100%, 380px);
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 34px rgba(136, 79, 67, 0.28);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gift-button:hover,
.gift-button:focus-visible,
.button:hover,
.button:focus-visible,
.music-toggle:hover,
.music-toggle:focus-visible {
  transform: translateY(-2px);
}

.gift-button:active,
.button:active,
.music-toggle:active {
  transform: translateY(1px) scale(0.99);
}

.gift-button__glow {
  position: absolute;
  inset: -50%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.45) 50%, transparent 80%);
  transform: translateX(-60%) rotate(12deg);
  animation: shine 3.4s ease-in-out infinite;
}

.gift-button__content {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  font-weight: 700;
}

.gift-button__icon {
  filter: drop-shadow(0 4px 10px rgba(255, 255, 255, 0.24));
}

.hero,
.section {
  opacity: 0;
  transform: translateY(42px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

body[data-state="opened"] .hero,
body[data-state="opened"] .section {
  opacity: 1;
  transform: translateY(0);
}

.hero {
  display: grid;
  gap: 22px;
  padding: 20px 0 24px;
}

.frame {
  border-radius: calc(var(--radius-lg) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.hero__media {
  max-height: 70vh;
}

.hero__media img {
  height: 100%;
  object-fit: cover;
}

.hero__content {
  padding: 28px 24px;
  border-radius: var(--radius-lg);
}

.hero h2 {
  font-size: clamp(2.5rem, 9vw, 5.5rem);
}

.lead {
  font-size: 1.05rem;
  margin: 18px 0 0;
}

.hero__actions,
.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button,
.music-toggle {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.button {
  padding: 14px 20px;
  font-weight: 700;
}

.button--primary {
  background: linear-gradient(135deg, #a65346 0%, #d08773 100%);
  color: #fff9f4;
  box-shadow: 0 16px 30px rgba(160, 83, 70, 0.24);
}

.button--ghost {
  background: rgba(255, 251, 246, 0.86);
  color: var(--text);
  border: 1px solid rgba(121, 84, 59, 0.18);
}

.section {
  padding: 44px 0 0;
}

.section-heading {
  max-width: 700px;
  margin-bottom: 20px;
}

.section h2 {
  font-size: clamp(2.2rem, 7vw, 4rem);
}

.message-card {
  padding: 28px 24px;
  border-radius: var(--radius-lg);
}

.message-card p {
  margin: 0;
  font-size: 1.06rem;
  white-space: pre-line;
}

.gallery-grid,
.timeline-grid,
.final-grid {
  display: grid;
  gap: 18px;
}

.gallery-card,
.timeline-card,
.final-card {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.gallery-card img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.gallery-card__content {
  padding: 16px;
}

.gallery-card h3,
.timeline-card h3,
.final-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.gallery-card p,
.timeline-card p,
.final-card p {
  margin: 10px 0 0;
}

.timeline-card {
  padding: 22px;
  position: relative;
}

.timeline-card::before {
  content: "";
  width: 52px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  display: block;
  margin-bottom: 16px;
}

.game-shell {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.game-meta {
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
  margin-bottom: 18px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.memory-card {
  position: relative;
  aspect-ratio: 1 / 1.18;
  border-radius: 20px;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
  cursor: pointer;
}

.memory-card.is-flipped,
.memory-card.is-matched {
  transform: rotateY(180deg);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  backface-visibility: hidden;
  overflow: hidden;
}

.memory-card__face--front {
  background:
    radial-gradient(circle at top, rgba(255, 244, 233, 0.8), transparent 45%),
    linear-gradient(160deg, #a85d51 0%, #d8907d 100%);
  display: grid;
  place-items: center;
  color: #fff8f1;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.memory-card__face--back {
  transform: rotateY(180deg);
  background: #ffffff;
}

.memory-card__face--back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card__caption {
  position: absolute;
  inset: auto 10px 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(34, 20, 16, 0.54);
  color: #fff8f1;
  font-size: 0.82rem;
}

.game-win {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 250, 246, 0.88);
  border: 1px solid rgba(121, 84, 59, 0.14);
}

.game-win p {
  margin: 0 0 16px;
  color: var(--text-soft);
}

.final-section {
  padding-bottom: 56px;
}

.final-card {
  padding: 24px;
}

.final-card--message {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.share-feedback {
  min-height: 1.5em;
}

.music-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(58, 40, 32, 0.84);
  color: #fffaf6;
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 30px rgba(48, 31, 24, 0.2);
}

.music-toggle__icon {
  font-size: 1.1rem;
}

.is-hidden {
  display: none !important;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 20;
}

.confetti-piece {
  position: absolute;
  top: -10vh;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  opacity: 0.88;
  animation: confetti-fall 3.2s ease-out forwards;
}

body[data-state="opening"] .gift-box__lid {
  transform: rotateX(-128deg) translateY(-18px);
  opacity: 0.32;
}

body[data-state="opening"] .gift-screen {
  animation: fadeLift 1.4s ease forwards;
}

body[data-state="opening"] .gift-preview img {
  transform: scale(1.04);
  transition: transform 1.1s ease;
}

@keyframes shine {
  0%,
  100% {
    transform: translateX(-65%) rotate(12deg);
    opacity: 0;
  }
  18%,
  52% {
    opacity: 1;
  }
  72% {
    transform: translateX(72%) rotate(12deg);
    opacity: 0;
  }
}

@keyframes float {
  0% {
    transform: translateY(0) scale(0.9);
    opacity: 0;
  }
  20%,
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(-40px) scale(1.05);
    opacity: 0;
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(20px, 28px, 0);
  }
}

@keyframes fadeLift {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  70% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(1.03) translateY(-18px);
    visibility: hidden;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(var(--x-shift), 115vh, 0) rotate(520deg);
    opacity: 0;
  }
}

.floating-conversion {
  position: fixed;
  left: max(0.9rem, env(safe-area-inset-left));
  right: max(0.9rem, env(safe-area-inset-right));
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  gap: 0.62rem;
  pointer-events: none;
}

.floating-conversion a {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.78rem 1rem;
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 18px 42px rgba(83, 50, 34, 0.24);
}

.floating-back {
  color: #fffaf4;
  border: 1px solid rgba(255, 250, 244, 0.55);
  background: rgba(67, 42, 31, 0.72);
  backdrop-filter: blur(16px);
}

.floating-budget {
  color: #3c2018;
  background: linear-gradient(135deg, #f0c088 0%, #fff7e8 48%, #d98f7d 100%);
  animation: premiumPulse 2.6s ease-in-out infinite;
}

@keyframes premiumPulse {
  0%,
  100% {
    box-shadow: 0 18px 42px rgba(83, 50, 34, 0.24), 0 0 0 rgba(240, 192, 136, 0);
  }

  50% {
    box-shadow: 0 22px 52px rgba(83, 50, 34, 0.32), 0 0 34px rgba(240, 192, 136, 0.34);
  }
}

@media (min-width: 760px) {
  .gift-screen {
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
    gap: 34px;
  }

  .gift-preview {
    min-height: 520px;
  }

  .gift-preview img {
    min-height: 520px;
  }

  .hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: center;
    padding-top: 32px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .final-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1040px) {
  .section {
    padding-top: 58px;
  }

  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .timeline-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

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