:root {
  color: #6f3e4d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  background: #f9d5d6;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 236, 166, 0.96) 0 2px, transparent 2.7px),
    radial-gradient(circle at 84% 16%, rgba(232, 137, 151, 0.68) 0 3px, transparent 3.8px),
    radial-gradient(circle at 13% 78%, rgba(244, 179, 190, 0.75) 0 3px, transparent 3.8px),
    radial-gradient(circle at 90% 72%, rgba(247, 208, 111, 0.8) 0 2px, transparent 2.7px),
    linear-gradient(148deg, #fff7e5 0%, #fee7dc 48%, #f7c3cf 100%);
}

button {
  font: inherit;
}

.surprise {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.surprise::before {
  position: absolute;
  inset: -18%;
  z-index: -2;
  content: "";
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.62), transparent 30%),
    radial-gradient(circle at 15% 75%, rgba(255, 214, 169, 0.55), transparent 24%),
    radial-gradient(circle at 82% 20%, rgba(255, 255, 255, 0.5), transparent 28%);
  animation: background-drift 12s ease-in-out infinite alternate;
}

.decorations {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.spark {
  position: absolute;
  color: #cf9443;
  filter: drop-shadow(0 4px 8px rgba(150, 99, 42, 0.16));
  animation: sparkle 2.8s ease-in-out infinite;
}

.spark--one {
  top: 12%;
  left: 17%;
  font-size: clamp(1rem, 5vw, 1.6rem);
}

.spark--two {
  top: 30%;
  right: 12%;
  font-size: clamp(0.8rem, 4vw, 1.25rem);
  animation-delay: -1.2s;
}

.spark--three {
  right: 22%;
  bottom: 14%;
  font-size: clamp(1rem, 4vw, 1.4rem);
  animation-delay: -2s;
}

.dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e59aa8;
  box-shadow: 0 5px 12px rgba(157, 85, 104, 0.16);
  animation: float-dot 4.5s ease-in-out infinite;
}

.dot--one {
  top: 20%;
  right: 22%;
}

.dot--two {
  bottom: 24%;
  left: 14%;
  width: 5px;
  height: 5px;
  background: #ebbb5c;
  animation-delay: -1.5s;
}

.dot--three {
  top: 58%;
  right: 9%;
  width: 5px;
  height: 5px;
  animation-delay: -3s;
}

.intro {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: clamp(1.6rem, 5vh, 2.5rem);
  padding:
    max(1.5rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  transition:
    opacity 700ms ease,
    visibility 0s linear 700ms;
}

.card {
  position: relative;
  display: grid;
  width: min(74vw, 22rem);
  aspect-ratio: 4 / 5;
  place-items: center;
  padding: clamp(2.3rem, 9vw, 3.5rem) clamp(1.4rem, 6vw, 2.25rem);
  overflow: hidden;
  color: #7b4051;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 249, 240, 0.66)),
    rgba(255, 253, 247, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: clamp(1.7rem, 8vw, 2.5rem);
  box-shadow:
    0 1.4rem 3.5rem rgba(105, 56, 70, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: card-float 3.6s ease-in-out infinite;
  transition:
    transform 250ms ease,
    box-shadow 250ms ease,
    opacity 720ms ease,
    filter 720ms ease;
}

.card::before,
.card::after {
  position: absolute;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  content: "";
  filter: blur(3px);
  pointer-events: none;
}

.card::before {
  top: -7rem;
  left: -5rem;
  background: rgba(255, 218, 184, 0.46);
}

.card::after {
  right: -6rem;
  bottom: -7rem;
  background: rgba(244, 180, 194, 0.38);
}

.card:focus-visible {
  outline: 3px solid rgba(123, 64, 81, 0.64);
  outline-offset: 7px;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-6px) scale(1.015);
    box-shadow:
      0 1.8rem 4.4rem rgba(105, 56, 70, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }
}

.card:active {
  transform: scale(0.985);
}

.card__glow {
  position: absolute;
  inset: -35%;
  background: linear-gradient(
    115deg,
    transparent 38%,
    rgba(255, 255, 255, 0.58) 48%,
    transparent 58%
  );
  transform: translateX(-55%) rotate(8deg);
  animation: card-shimmer 4.2s ease-in-out infinite;
}

.card__heart {
  position: absolute;
  top: clamp(1.2rem, 6vw, 2rem);
  color: #b26d82;
  font: 400 clamp(2rem, 9vw, 2.8rem) / 1 Georgia, serif;
}

.card__message {
  position: relative;
  z-index: 1;
  font: 700 clamp(1.65rem, 7.2vw, 2.25rem) / 1.24 Georgia, "Times New Roman", serif;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hint {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  color: #8c5260;
  font-size: clamp(0.78rem, 3.4vw, 0.92rem);
  font-weight: 650;
  letter-spacing: 0.045em;
  text-transform: lowercase;
}

.hint__pulse {
  position: relative;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #b26d82;
  box-shadow: 0 0 0 0 rgba(178, 109, 130, 0.45);
  animation: tap-pulse 1.8s ease-out infinite;
}

.reveal {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94);
  transition:
    opacity 850ms ease 160ms,
    transform 1050ms cubic-bezier(0.2, 0.8, 0.2, 1) 120ms,
    visibility 0s linear 1.1s;
}

.reveal::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(
    180deg,
    rgba(78, 49, 55, 0.14),
    rgba(63, 42, 48, 0.32)
  );
}

.reveal__backdrop {
  position: absolute;
  inset: -2.5rem;
  z-index: -2;
  width: calc(100% + 5rem);
  height: calc(100% + 5rem);
  object-fit: cover;
  filter: blur(28px) saturate(0.9);
  opacity: 0.78;
  transform: scale(1.08);
}

.photo {
  display: grid;
  width: min(88vw, 29rem);
  max-height: calc(100svh - max(2rem, env(safe-area-inset-top)) - max(2rem, env(safe-area-inset-bottom)));
  grid-template-rows: minmax(0, 1fr) auto;
  margin: 0;
  overflow: hidden;
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: clamp(1.4rem, 6vw, 2rem);
  box-shadow: 0 1.6rem 4rem rgba(45, 25, 31, 0.34);
  transform: translateY(1rem);
  transition: transform 950ms cubic-bezier(0.2, 0.8, 0.2, 1) 180ms;
}

.photo__image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: rgba(255, 250, 242, 0.86);
}

