/* ===== Bautizo Veneko - Estilos ===== */

/* Reseteo básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1a1a2e;
  /* Fondo degradado vibrante con tonos amarillos, azules y rojos sutiles */
  background: linear-gradient(
    135deg,
    #ffe66d 0%,
    #ffb84d 30%,
    #ff6b6b 60%,
    #4a69bd 100%
  );
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ===== App ===== */
.app {
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.titulo {
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  font-weight: 900;
  color: #1a1a2e;
  letter-spacing: -0.5px;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.6);
}

.bandera {
  display: inline-block;
}

/* Bandera en el título: alineada a la altura del texto, inline */
.titulo .bandera-img {
  width: 1em;
  height: auto;
  aspect-ratio: 3 / 2;
  vertical-align: middle;
  margin-left: 0.08em;
  -webkit-user-drag: none;
  user-select: none;
}

.subtitulo {
  margin-top: 10px;
  font-size: clamp(1rem, 4vw, 1.15rem);
  color: #1a1a2e;
  font-weight: 600;
  opacity: 0.85;
}

/* ===== Caja de entrada ===== */
.caja-entrada {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

input[type="text"] {
  width: 100%;
  padding: 18px 20px;
  font-size: 1.2rem;
  border: none;
  border-radius: 16px;
  background: #fff;
  color: #1a1a2e;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  outline: 2px solid transparent;
  transition: outline 0.2s, box-shadow 0.2s, transform 0.2s;
}

input[type="text"]:focus {
  outline: 2px solid #4a69bd;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

input[type="text"].error {
  outline: 2px solid #e63946;
  animation: shake 0.4s;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

#btn-bautizar {
  padding: 18px 20px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  background: #1a1a2e;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}

#btn-bautizar:active {
  transform: scale(0.97);
}

/* ===== Resultado ===== */
.resultado {
  margin-top: 32px;
  padding: 24px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.resultado.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  animation: pop-in 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  gap: 14px;
}

#nombre-mutado {
  font-size: clamp(2rem, 10vw, 3rem);
  font-weight: 900;
  color: #4a69bd;
  word-break: break-word;
}

.apoyo {
  background: none;
  color: #e63946;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  transition: background 0.2s;
}

.apoyo:hover {
  background: rgba(74, 105, 189, 0.1);
}

/* Botón compartir — secundario dentro de resultado */
#btn-compartir {
  display: none;
  width: 100%;
  padding: 14px 20px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  background: #1a1a2e;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  transition: transform 0.15s, opacity 0.2s;
}
#btn-compartir:active { transform: scale(0.97); }
#btn-compartir:disabled { opacity: 0.6; cursor: not-allowed; }
#btn-compartir.visible { display: block; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a2e;
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
  text-align: center;
  max-width: 90vw;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast a, .toast button {
  color: #ffd166;
  font-weight: 800;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 8px;
}

.pie {
  margin-top: 32px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a2e;
  opacity: 0.7;
}

/* ===== Utilidades ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Animaciones ===== */
@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ===== Tragaperras ===== */
.tragaperras {
  margin-top: 28px;
  display: none;
}

.tragaperras.activo {
  display: block;
}

.reeles {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, #3a2d66, #1a1a2e);
  border-radius: 20px;
  box-shadow: inset 0 0 0 3px #ffd166, 0 10px 24px rgba(0, 0, 0, 0.35);
  position: relative;
}

/* Ventana de la ruleta: muestra UNA banda a la vez (apaisada para la bandera) */
.ruleta {
  width: 64px;
  height: 44px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px #1a1a2e;
  position: relative;
}

/* Líneas superior/inferior de la ventana (efecto máquina) */
.ruleta::before,
.ruleta::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: #1a1a2e;
  z-index: 2;
  pointer-events: none;
}
.ruleta::before { top: 0; border-radius: 0 0 8px 8px; }
.ruleta::after { bottom: 0; border-radius: 8px 8px 0 0; }

/* Banda: columna de ítems que se desliza verticalmente.
   Anclada al top de la ventana para que translateY alinee los ítems exactamente. */
.banda {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.banda .item {
  width: 64px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1a2e;
  background: linear-gradient(180deg, #fff, #f0eef7);
  border-bottom: 1px solid #e2ddf0;
}

/* Bandera de Venezuela: completa, centrada y sin recortar en la celda apaisada */
.banda .item.flag {
  padding: 0;
  background: #fff;
}

.banda .item .flag-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

/* ===== Efecto fiesta: confeti ===== */
.confeti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
  display: none;
}

.confeti.activo {
  display: block;
}

.confeti .pieza {
  position: absolute;
  top: -20px;
  border-radius: 2px;
  animation: caer linear forwards;
}

@keyframes caer {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.9;
  }
}

/* Pop del nombre (fiesta) */
.resultado.fiesta #nombre-mutado {
  animation: fiesta-pop 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.3);
}

@keyframes fiesta-pop {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  50% { transform: scale(1.15) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ===== Estado de captura html2canvas ===== */
html.capturando {
  overflow: hidden;
}
html.capturando body {
  background-attachment: scroll;
}
html.capturando .titulo .bandera-img {
  width: 1em;
  height: 0.667em; /* aspect-ratio 3:2 explícito para html2canvas */
}
/* Sin barras negras de "efecto máquina" en la captura: la bandera se ve limpia */
html.capturando .ruleta::before,
html.capturando .ruleta::after {
  display: none;
}
