:root {
  --bg: #160711;
  --bg-2: #2a0c1f;
  --pink: #ff4f81;
  --soft-pink: #ffb6cf;
  --gold: #ffd166;
  --orange: #f77f00;
  --cream: #fff4dc;
  --muted: rgba(255, 244, 220, 0.72);
  --card: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 244, 220, 0.2);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 79, 129, 0.28), transparent 30rem),
    radial-gradient(circle at 86% 12%, rgba(255, 209, 102, 0.18), transparent 28rem),
    linear-gradient(140deg, var(--bg), var(--bg-2) 52%, #10050d);
  color: var(--cream);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

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

.intro,
.gift-screen,
.birthday-page {
  min-height: 100svh;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.intro,
.gift-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  transition: opacity 0.42s ease, transform 0.42s ease;
}

.intro.is-gone,
.gift-screen.is-gone {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.intro__glow {
  position: absolute;
  width: min(70vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 79, 129, 0.34), transparent 68%);
  filter: blur(12px);
  animation: breathe 4s ease-in-out infinite;
}

.intro-card {
  position: relative;
  width: min(100%, 520px);
  padding: clamp(1.25rem, 5vw, 2.3rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  text-align: center;
}

.intro-card.is-wrong {
  animation: shake 0.34s ease;
}

.eyebrow {
  display: inline-flex;
  min-height: 1.8rem;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.1);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.intro-card h1,
.gift-copy h1,
.hero h1 {
  margin: 0.7rem 0;
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.intro-card__copy,
.gift-copy p,
.hero__sub,
.message-card p {
  color: var(--muted);
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  line-height: 1.55;
}

.intro-card label {
  display: block;
  margin: 1.3rem 0 0.65rem;
  font-size: 1.2rem;
  font-weight: 900;
}

.intro-card__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
}

.intro-card input,
.intro-card button,
.again-button {
  min-height: 3.15rem;
  border-radius: 999px;
}

.intro-card input {
  min-width: 0;
  padding: 0 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.intro-card button,
.again-button {
  border: 0;
  padding: 0 1.15rem;
  background: linear-gradient(135deg, var(--pink), var(--gold));
  color: #280915;
  font-weight: 900;
  box-shadow: 0 16px 40px rgba(255, 79, 129, 0.28);
}

.feedback {
  min-height: 1.5rem;
  margin: 0.9rem 0 0;
  color: #ffd8e6;
  font-weight: 900;
}

.gift-screen {
  text-align: center;
}

.gift-screen[hidden],
.birthday-page[hidden],
.lightbox[hidden] {
  display: none;
}

.gift-screen.is-visible .gift {
  animation: giftEnter 0.65s ease both, giftWiggle 1.1s ease-in-out 0.7s infinite;
}

.gift {
  position: relative;
  width: min(58vw, 310px);
  aspect-ratio: 1;
  margin-top: 2rem;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 35px 55px rgba(0, 0, 0, 0.42));
}

.gift__body,
.gift__lid,
.gift__bow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 244, 220, 0.88) 43% 57%, transparent 58%),
    linear-gradient(135deg, var(--pink), #d62839);
}

.gift__body {
  bottom: 8%;
  width: 78%;
  height: 55%;
}

.gift__lid {
  top: 25%;
  width: 90%;
  height: 22%;
  z-index: 2;
}

