/* ============================================================
   DESAFÍO IA RESPONSABLE — Estilos
   Paleta extraída de las diapositivas de la charla
   ============================================================ */

:root {
  --azul:       #002CBE;   /* títulos, selección, botones primarios */
  --azul-barra: #002AB8;   /* barra inferior izquierda */
  --rojo:       #E90100;   /* número de pregunta, acentos, badge */
  --rojo-barra: #CD0301;   /* barra inferior derecha */
  --gris-txt:   #3F4354;   /* texto de cuerpo y opciones */
  --gris-suave: #6B7280;   /* texto secundario */
  --borde:      #E3E6E7;   /* contorno de tarjetas */
  --borde-2:    #D5D9DC;
  --fondo:      #FEFEFE;
  --fondo-2:    #F5F7F9;
  --verde:      #128A3A;   /* correcto */
  --sombra:     0 2px 10px rgba(0,0,0,.06);
  --sombra-2:   0 6px 24px rgba(0,0,0,.10);
  --radio:      16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: Arial, Helvetica, "Segoe UI", sans-serif;
  color: var(--gris-txt);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Barra inferior característica azul→rojo ---------- */
.barra-inferior {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 12px;
  display: flex;
  z-index: 50;
}
.barra-inferior .izq { flex: 1 1 68%; background: var(--azul-barra); }
.barra-inferior .der { flex: 1 1 32%; background: var(--rojo-barra); }

/* ---------- Header con logo ---------- */
.encabezado {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
}
.encabezado img { height: 40px; width: auto; }
.encabezado .marca {
  font-weight: 800;
  letter-spacing: .3px;
  font-size: 15px;
  color: var(--rojo);
  text-transform: uppercase;
}
.encabezado .marca span { color: var(--gris-txt); }
.encabezado .badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--rojo);
  color: var(--rojo);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 800;
  font-size: 14px;
}
.encabezado .badge small { color: var(--gris-txt); font-weight: 600; font-size: 11px; }

/* ---------- Contenedor central ---------- */
.contenedor {
  flex: 1 1 auto;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 20px 60px;
  display: flex;
  flex-direction: column;
}

/* ---------- Títulos tipo "Pregunta N" ---------- */
.titulo-pregunta {
  text-align: center;
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 800;
  color: var(--azul);
  margin-top: 6px;
}
.titulo-pregunta .num { color: var(--rojo); }
.separador {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin: 10px 0 20px;
}
.separador .linea { width: 26px; height: 3px; background: var(--azul); border-radius: 2px; }
.separador .punto { width: 5px; height: 5px; background: var(--azul); border-radius: 50%; }

/* ---------- Contexto y enunciado ---------- */
.contexto {
  text-align: center;
  font-size: clamp(15px, 2.4vw, 19px);
  color: var(--gris-txt);
  max-width: 720px;
  margin: 0 auto 6px;
  line-height: 1.4;
}
.contexto .hl { color: var(--azul); font-weight: 700; }
.enunciado {
  text-align: center;
  font-size: clamp(17px, 2.8vw, 22px);
  font-weight: 700;
  color: var(--gris-txt);
  max-width: 760px;
  margin: 6px auto 22px;
  line-height: 1.35;
}
.enunciado .rojo { color: var(--rojo); }

/* ---------- Rejilla de opciones A/B/C/D ---------- */
.opciones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 8px;
}
@media (max-width: 720px) {
  .opciones { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .opciones { grid-template-columns: 1fr; }
}

.opcion {
  position: relative;
  border: 1.5px solid var(--borde);
  border-radius: var(--radio);
  background: #fff;
  padding: 30px 16px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .05s;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-size: 15px;
  line-height: 1.35;
  color: var(--gris-txt);
  user-select: none;
}
.opcion:hover { box-shadow: var(--sombra); }
.opcion:active { transform: scale(.99); }

.opcion .letra {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--rojo);
  color: var(--rojo);
  font-weight: 800;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}

/* Estado seleccionado */
.opcion.sel {
  border-color: var(--azul);
  box-shadow: 0 0 0 2px var(--azul) inset, var(--sombra);
}
.opcion.sel .letra { border-color: var(--azul); color: #fff; background: var(--azul); }

/* Estado eliminado por comodín 50/50 */
.opcion.eliminada {
  opacity: .35;
  pointer-events: none;
  filter: grayscale(1);
}
.opcion.eliminada::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(0,0,0,.05) 8px, rgba(0,0,0,.05) 10px);
  border-radius: var(--radio);
}

