@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=Fredoka:wght@400;600;700&display=swap");

:root {
  --valentine-sky: linear-gradient(135deg, #ffe6ef 0%, #fde6ff 35%, #e9f6ff 100%);
  --valentine-ink: #532b4c;
  --valentine-petal: #ffb3d9;
  --valentine-glow: rgba(255, 107, 157, 0.35);
  --valentine-gold: #ffd6a5;
}

.valentine-invite {
  padding: 3rem 1.5rem 4rem;
  display: flex;
  justify-content: center;
}

.invite-card {
  position: relative;
  max-width: 900px;
  width: 100%;
  background: var(--valentine-sky);
  border-radius: 32px;
  padding: 2.5rem clamp(1.5rem, 3vw, 3rem);
  box-shadow: 0 24px 60px rgba(255, 107, 157, 0.22);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.invite-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.7), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(255, 240, 250, 0.6), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(255, 214, 165, 0.5), transparent 45%);
  pointer-events: none;
  opacity: 0.9;
}

.invite-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 2rem;
}

.invite-header h2 {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  color: #ff4d8d;
  letter-spacing: 0.5px;
}

.invite-header p {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  color: var(--valentine-ink);
  max-width: 680px;
  margin: 0.5rem auto 0;
}

.flying-envelope {
  position: relative;
  z-index: 1;
  margin: 2rem auto 1rem;
  width: min(240px, 60vw);
  height: 170px;
  cursor: url("/imgs/cursors/purr.png"), pointer;
  animation: envelopeFloat 6s ease-in-out infinite;
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 18px 35px rgba(255, 107, 157, 0.25);
  border: 2px solid rgba(255, 179, 217, 0.8);
}

.envelope-flap {
  position: absolute;
  left: 10px;
  right: 10px;
  top: -5px;
  height: 90px;
  background: linear-gradient(135deg, #ffd6e8, #fff0f8);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 16px;
  border: 2px solid rgba(255, 179, 217, 0.6);
}

.envelope-heart {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  background: #ff6fa9;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 8px 20px rgba(255, 107, 157, 0.45);
}

.envelope-heart::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: heartHalo 3s linear infinite;
}

