/* =========================================================================
   EuroLatam Solutions Group — RETO · EXAMEN TEÓRICO ALEMÁN
   Estilos exclusivos de examen-alemania.html. Solo tokens de base.css:
   ningún color ni espaciado escrito a mano.
   ========================================================================= */

/* --- MARCO DEL JUEGO ------------------------------------------------------ */
.quiz {
  max-width: var(--container-narrow);
  margin-inline: auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  overflow: hidden;
}

/* Cabecera fija del juego: progreso + contador de puntos de error */
.quiz__hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-m);
  padding: var(--sp-m) var(--sp-l);
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}

.quiz__hud-label {
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.quiz__hud-label strong {
  color: var(--fg-1);
  font-weight: 700;
}

/* Barra de progreso: 2px, como la línea del eyebrow */
.quiz__bar {
  height: 2px;
  background: var(--muted);
}

.quiz__bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width var(--t);
}

.quiz__body {
  padding: clamp(var(--sp-l), 4vw, var(--sp-2xl));
}

/* --- PANTALLAS (intro / pregunta / registro / resultado) ------------------ */
.quiz__screen[hidden] {
  display: none;
}

.quiz__screen {
  animation: quiz-in var(--t-slow) both;
}

@keyframes quiz-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- PREGUNTA ------------------------------------------------------------- */
.quiz__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-s);
  margin-bottom: var(--sp-l);
}

.quiz__question {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-heading);
  margin-bottom: var(--sp-xl);
  text-wrap: balance;
}

.quiz__options {
  display: grid;
  gap: var(--sp-m);
}

.q-option {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-m);
  width: 100%;
  padding: var(--sp-m) var(--sp-l);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--fg-1);
  transition: border-color var(--t-fast), background-color var(--t-fast);
}

.q-option:hover:not([disabled]) {
  border-color: var(--border-strong);
  background: var(--bg-3);
}

/* Letra A / B / C */
.q-option__key {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-2);
  transition: inherit;
}

/* Estados tras responder. Regla del manual: sin rojos ni verdes —
   correcto = Sky Blue, incorrecto = Blue Light con icono, texto explícito. */
.q-option[disabled] {
  cursor: default;
  opacity: 0.45;
}

.q-option.is-correct,
.q-option.is-wrong {
  opacity: 1;
}

.q-option.is-correct {
  border-color: var(--accent);
  background: rgba(74, 150, 212, 0.12);
}

.q-option.is-correct .q-option__key {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--deep-space);
}

.q-option.is-wrong {
  border-color: var(--blue-light);
}

.q-option.is-wrong .q-option__key {
  border-color: var(--blue-light);
  color: var(--blue-light);
}

/* --- VEREDICTO + EXPLICACIÓN --------------------------------------------- */
.quiz__feedback {
  margin-top: var(--sp-l);
  padding: var(--sp-l);
  background: var(--bg-3);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-btn);
}

.quiz__feedback[hidden] {
  display: none;
}

.quiz__verdict {
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-s);
}

.quiz__feedback.is-wrong {
  border-left-color: var(--blue-light);
}

.quiz__feedback.is-wrong .quiz__verdict {
  color: var(--blue-light);
}

.quiz__explain {
  color: var(--fg-2);
  font-size: 0.9375rem;
}

.quiz__next {
  margin-top: var(--sp-l);
}

/* --- MEDIDOR DE PUNTOS DE ERROR ------------------------------------------ */
.quiz__meter {
  display: flex;
  align-items: center;
  gap: var(--sp-s);
}

.quiz__meter-track {
  width: 72px;
  height: 4px;
  background: var(--muted);
  border-radius: var(--radius-btn);
  overflow: hidden;
}

.quiz__meter-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width var(--t);
}

.quiz__meter-fill.is-over {
  background: var(--blue-light);
}

/* --- RESULTADO ------------------------------------------------------------ */
.quiz__result-verdict {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-m);
}

/* Resultado en plano editorial: sin cajas, solo línea de acento + espacio */
.quiz__result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-xl);
  margin-block: var(--sp-xl);
}

.quiz__result-stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-s);
}

.quiz__result-stat::before {
  content: '';
  width: 32px;
  height: 3px;
  background: var(--accent);
  margin-bottom: var(--sp-xs);
}

.quiz__result-value {
  font-family: var(--font-display);
  font-size: var(--fs-stat);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.quiz__result-label {
  font-family: var(--font-display);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-2);
}

.quiz__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-m);
  margin-top: var(--sp-xl);
}

@media (max-width: 560px) {
  .quiz__result-stats {
    grid-template-columns: 1fr;
    gap: var(--sp-l);
  }
}

/* --- REGISTRO (puerta antes del resultado) -------------------------------- */
.quiz__gate-note {
  color: var(--fg-2);
  font-size: 0.9375rem;
  margin-bottom: var(--sp-l);
}

/* --- TARJETAS "CÓMO FUNCIONA EL EXAMEN REAL" ------------------------------
   Estilo editorial: imagen a sangre completa con velo oscuro, sin bordes;
   el contenido se apoya sobre el degradado, como en los sitios corporativos
   de referencia. */
.rule-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--sp-s);
  min-height: 300px;
  padding: var(--sp-2xl) var(--sp-l) var(--sp-l);
  background: var(--bg-3);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.rule-card__media {
  position: absolute;
  inset: 0;
}

