/* ai.jsiapo.dev — preparacion de certificaciones
   Movil primero. Sin framework. Tema oscuro deliberado: se estudia de noche.
   Profundidad = luminosidad (una superficie elevada es MAS CLARA), no sombra. */

:root {
  /* --- superficies: cada nivel es mas claro que el anterior --- */
  --bg: #0e1116;
  --surf-1: #161b23;
  --surf-2: #1d232d;
  --surf-3: #252d39;
  --bg-raised: var(--surf-1);   /* alias historico */
  --bg-sunk: #0a0d11;

  --line: #2b3341;
  --line-soft: #1c222c;
  --hair: rgba(255, 255, 255, .055);   /* filete superior de elevacion */

  /* --- texto: la jerarquia vive en el peso y el color, no en el tamaño --- */
  --text-bright: #f6f8fc;
  --text: #e3e8f0;
  --text-dim: #98a4b5;
  --text-faint: #6a7686;

  --accent: #6ea8fe;
  --accent-ink: #08111f;
  --aws: #ff9900;
  --anthropic: #d97757;
  --ok: #4ec98d;
  --warn: #f0b849;
  --bad: #f2646a;

  /* --- escala de espaciado, rampa de 4 --- */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 40px;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --tap: 44px;

  --topbar-h: 52px;
  --tabbar-h: 62px;
  --rail: 220px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body {
  padding-top: calc(var(--topbar-h) + var(--safe-t));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s4));
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { flex: none; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: #fff; }

/* foco visible solo para teclado; el dedo no lo necesita */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- topbar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) var(--s3) 0;
  display: flex; align-items: center; gap: var(--s1);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 var(--hair);
}
.topbar__back {
  width: var(--tap); height: var(--tap); margin-left: -10px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  color: var(--text-dim);
}
.topbar__back:active { background: var(--surf-2); color: var(--text); }
.topbar__title {
  margin: 0; font-size: 17px; font-weight: 680; letter-spacing: -.015em;
  color: var(--text-bright);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__slot {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 13px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- tabbar: 5 destinos, icono + etiqueta ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 var(--hair);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s1);
  min-height: var(--tap); padding: 0 2px;
  color: var(--text-faint);
  font-size: 10.5px; font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap;
  transition: color .15s ease;
}
.tab svg { width: 22px; height: 22px; }
.tab span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* estado activo: color + indicador, no solo color */
.tab.is-active { color: var(--accent); }
.tab.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 24px; height: 3px; margin-left: -12px;
  border-radius: 0 0 3px 3px; background: var(--accent);
}
.tab:active { opacity: .55; }

/* etiquetas que no se cortan en pantallas de 360 */
@media (max-width: 369px) {
  .tab { font-size: 9.5px; letter-spacing: -.02em; }
  .tab svg { width: 21px; height: 21px; }
}

/* ---------- layout ---------- */
.view { padding: var(--s4) var(--s4) var(--s7); max-width: 760px; margin: 0 auto; }
.view:focus { outline: none; }
.stack > * + * { margin-top: var(--s3); }

.section { margin-top: var(--s7); }
.section:first-child { margin-top: var(--s1); }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  margin-bottom: var(--s3);
}
.section__title {
  margin: 0; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint);
}
.section__link {
  font-size: 13px; font-weight: 600; color: var(--accent);
  display: inline-flex; align-items: center; min-height: 28px;
}

h2 {
  font-size: 21px; font-weight: 700; letter-spacing: -.02em;
  color: var(--text-bright); margin: 0 0 var(--s2);
}
h3 {
  font-size: 16px; font-weight: 680; letter-spacing: -.01em;
  color: var(--text-bright); margin: var(--s5) 0 var(--s2);
}
p { margin: 0 0 var(--s3); }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; line-height: 1.5; }

