body {
  background: radial-gradient(1200px 600px at 10% -10%, #ffb3c1 0%, transparent 60%),
              radial-gradient(1200px 600px at 110% 0%, #b3e5ff 0%, transparent 60%),
              radial-gradient(1200px 700px at 50% 100%, #ffe6a7 0%, transparent 60%),
              linear-gradient(180deg, #1c1b2e 0%, #0f0e1a 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.countdown-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.countdown-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.countdown-content {
  text-align: center;
  color: #fff;
  padding: 40px;
  max-width: 900px;
  animation: fadeInUp 1s ease;
}

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

.countdown-title {
  font-family: 'Great Vibes', cursive;
  font-size: 64px;
  margin: 0 0 15px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: glow 2s ease-in-out infinite alternate;
}

.countdown-subtitle {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  margin: 0 0 50px;
  opacity: 0.95;
  letter-spacing: 1px;
}

.countdown-timer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  padding: 25px 30px;
  border-radius: 15px;
  min-width: 110px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.time-unit:hover {
  transform: translateY(-5px);
}

.time-value {
  font-family: 'Poppins', sans-serif;
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.time-label {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 8px;
  opacity: 0.9;
}

.time-separator {
  font-size: 48px;
  font-weight: 700;
  opacity: 0.7;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.3; }
}

.countdown-decorations {
  display: flex;
  justify-content: center;
  gap: 30px;
  font-size: 40px;
  margin-top: 30px;
}

.decoration-icon {
  display: inline-block;
  animation: bounce 2s ease-in-out infinite;
}

.decoration-icon:nth-child(1) { animation-delay: 0s; }
.decoration-icon:nth-child(2) { animation-delay: 0.2s; }
.decoration-icon:nth-child(3) { animation-delay: 0.4s; }
.decoration-icon:nth-child(4) { animation-delay: 0.6s; }

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

.click-to-start {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.click-to-start.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-content {
  text-align: center;
  color: #fff;
  padding: 40px;
  animation: fadeInScale 0.8s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.start-title {
  font-family: 'Great Vibes', cursive;
  font-size: 72px;
  margin: 0 0 30px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.3);
  line-height: 1.2;
  animation: glow 2s ease-in-out infinite alternate;
}

.start-icon {
  font-size: 120px;
  margin: 20px 0;
  animation: rotate 3s ease-in-out infinite;
}

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

.start-button {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 700;
  padding: 20px 50px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: #f5576c;
  cursor: pointer;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.start-button:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 50px rgba(0,0,0,0.4);
  background: #fff;
}

.start-button:active {
  transform: scale(0.98);
}

.start-hint {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  margin-top: 30px;
  opacity: 0.9;
  animation: fadeInOut 2s ease-in-out infinite;
}

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

/* Desktop-only: make page unscrollable */
@media screen and (min-width: 769px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
}

.header {
  text-align: center;
  margin-top: 30px;
  color: #fff;
  animation: fadeInDown 1s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-family: 'Great Vibes', cursive;
  font-size: 64px;
  line-height: 1.1;
  margin: 0 20px 8px;
  background: linear-gradient(90deg, #ffd166, #f4978e, #cdb4db, #90e0ef);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 24px rgba(255, 255, 255, 0.2);
  animation: shimmer 3s ease-in-out infinite;
}

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

.subtitle {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  opacity: 0.85;
  margin: 0 20px 10px;
  animation: fadeIn 1.5s ease 0.3s both;
}

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


.cake {
  position: absolute;
  width: 420px;
  height: 320px;
  top: 58%;
  left: 50%;
  margin-top: -120px;
  margin-left: -210px;
  animation: cakeAppear 1.2s ease 0.5s both;
}

@keyframes cakeAppear {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.plate {
  width: 440px;
  height: 180px;
  position: absolute;
  bottom: -15px;
  left: -10px;
  background-color: #ccc;
  border-radius: 50%;
  box-shadow: 0 2px 0 #b3b3b3, 0 4px 0 #b3b3b3, 0 5px 50px rgba(0, 0, 0, 0.5);
}

.cake > * {
  position: absolute;
}

.layer {
  position: absolute;
  display: block;
  width: 420px;
  height: 170px;
  border-radius: 50%;
  background-color: #553c13;
  box-shadow: 0 2px 0px #6a4b18, 0 4px 0px #33240b, 0 6px 0px #32230b, 0 8px 0px #31230b, 0 10px 0px #30220b, 0 12px 0px #2f220b, 0 14px 0px #2f210a, 0 16px 0px #2e200a, 0 18px 0px #2d200a, 0 20px 0px #2c1f0a, 0 22px 0px #2b1f0a, 0 24px 0px #2a1e09, 0 26px 0px #2a1d09, 0 28px 0px #291d09, 0 30px 0px #281c09;
}

.layer-top {
  top: 0px;
}

.layer-middle {
  top: 50px;
}

.layer-bottom {
  top: 100px;
}

.icing {
  top: 2px;
  left: 5px;
  background-color: #f0e4d0;
  width: 410px;
  height: 150px;
  border-radius: 50%;
}
.icing:before {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  bottom: 6px;
  left: 5px;
  background-color: #f4ebdc;
  box-shadow: 0 0 4px #f6efe3, 0 0 4px #f6efe3, 0 0 4px #f6efe3;
  border-radius: 50%;
  z-index: 1;
}

.drip {
 display: block;
  width: 50px;
  height: 60px;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  background-color: #f0e4d0; 
}

.drip1 {
  top: 85px;
  left: 5px;
  transform: skewY(15deg);
  height: 75px;
  width: 60px;
}

.drip2 {
  top: 110px;
  left: 320px;
  transform: skewY(-15deg);
  height: 85px;
  width: 65px;
}

.drip3 {
  top: 88px;
  left: 160px;
  width: 120px;
  height: 80px;
  border-bottom-left-radius: 60px;
  border-bottom-right-radius: 60px;
}

.candle {
  background-color: #7B020B;
  width: 12px;
  height: 35px;
  border-radius: 6px/3px;
  top: -20px;
  left: 50%;
  margin-left: -8px;
  z-index: 10;
  opacity: 0;
  animation: candleAppear 0.6s ease forwards;
}
@keyframes candleAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.candle:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 6px;
  border-radius: 50%;
  background-color: #ad030f;
}

.candle.out .flame {
  animation: flameOut 0.4s ease forwards;
}
@keyframes flameOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.5) translateY(-10px);
  }
  100% {
    opacity: 0;
    transform: scale(0) translateY(-20px);
    display: none;
  }
}

.flame {
  position: absolute;
  background: radial-gradient(ellipse at center, #ffeb3b 0%, #ff9800 30%, #ff5722 70%, transparent 100%);
  width: 10px;
  height: 25px;
  border-radius: 8px 8px 8px 8px/20px 20px 8px 8px;
  top: -34px;
  left: 50%;
  margin-left: -7.5px;
  z-index: 10;
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.5), 0 0 20px rgba(255, 165, 0, 0.5), 0 0 60px rgba(255, 165, 0, 0.5), 0 0 80px rgba(255, 165, 0, 0.5);
  transform-origin: 50% 90%;
  animation: flicker 1s ease-in-out alternate infinite;
  filter: drop-shadow(0 0 5px rgba(255, 165, 0, 0.8));
}

@keyframes flicker {
  0% {
    transform: skewX(5deg) scale(1);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.3), 0 0 20px rgba(255, 165, 0, 0.3), 0 0 60px rgba(255, 165, 0, 0.3), 0 0 80px rgba(255, 165, 0, 0.3);
  }
  25% {
    transform: skewX(-5deg) scale(1.05);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.6), 0 0 20px rgba(255, 165, 0, 0.6), 0 0 60px rgba(255, 165, 0, 0.6), 0 0 80px rgba(255, 165, 0, 0.6);
  }
  50% {
    transform: skewX(10deg) scale(0.95);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.4), 0 0 20px rgba(255, 165, 0, 0.4), 0 0 60px rgba(255, 165, 0, 0.4), 0 0 80px rgba(255, 165, 0, 0.4);
  }
  75% {
    transform: skewX(-10deg) scale(1.02);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5), 0 0 20px rgba(255, 165, 0, 0.5), 0 0 60px rgba(255, 165, 0, 0.5), 0 0 80px rgba(255, 165, 0, 0.5);
  }
  100% {
    transform: skewX(5deg) scale(1);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.6), 0 0 20px rgba(255, 165, 0, 0.6), 0 0 60px rgba(255, 165, 0, 0.6), 0 0 80px rgba(255, 165, 0, 0.6);
  }
}

