* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Performance optimizations */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

:root {
  --primary-pink: #ff6b9d;
  --primary-purple: #764ba2;
  --primary-blue: #667eea;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  --gradient-2: linear-gradient(135deg, #ff6b9d, #ff8fab);
  --gradient-3: linear-gradient(135deg, #c471ed, #f64f59);
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
}

@media screen and (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
  }
}

body {
  font-family: "Poppins", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--gradient-1) !important;
  background-attachment: fixed;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  overflow-x: hidden;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  animation: gradientShift 20s ease infinite;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
  z-index: 0;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(255, 107, 157, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(102, 126, 234, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(240, 147, 251, 0.15) 0%,
      transparent 50%
    );
  animation: backgroundPulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

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

@keyframes gradientShift {
  0% {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  }
  25% {
    background: linear-gradient(135deg, #f093fb 0%, #ff6b9d 50%, #667eea 100%);
  }
  50% {
    background: linear-gradient(135deg, #ff6b9d 0%, #f093fb 50%, #764ba2 100%);
  }
  75% {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 50%, #ff6b9d 100%);
  }
  100% {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  }
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0 !important;
  opacity: 0.4;
  mix-blend-mode: screen;
}


.container {
  position: relative;
  z-index: 10;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  margin: 0;
  overflow: hidden;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
  background: transparent;
}

/* Animated Hearts Background */
.hearts {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.heart {
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(255, 192, 203, 0.6);
  transform: rotate(45deg) translateZ(0);
  animation: float 20s infinite ease-in-out;
  opacity: 0;
  will-change: transform, opacity;
  contain: layout style paint;
}

.heart:before,
.heart:after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(255, 192, 203, 0.6);
  border-radius: 50%;
}

.heart:before {
  top: -6px;
  left: 0;
}

.heart:after {
  left: -6px;
  top: 0;
}

@keyframes float {
  0% {
    transform: translateY(100vh) rotate(45deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(45deg);
    opacity: 0;
  }
}

/* Content Styling */
.content {
  position: relative;
  z-index: 100 !important;
  animation: fadeInUp 0.6s ease-out;
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 8px 6px;
  padding-top: max(54px, calc(var(--safe-area-top) + 8px));
  padding-bottom: max(12px, var(--safe-area-bottom));
  background: transparent;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  max-width: 100vw;
  width: 100%;
}

@media screen and (max-width: 768px) {
  .content {
    padding-left: 6px;
    padding-right: 6px;
    min-height: 0;
  }
}

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

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 20px 10px;
  position: relative;
  margin-bottom: 0;
  flex-shrink: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(2px);
  animation: heroEntrance 1s ease-out;
  margin-top: 10px;
}

.hero-section::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 107, 157, 0.6),
    transparent
  );
  margin: 10px auto 0;
  border-radius: 2px;
}

@keyframes heroEntrance {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  animation: twinkle 3s infinite;
}

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

.main-title {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.4rem, 6vw, 2.2rem);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
  position: relative;
}

.title-word {
  display: inline-block;
  color: #fff;
  background: linear-gradient(
    135deg,
    #fff 0%,
    #ffb6c1 40%,
    #ff6b9d 60%,
    #fff 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation:
    titleFloat 3s ease-in-out infinite,
    gradientMove 4s ease infinite;
  text-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 255, 255, 0.4),
    0 0 30px rgba(255, 107, 157, 0.3);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  font-weight: 700;
  letter-spacing: 0.5px;
}

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

.title-word:nth-child(2) {
  animation-delay: 0.5s;
}

.title-word.valentine-word {
  font-size: clamp(1.2rem, 5vw, 2rem);
  color: #ff6b9d;
  text-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.5),
    0 2px 12px rgba(255, 107, 157, 0.7),
    0 0 20px rgba(255, 107, 157, 0.4);
  animation: pulseGlow 2s ease-in-out infinite;
  margin-top: 6px;
  font-weight: 700;
  -webkit-text-fill-color: #ff6b9d;
  background: none;
}

@keyframes pulseGlow {
  0%,
  100% {
    text-shadow: 0 2px 8px rgba(255, 107, 157, 0.5);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 4px 16px rgba(255, 107, 157, 0.8);
    transform: scale(1.05);
  }
}

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

.name {
  font-size: clamp(1.3rem, 6vw, 2.1rem);
  color: #fff;
  font-weight: 700;
  margin: 10px 0 8px 0;
  text-shadow:
    3px 3px 12px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(255, 107, 157, 0.6),
    0 0 30px rgba(255, 107, 157, 0.4);
  animation:
    glow 2s ease-in-out infinite alternate,
    nameFloat 4s ease-in-out infinite;
  position: relative;
  display: inline-block;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  backdrop-filter: blur(5px);
  z-index: 10;
  letter-spacing: 1.5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes nameFloat {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.02);
  }
}

@keyframes heartBeat {
  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }
  25% {
    transform: translateY(-50%) scale(1.2);
  }
  50% {
    transform: translateY(-50%) scale(1);
  }
  75% {
    transform: translateY(-50%) scale(1.15);
  }
}

@keyframes glow {
  from {
    text-shadow:
      2px 2px 8px rgba(0, 0, 0, 0.3),
      0 0 15px rgba(255, 107, 157, 0.4);
  }
  to {
    text-shadow:
      2px 2px 8px rgba(0, 0, 0, 0.3),
      0 0 25px rgba(255, 107, 157, 0.7);
  }
}