/* ---------- card ---------- */
.card {
  background: var(--surf-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s4);
  box-shadow: inset 0 1px 0 var(--hair);
}
.card--link { display: block; transition: transform .12s ease, background .15s ease, border-color .15s ease; }
.card--link:active { transform: scale(.985); background: var(--surf-2); border-color: var(--line); }
.card__row { display: flex; align-items: center; gap: var(--s3); }
.card__grow { flex: 1; min-width: 0; }
.card__title { font-weight: 660; font-size: 15.5px; letter-spacing: -.012em; color: var(--text-bright); }
.card__sub { font-size: 13.5px; font-weight: 450; color: var(--text-dim); margin-top: 2px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--bg-sunk); border: 1px solid var(--line); color: var(--text-dim);
}
.chip--aws { color: var(--aws); border-color: color-mix(in srgb, var(--aws) 35%, transparent); background: color-mix(in srgb, var(--aws) 12%, transparent); }
.chip--anthropic { color: var(--anthropic); border-color: color-mix(in srgb, var(--anthropic) 35%, transparent); background: color-mix(in srgb, var(--anthropic) 12%, transparent); }
.chip--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.chip--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.chip--bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* ---------- badge: veredicto grande (aprobado / no aprobado) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 30px; padding: 0 var(--s4); border-radius: 999px;
  font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  background: var(--surf-2); border: 1px solid var(--line); color: var(--text-dim);
}
.badge--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge--no { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 14%, transparent); }

/* ---------- progreso ---------- */
.bar { height: 6px; border-radius: 999px; background: var(--bg-sunk); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-soft); }
.bar__fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s cubic-bezier(.2,.8,.3,1); }
.bar--aws .bar__fill { background: var(--aws); }
.bar--anthropic .bar__fill { background: var(--anthropic); }

.ring { --pct: 0; width: 46px; height: 46px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__track { stroke: var(--bg-sunk); }
.ring__val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s cubic-bezier(.2,.8,.3,1); }
.ring__txt {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-bright);
}

/* ---------- cuenta regresiva ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(165deg, var(--surf-3), var(--surf-1) 62%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--s5) var(--s4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.hero__label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-faint); font-weight: 700;
}
.hero__days {
  font-size: 44px; font-weight: 750; letter-spacing: -.035em; line-height: 1.05;
  color: var(--text-bright); font-variant-numeric: tabular-nums;
  margin-top: var(--s1);
}
.hero__unit { font-size: 15px; font-weight: 500; color: var(--text-dim); margin-left: 6px; letter-spacing: 0; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5);
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surf-2); color: var(--text);
  font-weight: 650; font-size: 15px; letter-spacing: -.005em;
  cursor: pointer; text-align: center;
  transition: transform .1s ease, background .15s ease;
  width: 100%;
  box-shadow: inset 0 1px 0 var(--hair);
}
.btn:active { transform: scale(.98); background: var(--surf-3); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn--primary:active { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn--ghost { background: transparent; color: var(--text-dim); box-shadow: none; }
.btn--ghost:active { background: var(--surf-2); }
.btn--sm { min-height: 36px; font-size: 13.5px; padding: 0 var(--s3); width: auto; }
.btn--danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; box-shadow: none; }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn-row { display: flex; gap: var(--s3); }
.btn-row > .btn { flex: 1; }

/* ---------- HOY: la lista de acciones del dia ---------- */
.today { display: grid; gap: var(--s2); }
.today__item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 64px; padding: var(--s3) var(--s4);
  background: var(--surf-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--hair);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.today__item:active { transform: scale(.985); background: var(--surf-2); border-color: var(--line); }
.today__ico {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--bg-sunk); border: 1px solid var(--line); color: var(--accent);
}
.today__ico svg { width: 20px; height: 20px; }
.today__grow { flex: 1; min-width: 0; }
.today__k { font-size: 15px; font-weight: 650; letter-spacing: -.012em; color: var(--text-bright); }
.today__s { font-size: 12.5px; font-weight: 450; color: var(--text-dim); margin-top: 2px; }
.today__cta {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- TILES: metricas compactas ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--s2); }
.tile {
  background: var(--surf-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: var(--s3) var(--s3) var(--s3);
  box-shadow: inset 0 1px 0 var(--hair);
  min-width: 0;
}
.tile__v {
  font-size: 22px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15;
  color: var(--text-bright); font-variant-numeric: tabular-nums;
}
.tile__l {
  font-size: 11px; font-weight: 650; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; line-height: 1.35;
}

/* ---------- HUB (pestaña "Mas") ---------- */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s2); }
.hub__item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 56px; padding: var(--s3) var(--s4);
  background: var(--surf-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius); box-shadow: inset 0 1px 0 var(--hair);
  font-size: 15px; font-weight: 600; color: var(--text);
  transition: background .15s ease, border-color .15s ease;
}
.hub__item:active { background: var(--surf-2); border-color: var(--line); }
.hub__item svg { width: 20px; height: 20px; color: var(--text-faint); }
.hub__item .chev { margin-left: auto; }

