@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Dancing+Script:wght@400;700&family=Quicksand:wght@300;400;500;600;700&display=swap');

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

:root {
  /* Colors */
  --pink-primary: #FF69B4;
  --pink-light: #FFB6C1;
  --pink-deep: #FF1493;
  --pink-bg-1: #FFF0F5;
  --pink-bg-2: #FFE4E1;
  --pink-soft: #FFC0CB;
  --white: #FFFFFF;
  --dark: #2D1B2E;
  --gold: #FFD700;
  --rose-gold: #B76E79;

  /* Gradients */
  --bg-gradient: linear-gradient(135deg, #FFF0F5 0%, #FFE4E1 50%, #FFF5F5 100%);
  --btn-gradient: linear-gradient(135deg, #FF69B4, #FF1493);
  --btn-gradient-hover: linear-gradient(135deg, #FF1493, #C71585);
  --card-gradient: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,240,245,0.9));

  /* Fonts — loaded from Google Fonts */
  --font-heading: 'Dancing Script', cursive;
  --font-body: 'Quicksand', sans-serif;
  --font-letter: 'Caveat', cursive;

  /* Spacing */
  --page-padding: 20px;

  /* Transitions */
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--dark);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.page {
  display: none;               /* hidden by default */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: var(--page-padding);
  position: relative;
  overflow: hidden;
}

.page.active {
  display: flex;
  animation: fadeInUp 0.8s ease-out;
}

/* The gallery page needs to scroll */
.page.scrollable {
  justify-content: flex-start;
  overflow-y: auto;
}

/* Key Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

@keyframes pulseAggressive {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,20,147,0.7); }
  50%      { transform: scale(1.15); box-shadow: 0 0 30px 10px rgba(255,20,147,0.4); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-110vh) rotate(720deg); opacity: 0; }
}

@keyframes floatHeart {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-200px) scale(0.5); opacity: 0; }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes flickerFlame {
  0%, 100% { transform: scaleY(1) scaleX(1); opacity: 1; }
  25%      { transform: scaleY(1.2) scaleX(0.9); opacity: 0.9; }
  50%      { transform: scaleY(0.9) scaleX(1.1); opacity: 1; }
  75%      { transform: scaleY(1.1) scaleX(0.95); opacity: 0.85; }
}

@keyframes smokePuff {
  0%   { opacity: 0.8; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(2); }
}

@keyframes envelopeOpen {
  0%   { transform: rotateX(0deg); }
  100% { transform: rotateX(-180deg); }
}

@keyframes slideUp {
  0%   { transform: translateY(100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes confettiFall {
  0%   { transform: translateY(-100%) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50%      { opacity: 1; transform: scale(1); }
}

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

@keyframes petalFall {
  0%   { transform: translateY(-10%) rotate(0deg) translateX(0); opacity: 1; }
  25%  { transform: translateY(25vh) rotate(90deg) translateX(30px); }
  50%  { transform: translateY(50vh) rotate(180deg) translateX(-20px); }
  75%  { transform: translateY(75vh) rotate(270deg) translateX(40px); }
  100% { transform: translateY(110vh) rotate(360deg) translateX(0); opacity: 0; }
}

/* Button Styles */
.btn {
  padding: 16px 48px;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-bounce);
  position: relative;
  z-index: 10;
}

.btn-yes {
  background: var(--btn-gradient);
  color: white;
  box-shadow: 0 8px 25px rgba(255, 20, 147, 0.4);
}

.btn-yes:hover {
  background: var(--btn-gradient-hover);
  transform: scale(1.1);
  box-shadow: 0 12px 35px rgba(255, 20, 147, 0.6);
}

.btn-no {
  background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
  color: #555;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-no.shrinking {
  transform: scale(0.8);
}

.btn-no.tiny {
  transform: scale(0.5);
  opacity: 0.6;
}

.btn-no.gone {
  display: none !important;
}

.btn-action {
  background: var(--btn-gradient);
  color: white;
  box-shadow: 0 8px 25px rgba(255, 20, 147, 0.4);
  animation: pulse 2s infinite;
}

.btn-container {
  display: flex;
  gap: 24px;
  margin-top: 30px;
  position: relative;
  width: 100%;
  max-width: 400px;
  justify-content: center;
  min-height: 70px;
}