/* Feedback correcto/incorrecto tras enviar */
.opcion.correcta { border-color: var(--verde); box-shadow: 0 0 0 2px var(--verde) inset; }
.opcion.correcta .letra { border-color: var(--verde); background: var(--verde); color:#fff; }
.opcion.incorrecta { border-color: var(--rojo); box-shadow: 0 0 0 2px var(--rojo) inset; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: scale(.99); }
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: #0023a0; }
.btn-rojo { background: var(--rojo); color: #fff; }
.btn-rojo:hover { background: #c40100; }
.btn-ghost { background: #fff; color: var(--azul); border: 2px solid var(--azul); }
.btn-ghost:hover { background: #f0f3ff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 16px 34px; font-size: 17px; }
.btn-block { width: 100%; }

/* ---------- Barra de acciones del quiz ---------- */
.acciones {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* ---------- Tarjeta / formularios ---------- */
.tarjeta {
  background: #fff;
  border: 1.5px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 30px 26px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}
.tarjeta h1 { color: var(--azul); font-size: 26px; margin-bottom: 4px; text-align: center; }
.tarjeta .sub { text-align: center; color: var(--gris-suave); margin-bottom: 22px; font-size: 15px; }

.campo { margin-bottom: 16px; }
.campo label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.campo input {
  width: 100%;
  border: 1.5px solid var(--borde-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--gris-txt);
  transition: border-color .15s;
}
.campo input:focus { outline: none; border-color: var(--azul); }

/* ---------- Mensajes ---------- */
.alerta {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}
.alerta-error { background: #fdecec; color: #a11; border: 1px solid #f5c2c2; }
.alerta-ok    { background: #e9f7ef; color: #128A3A; border: 1px solid #b8e6c8; }
.alerta-info  { background: #eef2ff; color: var(--azul); border: 1px solid #c9d4ff; }

/* ---------- Pantalla de espera ---------- */
.espera {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 40px 20px;
}
.espera .icono {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 4px solid var(--borde);
  border-top-color: var(--azul);
  animation: girar 1s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
.espera h2 { color: var(--azul); font-size: 24px; }
.espera p { color: var(--gris-suave); font-size: 16px; max-width: 420px; }

/* ---------- Cronómetro ---------- */
.cronometro {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  color: var(--azul);
  background: var(--fondo-2);
  border-radius: 999px;
  padding: 6px 16px;
  margin: 0 auto 14px;
}
.cronometro.urgente { color: var(--rojo); }

/* ---------- Comodín ---------- */
.zona-comodin { text-align: center; margin-top: 4px; }

/* ---------- Tabla de posiciones ---------- */
.tabla-pos { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
.tabla-pos th, .tabla-pos td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--borde); }
.tabla-pos th { color: var(--gris-suave); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.tabla-pos td.pts { font-weight: 800; color: var(--azul); text-align: right; }
.tabla-pos tr.top1 td { background: #fff7e6; }
.tabla-pos .medalla { font-size: 18px; }

/* ---------- Panel admin ---------- */
.admin-grid { display: grid; gap: 14px; margin-top: 10px; }
.fila-preg {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--borde);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.fila-preg .n {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--azul); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fila-preg .txt { flex: 1; font-size: 14px; }
.fila-preg .txt strong { display: block; color: var(--gris-txt); margin-bottom: 2px; }
.fila-preg .txt small { color: var(--gris-suave); }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.pill.oculta  { background: #eee; color: #666; }
.pill.activa  { background: #e9f7ef; color: var(--verde); }
.pill.cerrada { background: #fdecec; color: var(--rojo); }

.admin-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.admin-top h1 { color: var(--azul); font-size: 24px; }
.stat-mini { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-mini .s { text-align: center; }
.stat-mini .s b { display: block; font-size: 24px; color: var(--azul); }
.stat-mini .s span { font-size: 12px; color: var(--gris-suave); }

.mut { color: var(--gris-suave); font-size: 13px; }
.centro { text-align: center; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
