/* ─── Reinicio básico de estilos ─── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #020617;
  color: #e2e8f0;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

.contenedor {
  width: 90%;
  max-width: 1200px;
  margin: auto;
}

/* ─── Encabezado ─── */
header {
  padding: 80px 0 40px;
  text-align: center;
  background:
    radial-gradient(circle at top right, rgba(14,165,233,.25), transparent 25%),
    radial-gradient(circle at bottom left, rgba(59,130,246,.18), transparent 25%),
    linear-gradient(180deg, #020617 0%, #0f172a 100%);
}

.insignia {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(56,189,248,.25);
  background: rgba(56,189,248,.08);
  color: #7dd3fc;
  font-size: 14px;
  margin-bottom: 28px;
  letter-spacing: .5px;
}

h1 {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 16px;
  font-weight: 800;
  letter-spacing: -2px;
}

.degradado {
  background: linear-gradient(90deg, #38bdf8, #0ea5e9, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitulo {
  font-size: 20px;
  color: #94a3b8;
  margin-bottom: 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 300;
}

.enlace-volver {
  display: inline-block;
}

/* ─── Botones ─── */
.btn {
  padding: 12px 22px;
  border-radius: 12px;
  transition: .3s ease;
  font-weight: bold;
  border: none;
  cursor: pointer;
  font-size: 15px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primario {
  background: #0ea5e9;
  color: white;
}

.btn-primario:hover {
  background: #0284c7;
}

.btn-secundario {
  border: 1px solid rgba(148,163,184,.2);
  color: #cbd5e1;
  background: rgba(255,255,255,.03);
}

.btn-secundario:hover {
  background: rgba(255,255,255,.06);
}

.btn-peligro {
  background: #dc2626;
  color: white;
}

.btn-peligro:hover {
  background: #b91c1c;
}

.btn-peligro-borde {
  border: 1px solid rgba(220,38,38,.4);
  color: #fca5a5;
  background: rgba(220,38,38,.08);
}

.btn-peligro-borde:hover {
  background: rgba(220,38,38,.15);
}

.btn-grande {
  padding: 18px 40px;
  font-size: 20px;
}

/* ─── Barra de herramientas ─── */
.barra-herramientas {
  padding: 30px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.configuracion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.configuracion label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
}

.configuracion select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.15);
  background: rgba(15,23,42,.7);
  color: #e2e8f0;
  font-size: 15px;
  cursor: pointer;
}

.configuracion select:focus {
  outline: none;
  border-color: #0ea5e9;
}

.estadisticas {
  display: flex;
  gap: 24px;
  color: #94a3b8;
  font-size: 14px;
}

.estadisticas strong {
  color: #7dd3fc;
  font-size: 20px;
  display: block;
  margin-top: 4px;
}

/* ─── Tablero de números ─── */
.tablero {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  padding: 30px 0;
}

.celda {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.7);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 10px;
  padding: 8px 4px;
  cursor: pointer;
  transition: .3s ease;
  aspect-ratio: 1;
  min-height: 60px;
  position: relative;
}

.celda:hover {
  border-color: rgba(56,189,248,.35);
  transform: translateY(-2px);
}

.celda .numero {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}

.celda .nombre {
  font-size: 10px;
  color: #7dd3fc;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  max-width: 100%;
}

.celda.ocupado {
  border-color: rgba(56,189,248,.25);
  background: rgba(56,189,248,.08);
}

.celda.ganador {
  border-color: #fbbf24;
  background: rgba(251,191,36,.15);
  animation: pulso-ganador 1s ease infinite;
}

/* Animación de pulso en las celdas ganadoras */
@keyframes pulso-ganador {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,.4); }
  50% { box-shadow: 0 0 0 8px rgba(251,191,36,0); }
}

.celda .medalla {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #fbbf24;
  color: #020617;
  font-size: 10px;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Panel del editor ─── */
.editor {
  background: rgba(15,23,42,.7);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 20px;
  padding: 32px;
  margin: 20px 0;
  backdrop-filter: blur(8px);
}

.editor h2 {
  font-size: 28px;
  margin-bottom: 20px;
}

#nombreParticipante {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.15);
  background: rgba(255,255,255,.03);
  color: #e2e8f0;
  font-size: 16px;
  margin-bottom: 20px;
}

#nombreParticipante:focus {
  outline: none;
  border-color: #0ea5e9;
}

#nombreParticipante::placeholder {
  color: #64748b;
}

.botones-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ─── Sección del sorteo ─── */
.seccion-sorteo {
  text-align: center;
  padding: 40px 0;
}

/* ─── Animación del sorteo ─── */
.animacion {
  text-align: center;
  padding: 40px 0;
}

.numero-girando {
  font-size: 120px;
  font-weight: 800;
  background: linear-gradient(90deg, #38bdf8, #0ea5e9, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Courier New', Courier, monospace;
  animation: parpadeo .1s ease infinite;
}

/* Efecto de parpadeo rápido para la ruleta */
@keyframes parpadeo {
  0%, 100% { opacity: 1; }
  50% { opacity: .8; }
}

.etiqueta-girando {
  color: #94a3b8;
  font-size: 18px;
  margin-top: 12px;
}

/* ─── Resultados ─── */
.resultados {
  padding: 40px 0;
  text-align: center;
}

.resultados h2 {
  font-size: 36px;
  margin-bottom: 30px;
}

#listaGanadores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 30px;
}

.tarjeta-ganador {
  background: rgba(15,23,42,.7);
  border: 1px solid #fbbf24;
  border-radius: 16px;
  padding: 20px 28px;
  text-align: center;
  min-width: 160px;
}

.tarjeta-ganador .numero-ganador {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(90deg, #38bdf8, #0ea5e9, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tarjeta-ganador .nombre-ganador {
  color: #fbbf24;
  font-size: 18px;
  margin-top: 8px;
  font-weight: 600;
}

/* ─── Pie de página ─── */
footer {
  border-top: 1px solid rgba(148,163,184,.12);
  padding: 40px 0;
  text-align: center;
  color: #64748b;
  margin-top: 40px;
}

/* ─── Clase utilitaria para ocultar elementos ─── */
.oculto {
  display: none !important;
}

/* ─── Diseño responsive para dispositivos móviles ─── */
@media (max-width: 768px) {
  h1 { font-size: 38px; }

  .subtitulo { font-size: 17px; }

  .tablero {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 6px;
  }

  .celda { min-height: 50px; }

  .celda .numero { font-size: 11px; }

  .celda .nombre { font-size: 9px; }

  .numero-girando { font-size: 72px; }

  .barra-herramientas {
    flex-direction: column;
    align-items: stretch;
  }

  .configuracion {
    justify-content: center;
  }

  .estadisticas {
    justify-content: center;
  }

  .btn-grande {
    width: 100%;
  }
}