/* Saber Pro Prep - estilos. Colores centralizados en variables. */
:root {
  --azul: #1B3A5C;
  --azul-oscuro: #0f2540;
  --rojo: #E63946;
  --verde: #2A9D8F;
  --verde-claro: #E6F4F1;
  --amarillo: #E9C46A;
  --amarillo-claro: #FFF4CC;
  --fondo: #F8F9FA;
  --tarjeta: #FFFFFF;
  --texto: #212529;
  --texto-secundario: #5F6A74;
  --borde: #CED4DA;
  --foco: #0b5cad;
  --radio: 14px;
  --fuente: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 18px;
  line-height: 1.6;
  color: var(--texto);
  background: var(--fondo);
}
h1 { font-size: 34px; line-height: 1.2; color: var(--azul); margin: 0 0 12px; }
h2 { font-size: 22px; color: var(--azul); margin: 0 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--azul); }
a:hover { color: var(--azul-oscuro); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }

.saltar {
  position: absolute; left: 12px; top: -60px; background: var(--azul); color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 10;
}
.saltar:focus { top: 12px; }

/* ----- cabecera y navegación ----- */
.cabecera {
  background: var(--azul); color: #fff; padding: 14px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px;
}
.marca { font-size: 22px; font-weight: 700; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.nav a {
  color: #fff; text-decoration: none; display: inline-block;
  padding: 10px 14px; border-radius: 10px; font-size: 17px; min-height: 44px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.14); }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.22); font-weight: 700; }
.nav a:focus-visible { outline-color: var(--amarillo); }

