@font-face {
  font-family: "Zilla Slab";
  src: url("fuentes/zilla-slab.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
}

:root {
  --papel: #f7f2e7;
  --tinta: #26221c;
  --bermellon: #b93a1b;
  --verde: #1e6b3c;
  --rojo: #a32a20;
  --arena: #e7dcc4;
  --apagado: #6b6152;
  --curva: cubic-bezier(0, 0, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

button {
  font: inherit;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ad {
  position: relative;
  width: 300px;
  height: 600px;
  overflow: hidden;
  color: var(--tinta);
  background: var(--papel);
  border: 1px solid var(--tinta);
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
}

/* El borde real (N-24) desplaza la caja de contenido 1 px: el lienzo lo
   compensa para que las cajas del contrato caigan en su coordenada exacta. */
.lienzo {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 300px;
  height: 600px;
}

/* ------------------------------------------------ cabecera y progreso */

.cabecera {
  position: absolute;
  top: 16px;
  left: 19px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 262px;
  height: 50px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--tinta);
}

.cabecera__marca {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.marca {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kicker {
  display: block;
  color: var(--apagado);
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.progreso {
  position: absolute;
  top: 68px;
  left: 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 262px;
  height: 32px;
}

.progreso__pasos {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progreso__paso {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--apagado);
  background: var(--papel);
  border: 1px solid var(--apagado);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.progreso__paso + .progreso__paso {
  margin-left: 22px;
}

.progreso__paso + .progreso__paso::before {
  position: absolute;
  right: 21px;
  width: 20px;
  height: 1px;
  background: var(--apagado);
  content: "";
}

.progreso__paso.is-activo,
.progreso__paso.is-hecho {
  color: var(--papel);
  background: var(--tinta);
  border-color: var(--tinta);
}

.progreso__paso.is-hecho::before,
.progreso__paso.is-activo::before {
  background: var(--tinta);
}

.progreso__texto {
  color: var(--tinta);
  font-size: 14px;
  line-height: 1;
}

/* ------------------------------------------------ mensaje y estados */

.mensaje {
  position: static;
  width: 262px;
  height: 400px;
  margin: 112px 19px 0;
}

.ad[data-estado="fallback"] .progreso,
.ad[data-estado="fallback"] .quiz {
  display: none;
}

.quiz[hidden],
.resultado[hidden],
.explicacion[hidden],
.siguiente[hidden] {
  display: none;
}

.ad[data-estado="resultado"] .enunciado,
.ad[data-estado="resultado"] .opciones {
  display: none;
}

/* ------------------------------------------------ pregunta */

.enunciado {
  position: absolute;
  top: 112px;
  left: 19px;
  width: 251px;
  height: 109px;
  margin: 0;
  overflow: hidden;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.ad[data-estado^="correccion"] .enunciado {
  height: 76px;
  font-size: 17px;
  line-height: 1.3;
}

.opciones {
  position: absolute;
  top: 237px;
  left: 19px;
  display: grid;
  grid-template-rows: repeat(3, 44px);
  gap: 12px;
  width: 262px;
  height: 156px;
}

.ad[data-estado^="correccion"] .opciones {
  top: 200px;
}

.opcion {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 14px;
  color: var(--tinta);
  text-align: left;
  background: var(--papel);
  border: 1px solid var(--tinta);
  border-radius: 0;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.15;
  -webkit-tap-highlight-color: transparent;
}

.opcion__letra {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--bermellon);
  border: 1px solid var(--bermellon);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.opcion__texto {
  flex: 1 1 auto;
  min-width: 0;
}

.opcion__marca {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.opcion:hover {
  background: var(--arena);
}

.opcion:focus-visible,
.siguiente:focus-visible,
.reintentar:focus-visible,
.cta:focus-visible {
  outline: 3px solid var(--bermellon);
  outline-offset: 2px;
}

/* correccion: grupo bloqueado, veredicto con icono + texto + estilo */

.ad[data-estado^="correccion"] .opcion {
  cursor: default;
}

.opcion.is-clave {
  color: var(--papel);
  background: var(--verde);
  border-color: var(--verde);
}

.opcion.is-clave .opcion__letra {
  color: var(--papel);
  border-color: var(--papel);
}

.opcion.is-clave .opcion__marca::before {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 6px;
  height: 11px;
  border-bottom: 2px solid var(--papel);
  border-right: 2px solid var(--papel);
  content: "";
  transform: rotate(42deg);
}

.opcion.is-error {
  color: var(--papel);
  background: var(--rojo);
  border-color: var(--rojo);
}

.opcion.is-error .opcion__letra {
  color: var(--papel);
  border-color: var(--papel);
}

.opcion.is-error .opcion__marca::before,
.opcion.is-error .opcion__marca::after {
  position: absolute;
  top: 8px;
  left: 2px;
  width: 14px;
  height: 2px;
  background: var(--papel);
  content: "";
  transform: rotate(45deg);
}

.opcion.is-error .opcion__marca::after {
  transform: rotate(-45deg);
}

.opcion.is-apagada {
  color: var(--apagado);
  background: transparent;
  border-color: var(--apagado);
}

.opcion.is-apagada .opcion__letra {
  color: var(--apagado);
  border-color: var(--apagado);
}

/* ------------------------------------------------ explicación */

.explicacion {
  position: absolute;
  top: 368px;
  left: 19px;
  width: 262px;
  height: 115px;
  padding-bottom: 52px;
  overflow: hidden;
}

.explicacion__veredicto {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.2;
}

.explicacion__veredicto.is-acierto {
  color: var(--verde);
}

.explicacion__veredicto.is-fallo {
  color: var(--rojo);
}

.veredicto-icono {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.explicacion__veredicto.is-acierto .veredicto-icono::before {
  position: absolute;
  top: 3px;
  left: 5px;
  width: 4px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  transform: rotate(42deg);
}

.explicacion__veredicto.is-fallo .veredicto-icono::before,
.explicacion__veredicto.is-fallo .veredicto-icono::after {
  position: absolute;
  top: 7px;
  left: 3px;
  width: 9px;
  height: 2px;
  background: currentColor;
  content: "";
  transform: rotate(45deg);
}

.explicacion__veredicto.is-fallo .veredicto-icono::after {
  transform: rotate(-45deg);
}

.explicacion__porque {
  margin: 0;
  color: var(--tinta);
  font-size: 14px;
  line-height: 1.35;
}

/* ------------------------------------------------ reserva / nota */

.reserva {
  position: absolute;
  top: 405px;
  left: 19px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 262px;
  height: 107px;
  margin: 0;
  color: var(--apagado);
  font-size: 12px;
  line-height: 1.35;
}

.reserva__filete {
  flex: 0 0 auto;
  width: 26px;
  height: 1px;
  background: var(--bermellon);
}

.ad[data-estado^="correccion"] .reserva,
.ad[data-estado="resultado"] .reserva:not(.resultado__reserva) {
  display: none;
}

/* ------------------------------------------------ resultado */

.resultado {
  position: absolute;
  inset: 0;
}

.resultado__score {
  position: absolute;
  top: 112px;
  left: 19px;
  display: flex;
  align-items: center;
  width: 262px;
  height: 76px;
}

.score-sello {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  width: 76px;
  height: 76px;
  padding-top: 18px;
  color: var(--tinta);
  border: 2px solid var(--bermellon);
  border-radius: 50%;
}

#score-numero {
  font-size: 30px;
  line-height: 1;
}

.score-de {
  font-size: 13px;
  line-height: 1;
}

.resultado__resumen {
  position: absolute;
  top: 200px;
  left: 19px;
  width: 262px;
  height: 115px;
  padding-top: 38px;
  overflow: hidden;
}

.resultado__score h2 {
  position: absolute;
  top: 88px;
  left: 0;
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.resultado__resumen p {
  margin: 0;
  color: var(--apagado);
  font-size: 14px;
  line-height: 1.35;
}

.resultado__reserva {
  top: 327px;
  height: 117px;
}

.resultado__reserva .reserva__filete::after {
  position: relative;
  top: -8px;
  left: 34px;
  color: var(--bermellon);
  content: "✦";
  font-size: 13px;
}

.reintentar {
  position: absolute;
  top: 456px;
  left: 19px;
  width: 128px;
  height: 44px;
  padding: 0;
  color: var(--tinta);
  background: transparent;
  border: 1px solid var(--tinta);
  border-radius: 0;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.reintentar:hover {
  background: var(--arena);
}

/* ------------------------------------------------ controles fijos */

.siguiente {
  position: absolute;
  top: 439px;
  left: 19px;
  width: 262px;
  height: 44px;
  padding: 0;
  color: var(--papel);
  background: var(--bermellon);
  border: 1px solid var(--bermellon);
  border-radius: 0;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.siguiente:hover {
  background: var(--tinta);
  border-color: var(--tinta);
}

.cta {
  position: absolute;
  top: 532px;
  left: 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 262px;
  height: 44px;
  padding: 0 16px;
  color: var(--papel);
  text-decoration: none;
  background: var(--tinta);
  border: 1px solid var(--tinta);
  border-radius: 0;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
}

.cta::after {
  display: block;
  width: 9px;
  height: 9px;
  margin-right: 2px;
  border-top: 2px solid var(--papel);
  border-right: 2px solid var(--papel);
  content: "";
  transform: rotate(45deg);
}

.cta:hover {
  background: var(--bermellon);
  border-color: var(--bermellon);
}

/* ------------------------------------------------ fallback estático */

.fallback {
  position: absolute;
  top: 112px;
  left: 19px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 262px;
  height: 400px;
  padding: 22px 18px;
  border: 1px solid var(--tinta);
}

.fallback__etiqueta {
  margin: 0 0 14px;
  color: var(--bermellon);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fallback__dato {
  margin: 0 0 18px;
  font-size: 21px;
  line-height: 1.3;
}

.fallback__nota {
  margin: 0;
  color: var(--apagado);
  font-size: 13px;
  line-height: 1.35;
}

/* ------------------------------------------------ transición (solo tras input) */

.ad.transicionando .enunciado,
.ad.transicionando .opciones,
.ad.transicionando .explicacion,
.ad.transicionando .resultado,
.ad.transicionando .siguiente {
  animation: corte-in 220ms var(--curva) both;
}

@keyframes corte-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ================================================= 970×250: recomposición
   Mismo DOM, otras coordenadas. No se escala: se reparte en columnas. */

@media (min-aspect-ratio: 2/1) {
  .ad {
    width: 970px;
    height: 250px;
  }

  .lienzo {
    width: 970px;
    height: 250px;
  }

  .cabecera {
    top: 16px;
    left: 19px;
    align-items: center;
    width: 932px;
    height: 39px;
    padding-bottom: 0;
  }

  .cabecera__marca {
    flex-direction: row;
    align-items: baseline;
    gap: 14px;
  }

  .marca {
    font-size: 22px;
  }

  .progreso {
    top: 16px;
    right: 19px;
    left: auto;
    width: auto;
    height: 39px;
    gap: 18px;
  }

  .mensaje {
    width: 682px;
    height: 164px;
    margin: 71px 19px 0;
  }

  .enunciado {
    top: 71px;
    left: 19px;
    width: 250px;
    height: 164px;
    font-size: 19px;
  }

  .ad[data-estado^="correccion"] .enunciado {
    height: 164px;
    font-size: 17px;
  }

  .opciones {
    top: 112px;
    left: 293px;
    grid-template-rows: none;
    grid-template-columns: repeat(3, 128px);
    width: 408px;
    height: 44px;
  }

  .ad[data-estado^="correccion"] .opciones {
    top: 78px;
  }

  .ad[data-estado^="correccion"] .opcion__texto {
    transform: translateX(-8px);
  }

  .opcion {
    gap: 6px;
    padding: 0 8px;
    justify-content: center;
    text-align: center;
    font-size: 14px;
  }

  .opcion__letra {
    display: none;
  }

  .opcion__marca {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
  }

  .opcion.is-clave .opcion__marca::before {
    top: 1px;
    left: 3px;
    width: 4px;
    height: 8px;
  }

  .opcion.is-error .opcion__marca::before,
  .opcion.is-error .opcion__marca::after {
    top: 5px;
    left: 1px;
    width: 10px;
  }

  .explicacion {
    top: 134px;
    left: 293px;
    width: 408px;
    height: 82px;
    padding-bottom: 0;
  }

  .reserva {
    top: 191px;
    left: 293px;
    width: 408px;
    height: 44px;
    align-items: flex-start;
  }

  .resultado__score {
    top: 71px;
    left: 19px;
    flex-direction: column;
    justify-content: center;
    width: 250px;
    height: 164px;
  }

  .resultado__resumen {
    top: 71px;
    left: 293px;
    width: 408px;
    height: 108px;
    padding-top: 34px;
  }

  .resultado__score h2 {
    position: static;
    margin-top: 10px;
    font-size: 20px;
    text-align: center;
  }

  .resultado__reserva {
    display: none;
  }

  .reintentar {
    top: 191px;
    left: 293px;
    width: 196px;
  }

  .siguiente {
    top: 71px;
    left: 724px;
    width: 228px;
  }

  .cta {
    top: 191px;
    left: 724px;
    width: 228px;
  }

  .fallback {
    top: 71px;
    left: 19px;
    width: 682px;
    height: 164px;
    padding: 18px 22px;
  }

  .fallback__dato {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