/* Cat Image Styles */
.cat-image-container {
  width: 90%;
  max-width: 450px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(255, 105, 180, 0.3);
  margin: 20px 0;
  animation: fadeInUp 0.6s ease-out;
}

.cat-image-container img {
  width: 100%;
  height: auto;
  display: block;
}

.cat-heading {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--pink-deep);
  text-align: center;
  text-shadow: 2px 2px 10px rgba(255, 105, 180, 0.3);
  margin-bottom: 10px;
}

/* Password Page Styles */
.password-page {
  background: linear-gradient(135deg, #1a0a1e 0%, #2D1B2E 50%, #1a0a1e 100%);
  color: white;
}

.password-container {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 105, 180, 0.2);
  border-radius: 30px;
  padding: 50px 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.password-input {
  width: 100%;
  padding: 16px 24px;
  border: 2px solid rgba(255, 105, 180, 0.3);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-family: var(--font-body);
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: var(--transition-smooth);
  margin: 20px 0;
}

.password-input:focus {
  border-color: var(--pink-primary);
  box-shadow: 0 0 20px rgba(255, 105, 180, 0.3);
}

.password-input.wrong {
  animation: shake 0.5s ease;
  border-color: #ff4444;
}

.lock-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.password-hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 15px;
}

.password-error {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 10px;
  min-height: 24px;
}

/* Birthday Entrance Page */
.birthday-title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 8vw, 5rem);
  background: linear-gradient(135deg, var(--pink-deep), var(--gold), var(--pink-primary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
  text-align: center;
  line-height: 1.3;
}

.birthday-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--pink-deep);
  margin-top: 20px;
  opacity: 0;
  animation: fadeIn 1s ease-out 1s forwards;
}

/* Cake Page Styles */
.cake-container {
  position: relative;
  width: 300px;
  height: 350px;
  margin: 20px auto;
}