.contenido { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.lead { font-size: 19px; color: var(--texto-secundario); margin-bottom: 20px; }
.ayuda { font-size: 16px; color: var(--texto-secundario); }
.grande { font-size: 36px; font-weight: 700; color: var(--azul); margin: 0 0 4px; line-height: 1.1; }

/* ----- tarjetas y avisos ----- */
.tarjeta {
  background: var(--tarjeta); border: 1px solid #E9ECEF; border-radius: var(--radio);
  padding: 24px; margin-bottom: 20px;
}
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-bottom: 20px; }
.tarjetas .tarjeta { margin-bottom: 0; }
.destacada { background: var(--azul); color: #fff; }
.destacada h2 { color: #fff; }
.destacada a.btn { background: var(--amarillo); color: var(--texto); border-color: var(--amarillo); }
.vacio { text-align: center; padding: 40px 24px; }
.peligro { border-color: #F5C2C7; }
.aviso {
  border-radius: 12px; padding: 14px 18px; margin: 0 0 20px; font-size: 17px;
  background: #EEF3F8; border: 1px solid #C9D6E3; color: var(--texto);
}
.aviso.informativo { background: #EEF3F8; }
.aviso.alerta { background: var(--amarillo-claro); border-color: var(--amarillo); }
.aviso p:last-child { margin-bottom: 0; }

/* ----- botones y campos ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 20px; border-radius: 10px;
  border: 2px solid var(--azul); background: #fff; color: var(--azul);
  font: inherit; font-size: 17px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #EEF3F8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primario { background: var(--azul); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--azul-oscuro); color: #fff; }
/* Rojo oscurecido para que el texto blanco cumpla 4.5:1 (el rojo de marca da 4.17:1). */
.btn-peligro { border-color: #A81D29; color: #fff; background: #A81D29; }
.btn-peligro:hover { background: #8E1823; }
.acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.pie { justify-content: space-between; align-items: center; }

label { font-weight: 700; display: block; margin-bottom: 6px; }
input[type="number"], input[type="text"] {
  font: inherit; font-size: 18px; min-height: 48px; padding: 8px 12px;
  border: 2px solid var(--borde); border-radius: 10px; background: #fff; color: var(--texto);
  width: 100%; max-width: 260px;
}
input:focus-visible { border-color: var(--foco); }
.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline label { width: 100%; margin-bottom: 0; }
.formulario .campo { margin-bottom: 18px; }
.opcion-check { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: 8px 0; }
.opcion-check input { width: 22px; height: 22px; }

/* ----- sesión: cabecera y reloj ----- */
.sesion-cabecera {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.sesion-cabecera h1 { margin-bottom: 0; }
.reloj {
  background: var(--azul); color: #fff; border-radius: 12px; padding: 12px 20px;
  display: flex; flex-direction: column; align-items: flex-end; min-width: 200px;
}
.reloj-etq { font-size: 15px; opacity: 0.9; }
.reloj-val { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ----- sesión: pregunta, opciones, mapa ----- */
.sesion { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.pregunta {
  background: var(--tarjeta); border: 1px solid #E9ECEF; border-radius: var(--radio); padding: 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.escenario { color: var(--texto-secundario); font-size: 17px; margin: 0; }
.pasaje { margin: 0; padding: 16px 20px; background: #F1F4F7; border-radius: 12px; font-size: 19px; line-height: 1.65; }
.enunciado { font-size: 23px; line-height: 1.45; margin: 0; font-weight: 700; color: var(--texto); }
.opciones { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.opcion {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px;
  border: 2px solid var(--borde); border-radius: 12px; cursor: pointer; font-weight: 400; margin: 0;
}
.opcion:hover { border-color: var(--azul); }
.opcion input { width: 22px; height: 22px; margin-top: 3px; flex-shrink: 0; accent-color: var(--azul); }
.opcion:has(input:checked) { border-color: var(--azul); background: #EEF3F8; }
.letra {
  width: 30px; height: 30px; border-radius: 50%; background: #E9ECEF; color: var(--texto);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.mapa {
  background: var(--tarjeta); border: 1px solid #E9ECEF; border-radius: var(--radio); padding: 20px;
  position: sticky; top: 16px;
}
.mapa h2 { margin-bottom: 4px; }
.cuadricula { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.celda {
  min-height: 44px; border-radius: 10px; border: 2px solid var(--borde); background: #fff;
  color: var(--texto); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
}
.celda.respondida { background: var(--verde-claro); border-color: var(--verde); }
.celda.marcada { background: var(--amarillo-claro); border-color: #B07A00; }
.celda.actual { border-width: 3px; border-color: var(--azul); }

/* ----- resultados ----- */
.lista-barras { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.lista-barras li { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 6px 14px; align-items: center; }
.lista-barras li > span:first-child { grid-column: 1; }
.lista-barras li > span:last-child { grid-column: 2; text-align: right; }
.etiq { font-size: 16px; }
.barra { grid-column: 1; display: block; height: 12px; border-radius: 6px; background: #E9ECEF; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--verde); }
.detalle { background: #fff; border: 1px solid #E9ECEF; border-radius: 12px; padding: 14px 18px; margin-bottom: 12px; }
.detalle summary { cursor: pointer; font-weight: 700; font-size: 17px; }
.detalle .estado { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 15px; margin-right: 8px; background: #E9ECEF; }
.detalle.buena .estado { background: var(--verde-claro); color: #0c5d52; }
.detalle.mala .estado { background: #FBE3E5; color: #8a1520; }
.unidades { padding-left: 22px; font-size: 19px; }
.unidades li { margin-bottom: 10px; }
.deshabilitada { color: var(--texto-secundario); }

/* ----- gráfico y tablas ----- */
.grafico { width: 100%; max-width: 640px; height: auto; display: block; }
.grafico .eje { stroke: #6C757D; stroke-width: 1; }
.grafico .linea { fill: none; stroke: var(--azul); stroke-width: 3; }
.grafico .punto { fill: var(--verde); stroke: #fff; stroke-width: 2; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
caption { text-align: left; font-weight: 700; padding-bottom: 8px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #E9ECEF; }

/* ----- responsive: desde 375 px ----- */
@media (max-width: 900px) {
  .sesion { grid-template-columns: 1fr; }
  .mapa { position: static; }
}
@media (max-width: 480px) {
  body { font-size: 17px; }
  h1 { font-size: 27px; }
  .enunciado { font-size: 20px; }
  .contenido { padding: 20px 14px 48px; }
  .pregunta { padding: 20px; }
  .pie .btn { flex: 1 1 140px; }
  .reloj { align-items: stretch; width: 100%; }
  .grande { font-size: 30px; }
}

/* ----- celular: tablas apiladas y encabezados sin marco de foco al cambiar de vista ----- */
h1[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
@media (max-width: 480px) {
  table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border: 1px solid #E9ECEF; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; background: #fff; }
  td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  td::before { content: attr(data-etiq); font-weight: 700; color: var(--texto-secundario); }
  .formulario .campo input { max-width: none; }
}

/* ----- movimiento reducido ----- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
