*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink-light: #fff0f3;
  --pink: #e91e63;
  --pink-hot: #c2185b;
  --rose: #d81b60;
  --mauve: #880e4f;
  --cream: #fff5f7;
  --text: #4a0e2f;
}

body {
  font-family: 'Quicksand', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 30%, #f48fb1 60%, #ec407a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  position: relative;
}

/* ─── Floating Hearts Background ─── */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.floating-heart {
  position: absolute;
  bottom: -80px;
  opacity: 0;
  animation: floatUp linear infinite;
  font-size: 24px;
  filter: drop-shadow(0 0 4px rgba(255, 105, 135, 0.3));
}

@keyframes floatUp {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-110vh) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

/* ─── Main Card ─── */
.card-container {
  position: relative;
  z-index: 10;
  width: 90vw;
  max-width: 520px;
  padding: 20px;
}

.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 48px 36px;
  box-shadow:
    0 8px 32px rgba(201, 24, 74, 0.15),
    0 2px 8px rgba(201, 24, 74, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 34px;
  background: linear-gradient(135deg, #e91e63, #c2185b, #d81b60, #f48fb1);
  z-index: -1;
  opacity: 0.5;
}

.card:hover {
  transform: translateY(-2px);
}

/* ─── Stage Animations ─── */
.stage {
  display: none;
  animation: fadeSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  flex: 1;
  justify-content: center;
}

.stage.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Typography ─── */
.script-title {
  font-family: 'Sacramento', cursive;
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  color: var(--pink-hot);
  margin-bottom: 8px;
  line-height: 1.2;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.15rem);
  color: var(--rose);
  margin-bottom: 28px;
  font-weight: 600;
}

.question {
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 32px;
  line-height: 1.4;
}

.emoji-big {
  font-size: clamp(4rem, 12vw, 7rem);
  display: block;
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
  line-height: 1;
}

.emoji-medium {
  font-size: clamp(2.5rem, 8vw, 4rem);
  display: block;
  margin-bottom: 12px;
  line-height: 1;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

/* ─── Buttons ─── */
.btn-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn {
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  font-family: 'Quicksand', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
  border-radius: inherit;
}

.btn-yes {
  background: linear-gradient(135deg, var(--pink-hot) 0%, var(--mauve) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 0, 110, 0.4);
}

.btn-yes:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(255, 0, 110, 0.5);
}

.btn-yes:active {
  transform: scale(0.98);
}

.btn-no {
  background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
  color: #424242;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
  user-select: none;
}

.btn-option {
  background: linear-gradient(135deg, var(--pink) 0%, var(--rose) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(251, 111, 146, 0.35);
}

.btn-option:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(251, 111, 146, 0.5);
}

/* ─── Confetti Canvas ─── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

/* ─── Final Stage ─── */
.final-message {
  font-size: clamp(1.05rem, 3vw, 1.2rem);
  line-height: 1.7;
  color: var(--text);
  margin: 20px 0;
}

.final-hearts {
  font-size: 3rem;
  animation: pulse 1.5s ease-in-out infinite;
  display: block;
  margin: 16px 0;
}

.final-script {
  font-family: 'Sacramento', cursive;
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--pink-hot);
  margin: 16px 0;
}

/* ─── Progress Dots ─── */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  opacity: 0.3;
  transition: all 0.4s ease;
}

.dot.filled {
  opacity: 1;
  background: var(--pink-hot);
  transform: scale(1.2);
}

/* ─── No Counter ─── */
.no-counter {
  font-size: 0.8rem;
  color: var(--rose);
  margin-top: 12px;
  min-height: 20px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.no-counter.visible {
  opacity: 1;
}

/* ─── Sparkle effect on Yes grow ─── */
@keyframes sparkle {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1.5) rotate(180deg);
    opacity: 0;
  }
}

/* ─── Password Section ─── */
.password-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid rgba(226, 135, 167, 0.2);
}

.password-prompt {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 16px;
  font-weight: 600;
}

.password-input-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.password-input {
  padding: 14px 20px;
  border: 2px solid var(--pink);
  border-radius: 50px;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: all 0.3s ease;
  min-width: 200px;
  text-align: center;
  background: white;
  color: var(--text);
}

.password-input:focus {
  border-color: var(--pink-hot);
  box-shadow: 0 0 0 4px rgba(194, 24, 91, 0.1);
  transform: scale(1.02);
}

.password-input::placeholder {
  color: #999;
  font-weight: 500;
}

.password-error {
  min-height: 24px;
  font-size: 0.95rem;
}

/* ─── Image Gallery ─── */
.image-gallery {
  margin-top: 24px;
  animation: fadeSlideIn 0.6s ease forwards;
}

.unlock-success {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--pink-hot);
  margin-bottom: 20px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 1;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .card {
    padding: 36px 24px;
    border-radius: 24px;
  }
  .card::before {
    border-radius: 26px;
  }
  .btn {
    padding: 12px 28px;
    font-size: 0.95rem;
  }
  .btn-group {
    gap: 12px;
  }
  .password-input {
    min-width: 100%;
  }
  .image-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }
}

/* ─── Envelope intro animation ─── */
.envelope-anim {
  animation: envelopeOpen 0.8s ease-out forwards;
}

@keyframes envelopeOpen {
  0% {
    transform: scale(0.3) rotate(-10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.05) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* ─── Shrink/grow no/yes buttons ─── */
.btn-yes.growing {
  animation: growBtn 0.3s forwards;
}

@keyframes growBtn {
  to {
    transform: scale(1.15);
  }
}