.photo__fallback {
  display: none;
  min-height: 55svh;
  place-items: center;
  padding: 2rem;
  color: #7b4051;
  background: linear-gradient(145deg, #fff7e5, #f7c3cf);
  font: 700 1.7rem / 1.25 Georgia, serif;
  text-align: center;
}

.photo__caption {
  padding:
    clamp(1.05rem, 4.5vw, 1.4rem)
    clamp(1rem, 5vw, 1.6rem)
    max(clamp(1.05rem, 4.5vw, 1.4rem), env(safe-area-inset-bottom));
  color: #713d4b;
  background:
    radial-gradient(circle at 90% 15%, rgba(250, 214, 141, 0.28), transparent 35%),
    linear-gradient(135deg, rgba(255, 251, 242, 0.98), rgba(255, 235, 230, 0.98));
  font: 700 clamp(1.15rem, 5.3vw, 1.55rem) / 1.25 Georgia, "Times New Roman", serif;
  letter-spacing: -0.015em;
  text-align: center;
  text-wrap: balance;
}

.is-open .intro {
  opacity: 0;
  visibility: hidden;
}

.is-open .card {
  opacity: 0;
  filter: blur(9px);
  transform: scale(1.08);
  animation-play-state: paused;
}

.is-open .reveal {
  z-index: 3;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition:
    opacity 850ms ease 160ms,
    transform 1050ms cubic-bezier(0.2, 0.8, 0.2, 1) 120ms,
    visibility 0s;
}

.is-open .photo {
  transform: translateY(0);
}

.photo-error .photo__image {
  display: none;
}

.photo-error .photo__fallback {
  display: grid;
}

@keyframes card-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes card-shimmer {
  0%,
  58% {
    transform: translateX(-62%) rotate(8deg);
  }
  82%,
  100% {
    transform: translateX(62%) rotate(8deg);
  }
}

@keyframes tap-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(178, 109, 130, 0.45);
  }
  75%,
  100% {
    box-shadow: 0 0 0 0.75rem rgba(178, 109, 130, 0);
  }
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.84) rotate(-8deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.12) rotate(8deg);
  }
}

@keyframes float-dot {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes background-drift {
  from {
    transform: translate3d(-1%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(1%, 1%, 0) scale(1.03);
  }
}

@media (max-height: 650px) {
  .intro {
    gap: 1.2rem;
  }

  .card {
    width: min(54vh, 18rem);
  }

  .photo {
    width: min(76vw, 24rem);
  }

  .photo__caption {
    padding-top: 0.8rem;
    padding-bottom: max(0.8rem, env(safe-area-inset-bottom));
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .photo {
    width: auto;
    height: calc(100svh - 1.5rem);
    grid-template-columns: minmax(0, auto) minmax(10rem, 18rem);
    grid-template-rows: 1fr;
  }

  .photo__caption {
    display: grid;
    align-content: center;
  }
}

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