/* ---------- fichas ---------- */
.fc {
  min-height: 46vh; display: flex; flex-direction: column; justify-content: center;
  text-align: center; padding: var(--s5) var(--s4);
  background: var(--surf-1); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 var(--hair);
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.fc__q { font-size: 20px; font-weight: 640; letter-spacing: -.018em; line-height: 1.4; color: var(--text-bright); }
.fc__a {
  margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line);
  font-size: 16px; line-height: 1.6; color: var(--text); text-align: left;
}
.fc__hint { margin-top: var(--s5); font-size: 12.5px; color: var(--text-faint); }
.fc__meta {
  font-size: 11px; color: var(--text-faint); letter-spacing: .07em;
  text-transform: uppercase; font-weight: 700; margin-bottom: var(--s3);
}
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); margin-top: var(--s3); }
.grade {
  min-height: 54px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surf-2); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 12.5px; font-weight: 650;
  box-shadow: inset 0 1px 0 var(--hair);
  transition: transform .1s ease;
}
.grade small { font-size: 10px; color: var(--text-faint); font-weight: 500; }
.grade:active { transform: scale(.96); }
.grade--0 { color: var(--bad); }
.grade--1 { color: var(--warn); }
.grade--2 { color: var(--accent); }
.grade--3 { color: var(--ok); }

/* ---------- preguntas ---------- */
.q__stem { font-size: 16.5px; font-weight: 580; line-height: 1.5; color: var(--text-bright); margin-bottom: var(--s2); }
.q__scenario {
  background: var(--bg-sunk); border-left: 3px solid var(--accent);
  padding: var(--s3) var(--s3); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14.5px; line-height: 1.55; color: var(--text-dim); margin-bottom: var(--s3);
}
.opts { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s4) 0; }
.opt {
  display: flex; gap: var(--s3); align-items: flex-start;
  min-height: var(--tap); padding: var(--s3) var(--s3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surf-1);
  box-shadow: inset 0 1px 0 var(--hair);
  cursor: pointer; text-align: left; font-size: 14.5px; line-height: 1.45; color: var(--text);
  transition: border-color .15s ease, background .15s ease;
  width: 100%;
}
.opt__key {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 750;
  background: var(--bg-sunk); border: 1px solid var(--line); color: var(--text-dim);
}
.opt.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surf-1)); }
.opt.is-picked .opt__key { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.opt.is-right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--surf-1)); }
.opt.is-right .opt__key { background: var(--ok); color: #06150e; border-color: var(--ok); }
.opt.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, var(--surf-1)); }
.opt.is-wrong .opt__key { background: var(--bad); color: #1a0507; border-color: var(--bad); }
.opt[disabled] { cursor: default; }

.explain {
  margin-top: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  background: var(--bg-sunk); border: 1px solid var(--line-soft);
  font-size: 14.5px; line-height: 1.6; color: var(--text-dim);
}
.explain__tag {
  font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); display: block; margin-bottom: var(--s1);
}

.qbar { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.qbar .bar { flex: 1; }
.qbar__count {
  font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums;
  font-weight: 650; white-space: nowrap;
}
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; color: var(--text); }
.timer.is-low { color: var(--bad); }