.heart-winds {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.wind-heart {
  position: absolute;
  font-size: 1.1rem;
  opacity: 0.8;
  filter: drop-shadow(0 6px 12px rgba(255, 107, 157, 0.35));
  animation: windDrift 4s ease-in-out infinite;
}

.wind-heart:nth-child(1) {
  top: 12px;
  left: -10px;
  animation-delay: 0s;
}

.wind-heart:nth-child(2) {
  top: 40px;
  right: -8px;
  animation-delay: 1s;
}

.wind-heart:nth-child(3) {
  bottom: 18px;
  left: 12px;
  animation-delay: 2s;
}

.wind-heart:nth-child(4) {
  bottom: 28px;
  right: 14px;
  animation-delay: 2.6s;
}

.invite-actions {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 1.5rem;
}

.invite-actions .invite-btn {
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff5b9a, #ff95c2);
  color: #fff;
  box-shadow: 0 12px 24px var(--valentine-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.invite-actions .invite-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 30px rgba(255, 107, 157, 0.4);
}

.valentine-dialog {
  position: fixed;
  inset: 0;
  background: rgba(16, 8, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 9998;
  perspective: 900px;
  padding: 1rem;
}

.valentine-dialog.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Envelope Wrapper ── */
.envelope-wrapper {
  position: relative;
  width: min(92vw, 520px);
  max-width: 520px;
  padding-bottom: 160px;
  --envelope-height: 300px;
  --envelope-front-height: 200px;
  --envelope-flap-height: 180px;
}

/* Envelope back (visible behind the letter) */
.env-back {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--envelope-height);
  background: linear-gradient(175deg, #f9d4e2 0%, #f2b8cd 40%, #eea5bf 100%);
  border-radius: 0 0 22px 22px;
  box-shadow: 0 14px 40px rgba(180, 60, 100, 0.25);
  z-index: 0;
  border: 2px solid rgba(200, 120, 160, 0.3);
  border-top: none;
}

/* Envelope inner shadow/liner */
.env-back::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 0 0 16px 16px;
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

/* Envelope front flap — folds open on dialog open */
.env-flap {
  position: absolute;
  top: calc(100% - var(--envelope-height));
  left: -2px;
  right: -2px;
  height: var(--envelope-flap-height);
  background: linear-gradient(170deg, #fce4ed 0%, #f5c6d8 60%, #edafc6 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: top center;
  z-index: 3;
  border: 2px solid rgba(200, 120, 160, 0.3);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.valentine-dialog.is-open .env-flap {
  transform: rotateX(180deg);
  z-index: 0;
}

/* Inner triangle shadow on flap */
.env-flap::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 10%;
  right: 10%;
  height: 90%;
  clip-path: polygon(0 0, 50% 90%, 100% 0);
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

/* Envelope front body (covers bottom of letter) */
.env-front {
  position: absolute;
  bottom: 0;
  left: -2px;
  right: -2px;
  height: var(--envelope-front-height);
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  border-radius: 0 0 22px 22px;
}

.env-front::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(175deg, #f9d4e2 0%, #f2b8cd 40%, #eea5bf 100%);
  clip-path: polygon(0 0, 50% 65%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 22px 22px;
}

/* Inner pattern on envelope front */
.env-front::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  height: calc(100% - 16px);
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 100%, 0 100%);
  border: 1.5px dashed rgba(255, 255, 255, 0.3);
  border-radius: 0 0 16px 16px;
  pointer-events: none;
}

/* ── Letter Card (the actual letter) ── */
.letter-card {
  position: relative;
  width: 100%;
  background:
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 34px,
      rgba(200, 170, 190, 0.12) 34px,
      rgba(200, 170, 190, 0.12) 35px
    ),
    linear-gradient(160deg, #fffdf8 0%, #fff9f0 30%, #fff5ee 60%, #fffbf5 100%);
  border-radius: 8px;
  padding: 2.2rem 2rem 2.5rem;
  box-shadow:
    0 2px 8px rgba(140, 80, 100, 0.1),
    inset 0 0 60px rgba(255, 240, 230, 0.4);
  border: 1.5px solid rgba(210, 180, 190, 0.4);
  text-align: center;
  font-family: "Fredoka", sans-serif;
  z-index: 1;
  transform: translateY(0);
  opacity: 1;
  overflow: visible;
}

.valentine-dialog.is-open .letter-card {
  animation: letterSlideOut 1.2s 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Aged paper edge effect */
.letter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(200, 170, 150, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(200, 170, 150, 0.06) 0%, transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(180, 150, 130, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(200, 170, 150, 0.06) 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, rgba(255, 245, 235, 0.3) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  border-radius: 8px;
}

/* Subtle watermark */
.letter-card::after {
  content: "♡";
  position: absolute;
  bottom: 60px;
  right: 30px;
  font-size: 6rem;
  color: rgba(255, 180, 200, 0.06);
  pointer-events: none;
  z-index: 0;
  transform: rotate(-15deg);
}

/* Ensure content above decorations */
.letter-card > * {
  position: relative;
  z-index: 1;
}

/* Cute stamp in corner */
.letter-stamp {
  position: absolute;
  top: 14px;
  right: 50px;
  width: 44px;
  height: 44px;
  background: #fff;
  border: 2px dashed rgba(200, 140, 170, 0.4);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  transform: rotate(6deg);
  box-shadow: 0 2px 8px rgba(200, 140, 170, 0.15);
}

/* Decorative line under the header */
.letter-line {
  width: 60%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(255, 150, 180, 0.3), rgba(255, 150, 180, 0.5), rgba(255, 150, 180, 0.3), transparent);
  margin: 0 auto 0.8rem;
}

/* Letter footer signature */
.letter-footer {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(200, 170, 190, 0.25);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.letter-footer span:first-child {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.95rem;
  color: #a0788e;
  font-style: italic;
}

.letter-signature {
  font-family: "Dancing Script", cursive;
  font-size: 1.5rem;
  color: #e8648a;
  letter-spacing: 0.5px;
}

.dialog-card.shake {
  animation: dialogShake 0.4s ease;
}

.dialog-emoji-face {
  font-size: 3.5rem;
  margin-bottom: 0.4rem;
  animation: faceBounceIn 0.5s ease;
  transition: transform 0.3s ease;
  line-height: 1;
}

.dialog-emoji-face.face-bounce {
  animation: faceBounce 0.5s ease;
}

.dialog-card h3 {
  font-size: 1.9rem;
  color: #ff4d8d;
  margin-bottom: 0.5rem;
}

.dialog-card p {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  color: var(--valentine-ink);
}

.dialog-actions {
  position: relative;
  min-height: 60px;
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* When evasion mode kicks in, switch to positioned layout */
.dialog-actions.evasion-mode {
  display: block;
  height: 120px;
}

.dialog-actions button {
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: url("/imgs/cursors/purr.png"), pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.3s ease;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

/* Shimmer sweep on both buttons */
.dialog-actions button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: none;
  pointer-events: none;
}

.dialog-actions button:hover::after {
  animation: btnShimmer 0.7s ease forwards;
}

.valentine-yes {
  background: linear-gradient(135deg, #ff5b9a, #ff85b8, #ffb3d9);
  background-size: 200% 200%;
  animation: yesGradientShift 3s ease-in-out infinite, yesPulseGlow 2s ease-in-out infinite;
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.5), 0 0 0 0 rgba(255, 91, 154, 0);
  border-color: rgba(255, 255, 255, 0.5);
  position: relative;
  z-index: 3;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(180, 40, 90, 0.25);
}

.valentine-yes:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 14px 32px rgba(255, 107, 157, 0.55), 0 0 20px rgba(255, 91, 154, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
}

.valentine-yes:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

.valentine-yes.celebrate {
  animation: yesExplode 0.7s ease;
}

.valentine-no {
  background: linear-gradient(135deg, #fff5fa, #ffe8f3);
  color: #b8547a;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(255, 179, 217, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 179, 217, 0.5);
  transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1), top 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease, box-shadow 0.25s ease;
  z-index: 2;
}

/* Once evasion starts, No becomes absolutely positioned */
.evasion-mode .valentine-no {
  position: absolute;
  left: calc(50% + 60px);
  top: 50%;
  transform: translateY(-50%);
}

.valentine-no:hover {
  background: linear-gradient(135deg, #ffe0ee, #ffd4e8);
  box-shadow: 0 8px 22px rgba(255, 179, 217, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 140, 190, 0.6);
}

.valentine-no.is-shy {
  opacity: 0.5;
  z-index: 1;
  transform: scale(0.9);
  filter: blur(0.3px);
}

.evasion-mode .valentine-no.is-shy {
  transform: translateY(-50%) scale(0.9);
}

.valentine-no.is-dizzy {
  animation: noDizzy 0.6s ease-in-out infinite;
}

.evasion-mode .valentine-no.is-dizzy {
  animation: noDizzyAbsolute 0.6s ease-in-out infinite;
}

.valentine-hint {
  font-size: 0.95rem;
  margin-top: 1rem;
  color: #9d5a7b;
  transition: all 0.3s ease;
}

.no-counter {
  font-size: 0.75rem;
  color: #c9a0b8;
  margin-top: 0.4rem;
  min-height: 1.2em;
}

/* Love meter */
.love-meter {
  margin: 1rem 0 0.5rem;
}

.love-meter-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #c090a8;
  margin-bottom: 0.4rem;
}

.love-meter-bar {
  width: 80%;
  max-width: 260px;
  height: 8px;
  background: #f5e0ea;
  border-radius: 99px;
  margin: 0 auto;
  overflow: hidden;
}

.love-meter-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff1493, #ff5b9a, #ff9bc5);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(255, 91, 154, 0.4);
}

.love-meter-hearts {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

.love-meter-hearts span {
  transition: transform 0.3s ease;
  display: inline-block;
}

.love-meter-hearts span.heart-pop {
  animation: heartPop 0.4s ease;
}

/* Mini floating hearts inside dialog */
.mini-float-heart {
  position: absolute;
  font-size: 1.2rem;
  pointer-events: none;
  animation: miniFloat 1.2s ease-out forwards;
  z-index: 10;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: rgba(255, 220, 240, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 179, 217, 0.4);
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 600;
  cursor: url("/imgs/cursors/purr.png"), pointer;
  color: #b8547a;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 5;
  line-height: 1;
}

.dialog-close:hover {
  background: rgba(255, 91, 154, 0.2);
  border-color: rgba(255, 107, 157, 0.6);
  color: #ff4d8d;
  transform: rotate(90deg) scale(1.15);
  box-shadow: 0 4px 14px rgba(255, 107, 157, 0.3);
}

.dialog-close:active {
  transform: rotate(90deg) scale(0.9);
}

.valentine-celebration {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 239, 246, 0.92);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 9999;
}

.valentine-celebration.show {
  opacity: 1;
  pointer-events: auto;
}

.celebration-fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.firework-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: fireworkBurst 1s ease-out forwards;
}

.celebration-card {
  background: #fff;
  border-radius: 28px;
  padding: 2.5rem 3rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(255, 107, 157, 0.3);
  border: 2px solid rgba(255, 179, 217, 0.7);
  font-family: "Fredoka", sans-serif;
  animation: celebrationPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

.celebration-emoji {
  font-size: 4rem;
  animation: celebrationSpin 0.8s ease;
  display: block;
  margin-bottom: 0.5rem;
}

.celebration-card h3 {
  font-size: 2rem;
  color: #ff4d8d;
  margin-bottom: 0.3rem;
}

.celebration-card p {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  color: var(--valentine-ink);
}

.celebration-hearts {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  font-size: 1.5rem;
  margin-top: 0.8rem;
}

.celebration-hearts span {
  animation: celebHeartFloat 1.5s ease-in-out infinite;
}

.celebration-hearts span:nth-child(2) { animation-delay: 0.2s; }
.celebration-hearts span:nth-child(3) { animation-delay: 0.4s; }
.celebration-hearts span:nth-child(4) { animation-delay: 0.6s; }
.celebration-hearts span:nth-child(5) { animation-delay: 0.8s; }

.celebration-loading {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: #ff6fa9;
  border-radius: 50%;
  animation: loadingBounce 1.2s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

.confetti-piece {
  position: fixed;
  font-size: 1.4rem;
  animation: confettiFall 1.6s ease forwards;
  pointer-events: none;
  z-index: 10000;
}

@keyframes envelopeFloat {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-12px) rotate(2deg);
  }
}

@keyframes heartHalo {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.15);
    opacity: 0.1;
  }
}

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

@keyframes dialogPop {
  0% {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes letterSlideOut {
  0% {
    transform: translateY(280px);
    z-index: 1;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  44% {
    z-index: 1;
  }
  45% {
    z-index: 6;
  }
  65% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0);
    z-index: 6;
    opacity: 1;
  }
}

@keyframes dialogShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px) rotate(-1deg); }
  30% { transform: translateX(8px) rotate(1deg); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

@keyframes faceBounceIn {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes faceBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.4) rotate(-5deg); }
  60% { transform: scale(0.9) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes noDizzy {
  0% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(12deg) scale(0.95); }
  30% { transform: rotate(-10deg) scale(1.02); }
  50% { transform: rotate(8deg) scale(0.97); }
  70% { transform: rotate(-6deg) scale(1.01); }
  85% { transform: rotate(4deg) scale(0.98); }
  100% { transform: rotate(0deg) scale(1); }
}

@keyframes noDizzyAbsolute {
  0% { transform: translateY(-50%) rotate(0deg) scale(1); }
  15% { transform: translateY(-50%) rotate(12deg) scale(0.95); }
  30% { transform: translateY(-50%) rotate(-10deg) scale(1.02); }
  50% { transform: translateY(-50%) rotate(8deg) scale(0.97); }
  70% { transform: translateY(-50%) rotate(-6deg) scale(1.01); }
  85% { transform: translateY(-50%) rotate(4deg) scale(0.98); }
  100% { transform: translateY(-50%) rotate(0deg) scale(1); }
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.6); }
  100% { transform: scale(1); }
}

