body {
  margin: 0;
  background: radial-gradient(circle at top, #ffe6f0, #fddde6);
  font-family: 'Pacifico', cursive, sans-serif;
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* Contenedor del pastel */
.pastel {
  position: relative;
  width: 240px;
  margin: 40px auto 0;
  animation: flotar 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

/* Plato */
.plato {
  width: 300px;
  height: 30px;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border-radius: 50%;
  box-shadow: 
    inset 0 3px 8px rgba(0,0,0,0.1),
    0 8px 16px rgba(0,0,0,0.15),
    0 4px 8px rgba(255,255,255,0.4);
  margin-bottom: -15px;
  transform: perspective(500px) rotateX(5deg);
}

/* Capas */
.capa {
  width: 100%;
  height: 65px;
  border-radius: 25px 25px 12px 12px;
  opacity: 0;
  transform: translateY(-120px) scale(0.9);
  animation: caer 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 
    inset 0 -8px 12px rgba(0,0,0,0.1),
    0 8px 16px rgba(0,0,0,0.1);
  position: relative;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Colores */
.capa1 {
  animation-delay: 0.5s;
  background: linear-gradient(165deg, #ff7eb3, #ff5c8a);
}
.capa2 {
  animation-delay: 1s;
  background: linear-gradient(165deg, #ffafd1, #ff8fb6);
}
.capa3 {
  animation-delay: 1.5s;
  background: linear-gradient(165deg, #ffd1e6, #ffb7d5);
  .capa3::after {
  content: '✨';
  position: absolute;
  font-size: 20px;
  top: 50%;
  left: 10%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.6);
}
}

/* Vela */
.vela {
  width: 16px;
  height: 55px;
  background: repeating-linear-gradient(
    -45deg,
    #ffffff 0 8px,
    #ffd6e0 8px 16px
  );
  border-radius: 6px 6px 2px 2px;
  position: absolute;
  top: -65px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  opacity: 0;
  animation: caerVela 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: 2.2s;
  box-shadow: 
    0 0 12px rgba(255,255,255,0.7),
    inset 0 -8px 12px rgba(255,192,203,0.4);
  transition: all 0.4s ease;
  overflow: visible;
}

/* Base de la vela (dorada) */
.vela::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 10px;
  background: linear-gradient(145deg, #fcd34d, #fbbf24);
  border-radius: 50%;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.15);
}

/* Flama mejorada */
.flama {
  width: 22px;
  height: 28px;
  background: radial-gradient(circle at 50% 30%, 
    #fff7c2 0%, 
    #ffd86f 35%, 
    #ff9a5c 70%, 
    #ff5e62 100%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  animation: parpadeo 1.5s infinite alternate ease-in-out;
  filter: blur(0.4px) drop-shadow(0 0 12px rgba(255,200,100,0.7));
}

/* Brillo extra de la flama */
.flama::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(255,255,255,0.9), transparent 70%);
  border-radius: 50%;
  opacity: 0.8;
}


/* Mensaje */
.mensaje {
  font-size: 3.2em;
  background: linear-gradient(45deg, #ff6b9c, #ff8eb7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-top: 60px;
  opacity: 0;
  animation: aparecer 2s ease forwards;
  animation-delay: 3s;
  text-shadow: 
    3px 3px 6px rgba(0,0,0,0.1),
    0 0 20px rgba(255,107,156,0.3);
  letter-spacing: 2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

#btnCarta {
  position: relative;
  border-radius: 12px;
  width: 180px;
  height: 120px;
  background: #ff8eb7;
  border: none;
  cursor: pointer;
  opacity: 0;
  animation: aparecer 2s ease forwards;
  animation-delay: 3s;
  font-family: 'Pacifico', cursive;
  font-size: 1.2em;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Solapa superior */
#btnCarta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: #ff6b9c;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform 0.3s ease;
}

/* Texto centrado */
#btnCarta span {
  position: relative;
  z-index: 2;
  top: 15%;
}

/* Efecto hover: abre la solapa */
#btnCarta:hover::before {
  transform: translateY(-15px) scale(1.05);
}

#btnCarta:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

.carta {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 320px;
  height: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  padding: 20px;
  text-align: center;
  font-size: 1.3em;
  color: #ff3b7f;
  line-height: 1.6;
  z-index: 999;
  transition: transform 0.6s ease;
  opacity: 0;
}

.carta.activa {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.carta .papel {
  background: #fff0f5;
  border: 2px dashed #ffb6c1;
  border-radius: 8px;
  padding: 15px;
  height: calc(100% - 30px);
  overflow-y: auto;
  box-shadow: inset 0 0 10px rgba(255,182,193,0.2);
}

/* Botón cerrar */
.cerrar {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.4em;
  color: #ff3b7f;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.cerrar:hover {
  transform: scale(1.2);
}

/* Botón música */
.btn-musica {
  margin-top: 20px;
  padding: 10px 18px;
  font-size: 1em;
  background: linear-gradient(45deg, #ff6b9c, #ff8eb7);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-family: 'Pacifico', cursive;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}
.btn-musica:hover {
  transform: scale(1.05);
}

@keyframes brillo {
  0% { left: -75px; }
  50% { left: 120%; }
  100% { left: 120%; }
}

/* Animaciones */
@keyframes caer {
  0% { 
    transform: translateY(-120px) scale(0.9); 
    opacity: 0; 
  }
  60% { 
    transform: translateY(20px) scale(1.05); 
  }
  100% { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

@keyframes caerVela {
  0% { 
    transform: translateX(-50%) translateY(-100px) rotate(-5deg); 
    opacity: 0; 
  }
  60% { 
    transform: translateX(-50%) translateY(10px) rotate(5deg); 
  }
  100% { 
    transform: translateX(-50%) translateY(0) rotate(0deg); 
    opacity: 1; 
  }
}

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

@keyframes parpadeo {
  0% { 
    transform: translateX(-50%) scale(1) rotate(-2deg);
    opacity: 1;
    filter: brightness(1);
  }
  100% { 
    transform: translateX(-50%) scale(1.15) rotate(2deg);
    opacity: 0.8;
    filter: brightness(1.2);
  }
}

@keyframes flotar {
  0% { 
    transform: translateY(0) rotate(0deg); 
  }
  50% { 
    transform: translateY(-15px) rotate(1deg); 
  }
  100% { 
    transform: translateY(0) rotate(0deg); 
  }
}

/* Confeti cayendo */
.confeti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  opacity: 0.9;
  border-radius: 2px;
  animation: caerConfeti 4s linear forwards;
  z-index: 0; /* detrás del pastel y mensaje */
}

@keyframes caerConfeti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}

/* Asegurar que pastel y mensaje estén al frente */
.pastel, .mensaje {
  position: relative;
  z-index: 2;
}