.cake-name {
  position: absolute;
  top: 95px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Great Vibes', cursive;
  font-size: 42px;
  font-weight: 600;
  color: #3d2914;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  z-index: 25;
  pointer-events: none;
  letter-spacing: 2px;
  background: linear-gradient(45deg, #3d2914, #654321, #8b4513);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  width: 100%;
  text-align: center;
}

/* Balloons */
.balloons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.balloon {
  position: absolute;
  bottom: -120px;
  width: 36px;
  height: 46px;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  box-shadow: inset -6px -10px 18px rgba(0,0,0,0.2);
}
.balloon:after {
  content: "";
  position: absolute;
  bottom: -18px;
  left: 50%;
  width: 2px;
  height: 28px;
  background: rgba(255,255,255,0.6);
}
.balloon .knot {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 8px;
  background: inherit;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

/* Confetti */
.confetti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 16px;
  opacity: 0.9;
  transform: translateY(-100vh) rotate(0deg);
  will-change: transform;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  animation: confettiSparkle 1.5s ease-in-out infinite alternate;
}
@keyframes confettiSparkle {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

/* Floating sparkles */
.sparkle {
  position: fixed;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255,255,255,0.8), 0 0 20px rgba(255,255,255,0.4);
  pointer-events: none;
  z-index: 1;
  bottom: -10px;
}

@keyframes sparkleFloat {
  0% {
    transform: translateY(0) translateX(0) scale(0);
    opacity: 0;
  }
  5% {
    opacity: 1;
    transform: translateY(-50px) translateX(0) scale(1);
  }
  95% {
    opacity: 1;
  }
  100% {
    transform: translateY(-110vh) translateX(var(--drift)) scale(0.5) rotate(360deg);
    opacity: 0;
  }
}

@keyframes sparkleGlow {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(255,255,255,0.8), 0 0 20px rgba(255,255,255,0.4);
  }
  50% { 
    box-shadow: 0 0 20px rgba(255,255,255,1), 0 0 30px rgba(255,255,255,0.6);
  }
}