.subtitle {
  font-size: clamp(0.8rem, 3.2vw, 1.05rem);
  color: #fff;
  font-weight: 500;
  margin-top: 10px;
  display: block;
  line-height: 1.6;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  text-shadow:
    1px 1px 4px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  backdrop-filter: blur(3px);
  margin-right: auto;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Interactive Birthday Card */
.birthday-card {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 20px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 0 0 2px rgba(255, 107, 157, 0.3),
    0 0 20px rgba(255, 107, 157, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: cardPulse 2s ease-in-out infinite;
  position: relative;
  backdrop-filter: blur(20px);
  overflow: hidden;
  perspective: 1000px;
  min-height: auto;
  max-height: 28vh;
  flex-shrink: 0;
  will-change: transform;
  contain: layout style paint;
  transform: translateZ(0);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.birthday-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 107, 157, 0.1),
    transparent
  );
  animation: cardShine 6s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes cardShine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.birthday-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(255, 107, 157, 0.5),
    0 0 30px rgba(255, 107, 157, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  animation: none;
}

@keyframes cardPulse {
  0%,
  100% {
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.15),
      0 0 0 2px rgba(255, 107, 157, 0.3),
      0 0 20px rgba(255, 107, 157, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }
  50% {
    box-shadow:
      0 10px 28px rgba(0, 0, 0, 0.2),
      0 0 0 3px rgba(255, 107, 157, 0.5),
      0 0 30px rgba(255, 107, 157, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

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

/* When card is open, expand so full letter can be read */
.birthday-card.flipped {
  max-height: 75vh;
  min-height: 320px;
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  padding: 12px 8px;
  overflow: hidden;
  cursor: pointer;
}

.card-front::before {
  content: "👆 Click Me!";
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #ff6b9d, #ff8fab);
  color: white;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: clamp(0.7rem, 2.2vw, 0.8rem);
  font-weight: 700;
  z-index: 10;
  animation: bounceHint 1.5s ease-in-out infinite;
  box-shadow: 0 3px 10px rgba(255, 107, 157, 0.5);
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.card-front::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px;
  border: 2px dashed rgba(255, 107, 157, 0.4);
  pointer-events: none;
  animation: borderPulse 2s ease-in-out infinite;
  z-index: 1;
}

@keyframes borderPulse {
  0%,
  100% {
    border-color: rgba(255, 107, 157, 0.4);
    opacity: 0.6;
  }
  50% {
    border-color: rgba(255, 107, 157, 0.7);
    opacity: 1;
  }
}

@keyframes bounceHint {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-5px) scale(1.05);
  }
}

.card-back {
  transform: rotateY(180deg);
}

.birthday-card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 192, 203, 0.1) 0%,
    transparent 70%
  );
  animation: rotate 25s linear infinite;
  pointer-events: none;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Balloons */
.balloons {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 8px;
  position: relative;
  height: auto;
  min-height: 50px;
  flex-wrap: wrap;
}

