﻿:root {
  --pink-1: #ffe6f0;
  --pink-2: #ffb7d5;
  --pink-3: #ff6eae;
  --pink-4: #e93d8f;
  --pink-5: #9b1b61;
  --surface: rgba(255, 249, 252, 0.84);
  --surface-border: rgba(255, 255, 255, 0.6);
  --text: #72184a;
  --white: #fff8fc;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, #ffd9ea 0%, transparent 38%),
    radial-gradient(circle at 86% 22%, #ffc5de 0%, transparent 43%),
    linear-gradient(135deg, var(--pink-2), var(--pink-3));
  display: grid;
  place-items: center;
  color: var(--text);
}

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

.heart {
  position: absolute;
  bottom: -40px;
  color: rgba(255, 255, 255, 0.78);
  animation: floatUp linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
  user-select: none;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-120vh) translateX(55px) rotate(26deg);
    opacity: 0;
  }
}

.card {
  position: relative;
  z-index: 1;
  width: min(92vw, 760px);
  background: var(--surface);
  border: 2px solid var(--surface-border);
  border-radius: 28px;
  padding: 2.7rem 1.4rem;
  text-align: center;
  box-shadow:
    0 24px 55px rgba(116, 22, 72, 0.23),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  animation: popIn 0.9s ease;
  margin: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

@keyframes popIn {
  from {
    transform: scale(0.92) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

h1 {
  font-size: clamp(1.8rem, 4.3vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin-bottom: 0.8rem;
  color: var(--pink-4);
  text-shadow: 0 2px 12px rgba(255, 110, 174, 0.3);
}

p {
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
  margin-bottom: 2rem;
  color: var(--pink-5);
  font-weight: 700;
}

.buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: nowrap;
  align-items: center;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.8rem;
  min-width: 150px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

#yesBtn {
  background: linear-gradient(135deg, var(--pink-3), var(--pink-4));
  color: var(--white);
  box-shadow: 0 10px 24px rgba(233, 61, 143, 0.34);
}

#yesBtn:hover {
  transform: translateY(-2px) scale(1.03);
}

#yesBtn:active {
  transform: translateY(0) scale(0.99);
}

#noBtn {
  background: #ffe2ef;
  color: #a53b71;
  box-shadow: 0 8px 20px rgba(165, 59, 113, 0.2);
  transform-origin: center;
}

#noBtn:hover {
  background: #ffd7e9;
}

.result {
  margin-top: 1.3rem;
  min-height: 1.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #9c1d61;
}

.cat-box {
  margin-top: 1rem;
}

.cat-img {
  width: min(82vw, 230px);
  border-radius: 16px;
  border: 3px solid #ffffff;
  box-shadow: 0 12px 28px rgba(122, 21, 79, 0.28);
}

.hidden {
  display: none !important;
}

.surprise {
  margin-top: 0.5rem;
  animation: popIn 0.7s ease;
  position: relative;
}

.surprise-title {
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  color: var(--pink-4);
  margin-bottom: 0.7rem;
}

.surprise-text {
  margin-bottom: 1rem;
  font-size: clamp(1rem, 2.4vw, 1.12rem);
  color: #8a2d61;
}

.envelope-wrap {
  margin: 1rem auto 0;
  width: min(92vw, 430px);
  text-align: center;
}

.envelope {
  --flap: 0%;
  position: relative;
  width: 100%;
  height: 230px;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffc5de, #ff9dc7);
  box-shadow: 0 22px 40px rgba(122, 21, 79, 0.22);
  overflow: hidden;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  transform-origin: top;
  transform: rotateX(calc(var(--flap) * -0.65deg));
}

.envelope-heart {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.8rem;
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
}

.tap-label {
  display: block;
  margin-top: 0.95rem;
  font-weight: 700;
  color: #912459;
}

.envelope.tap {
  transform: scale(0.985);
}

.envelope.is-opened {
  transform: translateY(-4px) scale(1.02);
}

.photo-wall {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.flip-card {
  border: none;
  background: transparent;
  padding: 0;
  perspective: 900px;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.flip-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.flip-inner {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  transform-style: preserve-3d;
  transition: transform 0.55s ease;
}

.flip-card.is-flipped .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 22px rgba(122, 21, 79, 0.2);
}

.flip-front {
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #ffb4d3, #f57eb4);
  color: #ffffff;
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 900;
  text-shadow: 0 3px 8px rgba(122, 21, 79, 0.45);
}

.flip-back {
  object-fit: cover;
  transform: rotateY(180deg);
}

.flip-card:not(.is-flipped):hover .flip-inner {
  transform: translateY(-2px) scale(1.02);
}

@media (max-width: 520px) {
  .card {
    padding: 2.15rem 1rem;
    border-radius: 24px;
  }

  button {
    min-width: 126px;
    padding: 0.85rem 1rem;
  }

  .envelope {
    height: 190px;
  }

  .envelope-heart {
    font-size: 2.3rem;
  }

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

@media (min-width: 390px) and (max-width: 430px) {
  .card {
    width: min(94vw, 405px);
    padding: 2rem 0.95rem;
    border-radius: 22px;
  }

  h1 {
    font-size: clamp(1.55rem, 7vw, 2.05rem);
  }

  #mainSubtitle {
    margin-bottom: 1.35rem;
  }

  .buttons {
    gap: 0.55rem;
  }

  button {
    min-width: 118px;
    font-size: 0.93rem;
    padding: 0.78rem 0.85rem;
  }

  .surprise-title {
    font-size: clamp(1.15rem, 5.4vw, 1.45rem);
  }

  .surprise-text {
    font-size: 0.96rem;
    line-height: 1.42;
  }
}