.gift__bow {
  top: 8%;
  width: 34%;
  height: 28%;
  border-radius: 50% 50% 12px 12px;
  background: radial-gradient(circle at 35% 32%, #fff0a8, var(--gold), var(--orange));
}

.gift.is-opening .gift__lid {
  animation: lidOpen 0.95s cubic-bezier(0.15, 0.9, 0.22, 1) forwards;
}

.gift.is-opening .gift__bow {
  animation: bowOpen 0.95s cubic-bezier(0.15, 0.9, 0.22, 1) forwards;
}

.birthday-page {
  display: grid;
  gap: clamp(1.3rem, 4vw, 2.6rem);
  width: min(1180px, 100%);
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
}

.birthday-page.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.hero {
  min-height: min(78svh, 780px);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.hero h1 {
  max-width: 900px;
  background: linear-gradient(135deg, #fff4dc, var(--gold), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 70px rgba(255, 79, 129, 0.18);
}

.hero__from {
  width: fit-content;
  margin: 1rem auto 0;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--gold);
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  font-weight: 800;
}

.photo-cloud {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: clamp(0.55rem, 1.6vw, 1rem);
  align-items: center;
}

.photo-card {
  grid-column: span 3;
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 0.45rem;
  border: 0;
  border-radius: 18px;
  background: #fff7e6;
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt));
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.photo-card:nth-child(1),
.photo-card:nth-child(6) {
  grid-column: span 4;
  aspect-ratio: 5 / 4;
}

.photo-card:hover,
.photo-card:focus-visible {
  z-index: 3;
  transform: rotate(0deg) translateY(-8px) scale(1.025);
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.48);
}

.photo-card img,
.flying-photo img,
.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 13px;
}

.message-card {
  padding: clamp(1.2rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.message-card h2 {
  margin: 0.7rem 0 1rem;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.95;
}

.signature {
  color: var(--cream) !important;
  font-weight: 900;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.mini-grid article {
  min-height: 120px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(14px);
}

.mini-grid span {
  display: block;
  color: var(--gold);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 0.9;
}

.mini-grid p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-weight: 800;
}

.again-button {
  width: fit-content;
  margin: 0 auto 3rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(11, 3, 9, 0.88);
  backdrop-filter: blur(12px);
}

.lightbox button {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 2rem;
}

.lightbox img {
  width: min(92vw, 760px);
  height: min(82vh, 860px);
  object-fit: contain;
  background: #050505;
  box-shadow: var(--shadow);
}

.confetti {
  position: fixed;
  left: var(--left);
  top: var(--top);
  z-index: 80;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  background: var(--color);
  pointer-events: none;
  animation: confetti var(--time) cubic-bezier(0.12, 0.78, 0.2, 1) forwards;
}

.flying-photo {
  position: fixed;
  left: 50%;
  top: 48%;
  z-index: 70;
  width: clamp(110px, 18vw, 235px);
  aspect-ratio: 4 / 5;
  padding: 0.42rem;
  border-radius: 16px;
  background: #fff7e6;
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: photoFly 3.2s cubic-bezier(0.12, 0.78, 0.2, 1) forwards;
  animation-delay: var(--delay);
}

@keyframes breathe {
  50% {
    transform: scale(1.08);
  }
}

@keyframes shake {
  20% {
    transform: translateX(-10px);
  }
  40% {
    transform: translateX(9px);
  }
  60% {
    transform: translateX(-7px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes giftEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.85);
  }
}

@keyframes giftWiggle {
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@keyframes lidOpen {
  to {
    transform: translate(-50%, -210px) rotate(22deg);
    opacity: 0;
  }
}

@keyframes bowOpen {
  to {
    transform: translate(-50%, -250px) rotate(-32deg);
    opacity: 0;
  }
}

@keyframes confetti {
  to {
    transform: translate(var(--x), var(--y)) rotate(var(--r));
    opacity: 0;
  }
}

@keyframes photoFly {
  0% {
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(var(--s)) rotate(var(--r));
    opacity: 0;
  }
}

@media (max-width: 780px) {
  .intro-card__row {
    grid-template-columns: 1fr;
  }

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

  .photo-card,
  .photo-card:nth-child(1),
  .photo-card:nth-child(6) {
    grid-column: auto;
    aspect-ratio: 4 / 5;
  }

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

@media (max-width: 480px) {
  .intro,
  .gift-screen,
  .birthday-page {
    padding: 0.9rem;
  }

  .photo-cloud,
  .mini-grid {
    gap: 0.7rem;
  }

  .photo-card {
    border-radius: 14px;
    padding: 0.32rem;
  }

  .mini-grid article {
    min-height: 104px;
  }
}

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