/* ---------- SCORE: resultado en escala 100–1000 ---------- */
.score { text-align: center; padding: var(--s5) 0 var(--s3); }
.score__v {
  font-size: 52px; font-weight: 780; letter-spacing: -.04em; line-height: 1;
  color: var(--text-bright); font-variant-numeric: tabular-nums;
}
.score__scale {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  letter-spacing: .04em; margin-top: var(--s2);
}
.score__bar { position: relative; margin: var(--s5) 0 var(--s6); }
.score__bar .bar { height: 10px; }
.score__mark {
  position: absolute; top: -5px; bottom: -5px; width: 2px;
  background: var(--text-dim); border-radius: 2px;
}
.score__mark span {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 650; letter-spacing: .04em;
  color: var(--text-faint); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- lectura de teoria ---------- */
.prose {
  font-size: 17px;
  line-height: 1.65;
  max-width: 66ch;
  color: var(--text);
  letter-spacing: -.003em;
}
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 var(--s4); }
.prose h3 {
  font-size: 17px; font-weight: 750; letter-spacing: -.01em;
  color: var(--text-bright);
  margin: var(--s6) 0 var(--s3);
  padding-top: var(--s2);
  border-top: 1px solid var(--line-soft);
}
.prose h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose ul, .prose ol { padding-left: var(--s5); margin: 0 0 var(--s4); }
.prose li { margin-bottom: var(--s2); padding-left: var(--s1); }
.prose li::marker { color: var(--text-faint); }
.prose li > ul, .prose li > ol { margin: var(--s2) 0 0; }
.prose strong { font-weight: 700; color: var(--text-bright); }
.prose em { color: var(--text-dim); font-style: italic; }
.prose code {
  font-family: var(--mono); font-size: .84em;
  background: var(--bg-sunk); border: 1px solid var(--line-soft);
  color: var(--text-bright);
  padding: 2px 6px; border-radius: 6px;
  white-space: nowrap;
}
.prose blockquote {
  margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
  border-left: 3px solid var(--warn); background: var(--bg-sunk);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim); font-size: 15.5px; line-height: 1.6;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--s6) 0; }

/* tablas: filete horizontal, sin bordes verticales, cabecera de bajo contraste */
.prose .scroll-x { margin: 0 0 var(--s5); max-width: 100%; }
.prose table {
  width: 100%; min-width: 24rem;
  border-collapse: collapse;
  font-size: 14.5px; line-height: 1.5;
  margin: 0;
}
.prose th, .prose td {
  text-align: left; vertical-align: top;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line-soft);
}
.prose th {
  color: var(--text-faint); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  padding-top: 0; padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.prose td { color: var(--text-dim); }
.prose td:first-child { color: var(--text); font-weight: 600; }
.prose th:first-child, .prose td:first-child { padding-left: 0; }
.prose th:last-child, .prose td:last-child { padding-right: 0; }
.prose tbody tr:last-child td { border-bottom: 0; }

.scroll-x {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.scroll-x::-webkit-scrollbar-track { background: transparent; }

/* ---------- progreso y navegacion de leccion ---------- */
.lprog { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.lprog .bar { flex: 1; }
.lprog__txt {
  flex: none; font-size: 12px; font-weight: 650; color: var(--text-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.lnav {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s3);
  margin-top: var(--s7); padding-top: var(--s5);
  border-top: 1px solid var(--line-soft);
}
.lnav .btn { width: 100%; }

/* ---------- indice de lecciones ---------- */
.llist {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; background: var(--surf-1);
  box-shadow: inset 0 1px 0 var(--hair);
}
.llist__item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 54px; padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px; font-weight: 550; color: var(--text);
  transition: background .15s ease;
}
.llist__item:last-child { border-bottom: 0; }
.llist__item:active { background: var(--surf-2); }
.llist__item .row__grow, .llist__item .card__grow { flex: 1; min-width: 0; }
.llist__min {
  flex: none; font-size: 12px; font-weight: 600; color: var(--text-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- cabecera de dominio ---------- */
.dhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  margin: var(--s6) 0 var(--s2);
  font-size: 13.5px; font-weight: 700; letter-spacing: -.005em; color: var(--text-bright);
}
.dhead:first-child { margin-top: 0; }
.dhead__w {
  flex: none; font-size: 11.5px; font-weight: 700; color: var(--text-faint);
  font-variant-numeric: tabular-nums; letter-spacing: .03em;
}

/* ---------- ficha tecnica del examen ---------- */
.fmt {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surf-1); overflow: hidden;
  box-shadow: inset 0 1px 0 var(--hair);
}
.fmt__row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: var(--tap); padding: var(--s2) var(--s4);
  border-bottom: 1px solid var(--line-soft);
}
.fmt__row:last-child { border-bottom: 0; }
.fmt__k { font-size: 13.5px; font-weight: 500; color: var(--text-dim); min-width: 0; }
.fmt__v {
  font-size: 14px; font-weight: 680; color: var(--text-bright);
  font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap;
}

/* ---------- lab ---------- */
.step { display: flex; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft); }
.step:last-child { border-bottom: 0; }
.step__n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-sunk); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 12px; font-weight: 750; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.step__body { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.6; }
pre.cmd {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  background: var(--bg-sunk); border: 1px solid var(--line-soft);
  color: var(--text-bright);
  padding: var(--s3); border-radius: var(--radius-sm);
  overflow-x: auto; margin: var(--s2) 0 0; white-space: pre;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}