.cake-layer {
  position: absolute;
  border-radius: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.cake-bottom {
  width: 280px;
  height: 120px;
  bottom: 0;
  background: linear-gradient(135deg, #FF69B4, #FF1493);
  border-radius: 20px 20px 30px 30px;
}

.cake-middle {
  width: 220px;
  height: 100px;
  bottom: 110px;
  background: linear-gradient(135deg, #FFB6C1, #FF69B4);
  border-radius: 20px;
}

.cake-top {
  width: 160px;
  height: 80px;
  bottom: 200px;
  background: linear-gradient(135deg, #FFF0F5, #FFB6C1);
  border-radius: 20px 20px 10px 10px;
}

.cake-text {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: white;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  white-space: nowrap;
}

.candle {
  position: absolute;
  width: 8px;
  height: 45px;
  background: linear-gradient(to top, var(--gold), #FFFACD);
  border-radius: 3px;
  top: -60px;
}

.flame {
  position: absolute;
  width: 14px;
  height: 20px;
  background: radial-gradient(ellipse at bottom, #FFD700, #FF6347, transparent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  animation: flickerFlame 0.3s ease-in-out infinite alternate;
}

.flame.out {
  display: none;
}

.smoke {
  display: none;
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(200, 200, 200, 0.6);
  border-radius: 50%;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
}

.smoke.visible {
  display: block;
  animation: smokePuff 1s ease-out forwards;
}

.knife {
  display: none;
  width: 120px;
  cursor: grab;
  position: absolute;
  z-index: 100;
  font-size: 4rem;
  user-select: none;
  transition: none;
}

.knife.active {
  display: block;
}

.cake-slice-line {
  display: none;
  position: absolute;
  width: 3px;
  height: 0;
  background: var(--gold);
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  transition: height 0.5s ease;
}

.cake-slice-line.cutting {
  display: block;
  height: 100%;
}

/* Gallery Page Styles */
.gallery-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--pink-deep);
  text-align: center;
  margin: 40px 0 30px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding: 0 20px 40px;
  max-width: 900px;
  width: 100%;
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.polaroid {
  background: white;
  padding: 10px 10px 40px;
  border-radius: 5px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  transform: rotate(var(--rotation, 0deg));
  transition: var(--transition-smooth);
  cursor: pointer;
  animation: gentleFloat 4s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 20px 50px rgba(255, 105, 180, 0.3);
  z-index: 10;
}

.polaroid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 3px;
}

.video-section {
  width: 100%;
  max-width: 900px;
  padding: 0 20px 40px;
}

.video-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  margin-bottom: 24px;
}

.video-card video {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.lightbox img {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 60px rgba(255, 105, 180, 0.5);
}

/* Love Letter / Envelope Styles */
.envelope-container {
  perspective: 1000px;
  width: 320px;
  height: 220px;
  margin: 30px auto;
  cursor: pointer;
}

.envelope {
  position: relative;
  width: 100%;
  height: 100%;
}

.envelope-body {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #FFB6C1, #FF69B4);
  border-radius: 10px;
  position: relative;
  box-shadow: 0 10px 30px rgba(255, 105, 180, 0.3);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(135deg, #FF69B4, #FF1493);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: top center;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.envelope-flap.open {
  transform: rotateX(-180deg);
}

.envelope-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  z-index: 3;
  animation: pulse 1.5s infinite;
}

.letter-container {
  display: none;
  max-width: 700px;
  width: 90%;
  margin: 0 auto;
  padding: 40px;
  background: linear-gradient(135deg, #FFFAF0, #FFF5EE);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(255, 105, 180, 0.2);
  position: relative;
  animation: slideUp 1s ease-out;
}

.letter-container.visible {
  display: block;
}

.letter-text {
  font-family: var(--font-letter);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  line-height: 2;
  color: var(--dark);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.letter-decoration {
  position: absolute;
  font-size: 2rem;
  opacity: 0.2;
}

/* Countdown / Final Page */
.countdown-container {
  display: flex;
  gap: 15px;
  margin: 30px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.countdown-box {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 20px 25px;
  min-width: 90px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(255, 105, 180, 0.2);
  border: 2px solid rgba(255, 105, 180, 0.1);
}

.countdown-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--pink-deep);
  font-weight: 700;
}

.countdown-label {
  font-size: 0.8rem;
  color: var(--rose-gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 5px;
}

.birthday-today {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 6vw, 4rem);
  color: var(--pink-deep);
  text-align: center;
  animation: pulse 2s infinite;
}

/* Particle Effects */
.particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  font-size: 1.5rem;
  animation: floatUp 4s ease-in forwards;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 3s ease-in forwards;
}

.sparkle-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, var(--gold), transparent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: sparkle 0.6s ease-out forwards;
}

.petal {
  position: absolute;
  font-size: 1.5rem;
  animation: petalFall 6s linear forwards;
  pointer-events: none;
}

/* Music toggle button */
.music-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--btn-gradient);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 500;
  box-shadow: 0 4px 15px rgba(255, 20, 147, 0.4);
  transition: var(--transition-smooth);
  display: none;
}

.music-toggle:hover {
  transform: scale(1.1);
}

/* Balloon styles */
.balloon-container {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
  max-width: 500px;
  margin: 20px auto;
}

.balloon {
  width: 80px;
  height: 100px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  position: relative;
  cursor: pointer;
  animation: gentleFloat 3s ease-in-out infinite;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: 50%;
  width: 2px;
  height: 30px;
  background: rgba(0,0,0,0.2);
  transform: translateX(-50%);
}

.balloon.popped {
  transform: scale(1.5);
  opacity: 0;
  transition: all 0.3s ease;
}

.balloon-message {
  display: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--dark);
  text-align: center;
  padding: 10px 20px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  animation: fadeInUp 0.5s ease-out;
  max-width: 250px;
  margin: 10px auto;
}

.balloon-message.visible {
  display: block;
}

@media (max-width: 480px) {
  .password-container { padding: 30px 20px; }
  .btn { padding: 14px 36px; font-size: 1rem; }
  .cat-image-container { max-width: 95%; }
  .letter-container { padding: 25px 20px; }
  .countdown-box { min-width: 70px; padding: 15px; }
  .countdown-number { font-size: 2rem; }
  .gallery-grid { gap: 8px; padding: 0 10px 20px; }
  .polaroid { padding: 6px 6px 25px; }
  .polaroid img { height: 140px; }
  .envelope-container { width: 260px; height: 180px; }
}