.balloon {
  width: clamp(24px, 6vw, 40px);
  height: clamp(30px, 7vw, 50px);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
  animation: bounce 2.5s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.balloon:active {
  transform: scale(1.15);
}

.balloon1 {
  background: var(--gradient-2);
  animation-delay: 0s;
}
.balloon2 {
  background: var(--gradient-3);
  animation-delay: 0.2s;
}
.balloon3 {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  animation-delay: 0.4s;
}
.balloon4 {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  animation-delay: 0.6s;
}
.balloon5 {
  background: linear-gradient(135deg, #fa709a, #fee140);
  animation-delay: 0.8s;
}
.balloon6 {
  background: linear-gradient(135deg, #a8edea, #fed6e3);
  animation-delay: 1s;
}
.balloon7 {
  background: linear-gradient(135deg, #ffecd2, #fcb69f);
  animation-delay: 1.2s;
}

.balloon::after {
  content: "";
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 60px;
  background: rgba(0, 0, 0, 0.15);
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-15px) rotate(-2deg);
  }
  75% {
    transform: translateY(-10px) rotate(2deg);
  }
}

/* Title */
.title {
  font-size: clamp(1rem, 4.5vw, 1.5rem);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin: 6px 0;
  font-weight: bold;
  animation: pulse 2s ease-in-out infinite;
}

.name {
  font-size: clamp(1rem, 4vw, 1.4rem);
  color: #ff6b9d;
  text-align: center;
  margin-bottom: 6px;
  font-weight: 600;
}

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

/* Cake */
.cake-container {
  display: flex;
  justify-content: center;
  margin: 6px 0;
}

.cake {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
  touch-action: manipulation;
}

.cake:active {
  transform: scale(1.05);
}

.candle {
  width: 6px;
  height: 28px;
  background: linear-gradient(180deg, #fff 0%, #f0f0f0 100%);
  border-radius: 3px;
  position: relative;
  margin-bottom: 4px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.flame {
  width: 10px;
  height: 16px;
  background: linear-gradient(180deg, #ffeb3b 0%, #ff9800 50%, #f44336 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  animation: flicker 0.4s ease-in-out infinite alternate;
  box-shadow: 0 0 12px rgba(255, 235, 59, 0.7);
}

@keyframes flicker {
  0% {
    transform: translateX(-50%) scale(1) rotate(-2deg);
  }
  100% {
    transform: translateX(-50%) scale(1.1) rotate(2deg);
  }
}

.layer {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.layer1 {
  width: clamp(70px, 22vw, 140px);
  height: clamp(20px, 6vw, 40px);
  background: var(--gradient-2);
}

.layer2 {
  width: clamp(58px, 18vw, 115px);
  height: clamp(16px, 5vw, 32px);
  background: var(--gradient-3);
  margin-top: -4px;
}

.layer3 {
  width: clamp(46px, 14vw, 90px);
  height: clamp(12px, 4vw, 24px);
  background: linear-gradient(135deg, #f093fb, #f5576c);
  margin-top: -4px;
}

.frosting {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px 8px 0 0;
}

/* Flip Button */
.flip-btn,
.flip-btn-back {
  background: linear-gradient(135deg, #ff6b9d, #ff8fab, #ff6b9d);
  background-size: 200% 200%;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: clamp(0.8rem, 2.8vw, 1rem);
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow:
    0 6px 20px rgba(255, 107, 157, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: "Poppins", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  width: 100%;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  overflow: hidden;
  animation: buttonGradient 3s ease infinite;
}

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

.flip-btn::before,
.flip-btn-back::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.flip-btn:hover::before,
.flip-btn-back:hover::before {
  width: 300px;
  height: 300px;
}

.flip-btn:hover,
.flip-btn-back:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 10px 30px rgba(255, 107, 157, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.flip-btn:active,
.flip-btn-back:active {
  transform: translateY(1px) scale(0.98);
}

.card-hint {
  font-size: clamp(0.7rem, 2.4vw, 0.85rem);
  color: rgba(118, 75, 162, 0.9);
  margin-top: 8px;
  font-style: italic;
  font-weight: 600;
  text-align: center;
  animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Message Box */
.message-box {
  text-align: center;
  padding: 12px 10px 20px;
  position: relative;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Show scrollbar when needed so kid knows to scroll */
.message-box::-webkit-scrollbar {
  width: 6px;
}

.message-box::-webkit-scrollbar-track {
  background: rgba(255, 107, 157, 0.15);
  border-radius: 3px;
}

.message-box::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 157, 0.5);
  border-radius: 3px;
}

.message-box::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 157, 0.7);
}

.decorative-border {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(255, 107, 157, 0.35);
  border-radius: 14px;
  opacity: 0.5;
  pointer-events: none;
}

.message-box h3 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  color: var(--primary-purple);
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.scroll-hint {
  font-size: clamp(0.65rem, 2.2vw, 0.75rem);
  color: rgba(118, 75, 162, 0.85);
  margin-bottom: 10px;
  font-style: italic;
  position: relative;
  z-index: 1;
}

.message {
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  line-height: 1.5;
  color: #555;
  margin: 4px 0;
  text-align: justify;
  position: relative;
  z-index: 1;
}

.signature {
  margin-top: 12px;
  font-style: italic;
  color: var(--primary-purple);
  position: relative;
  z-index: 1;
}

.name-sign {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  font-weight: bold;
  margin-top: 6px;
  font-family: "Dancing Script", cursive;
}

/* Wishes Section */
.wishes-section,
.valentine-wishes-section,
.quotes-section,
.final-message {
  content-visibility: auto;
  contain-intrinsic-size: auto 200px;
}

.wishes-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 18px;
  padding: 14px 10px;
  margin: 0;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  backdrop-filter: blur(8px);
}

.wishes-section h3 {
  text-align: center;
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  color: var(--primary-purple);
  margin-bottom: 12px;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wishes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.wish-card {
  background: var(--gradient-1);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  color: white;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 4px 14px rgba(102, 126, 234, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.wish-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(102, 126, 234, 0.35);
}

.wish-card:active {
  transform: scale(0.97);
}

.wish-icon {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  margin-bottom: 4px;
  animation: bounce-icon 2s ease-in-out infinite;
}

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

.wish-card h4 {
  font-size: clamp(0.75rem, 2.8vw, 1rem);
  margin-bottom: 3px;
  font-weight: 600;
}

.wish-card p {
  font-size: clamp(0.65rem, 2.2vw, 0.85rem);
  line-height: 1.3;
  opacity: 0.95;
}

/* Gallery */
/* Valentine's Day Section */
.valentine-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 20px;
  padding: 18px 12px;
  margin: 0;
  box-shadow:
    0 8px 28px rgba(255, 107, 157, 0.15),
    0 0 0 1px rgba(255, 107, 157, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

.valentine-section:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 32px rgba(255, 107, 157, 0.3),
    0 0 0 1px rgba(255, 107, 157, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.valentine-section::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 107, 157, 0.1) 0%,
    transparent 70%
  );
  animation: rotateGradient 20s linear infinite;
  pointer-events: none;
}

.valentine-section h3 {
  text-align: center;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: #ff6b9d;
  margin-bottom: 12px;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(255, 107, 157, 0.3);
  position: relative;
  z-index: 1;
}

.valentine-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
}

.valentine-card {
  background: linear-gradient(135deg, #ff6b9d, #ff8fab, #ff6b9d);
  background-size: 200% 200%;
  border-radius: 16px;
  padding: 18px 12px;
  text-align: center;
  color: white;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 6px 20px rgba(255, 107, 157, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  animation: cardGradient 3s ease infinite;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

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

.valentine-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 70%
  );
  animation: rotateGradient 15s linear infinite;
  pointer-events: none;
}

.valentine-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow:
    0 12px 30px rgba(255, 107, 157, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.valentine-icon {
  font-size: clamp(2rem, 6vw, 3rem);
  margin-bottom: 10px;
  animation:
    bounce-icon 2s ease-in-out infinite,
    iconGlow 2s ease-in-out infinite;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  display: inline-block;
}

@keyframes iconGlow {
  0%,
  100% {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2))
      drop-shadow(0 0 10px rgba(255, 107, 157, 0.3));
  }
  50% {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2))
      drop-shadow(0 0 20px rgba(255, 107, 157, 0.6));
  }
}

.valentine-card h4 {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  margin-bottom: 6px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.valentine-card p {
  font-size: clamp(0.7rem, 2.2vw, 0.9rem);
  line-height: 1.5;
  opacity: 0.95;
  position: relative;
  z-index: 1;
}

/* Valentine's Day Wishes Section */
.valentine-wishes-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 18px;
  padding: 14px 10px;
  margin: 0;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  backdrop-filter: blur(8px);
}

.valentine-wishes-section h3 {
  text-align: center;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: #ff6b9d;
  margin-bottom: 12px;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(255, 107, 157, 0.3);
}

.valentine-wishes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.valentine-wish-card {
  background: linear-gradient(135deg, #667eea, #764ba2, #667eea);
  background-size: 200% 200%;
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  color: white;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 6px 20px rgba(102, 126, 234, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  animation: wishGradient 4s ease infinite;
}

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

.valentine-wish-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shine 3s infinite;
  pointer-events: none;
}

.valentine-wish-card:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow:
    0 10px 28px rgba(102, 126, 234, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.wish-emoji {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  margin-bottom: 8px;
  animation:
    bounce-icon 2s ease-in-out infinite,
    emojiRotate 3s ease-in-out infinite;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes emojiRotate {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(-5deg) scale(1.1);
  }
  75% {
    transform: rotate(5deg) scale(1.1);
  }
}

.valentine-wish-card p {
  font-size: clamp(0.7rem, 2.2vw, 0.9rem);
  line-height: 1.5;
  margin: 0;
  font-weight: 500;
}

.gallery-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 16px;
  padding: 10px 6px;
  margin: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  display: none;
}

.gallery-section h3 {
  text-align: center;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--primary-purple);
  margin-bottom: 8px;
  font-family: "Dancing Script", cursive;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.gif-wrapper {
  width: 100%;
  height: clamp(60px, 15vw, 90px);
  border-radius: 10px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gif-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.fallback-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  flex-direction: column;
}

.gif-note {
  font-size: clamp(0.6rem, 2vw, 0.8rem);
  color: rgba(255, 255, 255, 0.8);
  margin-top: 8px;
  font-weight: 500;
  text-align: center;
}

.fallback-animation span {
  animation: bounce-emoji 1.5s ease-in-out infinite;
}

.fallback-animation span:nth-child(1) {
  animation-delay: 0s;
}

.fallback-animation span:nth-child(2) {
  animation-delay: 0.3s;
}

.fallback-animation span:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes bounce-emoji {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.15);
  }
}

.gif-item p {
  font-size: clamp(0.65rem, 2.2vw, 0.85rem);
  color: white;
  font-weight: 600;
  margin: 0;
  font-family: "Dancing Script", cursive;
}

/* Countdown */
.countdown-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 20px;
  padding: 14px 8px;
  margin: 0;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-align: center;
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.countdown-section:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.countdown-section h3 {
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  color: var(--primary-purple);
  margin-bottom: 10px;
  font-weight: 700;
  font-family: "Dancing Script", cursive;
}

.relationship-date {
  font-size: clamp(0.75rem, 2.5vw, 1rem);
  color: var(--primary-pink);
  margin-bottom: 8px;
  font-weight: 600;
  font-style: italic;
}

.timer {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.time-unit {
  background: var(--gradient-1);
  border-radius: 12px;
  padding: 10px 8px;
  min-width: clamp(52px, 12vw, 72px);
  box-shadow:
    0 4px 14px rgba(102, 126, 234, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all 0.25s ease;
  touch-action: manipulation;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.time-unit:active {
  transform: scale(0.95);
}

.time-unit .number {
  display: block;
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  font-weight: bold;
  color: white;
  font-family: "Poppins", sans-serif;
}

.time-unit .label {
  display: block;
  font-size: clamp(0.55rem, 1.8vw, 0.75rem);
  color: rgba(255, 255, 255, 0.95);
  margin-top: 3px;
  font-weight: 500;
}

.timer-message {
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  color: var(--primary-purple);
  font-style: italic;
  margin-top: 6px;
}

/* Birthday Countdown */
.birthday-countdown-section {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 10px 6px;
  margin: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  text-align: center;
  flex-shrink: 0;
}

.birthday-countdown-section h3 {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--primary-purple);
  margin-bottom: 8px;
  font-family: "Dancing Script", cursive;
}

.birthday-timer {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.age-message {
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  color: var(--primary-purple);
  font-style: italic;
  margin-top: 6px;
  font-weight: 600;
}

.age-message #age {
  color: var(--primary-pink);
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  font-weight: bold;
}

/* Quotes Carousel */
.quotes-section {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 10px 6px;
  margin: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  display: none;
}

/* Timeline */
.timeline-section {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 10px 6px;
  margin: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  display: none;
}

/* GIF Section */
.gif-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 16px;
  padding: 10px 6px;
  margin: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  z-index: 30;
  position: relative;
}

.gif-section h3 {
  text-align: center;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--primary-purple);
  margin-bottom: 8px;
  font-family: "Dancing Script", cursive;
}

.gif-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

/* Fun Interactive Section */
.fun-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 18px;
  padding: 16px 12px;
  margin: 0;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-align: center;
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.fun-section::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 107, 157, 0.1) 0%,
    transparent 70%
  );
  animation: rotateGradient 20s linear infinite;
  pointer-events: none;
}

@keyframes rotateGradient {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.fun-section h3 {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--primary-purple);
  margin-bottom: 12px;
  font-family: "Dancing Script", cursive;
}

.fun-question {
  padding: 20px 16px;
  background: var(--gradient-1);
  border-radius: 16px;
  margin-bottom: 16px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 18px rgba(102, 126, 234, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fun-question::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shine 3s infinite;
  pointer-events: none;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.fun-question h4 {
  font-size: clamp(1rem, 3.8vw, 1.4rem);
  margin-bottom: 8px;
  font-family: "Dancing Script", cursive;
}

.fun-subtext {
  font-size: clamp(0.75rem, 2.8vw, 1rem);
  margin-bottom: 12px;
  opacity: 0.95;
  font-style: italic;
}

.fun-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  position: relative;
}

.fun-btn {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-purple);
  border: none;
  padding: 12px 20px;
  border-radius: 20px;
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: "Poppins", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  min-width: 110px;
  flex: 1;
  max-width: 160px;
  position: relative;
  overflow: hidden;
}

.fun-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.fun-btn:active {
  transform: translateY(0) scale(0.98);
}

.yes-btn {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  position: relative;
  overflow: hidden;
}

.yes-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.yes-btn:active::before {
  width: 300px;
  height: 300px;
}

.no-btn {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
  transition: all 0.3s ease;
  cursor: not-allowed;
}

.no-btn:hover {
  cursor: not-allowed !important;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }
  25% {
    transform: translateX(-10px) rotate(-5deg);
  }
  75% {
    transform: translateX(10px) rotate(5deg);
  }
}

