/* ElectroListo · sistema visual
   Tinta azul marino + destello ámbar. Barlow (títulos, aire de rótulo industrial) + Source Sans 3 (lectura). */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eeebe3;
  --ink: #14213d;
  --ink-2: #3b4660;
  --muted: #4b5468;            /* 6.9:1 sobre papel (antes 5.4:1): se lee mejor con sol */
  --line: #d9d4c7;             /* separadores decorativos */
  --ctl: #7d7867;              /* borde de controles (opciones, campos, botones): 4.4:1 sobre blanco */
  --on-ok: #ffffff; --on-bad: #ffffff;
  --brand: #14213d;
  --spark: #f5a524;
  --spark-ink: #14213d;
  --ok: #157a3a;
  --ok-bg: #e5f4ea;
  --bad: #b42318;
  --bad-bg: #fbe9e7;
  --info: #1d4ed8;
  --focus: #1d4ed8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 6px 20px rgba(20, 33, 61, .06);
  --font-h: "Barlow", system-ui, sans-serif;
  --font-b: "Source Sans 3", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424; --surface: #151e33; --surface-2: #1c2741; --ink: #eef1f7; --ink-2: #c9d0de;
    --muted: #9aa5bb; --line: #2b3755; --brand: #eef1f7; --ok: #4ade80; --ok-bg: #0f2f1d;
    --bad: #f87171; --bad-bg: #3a1514; --info: #93b4ff; --focus: #93b4ff;
    --ctl: #7080a6; --on-ok: #06210f; --on-bad: #2a0807;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424; --surface: #151e33; --surface-2: #1c2741; --ink: #eef1f7; --ink-2: #c9d0de;
  --muted: #9aa5bb; --line: #2b3755; --brand: #eef1f7; --ok: #4ade80; --ok-bg: #0f2f1d;
  --bad: #f87171; --bad-bg: #3a1514; --info: #93b4ff; --focus: #93b4ff;
  --ctl: #7080a6; --on-ok: #06210f; --on-bad: #2a0807;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 var(--font-b);
  min-height: 100dvh; display: flex; flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--info); }
h1, h2, h3 { font-family: var(--font-h); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 7vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 4.5vw, 2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a.sr-only:focus { width: auto; height: auto; clip: auto; z-index: 20; left: 12px; top: 8px; padding: 12px 16px; background: var(--spark); color: var(--spark-ink); font-weight: 700; border-radius: 10px; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  font: 800 1.25rem var(--font-h); letter-spacing: -.01em; min-height: 44px; }
.logo svg { width: 34px; height: 34px; }
.top nav { display: flex; gap: 4px; }
.navlink { color: var(--ink-2); text-decoration: none; font-weight: 600; padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.navlink:hover { background: var(--surface-2); }

main { flex: 1; padding: 24px 0 48px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 12px; border: 2px solid transparent;
  font: 700 1.05rem var(--font-b); text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s; }
.btn svg { width: 20px; height: 20px; }
.btn-spark { background: var(--spark); color: var(--spark-ink); }
.btn-spark:hover { background: #e6951a; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ctl); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn:active:not([disabled]) { filter: brightness(.92); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Portada */
.hero { padding: 16px 0 8px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font: 700 .85rem var(--font-b); text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-2); background: var(--surface-2); padding: 6px 12px; border-radius: 999px; margin-bottom: 16px; }
.kicker i { width: 8px; height: 8px; border-radius: 50%; background: var(--spark); display: inline-block; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--spark) 55%, transparent) 62%); }
.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 36em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 12px; }
.fine { font-size: .95rem; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font: 800 1.6rem var(--font-h); }
.stat span { font-size: .88rem; color: var(--muted); line-height: 1.3; display: block; }

.section { margin-top: 40px; }
.grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { display: flex; align-items: center; gap: 10px; }
.card h3 svg { width: 22px; height: 22px; color: var(--spark); flex: none; }
.card p:last-child { margin-bottom: 0; }

.price { border: 2px solid var(--ink); }
.price .amount { font: 800 3rem/1 var(--font-h); }
.price ul { padding-left: 0; list-style: none; margin: 16px 0; }
.price li { display: flex; gap: 10px; padding: 6px 0; }
.price li svg { width: 20px; height: 20px; color: var(--ok); flex: none; margin-top: 3px; }

details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 44px; list-style-position: inside; }
details p { color: var(--ink-2); }

.notice { background: var(--surface-2); border-left: 4px solid var(--spark); padding: 12px 14px; border-radius: 8px; font-size: .92rem; color: var(--ink-2); }

/* Quiz */
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: .92rem; color: var(--muted); }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 20px; box-shadow: inset 0 0 0 1px var(--ctl); }
.bar > i { display: block; height: 100%; background: var(--spark); border-radius: 99px; transition: width .3s; }
.tag svg { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; margin-right: 2px; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.qtext { font: 700 clamp(1.3rem, 5.4vw, 1.5rem)/1.35 var(--font-b); margin: 14px 0 20px; scroll-margin-top: 76px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--surface); color: var(--ink); border: 2px solid var(--ctl); border-radius: 12px;
  padding: 14px; min-height: 60px; font: 500 1.1rem/1.4 var(--font-b); cursor: pointer; transition: border-color .15s, background-color .15s; }