/* Ambient balloons */
.ambient-balloon {
  position: fixed;
  width: 36px;
  height: 46px;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  box-shadow: inset -6px -10px 18px rgba(0,0,0,0.2);
  pointer-events: none;
  z-index: 1;
  bottom: -60px;
}

.ambient-balloon:after {
  content: "";
  position: absolute;
  bottom: -18px;
  left: 50%;
  width: 2px;
  height: 28px;
  background: rgba(255,255,255,0.6);
}

.ambient-balloon .knot {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 8px;
  background: inherit;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

@keyframes ambientBalloonFloat {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  5% {
    opacity: 0.8;
  }
  95% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-110vh) translateX(var(--drift)) rotate(var(--rotate));
    opacity: 0;
  }
}

/* Music toggle */
#musicToggle {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  z-index: 1200;
  animation: slideInRight 0.6s ease 1.5s both;
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
#musicToggle:hover { 
  transform: scale(1.1) rotate(10deg); 
  background: rgba(255,255,255,0.3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
#musicToggle:active { transform: scale(0.95); }
#musicToggle.active { 
  background: rgba(76,175,80,0.7); 
  animation: musicPulse 1.5s ease-in-out infinite;
}
@keyframes musicPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(76,175,80,0.4); }
  50% { box-shadow: 0 8px 24px rgba(76,175,80,0.7); }
}

/* Replay button */
#replayBtn {
  position: fixed;
  top: 14px;
  right: 66px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  z-index: 1200;
  animation: slideInRight 0.6s ease 1.7s both;
}
#replayBtn:hover { 
  transform: scale(1.1) rotate(-15deg); 
  background: rgba(255,255,255,0.3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
#replayBtn:active { 
  transform: scale(0.95) rotate(360deg); 
  transition: transform 0.5s ease;
}