@keyframes floatHeartUp {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(-200px) scale(1.2);
    opacity: 0;
  }
}

@keyframes popIn {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes sparkle {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: scale(2) rotate(360deg);
    opacity: 0;
  }
}

@keyframes pulse-attention {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.8);
  }
}

.love-btn {
  background: linear-gradient(135deg, #ff6b9d, #ff8fab);
  color: white;
  min-width: 130px;
  padding: 14px 20px;
  font-weight: 600;
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
  transition: all 0.3s ease;
}

.love-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 25px rgba(255, 107, 157, 0.5);
}

.love-btn:active {
  transform: translateY(-1px) scale(0.98);
}

.love-buttons-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
  align-items: stretch;
}

.fun-buttons.love-buttons-grid {
  flex-wrap: nowrap;
}

.emoji-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.emoji-btn {
  font-size: 2rem;
  min-width: 56px;
  min-height: 56px;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffb6c1, #ff69b4);
  border: 2px solid rgba(255, 255, 255, 0.6);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.emoji-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 105, 180, 0.5);
}

.kiss-btn {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  padding: 14px 24px;
}

.hug-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  padding: 14px 24px;
}

.promises-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.promise-item {
  background: rgba(255, 255, 255, 0.25);
  border: 2px dashed rgba(255, 255, 255, 0.6);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: clamp(0.85rem, 2.8vw, 1rem);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Poppins", sans-serif;
  touch-action: manipulation;
}

.promise-item:hover {
  background: rgba(255, 255, 255, 0.35);
}

.promise-item.promise-done {
  border-style: solid;
  background: rgba(76, 175, 80, 0.5);
}

.restart-btn {
  background: var(--gradient-1);
  color: white;
  margin-top: 12px;
  max-width: 200px;
}