@keyframes miniFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-100px) scale(0.3) rotate(20deg); }
}

@keyframes fireworkBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--fx, 50px), var(--fy, -50px)) scale(0); opacity: 0; }
}

@keyframes celebrationPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes celebrationSpin {
  0% { transform: rotate(0deg) scale(0); }
  50% { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

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

@keyframes loadingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

@keyframes yesExplode {
  0% { transform: scale(1); }
  30% { transform: scale(1.35) rotate(-3deg); }
  60% { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes yesGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes yesPulseGlow {
  0%, 100% { box-shadow: 0 8px 24px rgba(255, 107, 157, 0.5), 0 0 0 0 rgba(255, 91, 154, 0); }
  50% { box-shadow: 0 10px 28px rgba(255, 107, 157, 0.55), 0 0 16px rgba(255, 91, 154, 0.2); }
}

@keyframes btnShimmer {
  0% { left: -100%; }
  100% { left: 150%; }
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 40px)) translateX(var(--drift, 0px)) rotate(720deg) scale(0.4);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .envelope-wrapper {
    width: min(94vw, 480px);
    --envelope-height: 260px;
    --envelope-front-height: 170px;
    --envelope-flap-height: 150px;
  }

  .letter-card {
    padding: 1.8rem 1.5rem 2rem;
  }

  .dialog-actions {
    min-height: 60px;
  }

  .dialog-actions.evasion-mode {
    height: 140px;
  }

  .evasion-mode .valentine-no {
    left: 50%;
    top: 90px;
    transform: translateX(-50%);
  }

  .dialog-close {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .dialog-actions button {
    font-size: 0.95rem;
    padding: 0.75rem 1.4rem;
  }
}

@media (max-width: 600px) {
  .valentine-dialog {
    padding: 1.25rem;
  }

  .valentine-invite {
    padding: 2rem 1rem 3rem;
  }

  .invite-card {
    padding: 2rem 1.25rem 2.5rem;
    border-radius: 24px;
  }

  .invite-header h2 {
    font-size: 1.8rem;
  }

  .invite-header p {
    font-size: 1.05rem;
  }

  .flying-envelope {
    width: min(210px, 70vw);
    height: 150px;
  }

  .invite-actions .invite-btn {
    width: 100%;
    max-width: 280px;
  }

  .dialog-card {
    padding: 1.6rem 1.5rem 2rem;
    max-height: 80vh;
    overflow-y: auto;
  }

  .letter-stamp {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    right: 42px;
    top: 12px;
  }

  .dialog-card h3 {
    font-size: 1.6rem;
  }

  .dialog-card p {
    font-size: 1rem;
  }

  .letter-signature {
    font-size: 1.3rem;
  }

  .dialog-emoji-face {
    font-size: 2.8rem;
  }

  .love-meter-bar {
    width: 90%;
  }
}

@media (max-width: 420px) {
  .envelope-wrapper {
    width: 96vw;
    padding-bottom: 130px;
    --envelope-height: 220px;
    --envelope-front-height: 140px;
    --envelope-flap-height: 120px;
  }

  .letter-card {
    padding: 1.4rem 1.1rem 1.6rem;
    border-radius: 6px;
  }

  .letter-card::after {
    font-size: 4rem;
    bottom: 40px;
    right: 16px;
  }

  .dialog-card h3 {
    font-size: 1.35rem;
  }

  .dialog-card p {
    font-size: 0.9rem;
  }

  .dialog-emoji-face {
    font-size: 2.4rem;
    margin-bottom: 0.2rem;
  }

  .letter-stamp {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    right: 32px;
    top: 10px;
  }

  .dialog-actions button {
    font-size: 0.85rem;
    padding: 0.65rem 1.2rem;
  }

  .dialog-actions {
    gap: 0.6rem;
  }

  .dialog-actions.evasion-mode {
    height: 160px;
  }

  .evasion-mode .valentine-no {
    left: 50%;
    top: 100px;
    transform: translateX(-50%);
  }

  .dialog-actions.evasion-mode {
    height: 110px;
  }

  .valentine-hint {
    font-size: 0.8rem;
  }

  .no-counter {
    font-size: 0.65rem;
  }

  .letter-footer {
    margin-top: 0.8rem;
  }

  .letter-signature {
    font-size: 1.1rem;
  }

  .love-meter-label {
    font-size: 0.6rem;
  }

  .love-meter-bar {
    height: 6px;
  }

  .love-meter-hearts span {
    font-size: 0.7rem;
  }

  .dialog-close {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
    top: -12px;
    right: -8px;
  }
}

@media (max-width: 360px) {
  .valentine-dialog {
    padding: 0.75rem;
  }

  .dialog-card {
    max-height: 75vh;
  }

  .dialog-actions.evasion-mode {
    height: 140px;
  }

  .evasion-mode .valentine-no {
    top: 90px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flying-envelope,
  .wind-heart,
  .envelope-heart::after {
    animation: none;
  }

  .letter-card {
    transform: translateY(0);
    z-index: 6;
    opacity: 1;
    animation: none;
  }

  .env-flap {
    transition: none;
  }
}
