body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: radial-gradient(circle at bottom, #0b0b1d 0%, #000 100%);
  font-family: Arial, sans-serif;
  overflow: hidden;
  position: relative; /* necesario para estrellas */
}

/* === Estrellas === */
.estrella {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: brillar 2s infinite alternate;
  opacity: 0.8;
}

@keyframes brillar {
  from { opacity: 0.2; transform: scale(1); }
  to   { opacity: 1; transform: scale(1.4); }
}

/* === Luna === */
.luna {
  position: absolute;
  top: 20%;       /* altura de la luna */
  right: 400px;   /* distancia al borde derecho */
  width: 120px;
  height: 120px;
  background: #fdf5c9;
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(255, 255, 200, 0.8);
  z-index: 6;
  overflow: hidden;
}

.luna::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0; /* comienza tapando la luna */
  width: 100%;
  height: 100%;
  background: #0b0b1d; /* mismo color que el cielo */
  border-radius: 50%;
  animation: fases 6s forwards ease-in-out;
}

/* La luna se llena poco a poco y se queda */
@keyframes fases {
  0%   { left: 0; }     
  100% { left: 120px; } 
}

/* Carta */
.carta {
  width: 1830px;
  height: 900px;
  position: relative;
  perspective: 1000px;
  cursor: pointer;
  z-index: 10; /* carta encima de estrellas */
}

.sobre {
  width: 50%;
  height: 50%;
  background: #ff4d6d;
  position: absolute;
  transform-style: preserve-3d;
  transition: transform 1s;
  border-radius: 8px;
}

.carta.open .sobre {
  transform: rotateX(180deg);
}

.frente, .dentro {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  color: white;
  padding: 10px;
  box-sizing: border-box;
}

.frente {
  background: #ff4d6d;
}

.dentro {
  background: white;
  color: black;
  transform: rotateX(180deg);
  font-size: 18px;
  overflow-y: auto;
  display: block;
  padding: 20px;
  box-sizing: border-box;
}

/* Contenido dentro de la carta */
.contenido-carta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 15px;
  padding: 20px;
  font-family: 'Dancing Script', cursive;
  line-height: 1.6;
  border: 2px solid #ffb6c1;
  border-radius: 10px;
  background: #fffdf7;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
}

/* Encabezado con fecha */
.encabezado {
  align-self: flex-end;
  font-size: 16px;
  font-style: italic;
  color: #444;
}

/* Saludo */
.saludo {
  font-size: 20px;
  font-weight: bold;
  color: #ff4d6d;
}

/* Texto del mensaje */
.mensaje p {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.mensaje img {
  display: block;
  margin: 10px auto;
  max-width: 150px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* Firma al final */
.despedida {
  margin-top: 20px;
  align-self: flex-end;
  font-size: 20px;
  color: #444;
}

/* Corazones flotando */
.corazon {
  position: absolute;
  color: rgb(255, 255, 255);
  font-size: 20px;
  animation: flotar 5s linear infinite;
  opacity: 0.8;
}

@keyframes flotar {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}