.fun-final {
  padding: 18px 14px;
  background: var(--gradient-1);
  border-radius: 16px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 8px 28px rgba(102, 126, 234, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fun-final::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: rotateGradient 15s linear infinite;
  pointer-events: none;
}

.final-heart {
  font-size: clamp(2rem, 7vw, 3.5rem);
  margin-bottom: 12px;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.15);
  }
  50% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(1.12);
  }
}

.fun-final h4 {
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  margin-bottom: 12px;
  font-family: "Dancing Script", cursive;
}

.final-message-text {
  font-size: clamp(0.8rem, 2.8vw, 1rem);
  line-height: 1.7;
  margin-bottom: 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px;
  border-radius: 10px;
}

.final-name {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  font-weight: bold;
  margin-top: 8px;
  font-family: "Dancing Script", cursive;
  display: block;
}

/* Surprise Section */
.surprise-section {
  background: rgba(255, 255, 255, 0.98) !important;
  border-radius: 18px;
  padding: 14px 10px;
  margin: 0;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-align: center;
  flex-shrink: 0;
  z-index: 30;
  position: relative;
  backdrop-filter: blur(8px);
}

.surprise-section h3 {
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  color: var(--primary-purple);
  margin-bottom: 10px;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
}

.surprise-subtitle {
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  color: #666;
  margin-bottom: 10px;
  font-style: italic;
}

.surprise-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.surprise-btn {
  background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #667eea);
  background-size: 300% 300%;
  border-radius: 16px;
  padding: 14px 10px;
  text-decoration: none;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 6px 20px rgba(102, 126, 234, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 75px;
  position: relative;
  overflow: hidden;
  animation: surpriseGradient 4s ease infinite;
}

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

.surprise-btn::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 70%
  );
  animation: rotateGradient 8s linear infinite;
  pointer-events: none;
}

.surprise-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow:
    0 10px 30px rgba(102, 126, 234, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  z-index: 2;
}

.surprise-btn:active {
  transform: scale(0.97);
}

.surprise-icon {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  animation: bounce-icon 2s ease-in-out infinite;
}

.surprise-text {
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  font-weight: 600;
  font-family: "Poppins", sans-serif;
}

/* Final Message */
.final-message {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 10px 8px;
  margin: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  text-align: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  display: none;
}

.message-heart {
  font-size: clamp(2rem, 7vw, 3.5rem);
  margin-bottom: 8px;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.final-message h3 {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--primary-purple);
  margin-bottom: 8px;
  font-family: "Dancing Script", cursive;
}

.final-message p {
  font-size: clamp(0.8rem, 2.8vw, 1rem);
  line-height: 1.6;
  color: #555;
  max-width: 100%;
  margin: 0 auto 12px;
}

.love-signature {
  margin-top: 12px;
  font-style: italic;
  color: var(--primary-purple);
}

.final-name {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  font-weight: bold;
  margin-top: 6px;
  font-family: "Dancing Script", cursive;
}

