:root {
  /* Superficies */
  --papel: #FAF5F2;        /* hueso cálido: fondo general */
  --hoja: #FFFCFA;         /* superficie clara para alternativas y campos */
  --lectura: #E9D1CC;      /* blush: tarjetas y bloques de lectura */
  --linea: #DFC6CC;        /* rosado: bordes y divisores */
  /* Marca y texto */
  --pizarra: #374059;      /* color de marca, encabezados, logo */
  --pizarra-honda: #262D42;/* barras de navegación y modo oscuro */
  --grafito: #262D42;      /* texto principal y burbuja marcada */
  --sobre-pizarra: #FAF5F2;/* texto sobre el color de marca */
  --suave: #5E6478;
  /* Acento */
  --tinta: #86463A;        /* terracota oscuro: texto y enlaces sobre claro */
  --tinta-tenue: #F0DDD7;
  --accion: #A65A4A;       /* terracota profundo: botón principal */
  --deco: #C58B7E;         /* terracota: barras de progreso e ilustración */
  /* Estado */
  --acierto: #2F8F6B;
  --acierto-tenue: #E2F1EB;
  --error: #B3263E;
  --error-tenue: #F9E5E8;
  --repasar: #E0A030;
  --foco: #2B5FD9;
  --fuente: "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif;
  --titular: "Bricolage Grotesque", "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --radio: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #262D42; --hoja: #323A52; --lectura: #374059; --linea: #4A5270;
    --pizarra: #E9D1CC; --pizarra-honda: #1D2334; --grafito: #FAF5F2; --suave: #B6BACA; --sobre-pizarra: #262D42;
    --tinta: #E0B5AA; --tinta-tenue: #46374A; --accion: #C58B7E; --deco: #C58B7E;
    --acierto: #63C79E; --acierto-tenue: #1D3B33; --error: #F2889A; --error-tenue: #43222C;
    --repasar: #E0A030; --foco: #9DB6FF; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papel: #262D42; --hoja: #323A52; --lectura: #374059; --linea: #4A5270;
  --pizarra: #E9D1CC; --pizarra-honda: #1D2334; --grafito: #FAF5F2; --suave: #B6BACA; --sobre-pizarra: #262D42;
  --tinta: #E0B5AA; --tinta-tenue: #46374A; --accion: #C58B7E; --deco: #C58B7E;
  --acierto: #63C79E; --acierto-tenue: #1D3B33; --error: #F2889A; --error-tenue: #43222C;
  --repasar: #E0A030; --foco: #9DB6FF; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papel); color: var(--grafito);
  font-family: var(--fuente); font-size: 1.0625rem; line-height: 1.55;
}
h1, h2, h3 { font-family: var(--titular); color: var(--pizarra); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--tinta); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
main { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.1rem 5rem; }
main:focus { outline: none; }
main.ancho { max-width: 1080px; }
.cargando, .vacio { color: var(--suave); }

/* ---------- barra ---------- */
.barra {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.1rem; background: var(--pizarra-honda); color: #FAF5F2;
  position: sticky; top: 0; z-index: 5;
}
.marca { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: #FAF5F2;
  font-family: var(--titular); font-weight: 700; font-size: 1.05rem; }
.burbuja-logo { width: 28px; height: 28px; border-radius: 50%; background: var(--deco); color: var(--pizarra-honda);
  display: grid; place-items: center; font-size: .85rem; }
