
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: radial-gradient(circle at center, #35101f 0%, #200b16 50%, #10060d 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* LLUVIA DE CORAZONES */
#falling-hearts {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.falling-heart {
  position: absolute;
  top: -50px;
  color: #ff6b98;
  opacity: .65;
  animation: falling linear forwards;
}

@keyframes falling {
  0% {
    transform: translateY(-50px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: .65;
  }
  90% {
    opacity: .5;
  }
  100% {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}

/* CONTENEDOR PRINCIPAL */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  text-align: center;
  padding: 40px 30px;
  border: 1px solid rgba(255,141,181,.25);
  border-radius: 25px;
  background: rgba(65,15,36,.35);
  box-shadow: 0 0 40px rgba(255,70,130,.12);
  backdrop-filter: blur(8px);
}

/* TÍTULO */
.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.container h1 {
  color: #ff8db5;
  font-family: 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  font-size: clamp(32px, 7vw, 43px);
  font-weight: normal;
  text-shadow: 0 0 12px rgba(255,100,160,.4);
}

.title-heart {
  color: #ff6b98;
  font-size: clamp(32px, 7vw, 43px);
  text-shadow: 0 0 8px rgba(255,60,120,.8), 0 0 20px rgba(255,60,120,.5);
  animation: titlePulse 1.5s ease-in-out infinite alternate;
}

@keyframes titlePulse {
  from { transform: scale(.9); }
  to { transform: scale(1.15); }
}

/* CUENTA ATRÁS */
#countdown-container {
  margin-bottom: 25px;
  animation: appear 1s ease;
}

#countdown {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(7px, 2vw, 12px);
  width: 100%;
}

#countdown .time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  padding: 12px 5px;
  border: 1px solid rgba(255,141,181,.5);
  border-radius: 15px;
  background: rgba(20,5,14,.4);
  box-shadow: 0 0 12px rgba(255,80,140,.08);
  transition: border-color .3s ease, box-shadow .3s ease;
}

#countdown .time-unit:hover {
  border-color: #ff80ab;
  box-shadow: 0 0 15px rgba(255,80,140,.2);
}

#countdown .time-unit span {
  color: #ff8db5;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(255,80,140,.35);
}

#countdown .time-unit small {
  color: #e9b5c8;
  font-size: clamp(9px, 2vw, 11px);
  margin-top: 5px;
}

/* TEXTO Y FORMULARIO */
.container .subtitle {
  color: #f5c5d5;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 20px;
}

input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255,141,181,.5);
  border-radius: 30px;
  background: rgba(20,5,14,.65);
  color: white;
  font-size: 15px;
  text-align: center;
  outline: none;
  transition: .3s;
}

input::placeholder {
  color: #c994a9;
}

input:focus {
  border-color: #ff80ab;
  box-shadow: 0 0 15px rgba(255,80,140,.3);
}

input:disabled {
  opacity: .6;
}

button {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #ff4f87, #ff80ab);
  color: white;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(255,70,130,.3);
  transition: transform .3s, box-shadow .3s;
}

button:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 8px 25px rgba(255,70,130,.5);
}

button:disabled {
  opacity: .6;
  cursor: default;
}

/* POPUP DE ERROR */
#error-popup {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 2, 8, .78);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
}

#error-popup.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.error-box {
  position: relative;
  width: 100%;
  max-width: 350px;
  padding: 35px 25px 25px;
  border: 1px solid rgba(255,141,181,.55);
  border-radius: 22px;
  background: radial-gradient(circle at top, #4a142c 0%, #210b18 65%, #160711 100%);
  box-shadow: 0 0 40px rgba(255,70,130,.25);
  text-align: center;
  transform: scale(.85) translateY(15px);
  transition: transform .35s ease;
}

#error-popup.active .error-box {
  transform: scale(1) translateY(0);
}

/* CRUZ PARA CERRAR */
#close-error {
  position: absolute;
  top: 10px;
  right: 13px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255,141,181,.4);
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  color: #ffc1d5;
  font-size: 24px;
  font-weight: normal;
  line-height: 28px;
  cursor: pointer;
  box-shadow: none;
  transition: background .3s, transform .3s;
}

#close-error:hover {
  background: rgba(255,100,150,.25);
  transform: rotate(90deg);
  box-shadow: none;
}

.error-box p {
  color: #ff91b8;
  font-size: 17px;
  font-weight: bold;
  line-height: 1.5;
  margin: 10px 0 20px;
}

#pig {
  display: block;
  width: 100%;
  max-width: 230px;
  max-height: 220px;
  object-fit: contain;
  border-radius: 15px;
  margin: 0 auto;
}

#attempt {
  display: block;
  margin-top: 15px;
  color: #e9b5c8;
  font-size: 12px;
}

/* TRANSICIÓN AL ACERTAR */
#page-transition {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(circle, #4a142c 0%, #210b18 55%, #10060d 100%);
  color: #ffe0e9;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 1.1s ease, visibility 1.1s ease;
}

#page-transition.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.transition-heart {
  color: #ff6b98;
  font-size: clamp(90px, 18vw, 170px);
  text-shadow: 0 0 15px rgba(255,80,140,.9), 0 0 45px rgba(255,80,140,.7);
  animation: transitionPulse 1s ease-in-out infinite alternate;
}

#page-transition p {
  font-size: clamp(18px, 4vw, 26px);
  text-align: center;
  color: #ffe0e9;
  padding: 0 20px;
}

#page-transition span {
  font-size: 28px;
  animation: transitionSparkle 1s ease-in-out infinite alternate;
}

@keyframes transitionPulse {
  from { transform: scale(.85); }
  to { transform: scale(1.12); }
}

@keyframes transitionSparkle {
  from { opacity: .4; transform: scale(.8); }
  to { opacity: 1; transform: scale(1.2); }
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.leaving-page {
  overflow: hidden;
}

body.leaving-page #falling-hearts {
  display: none;
}

/* MÓVILES */
@media (max-width: 480px) {
  .container {
    padding: 35px 20px;
  }

  .title-container {
    gap: 10px;
    margin-bottom: 25px;
  }

  #countdown {
    gap: 7px;
  }

  #countdown .time-unit {
    padding: 11px 3px;
    border-radius: 12px;
  }

  #countdown .time-unit span {
    font-size: 22px;
  }

  #countdown .time-unit small {
    font-size: 9px;
  }

  .container .subtitle {
    font-size: 14px;
  }
}

@media (max-height: 550px) {
  .container {
    padding: 20px;
  }

  .title-container {
    margin-bottom: 15px;
  }

  #countdown-container {
    margin-bottom: 15px;
  }

  .container .subtitle {
    margin-bottom: 12px;
  }

  #pig {
    max-height: 120px;
  }

  .error-box {
    padding-top: 30px;
    padding-bottom: 15px;
  }
}