.rule-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Sin colores: la ilustración pasa a monocromo para que el texto domine */
  filter: grayscale(1) brightness(0.85);
}

.rule-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 16, 30, 0.55) 0%, rgba(7, 16, 30, 0.82) 45%, rgba(7, 16, 30, 0.97) 100%);
}

.rule-card > :not(.rule-card__media) {
  position: relative;
  z-index: 1;
}

.rule-card__value {
  font-family: var(--font-display);
  font-size: var(--fs-stat);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.rule-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-1);
}

.rule-card__text {
  color: var(--off-white); /* blanco: sobre la foto el gris se perdía */
  font-size: 0.9375rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(7, 16, 30, 0.7);
}

/* --- CIFRAS CON VENTANA DE EXPLICACIÓN ------------------------------------ */
/* La caja muestra solo el número; la explicación aparece al pasar el cursor
   (o al tocar la caja en móvil, vía focus). */
.stats--tips {
  overflow: visible; /* las ventanas sobresalen del marco */
}

.stat--tip {
  position: relative;
  outline-offset: -2px;
}

/* Con icono y rótulo visibles, la línea de acento genérica sobra */
.stats--flat .stat--tip::before {
  content: none;
}

.stat__icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: var(--sp-s);
}

.stat__tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% - var(--sp-s));
  transform: translate(-50%, 0);
  width: min(300px, 84vw);
  padding: var(--sp-m) var(--sp-l);
  background: var(--bg-3);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-card);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--fg-2);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t), visibility 0s var(--t);
  z-index: 10;
}

.stat--tip:hover .stat__tip,
.stat--tip:focus .stat__tip,
.stat--tip:focus-within .stat__tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, calc(-1 * var(--sp-s)));
  transition: opacity var(--t), transform var(--t), visibility 0s;
}

.stat__tip-title {
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-s);
}

.stat__tip p:last-child {
  margin: 0;
}

/* En pantallas estrechas la ventana se ancla al borde de su caja */
@media (max-width: 640px) {
  .stat__tip {
    left: 0;
    transform: translate(0, 0);
    width: min(280px, 80vw);
  }
  .stat--tip:hover .stat__tip,
  .stat--tip:focus .stat__tip,
  .stat--tip:focus-within .stat__tip {
    transform: translate(0, calc(-1 * var(--sp-s)));
  }
  .stat--tip:nth-child(even) .stat__tip {
    left: auto;
    right: 0;
  }
}

/* Rótulo bajo la cifra: un punto más grande que el label estándar
   para que la fila se entienda de un vistazo */
.stats--flat .stat__label {
  font-size: 0.75rem;
  color: var(--fg-1);
}

/* --- VENTANA EMERGENTE · CÓMO FUNCIONA EL EXAMEN -------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 16, 30, 0.85);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-panel);
  padding: clamp(var(--sp-l), 4vw, var(--sp-2xl));
  animation: quiz-in var(--t-slow) both;
}

.modal__close {
  position: absolute;
  top: var(--sp-m);
  right: var(--sp-m);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--fg-2);
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}

.modal__close:hover {
  color: var(--fg-1);
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.modal__cards {
  display: grid;
  gap: var(--sp-m);
}

@media (min-width: 760px) {
  .modal__cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- CIFRAS PLANAS · sin caja, número grande + línea de acento ------------ */
/* Estilo editorial: los números respiran sobre el fondo de la página,
   separados solo por espacio en blanco. */
.stats--flat {
  background: transparent;
  border: 0;
  border-radius: 0;
  gap: clamp(var(--sp-l), 4vw, var(--sp-2xl)) var(--sp-xl);
}

.stats--flat .stat {
  border: 0;
  padding: 0;
}

.stats--flat .stat::before {
  content: '';
  width: 32px;
  height: 3px;
  background: var(--accent);
  margin-bottom: var(--sp-xs);
}

.stats--flat .stat__value {
  font-size: clamp(2.5rem, 1.8rem + 3.2vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* --- VÍDEO DE FONDO DEL HERO ---------------------------------------------- */
/* pages.css solo estiliza la imagen del page-hero; el vídeo necesita el
   mismo encuadre a pantalla completa. */
.page-hero__bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- TELÉFONO CON INDICATIVO DE PAÍS -------------------------------------- */
.phone-row {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  gap: var(--sp-s);
}

@media (max-width: 480px) {
  .phone-row {
    grid-template-columns: 1fr;
  }
}

/* El autorrelleno del navegador pintaba el campo de blanco sobre el tema
   oscuro: se fuerza el fondo y el color del texto de la marca. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-1) inset;
  -webkit-text-fill-color: var(--fg-1);
  caret-color: var(--fg-1);
  transition: background-color 99999s ease-in-out 0s;
}

/* --- SELECCIÓN MÚLTIPLE (formato oficial) --------------------------------- */
/* Opción marcada, antes de comprobar */
.q-option.is-selected {
  border-color: var(--accent);
  background: rgba(74, 150, 212, 0.12);
}

.q-option.is-selected .q-option__key {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--deep-space);
}

/* Correcta que el jugador no marcó: se revela con borde punteado */
.q-option.is-missed {
  opacity: 1;
  border: 1px dashed var(--accent);
}

.q-option.is-missed .q-option__key {
  border-color: var(--accent);
  color: var(--accent);
}