.opt:active:not([disabled]) { background: var(--surface-2); }
.opt .otxt { flex: 1; padding-top: 3px; }
.opt .estado { display: flex; align-items: center; gap: 6px; margin-top: 6px; font: 800 .92rem var(--font-b); }
.opt .estado svg { width: 18px; height: 18px; flex: none; }
.opt.ok .estado { color: var(--ok); } .opt.bad .estado { color: var(--bad); }
.opt:hover:not([disabled]) { border-color: var(--ink-2); }
.opt .letter { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 800; font-family: var(--font-h); }
.opt.ok { border-color: var(--ok); background: var(--ok-bg); }
.opt.ok .letter { background: var(--ok); color: var(--on-ok); }
.opt.bad { border-color: var(--bad); background: var(--bad-bg); }
.opt.bad .letter { background: var(--bad); color: var(--on-bad); }
.opt[disabled] { cursor: default; }
.feedback { scroll-margin-top: 76px; margin-top: 18px; border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.feedback .verdict { display: flex; align-items: center; gap: 8px; font: 800 1.1rem var(--font-h); margin-bottom: 8px; }
.feedback .verdict svg { width: 22px; height: 22px; }
.verdict.ok { color: var(--ok); } .verdict.bad { color: var(--bad); }
.ref { font-weight: 700; color: var(--ink); }
.terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.terms span { font-size: .92rem; font-weight: 600; background: var(--surface-2); padding: 4px 10px; border-radius: 6px; }
.next { margin-top: 16px; }

/* Resultados */
.score { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; width: 112px; height: 112px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--c, var(--spark)) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; }
.ring > div { width: 86px; height: 86px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 800 1.6rem var(--font-h); }
.rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.row .bar { margin: 0; grid-column: 1 / -1; }
.row small { color: var(--muted); }
.row .bar > i.ok { background: var(--ok); } .row .bar > i.bad { background: var(--bad); }

/* Formularios */
label { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="email"] { width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--ctl); border-radius: 12px; }
input[type="email"][aria-invalid="true"] { border-color: var(--bad); }
input[type="email"]:focus { border-color: var(--focus); outline: none; }
.err { color: var(--bad); font-weight: 600; margin-top: 8px; }
.okmsg { color: var(--ok); font-weight: 600; margin-top: 8px; }
.stack > * + * { margin-top: 12px; }

.topic { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); min-height: 64px; }
.topic:hover { border-color: var(--ink-2); }
.topic svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.lock { color: var(--muted); }