/* Message button */
.message-btn {
  position: fixed;
  bottom: 45px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  border-radius: 999px;
  border: 0;
  background: radial-gradient(180px 60px at 50% 0%, #ff85a2, #ff477e);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  letter-spacing: .3px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.25);
  box-shadow: 0 12px 30px rgba(255, 64, 129, .45), inset 0 0 24px rgba(255,255,255,0.25);
  display: none;
  z-index: 1100;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.message-btn.show {
  display: inline-block;
  animation: glow 1.4s ease-in-out infinite alternate, popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.message-btn:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 15px 40px rgba(255, 64, 129, .6), inset 0 0 24px rgba(255,255,255,0.35);
}
.message-btn:active {
  transform: translateX(-50%) scale(0.98);
}
@keyframes glow {
  from { filter: drop-shadow(0 0 8px rgba(255, 64, 129, .6)); }
  to { filter: drop-shadow(0 0 16px rgba(255, 64, 129, .9)); }
}
@keyframes popIn {
  0% { 
    transform: translateX(-50%) scale(0);
    opacity: 0;
  }
  70% { 
    transform: translateX(-50%) scale(1.1);
  }
  100% { 
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

/* Book modal */
.book-modal { 
  position: fixed; 
  inset: 0; 
  display: none; 
  z-index: 2000;
}
.book-modal.show { 
  display: block; 
  animation: modalFadeIn 0.4s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.book-backdrop { 
  position: absolute; 
  inset: 0; 
  background: rgba(10,8,20,.7); 
  backdrop-filter: blur(6px); 
  opacity: 0; 
  transition: opacity .4s ease; 
}
.book-modal.show .book-backdrop { opacity: 1; }
.book-frame { 
  position: absolute; 
  inset: 0; 
  display: grid; 
  place-items: center; 
  padding: 20px; 
}
.book-scene { 
  perspective: 2000px; 
  width: min(1200px, 95vw); 
  height: min(800px, 85vh); 
  position: relative;
  opacity: 0;
  transform: scale(0.9) translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.book-modal.show .book-scene {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Realistic book container with 3D depth */
.book { 
  width: 100%; 
  height: 100%; 
  position: absolute; 
  transform-style: preserve-3d;
  filter: drop-shadow(0 25px 50px rgba(0,0,0,.4));
  transform: perspective(2000px) rotateY(0deg);
}

/* Book opening animation */
.book-opening .book {
  animation: bookOpen 1.2s ease-out forwards;
}

@keyframes bookOpen {
  0% {
    transform: perspective(2000px) rotateY(0deg) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: perspective(2000px) rotateY(0deg) scale(1);
    opacity: 1;
  }
}

/* Book spine and binding */
.book:before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  width: 16px;
  height: 100%;
  background: linear-gradient(90deg, 
    #3c2415 0%, 
    #5d3823 25%, 
    #4a2b18 50%, 
    #6b4028 75%, 
    #3c2415 100%);
  border-radius: 3px 0 0 3px;
  box-shadow: 
    inset 2px 0 4px rgba(0,0,0,.3),
    inset -2px 0 4px rgba(255,255,255,.1),
    -4px 0 12px rgba(0,0,0,.3);
  transform: rotateY(-15deg) translateZ(-4px);
}

/* Book thickness simulation */
.book:after {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 100%;
  height: calc(100% - 8px);
  background: repeating-linear-gradient(
    90deg,
    rgba(255,248,240,0.8) 0px,
    rgba(255,248,240,0.4) 1px,
    transparent 1px,
    transparent 2px
  );
  transform: translateZ(-6px);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(0,0,0,.2);
}

/* Enhanced page styling with realistic paper texture */
.page {
  position: absolute;
  width: 50%;
  height: 100%;
  top: 0;
  overflow: hidden;
  background: 
    linear-gradient(45deg, 
      rgba(255,248,240,0.95) 0%, 
      rgba(250,242,230,0.95) 50%, 
      rgba(255,248,240,0.95) 100%);
  box-shadow: 
    inset 0 0 0 1px rgba(210,180,140,.15),
    0 8px 25px rgba(0,0,0,.15),
    0 2px 8px rgba(0,0,0,.1);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 500ms ease-out;
  border-radius: 0 4px 4px 0;
}

/* Page positioning and z-index */
.page[data-page="1"] { left: 0; transform-origin: right center; z-index: 10; border-radius: 4px 0 0 4px; }
.page[data-page="2"] { left: 50%; transform-origin: left center; z-index: 9; }
.page[data-page="3"] { left: 0; transform-origin: right center; z-index: 8; border-radius: 4px 0 0 4px; }
.page[data-page="4"] { left: 50%; transform-origin: left center; z-index: 7; }
.page[data-page="5"] { left: 0; transform-origin: right center; z-index: 6; border-radius: 4px 0 0 4px; }
.page[data-page="6"] { left: 50%; transform-origin: left center; z-index: 5; }

.page.flipping { 
  z-index: 25 !important; 
  box-shadow: 
    inset 0 0 0 1px rgba(210,180,140,.15),
    0 15px 40px rgba(0,0,0,.3),
    0 8px 20px rgba(0,0,0,.2);
}

/* Realistic page shadows and binding effects */
.page:before { 
  content: ""; 
  position: absolute; 
  inset: 0; 
  background: linear-gradient(90deg, 
    rgba(139,115,85,.15) 0%, 
    transparent 12%, 
    transparent 88%, 
    rgba(139,115,85,.08) 100%); 
  opacity: .6; 
  pointer-events: none; 
}

/* Page borders with aged paper effect */
.page:after { 
  content: ""; 
  position: absolute; 
  inset: 0; 
  border: 1px solid rgba(139,115,85,.2);
  border-radius: inherit;
  box-shadow: 
    inset 0 0 0 1px rgba(255,248,240,.9),
    inset 0 0 12px rgba(139,115,85,.1);
  pointer-events: none; 
}

/* Enhanced binding shadows for left pages */
.page[data-page="1"]:before, 
.page[data-page="3"]:before, 
.page[data-page="5"]:before {
  background: linear-gradient(90deg, 
    rgba(101,67,33,.25) 0%, 
    rgba(139,115,85,.15) 8%, 
    transparent 18%, 
    transparent 88%, 
    rgba(139,115,85,.05) 100%);
}

/* Enhanced binding shadows for right pages */
.page[data-page="2"]:before, 
.page[data-page="4"]:before, 
.page[data-page="6"]:before {
  background: linear-gradient(90deg, 
    rgba(139,115,85,.05) 0%, 
    transparent 12%, 
    transparent 82%, 
    rgba(139,115,85,.15) 92%, 
    rgba(101,67,33,.25) 100%);
}

/* Enhanced page content styling */
.page-content { 
  padding: 35px 30px; 
  height: 100%; 
  overflow: auto; 
  font-family: 'Poppins', sans-serif; 
  color: #3d2f26;
  position: relative;
}

.page-text { display: grid; place-items: center; text-align: center; height: 100%; }
.page-text.warm { 
  background: 
    radial-gradient(300px 200px at 50% 20%, rgba(255,210,170,.25), transparent 70%),
    radial-gradient(200px 150px at 80% 80%, rgba(255,220,180,.15), transparent 60%);
}
.page-text.diary { 
  background: 
    radial-gradient(260px 180px at 30% 30%, rgba(255,200,200,.2), transparent 70%),
    radial-gradient(180px 120px at 70% 70%, rgba(255,210,210,.12), transparent 60%);
}

.message-text { 
  max-width: 85%; 
  font-family: 'Playfair Display', serif; 
  font-size: 19px; 
  line-height: 1.7; 
  text-shadow: 0 1px 2px rgba(255,255,255,.8);
}

.signature { 
  font-family: 'Dancing Script', cursive; 
  font-size: 26px; 
  margin-top: 25px; 
  color: #8b4f8a; 
  text-shadow: 0 1px 2px rgba(255,255,255,.8);
}

.script-title { 
  font-family: 'Great Vibes', cursive; 
  font-size: 38px; 
  margin: 0 0 15px; 
  color: #8b4f8a; 
  text-shadow: 0 2px 4px rgba(255,255,255,.8);
}

.ribbon-title { 
  font-family: 'Playfair Display', serif; 
  font-weight: 700; 
  font-size: 30px; 
  text-align: center; 
  margin: 8px 0 8px; 
  position: relative; 
  color: #7a4576; 
  text-shadow: 0 1px 3px rgba(255,255,255,.8);
}

.ribbon-title:after { 
  content: ""; 
  display: block; 
  width: 180px; 
  height: 8px; 
  margin: 8px auto 12px; 
  border-radius: 999px; 
  background: linear-gradient(90deg, 
    rgba(255,200,255,.6) 0%, 
    rgba(200,120,240,.8) 50%, 
    rgba(255,200,255,.6) 100%); 
  filter: blur(.3px); 
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.subtitle-page { 
  text-align: center; 
  font-family: 'Dancing Script', cursive; 
  font-size: 24px; 
  margin: 0 0 15px; 
  color: #8a5a87; 
  text-shadow: 0 1px 2px rgba(255,255,255,.8);
}

/* Polaroid-style photo frames */
.photo-frame { 
  margin: 8px auto 15px; 
  width: 300px; 
  background: #ffffff; 
  box-shadow: 
    0 8px 25px rgba(0,0,0,.25), 
    0 3px 12px rgba(0,0,0,.15),
    inset 0 1px 0 rgba(255,255,255,.8); 
  border-radius: 3px;
  transform: rotate(-2deg);
  position: relative;
  padding: 8px 8px 32px 8px;
  font-family: 'Poppins', sans-serif;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.photo-frame:hover {
  transform: rotate(0deg) scale(1.05) translateY(-5px);
  box-shadow: 
    0 15px 40px rgba(0,0,0,.35), 
    0 5px 20px rgba(0,0,0,.2),
    inset 0 1px 0 rgba(255,255,255,.9);
  z-index: 10;
}

.photo-frame:nth-child(even) {
  transform: rotate(1.5deg);
}

.photo-frame:nth-child(even):hover {
  transform: rotate(0deg) scale(1.05) translateY(-5px);
}

.photo-frame:before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 35px;
  height: 15px;
  background: 
    linear-gradient(45deg, transparent 30%, rgba(255,255,255,.9) 50%, transparent 70%),
    linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 50%, #e8e8e8 100%);
  transform: translateX(-50%) rotate(15deg);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.photo-frame img { 
  width: 100%; 
  display: block; 
  height: auto; 
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}

.photo-frame:after {
  content: attr(data-caption);
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 8px;
  text-align: center;
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

/* Navigation and controls */
.book-nav { 
  position: absolute; 
  bottom: 15px; 
  width: 100%; 
  display: flex; 
  justify-content: center; 
  gap: 15px; 
}

.nav-btn { 
  border: 0; 
  width: 48px; 
  height: 48px; 
  border-radius: 50%; 
  background: rgba(255,255,255,.25); 
  color: #fff; 
  font-size: 24px; 
  cursor: pointer; 
  box-shadow: 0 8px 25px rgba(0,0,0,.3); 
  transition: all .3s ease;
  backdrop-filter: blur(10px);
}

.nav-btn:hover { 
  transform: translateY(-3px) scale(1.05); 
  background: rgba(255,255,255,.35);
  box-shadow: 0 12px 35px rgba(0,0,0,.4);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.book-close { 
  position: absolute; 
  top: 15px; 
  right: 15px; 
  border: 0; 
  width: 48px; 
  height: 48px; 
  border-radius: 50%; 
  background: rgba(255,255,255,.25); 
  color: #fff; 
  font-size: 20px; 
  cursor: pointer; 
  box-shadow: 0 8px 25px rgba(0,0,0,.3); 
  z-index: 5; 
  backdrop-filter: blur(10px);
  transition: all .3s ease;
}

.book-close:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,.35);
}

/* Opening animation helpers */
.book-opening .page[data-page="1"] { 
  animation: pageInitial 1.2s ease-out forwards;
}
.book-opening .page[data-page="2"] { 
  animation: pageInitial 1.2s ease-out forwards;
}

@keyframes pageInitial {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Paper texture and aging effects */
.page-content:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(139,115,85,0.02) 0%, transparent 50%),
    radial-gradient(circle at 75% 25%, rgba(139,115,85,0.02) 0%, transparent 50%),
    radial-gradient(circle at 25% 75%, rgba(139,115,85,0.02) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(139,115,85,0.02) 0%, transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 24px,
      rgba(139,115,85,0.03) 25px,
      rgba(139,115,85,0.03) 26px
    );
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* Enhanced polaroid variations */
.photo-frame:nth-child(odd) {
  transform: rotate(-1.8deg) translateY(-2px);
}

.photo-frame:nth-child(3n) {
  transform: rotate(2.2deg) translateY(1px);
}

/* Add some subtle book wear */
.book-scene:before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: 
    radial-gradient(circle at 20% 30%, rgba(101,67,33,0.15) 0%, transparent 25%),
    radial-gradient(circle at 80% 70%, rgba(101,67,33,0.1) 0%, transparent 30%);
  pointer-events: none;
  border-radius: 8px;
  z-index: -1;
}

/* Credit footer */
.credit {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Dancing Script', cursive;
  font-size: 14px;
  color: rgba(180,150,120,0.8);
  text-shadow: none;
  z-index: 999;
  pointer-events: none;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  animation: fadeIn 1s ease 2s both;
}

/* Credit moved to right side to avoid collision */
.credit.moved {
  right: 20px;
  left: auto;
  transform: none;
  bottom: 12px;
}

/* Mobile Responsive Design */
@media screen and (max-width: 768px) {
  
  /* Ensure mobile can scroll properly */
  body {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 20px;
  }
  
  /* Header adjustments for mobile */
  .header {
    margin-top: 20px;
    background: rgba(0,0,0,0.3);
    padding: 15px 10px;
    border-radius: 15px;
    margin: 20px 10px 15px 10px;
    backdrop-filter: blur(10px);
  }
  
  .title {
    font-size: 36px;
    margin: 0 10px 6px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
  }
  
  .subtitle {
    font-size: 14px;
    margin: 0 15px 8px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
  }
  
  
  /* Smaller cake for mobile */
  .cake {
    width: 280px;
    height: 220px;
    top: 55%;
    margin-left: -140px;
    margin-top: -110px;
  }
  
  .plate {
    width: 300px;
    height: 120px;
    bottom: -10px;
    left: -10px;
  }
  
  .layer {
    width: 280px;
    height: 120px;
  }
  
  .layer-top {
    top: 0px;
  }
  
  .layer-middle {
    top: 35px;
  }
  
  .layer-bottom {
    top: 70px;
  }
  
  .icing {
    top: 2px;
    left: 5px;
    width: 270px;
    height: 110px;
  }
  
  /* Adjust drips for smaller cake */
  .drip1 {
    top: 60px;
    left: 5px;
    height: 50px;
    width: 40px;
  }
  
  .drip2 {
    top: 75px;
    left: 220px;
    height: 55px;
    width: 45px;
  }
  
  .drip3 {
    top: 62px;
    left: 110px;
    width: 80px;
    height: 55px;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
  }
  
  /* Smaller cake name */
  .cake-name {
    top: 65px;
    font-size: 28px;
  }
  
  /* Adjust candles for mobile */
  .candle {
    width: 6px;
    height: 20px;
    border-radius: 3px/2px;
    top: -25px;
    margin-left: -5px;
  }
  
  .candle:before {
    width: 6px;
    height: 3px;
  }
  
  .flame {
    width: 5px;
    height: 14px;
    top: -19px;
    margin-left: -2.5px;
  }
  
  /* Mobile button adjustments - moved to bottom */
  #musicToggle, #replayBtn {
    width: 40px;
    height: 40px;
    font-size: 16px;
    top: auto;
    bottom: 80px;
    z-index: 1300;
  }
  
  #musicToggle {
    right: 15px;
  }
  
  #replayBtn {
    right: 65px;
  }
  
  /* Message button mobile */
  .message-btn {
    bottom: 35px;
    padding: 12px 18px;
    font-size: 14px;
  }
  
  /* Mobile book modal */
  .book-scene {
    width: min(95vw, 500px);
    height: min(75vh, 400px);
    perspective: 1200px;
  }
  
  .book-frame {
    padding: 10px;
  }
  
  /* Mobile book pages */
  .page-content {
    padding: 15px 12px 25px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    box-sizing: border-box;
  }
  
  .message-text {
    font-size: 15px;
    line-height: 1.5;
    max-width: 95%;
    margin-bottom: 15px;
  }
  
  /* Ensure all pages are scrollable on mobile */
  .page .page-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    display: block;
  }
  
  /* Fix text containers for better mobile reading */
  .page-text {
    height: auto;
    min-height: auto;
    display: block;
    padding-bottom: 20px;
  }
  
  .page-text.warm,
  .page-text.diary {
    padding: 15px 0 25px 0;
  }
  
  .script-title {
    font-size: 28px;
    margin-bottom: 10px;
  }
  
  .ribbon-title {
    font-size: 22px;
  }
  
  .subtitle-page {
    font-size: 18px;
  }
  
  .signature {
    font-size: 20px;
    margin-top: 15px;
  }
  
  /* Mobile polaroid photos */
  .photo-frame {
    width: 220px;
    padding: 6px 6px 24px 6px;
  }
  
  .photo-frame:before {
    width: 25px;
    height: 12px;
    top: -4px;
  }
  
  .photo-frame:after {
    font-size: 10px;
    bottom: 4px;
  }
  
  /* Mobile navigation */
  .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .book-nav {
    bottom: 8px;
    padding: 5px 0;
    background: rgba(0,0,0,0.1);
    border-radius: 25px;
    backdrop-filter: blur(5px);
  }
  
  .book-close {
    width: 40px;
    height: 40px;
    font-size: 16px;
    top: 10px;
    right: 10px;
  }
  
  /* Mobile credit */
  .credit {
    font-size: 12px;
    bottom: 6px;
    color: rgba(255,255,255,0.9);
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
    background: rgba(0,0,0,0.2);
    padding: 4px 8px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
  }
  
  .credit.moved {
    right: 10px;
    bottom: 8px;
  }
  
  /* Smaller balloons for mobile */
  .balloon {
    width: 24px;
    height: 30px;
  }
  
  .balloon:after {
    height: 18px;
  }
  
  /* Mobile ambient balloons */
  .ambient-balloon {
    width: 28px;
    height: 36px;
  }
  
  .ambient-balloon:after {
    height: 20px;
  }
  
  /* Smaller confetti for mobile */
  .confetti {
    width: 6px;
    height: 8px;
  }
  
  /* Mobile sparkles */
  .sparkle {
    width: 3px;
    height: 3px;
  }
  
  /* Mobile countdown overlay */
  .countdown-title {
    font-size: 36px;
    margin: 0 0 10px;
  }
  
  .countdown-subtitle {
    font-size: 16px;
    margin: 0 0 30px;
  }
  
  .countdown-timer {
    gap: 8px;
    margin-bottom: 30px;
  }
  
  .time-unit {
    padding: 15px 12px;
    min-width: 70px;
  }
  
  .time-value {
    font-size: 32px;
  }
  
  .time-label {
    font-size: 10px;
    margin-top: 4px;
  }
  
  .time-separator {
    font-size: 28px;
  }
  
  .countdown-decorations {
    gap: 15px;
    font-size: 28px;
    margin-top: 20px;
  }
  
  /* Mobile click to start */
  .start-title {
    font-size: 42px;
    margin: 0 0 20px;
  }
  
  .start-icon {
    font-size: 80px;
    margin: 15px 0;
  }
  
  .start-button {
    font-size: 18px;
    padding: 16px 35px;
  }
  
  .start-hint {
    font-size: 14px;
    margin-top: 20px;
  }
}

/* Extra small mobile devices */
@media screen and (max-width: 480px) {
  
  /* Ensure extra small screens can scroll */
  body {
    padding-bottom: 30px;
  }
  
  .title {
    font-size: 28px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9);
  }
  
  .subtitle {
    font-size: 12px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.9);
  }
  
  .header {
    background: rgba(0,0,0,0.4);
    margin: 15px 8px 10px 8px;
  }
  
  /* Even smaller cake for very small screens */
  .cake {
    width: 240px;
    height: 180px;
    top: 52%;
    margin-left: -120px;
    margin-top: -90px;
  }
  
  .plate {
    width: 260px;
    height: 100px;
  }
  
  .layer {
    width: 240px;
    height: 100px;
  }
  
  .layer-middle {
    top: 30px;
  }
  
  .layer-bottom {
    top: 60px;
  }
  
  .icing {
    width: 230px;
    height: 90px;
  }
  
  .cake-name {
    font-size: 22px;
    top: 55px;
  }
  
  /* Fix candle and flame alignment for extra small screens */
  .candle {
    width: 5px;
    height: 18px;
    border-radius: 2.5px/1.5px;
    top: -22px;
    margin-left: -2.5px;
  }
  
  .candle:before {
    width: 5px;
    height: 2.5px;
  }
  
  .flame {
    width: 4px;
    height: 12px;
    top: -17px;
    margin-left: -2px;
  }
  
  /* Adjust drips for very small cake */
  .drip1 {
    height: 40px;
    width: 30px;
    top: 50px;
  }
  
  .drip2 {
    height: 45px;
    width: 35px;
    top: 65px;
    left: 180px;
  }
  
  .drip3 {
    width: 60px;
    height: 45px;
    top: 52px;
    left: 90px;
  }
  
  /* Very small book for tiny screens */
  .book-scene {
    width: min(94vw, 400px);
    height: min(75vh, 380px);
  }
  
  .message-text {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
  }
  
  /* Ensure scrolling works on very small screens too */
  .page-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px 20px 10px;
    height: 100%;
    box-sizing: border-box;
  }
  
  .page-text {
    padding-bottom: 15px;
  }
  
  .script-title {
    font-size: 22px;
    margin-bottom: 8px;
  }
  
  .signature {
    font-size: 18px;
    margin-top: 12px;
  }
  
  .photo-frame {
    width: 120px;
  }
  
  /* Adjust buttons for tiny screens */
  #musicToggle, #replayBtn {
    width: 35px;
    height: 35px;
    font-size: 14px;
    top: auto;
    bottom: 70px;
  }
  
  #musicToggle {
    right: 10px;
  }
  
  #replayBtn {
    right: 55px;
  }
  
  .message-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  /* Extra small sparkles and balloons */
  .sparkle {
    width: 2.5px;
    height: 2.5px;
  }
  
  .ambient-balloon {
    width: 22px;
    height: 28px;
  }
  
  .ambient-balloon:after {
    height: 16px;
  }
  
  /* Extra small countdown overlay */
  .countdown-title {
    font-size: 28px;
  }
  
  .countdown-subtitle {
    font-size: 14px;
    margin: 0 0 25px;
  }
  
  .countdown-timer {
    gap: 5px;
  }
  
  .time-unit {
    padding: 12px 8px;
    min-width: 60px;
  }
  
  .time-value {
    font-size: 26px;
  }
  
  .time-label {
    font-size: 9px;
  }
  
  .time-separator {
    font-size: 22px;
  }
  
  .countdown-decorations {
    gap: 10px;
    font-size: 22px;
  }
  
  /* Extra small click to start */
  .start-title {
    font-size: 32px;
    padding: 0 10px;
  }
  
  .start-icon {
    font-size: 70px;
  }
  
  .start-button {
    font-size: 16px;
    padding: 14px 30px;
  }
  
  .start-hint {
    font-size: 13px;
  }
}