.nav { display: flex; align-items: center; gap: 1.1rem; }
.nav a { color: #CFD3E0; text-decoration: none; font-weight: 700; }
.nav a.activo { color: #FAF5F2; box-shadow: inset 0 -2px 0 var(--deco); }
.nav .enlace { color: #CFD3E0; }
.nav .enlace:hover { color: #FAF5F2; }

/* ---------- controles ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .7rem 1.35rem; cursor: pointer;
  background: var(--accion); color: #FFFFFF; font-weight: 700; min-height: 44px;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.sec { background: transparent; color: var(--tinta); box-shadow: inset 0 0 0 1.5px var(--linea); }
.btn.tinta { background: var(--accion); color: #fff; }
.btn.repasar { background: var(--repasar); color: var(--pizarra-honda); }
.enlace { background: none; border: 0; padding: 0; color: var(--suave); font-weight: 700; cursor: pointer; }
.enlace:hover { color: var(--grafito); }
label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1.5px solid var(--linea); border-radius: 8px;
  background: var(--hoja); min-height: 44px;
}
textarea { min-height: 120px; resize: vertical; }
.campo { margin-bottom: 1rem; }
.fila { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ayuda { color: var(--suave); font-size: .9rem; }
.error-txt { color: var(--error); font-weight: 700; }

/* ---------- login ---------- */
main.acceso-ancha { max-width: 1180px; }
.pantalla-acceso { display: grid; grid-template-columns: 1fr; gap: 2.2rem; padding: 2rem 0 3rem; }
.panel-info { padding: .2rem 0; }
.marca-acceso { display: flex; align-items: center; gap: .55rem; font-family: var(--titular); font-weight: 700;
  color: var(--pizarra); margin-bottom: 1.6rem; }
.panel-info h1 { max-width: 16ch; }
.panel-info > p { max-width: 46ch; color: var(--suave); font-size: 1.05rem; }
.lista-features { list-style: none; margin: 1.8rem 0 0; padding: 0; display: none; flex-direction: column; gap: 1.2rem; max-width: 42ch; }
.lista-features li { display: flex; gap: .9rem; align-items: flex-start; }
.lista-features li b { color: var(--grafito); }
.lista-features li span:last-child { color: var(--suave); font-size: .94rem; line-height: 1.5; }
.icono-feat { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--deco); margin-top: .5rem; }
.panel-form { display: flex; align-items: center; }
.acceso { max-width: 420px; width: 100%; margin: 0 auto; background: var(--hoja); border: 1px solid var(--linea);
  border-radius: var(--radio); padding: 1.8rem 1.6rem; }
.pie-acceso { margin: 1rem 0 0; }
.solo-movil { display: block; margin: -.4rem 0 1rem; }
@media (min-width: 900px) {
  .pantalla-acceso { grid-template-columns: 1.15fr 1fr; align-items: center; gap: 3.5rem;
    min-height: calc(100vh - 6rem); padding: 3rem 0; }
  .lista-features { display: flex; }
  .solo-movil { display: none; }
  .acceso { border: 0; padding: 0; background: transparent; }
}
.pestanas { display: flex; gap: 1.2rem; margin: 1.2rem 0 1.1rem; border-bottom: 1px solid var(--linea); }
.pestanas button { background: none; border: 0; padding: .5rem 0; font-weight: 700; color: var(--suave); cursor: pointer; }
.pestanas button[aria-selected=true] { color: var(--pizarra); box-shadow: inset 0 -2px 0 var(--accion); }

/* ---------- inicio ---------- */
.saludo { margin: .5rem 0 1.6rem; }
.saludo p { color: var(--suave); }
.cifras { display: flex; flex-wrap: wrap; gap: .4rem 2rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.cifras li { display: flex; flex-direction: column; }
.cifras b { font-family: var(--titular); color: var(--pizarra); font-size: 1.7rem; line-height: 1.1; }
.cifras span { color: var(--suave); font-size: .9rem; }
.bloque { background: var(--lectura); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.3rem; margin-bottom: 1.6rem; }
.modos { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; padding: 0; margin: 0 0 1rem; }
.modos legend { font-weight: 700; font-size: .92rem; margin-bottom: .35rem; padding: 0; }
.modos label { margin: 0; font-weight: 400; }
.modos input { position: absolute; opacity: 0; }
.modos span { display: inline-block; padding: .45rem .95rem; border-radius: 999px; border: 1.5px solid var(--linea); cursor: pointer; }
.modos input:checked + span { border-color: var(--pizarra); background: var(--pizarra); color: var(--sobre-pizarra); }
.modos input:focus-visible + span { outline: 3px solid var(--foco); outline-offset: 2px; }

.medidor { list-style: none; padding: 0; margin: 0; }
.medidor li { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 3.2rem; align-items: center; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--linea); }
.medidor li:last-child { border-bottom: 0; }
.medidor .nombre small { display: block; color: var(--suave); }
.riel { height: 8px; background: var(--linea); border-radius: 99px; overflow: hidden; }
.riel i { display: block; height: 100%; background: var(--deco); border-radius: 99px; }
.riel i.bajo { background: var(--repasar); }
.medidor .pct { text-align: right; font-weight: 700; }

/* ---------- práctica ---------- */
.progreso { display: flex; justify-content: space-between; align-items: center; color: var(--suave); font-size: .92rem; margin-bottom: .6rem; }
.hilo { height: 4px; background: var(--linea); border-radius: 9px; margin-bottom: 1.4rem; overflow: hidden; }
.hilo i { display: block; height: 100%; background: var(--deco); transition: width .3s; }
.etiquetas { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.etiquetas span { font-size: .82rem; padding: .15rem .6rem; border-radius: 999px; background: var(--tinta-tenue); color: var(--grafito); }
.enunciado { font-size: 1.15rem; white-space: pre-line; margin-bottom: 1.3rem; max-width: 68ch; }

.opciones { list-style: none; padding: 0; margin: 0 0 1.3rem; }
.opcion {
  display: flex; gap: .85rem; align-items: flex-start; width: 100%; text-align: left;
  background: var(--hoja); border: 1.5px solid var(--linea); border-radius: var(--radio);
  padding: .75rem .9rem; margin-bottom: .55rem; cursor: pointer; min-height: 52px;
}
.opcion:hover:not(:disabled) { border-color: var(--accion); }
.opcion:disabled { cursor: default; }
.burbuja {
  flex: 0 0 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--deco);
  color: var(--tinta); display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  position: relative; overflow: hidden;
}
.burbuja::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--pizarra);
  transform: scale(0); transition: transform .18s ease-out;
}
.burbuja b { position: relative; }
.opcion[aria-pressed=true] { border-color: var(--pizarra); }
.opcion[aria-pressed=true] .burbuja { border-color: var(--pizarra); color: var(--sobre-pizarra); }
.opcion[aria-pressed=true] .burbuja::before { transform: scale(1); }
.opcion .texto { padding-top: .2rem; }
.opcion.correcta { border-color: var(--acierto); background: var(--acierto-tenue); }
.opcion.correcta .burbuja { border-color: var(--acierto); color: #fff; }
.opcion.correcta .burbuja::before { background: var(--acierto); transform: scale(1); }
.opcion.elegida-mal { border-color: var(--error); background: var(--error-tenue); }
.opcion.elegida-mal .burbuja { border-color: var(--error); color: #fff; }
.opcion.elegida-mal .burbuja::before { background: var(--error); transform: scale(1); }
.opcion .marca-res { margin-left: auto; font-weight: 700; font-size: .85rem; padding-top: .25rem; white-space: nowrap; }
.opcion.correcta .marca-res { color: var(--acierto); }
.opcion.elegida-mal .marca-res { color: var(--error); }

.resultado { border-left: 4px solid var(--acierto); padding: .2rem 0 .2rem 1rem; margin-bottom: 1.2rem; }
.resultado.mal { border-color: var(--error); }
.resultado h3 { margin-bottom: .3rem; }
.resultado p { white-space: pre-line; margin: 0; }
.acciones { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.acciones .derecha { margin-left: auto; }
.teclas { color: var(--suave); font-size: .85rem; margin-top: 1.4rem; }
kbd { font-family: inherit; border: 1px solid var(--linea); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; background: var(--hoja); }

.reporte { margin-top: 1rem; }
.item-reporte { padding: .6rem 0; border-bottom: 1px solid var(--linea); }
.item-reporte:last-child { border-bottom: 0; }
.item-reporte .acciones { margin-top: .4rem; }

/* ---------- resumen ---------- */
.marcador { font-family: var(--titular); color: var(--pizarra); font-size: clamp(3rem, 10vw, 4.5rem); line-height: 1; margin: .3rem 0 .4rem; }
.marcador small { font-size: .4em; color: var(--suave); }
.lista-fallas { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.lista-fallas li { padding: .7rem 0; border-bottom: 1px solid var(--linea); }
.lista-fallas .meta { color: var(--suave); font-size: .88rem; }

/* ---------- panel ---------- */
.rejilla { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.desplazable { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
th { font-size: .82rem; color: var(--suave); font-weight: 700; }
td.num, th.num { text-align: right; white-space: nowrap; }
.pregunta-corta { max-width: 46ch; }
.chip-bajo { color: var(--tinta); font-weight: 700; }

/* ---------- aviso ---------- */
.aviso {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: var(--pizarra-honda); color: #FAF5F2; padding: .7rem 1.2rem; border-radius: 12px;
  width: max-content; max-width: calc(100% - 2rem); z-index: 20; font-weight: 700; text-align: center;
}

@media (max-width: 560px) {
  .medidor li { grid-template-columns: 1fr 3rem; }
  .medidor .riel { grid-column: 1 / -1; order: 3; }
  .nav { gap: .8rem; }
  #marca-nombre { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- cuaderno y tarjetas ---------- */
.item-error { background: var(--hoja); border: 1px solid var(--linea); border-left: 3px solid var(--deco);
  border-radius: var(--radio); padding: .85rem 1rem; margin-bottom: .7rem; }
.item-error.activo { border-left-color: var(--accion); }
.item-error > div { margin-bottom: .35rem; }
.item-error > div:last-child { margin-bottom: 0; }
.item-error select { margin-top: .3rem; }
.cab-tarjeta { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin-bottom: .4rem; }
.cab-tarjeta input { margin-top: .35rem; }
.clasificador { margin: 1.2rem 0; border-left: 3px solid var(--repasar); }
.clasificador .modos span { text-align: left; }
.clasificador h3 { margin-bottom: .6rem; }
#out { width: 100%; }

/* estado "toca repasar": ámbar, nunca confundible con error */
.cifra-repasar b { color: var(--repasar); }
.marca-repaso { color: var(--repasar); font-weight: 700; }