/* ---------- filas de lista ---------- */
.rows {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; background: var(--surf-1);
  box-shadow: inset 0 1px 0 var(--hair);
}
.row {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-soft);
  min-height: var(--tap);
}
.row:last-child { border-bottom: 0; }
.row--link { transition: background .15s ease; }
.row--link:active { background: var(--surf-2); }
.row__grow { flex: 1; min-width: 0; }
.row__title { font-size: 14.5px; font-weight: 580; color: var(--text); }
.row__sub { font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }
.row__val { font-size: 13px; font-weight: 650; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { flex: none; color: var(--text-faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line); }
.dot--done { background: var(--ok); }
.dot--part { background: var(--warn); }

/* ---------- varios ---------- */
.empty { text-align: center; padding: var(--s7) var(--s5); color: var(--text-faint); }
.empty__icon { font-size: 30px; margin-bottom: var(--s2); opacity: .5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.stat {
  background: var(--surf-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: var(--s3) var(--s4);
  box-shadow: inset 0 1px 0 var(--hair);
  min-width: 0;
}
.stat__v {
  font-size: 24px; font-weight: 750; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--text-bright);
}
.stat__l {
  font-size: 11px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 650; margin-top: 3px; line-height: 1.35;
}
.field { display: block; margin-bottom: var(--s4); }
.field__l { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: var(--s2); font-weight: 600; }
.field input, .field select {
  width: 100%; min-height: var(--tap); padding: 0 var(--s3);
  background: var(--bg-sunk); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 16px;
  accent-color: var(--accent);
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.notice {
  padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.55;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: #f2d9a4;
}
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s4));
  transform: translateX(-50%) translateY(12px);
  background: #f0f3f8; color: #10151c; padding: var(--s2) var(--s5); border-radius: 999px;
  font-size: 13.5px; font-weight: 650; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  white-space: nowrap; max-width: calc(100vw - var(--s6)); overflow: hidden; text-overflow: ellipsis;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- tableta ---------- */
@media (min-width: 640px) {
  .view { padding: var(--s5) var(--s5) var(--s7); }
  .grid2, .tiles { gap: var(--s3); }
  .hero { padding: var(--s5); }
}

/* ---------- escritorio: la barra pasa a rail lateral ---------- */
@media (min-width: 900px) {
  body {
    padding-top: var(--topbar-h);
    padding-bottom: var(--s7);
    padding-left: var(--rail);
  }

  .topbar {
    left: var(--rail);
    height: var(--topbar-h);
    padding: 0 var(--s5);
  }
  .topbar__back { margin-left: -12px; }

  .tabbar {
    inset: 0 auto 0 0;
    width: var(--rail); height: 100%;
    padding: calc(var(--topbar-h) + var(--s4)) var(--s3) var(--s4);
    grid-template-columns: 1fr;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 2px;
    background: var(--bg-sunk);
    backdrop-filter: none; -webkit-backdrop-filter: none;
    border-top: 0; border-right: 1px solid var(--line-soft);
    box-shadow: none;
  }
  .tab {
    flex-direction: row; justify-content: flex-start; align-items: center;
    gap: var(--s3);
    min-height: 46px; padding: 0 var(--s3);
    border-radius: var(--radius-sm);
    font-size: 14.5px; font-weight: 600; letter-spacing: -.01em;
    transition: color .15s ease, background .15s ease;
  }
  .tab svg { width: 20px; height: 20px; }
  .tab.is-active { background: color-mix(in srgb, var(--accent) 13%, transparent); }
  .tab.is-active::before {
    top: 50%; left: 0; margin-left: 0;
    width: 3px; height: 20px; margin-top: -10px;
    border-radius: 0 3px 3px 0;
  }

  .view { max-width: 760px; padding: var(--s6) var(--s6) 96px; }
  .prose { font-size: 17.5px; }
  .toast { left: calc(50% + var(--rail) / 2); bottom: var(--s5); }
}

/* ---------- accesibilidad de movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .card--link:active, .btn:active, .grade:active, .today__item:active { transform: none; }
}