/* Phone & Tablet - Same beautiful look as desktop */
@media screen and (max-width: 768px) {
  .content {
    gap: 10px;
    padding: 10px 12px;
    padding-top: max(54px, calc(var(--safe-area-top) + 10px));
    padding-bottom: max(16px, var(--safe-area-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .hero-section {
    padding: 14px 8px;
  }

  .hero-section::after {
    width: 50px;
    height: 2px;
    margin-top: 8px;
  }

  .main-title {
    font-size: clamp(1.35rem, 5.8vw, 2rem);
    line-height: 1.35;
  }

  .title-word.valentine-word {
    font-size: clamp(1.05rem, 4.5vw, 1.6rem);
    margin-top: 4px;
  }

  .name {
    font-size: clamp(1.2rem, 5.2vw, 1.7rem);
    padding: 5px 12px;
    margin: 8px 0 6px 0;
  }

  .subtitle {
    font-size: clamp(0.8rem, 3vw, 1rem);
    margin-top: 8px;
    line-height: 1.6;
    padding: 6px 10px;
  }

  .birthday-card {
    max-height: 30vh;
    min-height: 190px;
    border-radius: 18px;
  }

  .birthday-card.flipped {
    max-height: 75vh;
    min-height: 280px;
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.12),
      0 0 0 1px rgba(255, 255, 255, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  /* Same premium card style as desktop on phone */
  .valentine-section,
  .valentine-wishes-section,
  .countdown-section,
  .wishes-section,
  .surprise-section,
  .fun-section {
    padding: 14px 12px;
    border-radius: 18px;
    box-shadow:
      0 4px 20px rgba(0, 0, 0, 0.08),
      0 0 0 1px rgba(255, 255, 255, 0.8),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .wish-card {
    border-radius: 14px;
    padding: 12px 10px;
    box-shadow:
      0 4px 14px rgba(102, 126, 234, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }

  .valentine-card {
    border-radius: 14px;
    padding: 16px 12px;
  }

  .valentine-wish-card {
    border-radius: 14px;
    padding: 12px 10px;
  }

  .valentine-section h3,
  .valentine-wishes-section h3,
  .wishes-section h3,
  .countdown-section h3,
  .surprise-section h3,
  .fun-section h3 {
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    margin-bottom: 10px;
  }

  .valentine-card p,
  .valentine-wish-card p,
  .wish-card p {
    font-size: clamp(0.74rem, 2.5vw, 0.9rem);
    line-height: 1.5;
  }

  .timer-message {
    font-size: clamp(0.72rem, 2.5vw, 0.9rem) !important;
    line-height: 1.55;
    padding: 0 6px;
  }

  .time-unit {
    border-radius: 12px;
    padding: 10px 6px;
    box-shadow:
      0 4px 14px rgba(102, 126, 234, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }

  .surprise-buttons {
    gap: 10px;
    margin-top: 12px;
  }

  .surprise-btn {
    min-height: 74px;
    padding: 14px 10px;
    border-radius: 16px;
    box-shadow:
      0 6px 18px rgba(102, 126, 234, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .surprise-text {
    font-size: clamp(0.74rem, 2.5vw, 0.9rem);
  }

  .surprise-icon {
    font-size: clamp(1.6rem, 5.5vw, 2.2rem);
  }

  .flip-btn,
  .flip-btn-back {
    border-radius: 22px;
    padding: 12px 22px;
    box-shadow:
      0 6px 20px rgba(255, 107, 157, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }

  .timeline-content p {
    font-size: clamp(0.74rem, 2.5vw, 0.9rem);
    line-height: 1.52;
  }

  .relationship-date {
    font-size: clamp(0.72rem, 2.4vw, 0.88rem);
  }
}

/* Small phones - Still beautiful, slightly compact */
@media screen and (max-width: 480px) {
  .content {
    gap: 8px;
    padding: 8px 10px;
    padding-top: max(52px, calc(var(--safe-area-top) + 8px));
    padding-bottom: max(14px, var(--safe-area-bottom));
  }

  .hero-section {
    padding: 12px 6px;
  }

  .hero-section::after {
    width: 40px;
    margin-top: 6px;
  }

  .main-title {
    font-size: clamp(1.2rem, 5.5vw, 1.75rem);
  }

  .title-word.valentine-word {
    font-size: clamp(1rem, 4.2vw, 1.4rem);
  }

  .name {
    font-size: clamp(1.1rem, 4.8vw, 1.5rem);
    padding: 4px 10px;
    margin: 6px 0 5px 0;
  }

  .subtitle {
    font-size: clamp(0.75rem, 2.8vw, 0.9rem);
    padding: 5px 8px;
    margin-top: 6px;
  }

  .birthday-card {
    max-height: 28vh;
    min-height: 170px;
    border-radius: 16px;
  }

  .birthday-card.flipped {
    max-height: 75vh;
    min-height: 260px;
    box-shadow:
      0 6px 20px rgba(0, 0, 0, 0.1),
      0 0 0 1px rgba(255, 255, 255, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .card-front,
  .card-back {
    padding: 12px 10px;
  }

  .balloons {
    min-height: 44px;
    gap: 5px;
  }

  .balloon {
    width: clamp(22px, 5.5vw, 32px);
    height: clamp(26px, 6.5vw, 40px);
  }

  .cake-container {
    margin: 6px 0;
  }

  .layer1 {
    width: clamp(62px, 20vw, 110px);
    height: clamp(18px, 5.5vw, 32px);
  }

  .layer2 {
    width: clamp(52px, 17vw, 95px);
    height: clamp(14px, 4.5vw, 26px);
  }

  .layer3 {
    width: clamp(42px, 14vw, 75px);
    height: clamp(10px, 3.5vw, 20px);
  }

  .candle {
    width: 5px;
    height: 24px;
  }

  .flame {
    width: 8px;
    height: 14px;
    top: -14px;
  }

  .title {
    font-size: clamp(0.9rem, 4vw, 1.3rem);
    margin: 4px 0;
  }

  /* Keep premium card look on small phone */
  .wishes-section,
  .valentine-section,
  .valentine-wishes-section,
  .countdown-section,
  .surprise-section,
  .fun-section {
    padding: 12px 10px;
    border-radius: 16px;
    box-shadow:
      0 4px 18px rgba(0, 0, 0, 0.07),
      0 0 0 1px rgba(255, 255, 255, 0.75),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .wishes-section h3,
  .valentine-section h3,
  .valentine-wishes-section h3,
  .countdown-section h3,
  .surprise-section h3,
  .fun-section h3 {
    font-size: clamp(0.95rem, 3.3vw, 1.25rem);
    margin-bottom: 8px;
  }

  .wishes-grid,
  .valentine-content,
  .valentine-wishes-grid {
    gap: 8px;
  }

  .valentine-content {
    grid-template-columns: 1fr;
  }

  .wish-card {
    padding: 12px 8px;
    border-radius: 12px;
    box-shadow:
      0 3px 12px rgba(102, 126, 234, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }

  .wish-icon {
    font-size: clamp(1.1rem, 3.8vw, 1.5rem);
  }

  .wish-card h4 {
    font-size: clamp(0.75rem, 2.6vw, 0.92rem);
  }

  .wish-card p {
    font-size: clamp(0.68rem, 2.2vw, 0.82rem);
    line-height: 1.45;
  }

  .valentine-card {
    padding: 14px 10px;
    border-radius: 14px;
  }

  .valentine-wish-card {
    padding: 10px 8px;
    border-radius: 12px;
  }

  .gif-wrapper {
    height: clamp(55px, 12vw, 75px);
  }

  .gif-item p {
    font-size: clamp(0.6rem, 2vw, 0.75rem);
  }

  .timer,
  .birthday-timer {
    gap: 6px;
    margin-bottom: 6px;
  }

  .time-unit {
    padding: 8px 5px;
    min-width: clamp(48px, 11.5vw, 62px);
    border-radius: 10px;
    box-shadow:
      0 3px 12px rgba(102, 126, 234, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }

  .time-unit .number {
    font-size: clamp(0.95rem, 3.3vw, 1.35rem);
  }

  .time-unit .label {
    font-size: clamp(0.52rem, 1.7vw, 0.72rem);
  }

  .timer-message,
  .age-message {
    font-size: clamp(0.68rem, 2.3vw, 0.86rem);
    margin-top: 6px;
    line-height: 1.5;
  }

  .surprise-buttons {
    gap: 8px;
    margin-top: 10px;
  }

  .surprise-btn {
    padding: 12px 10px;
    min-height: 70px;
    border-radius: 14px;
    box-shadow:
      0 5px 16px rgba(102, 126, 234, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .surprise-icon {
    font-size: clamp(1.45rem, 5vw, 2rem);
  }

  .surprise-text {
    font-size: clamp(0.7rem, 2.4vw, 0.84rem);
  }

  .flip-btn,
  .flip-btn-back {
    border-radius: 20px;
    padding: 12px 18px;
  }

  /* Prevent overflow on phone */
  .message-box,
  .fun-final,
  .valentine-card,
  .valentine-wish-card,
  .wish-card {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .quote-card .quote {
    font-size: clamp(0.75rem, 2.6vw, 0.9rem);
    line-height: 1.5;
    padding: 0 4px;
  }

  .relationship-date {
    font-size: clamp(0.68rem, 2.2vw, 0.82rem);
  }

  .timeline-section {
    padding: 10px 8px;
  }

  .timeline-content h4 {
    font-size: clamp(0.85rem, 3vw, 1.1rem);
  }

  .timeline-date {
    font-size: clamp(0.65rem, 2vw, 0.78rem);
  }

  .surprise-subtitle {
    font-size: clamp(0.65rem, 2.2vw, 0.85rem);
    margin-bottom: 6px;
  }

  .flip-btn,
  .flip-btn-back {
    padding: 12px 20px;
    font-size: clamp(0.8rem, 2.6vw, 0.95rem);
    margin-top: 8px;
    min-height: 44px; /* 44px min touch target - Apple HIG */
    width: 100%;
    max-width: 100%;
  }

  .message-box {
    padding: 6px;
  }

  .message-box h3 {
    font-size: clamp(0.9rem, 3.2vw, 1.2rem);
    margin-bottom: 4px;
  }

  .message {
    font-size: clamp(0.65rem, 2.2vw, 0.85rem);
    margin: 3px 0;
    line-height: 1.4;
  }

  .signature {
    margin-top: 8px;
  }

  .name-sign {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    margin-top: 4px;
  }

  .fun-question {
    padding: 10px 6px;
    margin-bottom: 8px;
  }

  .fun-question h4 {
    font-size: clamp(0.95rem, 3.5vw, 1.3rem);
  }

  .fun-subtext {
    font-size: clamp(0.7rem, 2.5vw, 0.95rem);
    margin-bottom: 10px;
  }

  .fun-buttons {
    gap: 6px;
  }

  .fun-btn {
    padding: 12px 18px;
    min-height: 46px;
    min-width: 100px;
    font-size: clamp(0.82rem, 2.8vw, 1rem);
    flex: 1 1 auto;
  }

  .love-btn {
    min-width: 110px;
    min-height: 46px;
    padding: 12px 16px;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  }

  .love-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kiss-btn,
  .hug-btn {
    padding: 12px 20px;
    min-height: 46px;
  }

  .promise-item {
    padding: 10px 14px;
  }

  .close-btn,
  .restart-btn {
    min-height: 44px;
    padding: 12px 24px;
  }

  .fun-final {
    padding: 12px 10px;
  }

  .final-heart {
    font-size: clamp(1.8rem, 6vw, 3rem);
    margin-bottom: 10px;
  }

  .fun-final h4 {
    font-size: clamp(1rem, 3.8vw, 1.4rem);
    margin-bottom: 10px;
  }

  .final-message-text {
    font-size: clamp(0.75rem, 2.5vw, 0.95rem);
    padding: 10px;
    line-height: 1.6;
    margin-bottom: 12px;
  }

  .final-name {
    font-size: clamp(0.95rem, 3.2vw, 1.2rem);
  }
}

/* Landscape orientation optimization */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .content {
    gap: 2px;
    padding: 2px;
  }

  .hero-section {
    padding: 4px 2px;
  }

  .main-title {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }

  .name {
    font-size: clamp(1rem, 4vw, 1.4rem);
    padding: 4px 8px;
    margin: 5px 0 4px 0;
  }

  .birthday-card {
    max-height: 22vh;
  }

  .birthday-card.flipped {
    max-height: 70vh;
    min-height: 220px;
  }

  .balloons {
    min-height: 35px;
  }

  .wishes-section,
  .valentine-section,
  .valentine-wishes-section,
  .gallery-section,
  .countdown-section,
  .birthday-countdown-section,
  .surprise-section,
  .fun-section {
    padding: 6px 4px;
  }
}

/* Prevent text selection on mobile */
@media (pointer: coarse) {
  * {
    -webkit-user-select: none;
    user-select: none;
  }

  input,
  textarea {
    -webkit-user-select: text;
    user-select: text;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .heart {
    width: 14px;
    height: 14px;
  }

  .heart:before,
  .heart:after {
    width: 14px;
    height: 14px;
  }
}

/* Surprise Pages Styles */
.surprise-page {
  min-height: 100vh;
  background: var(--gradient-1);
  padding: 40px 20px;
  position: relative;
}

.surprise-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    overflow: visible !important;
    padding-bottom: 60px;
    min-height: 100%;
}

/* Letter Page */
.letter-envelope {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.letter-envelope::before {
  content: "✉️";
  position: absolute;
  top: -30px;
  right: 30px;
  font-size: 2.5rem;
  animation: float-icon 3s ease-in-out infinite;
}

.letter-content h1 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--primary-purple);
  text-align: center;
  margin-bottom: 25px;
}

.letter-text {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  line-height: 1.8;
  color: #555;
  text-align: left;
}

.letter-text p {
  margin-bottom: 12px;
}

.letter-signature {
  margin-top: 25px;
  text-align: right;
  font-style: italic;
  color: var(--primary-purple);
  font-weight: 600;
}

/* Gift Page */
.gift-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.gift-box h1 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--primary-purple);
  margin-bottom: 30px;
}

.gift-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.gift-item {
  background: var(--gradient-1);
  border-radius: 15px;
  padding: 25px 15px;
  color: white;
}

.gift-icon {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  margin-bottom: 12px;
  animation: bounce-icon 2s ease-in-out infinite;
}

.gift-item h3 {
  font-size: clamp(1rem, 3vw, 1.3rem);
  margin-bottom: 8px;
}

.gift-item p {
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  opacity: 0.95;
}

/* Memories Page */
.memories-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.memories-section h1 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--primary-purple);
  text-align: center;
  margin-bottom: 30px;
}

.memory-timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.memory-item {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  background: var(--gradient-1);
  padding: 20px;
  border-radius: 15px;
  color: white;
}

.memory-date {
  font-weight: bold;
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  min-width: 100px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 10px;
  text-align: center;
}

.memory-content h3 {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  margin-bottom: 6px;
}

.memory-content p {
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  opacity: 0.95;
  line-height: 1.6;
}

/* Dreams Page */
.dreams-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.dreams-section h1 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--primary-purple);
  margin-bottom: 8px;
}

.dreams-intro {
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  color: #555;
  margin-bottom: 24px;
  font-style: italic;
}

.dreams-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.dream-card {
  background: var(--gradient-1);
  border-radius: 15px;
  padding: 25px 15px;
  color: white;
  transition: all 0.3s ease;
}

.dream-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.dream-icon {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  margin-bottom: 12px;
  animation: bounce-icon 2s ease-in-out infinite;
}

.dream-card h3 {
  font-size: clamp(1rem, 3vw, 1.3rem);
  margin-bottom: 8px;
}

.dream-card p {
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  opacity: 0.95;
  line-height: 1.6;
}

/* Surprise Options */
.surprise-options {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  overflow: visible !important;
}

.surprise-options h3 {
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  color: var(--primary-purple);
  margin-bottom: 20px;
  font-family: "Dancing Script", cursive;
}

.surprise-buttons-inner {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  justify-items: center;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: auto;
  max-width: 100%;
}

.surprise-option-btn {
  background: var(--gradient-2);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 50px;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-width: 140px;
  width: 100%;
  justify-content: center;
  align-items: center;
  box-shadow: 0 5px 20px rgba(255, 107, 157, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Poppins", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.surprise-option-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.6);
}

.surprise-option-btn span {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
}

/* Center the 3rd button - spans both columns */
.surprise-option-btn:nth-child(3) {
  grid-column: span 2;
  max-width: 60%;
  justify-self: center;
}

/* Secret Messages, Gift Reveals, Memory Reveals, Dream Reveals */
.secret-message,
.gift-reveal,
.memory-reveal,
.dream-reveal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  visibility: hidden;
}

.secret-message.show,
.gift-reveal.show,
.memory-reveal.show,
.dream-reveal.show {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
  display: flex !important;
}

.secret-message.hidden,
.gift-reveal.hidden,
.memory-reveal.hidden,
.dream-reveal.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  display: none !important;
}

.secret-content,
.gift-reveal-content,
.memory-reveal-content,
.dream-reveal-content {
  background: white;
  border-radius: 20px;
  padding: 35px;
  max-width: 500px;
  margin: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.secret-message.show .secret-content,
.gift-reveal.show .gift-reveal-content,
.memory-reveal.show .memory-reveal-content,
.dream-reveal.show .dream-reveal-content {
  transform: scale(1);
}

/* X close button on modal - top right */
.modal-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-purple);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition:
    background 0.2s,
    transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.modal-close-x:hover {
  background: white;
  transform: scale(1.08);
}

.secret-content,
.gift-reveal-content,
.memory-reveal-content,
.dream-reveal-content {
  position: relative;
}

.secret-content h2,
.gift-reveal-content h2,
.memory-reveal-content h2,
.dream-reveal-content h2 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--primary-purple);
  margin-bottom: 18px;
}

.secret-content p,
.gift-reveal-content p,
.memory-reveal-content p,
.dream-reveal-content p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.8;
  color: #555;
  margin-bottom: 22px;
}

.close-btn {
  background: var(--gradient-2);
  color: white;
  border: none;
  padding: 10px 28px;
  border-radius: 50px;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(255, 107, 157, 0.4);
  transition: all 0.3s ease;
  font-family: "Poppins", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.close-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.6);
}

.close-btn:active {
  transform: translateY(0);
}

/* Fixed close bar on surprise pages - always visible */
.surprise-close-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  background: rgba(255, 255, 255, 0.98);
  color: var(--primary-purple);
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(0.95rem, 2.8vw, 1.1rem);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-height: 48px;
  transition:
    background 0.3s ease,
    color 0.3s ease;
  font-family: "Poppins", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.surprise-close-bar:hover {
  background: white;
  color: #764ba2;
}

/* Surprise pages: allow scroll so all content is visible */
body:has(.surprise-close-bar) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    position: relative !important;
    height: auto !important;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

html:has(.surprise-close-bar) {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
}

body:has(.surprise-close-bar) .surprise-page {
    padding-top: max(56px, calc(48px + env(safe-area-inset-top)));
    min-height: 100vh;
    padding-bottom: 40px;
}

/* Back Button */
.back-btn {
  display: inline-block;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-purple);
  padding: 12px 28px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  margin-top: 20px;
  font-family: "Poppins", sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.back-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  background: white;
}

.back-btn:active {
  transform: translateY(0);
}

/* Responsive for Surprise Pages */
@media (max-width: 768px) {
  .surprise-page {
    padding: 20px 10px;
  }

  .letter-envelope,
  .gift-box,
  .memories-section,
  .dreams-section {
    padding: 20px 15px;
  }

  .gift-content,
  .dreams-content {
    grid-template-columns: 1fr;
  }

  .memory-item {
    flex-direction: column;
  }

  .memory-date {
    min-width: auto;
    width: 100%;
  }

  .surprise-buttons-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    display: grid !important;
    visibility: visible !important;
  }

  .surprise-option-btn {
    width: 100%;
    justify-content: center;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: auto;
  }

  .secret-content,
  .gift-reveal-content,
  .memory-reveal-content,
  .dream-reveal-content {
    padding: 25px 20px;
    max-width: 90%;
  }
}

/* ========== PHONE FIRST: GF will see on her phone ========== */
@media screen and (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
    -webkit-overflow-scrolling: touch;
  }

  .content {
    overflow-x: hidden;
    max-width: 100vw;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  /* Touch targets min 44px - easy to tap */
  .flip-btn,
  .flip-btn-back {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 1rem;
  }

  .fun-btn,
  .yes-btn,
  .no-btn,
  .love-btn,
  .kiss-btn,
  .hug-btn,
  .restart-btn {
    min-height: 48px;
    min-width: 44px;
    padding: 14px 20px;
    font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  }

  .surprise-btn {
    min-height: 72px;
    padding: 16px 12px;
  }

  .surprise-option-btn {
    min-height: 48px;
    padding: 14px 20px;
  }

  .modal-close-x {
    width: 44px;
    height: 44px;
    top: 10px;
    right: 10px;
  }

  .close-btn,
  .back-btn {
    min-height: 48px;
    padding: 14px 28px;
  }

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

  .name {
    font-size: clamp(1.15rem, 5vw, 1.6rem);
  }

  .subtitle {
    font-size: clamp(0.82rem, 2.9vw, 0.98rem);
    line-height: 1.6;
  }
}

@media screen and (max-width: 480px) {
  .content {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .flip-btn,
  .flip-btn-back {
    min-height: 48px;
    width: 100%;
    max-width: 100%;
  }

  .fun-buttons .fun-btn {
    min-height: 46px;
  }

  .surprise-close-bar {
    padding: 16px 20px;
    font-size: 1rem;
    min-height: 48px;
    padding-left: max(20px, env(safe-area-inset-left));
  }

  body:has(.surprise-close-bar) .surprise-page {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(30px, env(safe-area-inset-bottom));
  }

  .surprise-container {
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }
}