footer { border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: .88rem; color: var(--muted); }
footer a { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; }
footer .links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
footer .links span { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; }

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .top nav .navlink.hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---- v0.3: reporte, lecciones, simulacro, progreso, certificado ---- */
.btn-sm { min-height: 44px; padding: 8px 16px; font-size: .95rem; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .btn { flex: 1 1 140px; }
input[type="text"], textarea { width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--ctl); border-radius: 12px; }
textarea { min-height: 96px; resize: vertical; }
input[type="text"]:focus, textarea:focus { border-color: var(--focus); outline: none; }
.mini { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; color: var(--spark); margin-right: 4px; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notice .plain { margin-top: 6px; }
ul.reglas { list-style: disc; margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
ul.reglas li::marker { color: var(--spark); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .85rem; padding: 3px 10px; border-radius: 99px; }
.badge svg { width: 16px; height: 16px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Reportar un error */
#rep-zona { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.reporte { margin-top: 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
label.radio { display: flex; gap: 12px; align-items: center; font-weight: 500; min-height: 48px; padding: 8px 12px; margin: 0 0 8px;
  border: 2px solid var(--ctl); border-radius: 12px; cursor: pointer; background: var(--surface); }
label.radio:has(input:checked) { border-color: var(--ink-2); background: var(--surface-2); }
label.radio input { width: 22px; height: 22px; flex: none; accent-color: var(--ink); margin: 0; }

/* Lecciones */
.leccion .card h2 { font-size: 1.35rem; }
.leccion .card ul, .leccion .card ol { padding-left: 1.3em; margin: 0 0 1em; }
.leccion code { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.leccion .terms span { font-family: inherit; font-size: .88rem; }
.gloss { margin: 0; display: grid; gap: 14px; }
.gloss dt { font-weight: 700; } .gloss dt .es { color: var(--ink-2); font-weight: 600; } .gloss dt .es::before { content: "· "; }
.gloss dd { margin: 2px 0 0; color: var(--ink-2); }
.tema .topic { margin-bottom: 0; }
.lnk-leccion { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; margin: 6px 0 0; font-weight: 700; text-decoration: none; color: var(--info);
  border: 1px dashed var(--line); border-radius: 12px; }
.lnk-leccion svg { width: 18px; height: 18px; }

/* Simulacro */
.simbar { position: sticky; top: 60px; z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line); margin: -24px 0 16px; padding: 8px 0; }
.simbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: nowrap; }
.simbar #sim-meta { text-align: right; font-size: .88rem; line-height: 1.25; }
.simbar .reloj { white-space: nowrap; }
.reloj b { font: 800 1.4rem var(--font-h); font-variant-numeric: tabular-nums; letter-spacing: .02em; padding: 2px 8px; border-radius: 8px; }
.reloj b.poco { background: var(--bad-bg); color: var(--bad); }
.reloj b.poco::after { content: " · poco tiempo"; font: 700 .8rem var(--font-b); }
.opt.sel { border-color: var(--ink); background: var(--surface-2); }
.opt.sel .letter { background: var(--ink); color: var(--bg); }
.nav-q { margin-top: 16px; }
.ir { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--surface); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; padding: 4px 0 14px; }
.qn { min-height: 48px; border-radius: 10px; border: 2px solid var(--ctl); background: var(--surface); color: var(--ink); font: 700 1rem var(--font-b); cursor: pointer; }
.qn.done { background: var(--surface-2); border-color: var(--ink-2); }
.qn.cur { outline: 3px solid var(--focus); outline-offset: 1px; }
#fin-zona { margin-top: 16px; }
.hist li { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.hist-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hist .ir { margin-top: 10px; }
.hist .ir summary { display: flex; align-items: center; gap: 4px; }

/* Panel */
.listo { display: flex; gap: 14px; align-items: flex-start; border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px; }
.listo strong { display: block; font: 800 1.3rem var(--font-h); margin-bottom: 2px; }
.listo span { color: var(--ink-2); font-size: .95rem; display: block; }
.listo-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.listo-ico svg { width: 22px; height: 22px; }
.listo.si { border-color: var(--ok); background: var(--ok-bg); }
.listo.si .listo-ico { background: var(--ok); color: #fff; }
.row .bar > i.ok { background: var(--ok); }
.cert-form .cmsg:empty { display: none; }
.card h2 { margin-bottom: .6em; }
a.fine { display: inline-flex; align-items: center; min-height: 44px; }

/* ---- v0.4: propuesta UI ---- */
.rows.meta-abajo .row { grid-template-columns: 1fr; gap: 2px; }
.rows.meta-abajo .row small { order: 2; }
.rows.meta-abajo .row .bar { order: 3; margin-top: 4px; }
.pronto { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 16px; }
.pronto > summary { min-height: 52px; display: flex; align-items: center; }
.pronto .grid { padding-bottom: 16px; }
.det-tema { margin-top: 8px; border: 0; }
.det-tema > summary { color: var(--info); font-weight: 700; padding: 8px 0; }
.sin-venta { font-weight: 600; color: var(--ink-2); }

/* QA: botón Salir con el mismo estilo que los enlaces de la barra; enlaces en páginas legales con área táctil de 44 px */
button.navlink { background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
button.navlink[hidden] { display: none; }
main li a, main p a { display: inline-block; padding: 10px 0; min-height: 44px; }

/* ---- v0.5: plan de estudio ---- */
fieldset > legend { font-weight: 700; margin-bottom: 10px; }
.chips { display: grid; gap: 8px; }
.chips.c3 { grid-template-columns: repeat(3, 1fr); } .chips.c5 { grid-template-columns: repeat(5, 1fr); }
label.chip { position: relative; margin: 0; }
label.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
label.chip span { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 8px; text-align: center;
  border: 2px solid var(--ctl); border-radius: 12px; background: var(--surface); color: var(--ink); font: 700 1.05rem var(--font-b); }
label.chip input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
label.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.tareas { gap: 8px; }
.tarea { display: grid; grid-template-columns: 44px 1fr 24px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); padding: 4px 8px 4px 6px; min-height: 60px; }
.chk { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--ctl); background: var(--surface); color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.chk svg { width: 22px; height: 22px; }
.chk[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.tarea-txt { display: block; text-decoration: none; color: var(--ink); padding: 8px 4px; min-height: 44px; }
.tarea-txt strong { display: block; line-height: 1.3; }
.tarea-txt .fine { display: block; margin-top: 2px; }
.tarea-go svg { width: 20px; height: 20px; color: var(--muted); }
.tarea.hecha { background: var(--surface-2); }
.tarea.hecha .tarea-txt strong { text-decoration: line-through; color: var(--muted); }
.tarea .mini { margin-right: 2px; }
.dia h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 1.05rem; }
.dia.completa h3 { color: var(--ok); }
section.dia.card h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.semana { margin-bottom: 0; padding: 0 16px 12px; }
.semana > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 700 1.25rem var(--font-h); min-height: 56px; list-style: none; }
.semana > summary::-webkit-details-marker { display: none; }
.semana > summary .fine { font: 600 .95rem var(--font-b); }
.bloqueada { opacity: .85; background: var(--surface-2); box-shadow: none; }
.atraso { border-left-color: var(--bad); }
.tarea.sola { display: block; padding: 4px 12px; }
