/* ============================================================
   SIMAQ — cursos + multiherramienta. Mobile first.
   ============================================================ */

/* El usuario típico tiene 50–60 años y usa el teléfono al sol, en el
   huerto. De ahí el cuerpo de 18px, los textos secundarios que no bajan
   de 15px, y los contrastes por sobre el mínimo AA de WCAG. */
:root {
  --green-900: #14532D;
  --green-800: #166534;
  --green-700: #15803D;
  --green-600: #16A34A;
  --green-100: #DCFCE7;
  --green-50:  #F0FDF4;

  --amber-700: #B45309;
  --amber-600: #D97706;
  --amber-100: #FEF3C7;
  --red-600:   #DC2626;
  --red-50:    #FEF2F2;

  --ink:       #0B1220;   /* 17,4:1 sobre blanco */
  --ink-2:     #283548;   /* 11,4:1 */
  --ink-3:     #51607A;   /*  6,4:1 — antes 4,8:1 */
  --line:      #D8DFE9;
  --line-2:    #A9B6C8;
  --surface:   #FFFFFF;
  --surface-2: #F4F7FA;
  --bg:        #E9EEF4;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --r:    14px;
  --r-lg: 20px;
  --sh-1: 0 1px 2px rgba(15,23,42,.08), 0 2px 5px rgba(15,23,42,.08);
  --sh-2: 0 4px 12px rgba(15,23,42,.10), 0 12px 28px rgba(15,23,42,.12);
  --sh-3: 0 8px 24px rgba(15,23,42,.18), 0 24px 48px rgba(15,23,42,.20);

  --topbar-h: 60px;
  --dock-h:   72px;
  --safe-b:   env(safe-area-inset-bottom, 0px);
  --safe-t:   env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:       #F8FAFC;
    --ink-2:     #DCE3EC;   /* 13,6:1 sobre la superficie oscura */
    --ink-3:     #ABBACD;   /*  8,5:1 — antes 6,2:1 */
    --line:      #2E3B52;   /* borde visible contra la tarjeta */
    --line-2:    #4A5B75;
    --surface:   #161F2E;
    --surface-2: #1E293B;
    --bg:        #0A101C;
    --green-600: #22C55E;   /* el verde debe brillar sobre fondo oscuro */
    --green-700: #16A34A;
    --green-100: #14532D;
    --green-50:  #0C2A1A;
    --amber-100: #4A2A06;
    --amber-600: #FBBF24;
    --red-50:    #4A1010;
    --sh-1: 0 1px 3px rgba(0,0,0,.5);
    --sh-2: 0 4px 14px rgba(0,0,0,.55);
    --sh-3: 0 8px 26px rgba(0,0,0,.7);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Sin esto, cualquier `display` explícito le gana al atributo hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

/* ---------------- Topbar ---------------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 8px 0;
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__icon {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%;
  cursor: pointer; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.topbar__icon:active { background: var(--line); }
.topbar__icon svg { width: 26px; height: 26px; stroke-width: 2.2; }
.topbar__title {
  font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-inline: 8px;
}
.topbar__spacer { flex: 1; }

/* ---------------- Vista ---------------- */
.view {
  padding: calc(var(--topbar-h) + var(--safe-t) + 12px) 16px
           calc(var(--dock-h) + var(--safe-b) + 28px);
  max-width: 720px; margin-inline: auto;
  outline: none;
}
.view:focus-visible { outline: none; }

:where(button, a, input, [tabindex]):focus-visible {
  outline: 3px solid var(--green-600);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- Dock ---------------- */
.dock {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: calc(var(--dock-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.dock__gap { width: 112px; flex: none; }
.dock__link {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-2); font-size: .8125rem; font-weight: 650;
  letter-spacing: .01em;
  transition: color .18s;
}
.dock__link svg { width: 26px; height: 26px; stroke-width: 2.1; }
.dock__link[aria-current="page"] { color: var(--green-600); }

/* ---------------- FAB ---------------- */
.fab {
  position: fixed; z-index: 60;
  left: 50%; bottom: calc(var(--safe-b) + 14px);
  transform: translateX(-50%);
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border: 3px solid rgba(255,255,255,.35); border-radius: 50%;
  background: linear-gradient(160deg, var(--green-600), var(--green-800));
  color: #fff; cursor: pointer;
  box-shadow: var(--sh-3), 0 0 0 4px rgba(22,163,74,.18);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s;
}
/* Los dos iconos se superponen y se alternan con opacidad. */
.fab__icon {
  grid-area: 1 / 1;
  width: 34px; height: 34px;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  transition: opacity .18s, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.fab__icon--close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.fab__ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 3px solid #fff; opacity: 0;
  transition: opacity .2s, transform .2s;
}
.fab[aria-expanded="true"] { transform: translateX(-50%) scale(.94); }
.fab[aria-expanded="true"] .fab__icon--tool { opacity: 0; transform: rotate(90deg) scale(.6); }
.fab[aria-expanded="true"] .fab__icon--close { opacity: 1; transform: none; }
.fab[aria-expanded="true"] .fab__ring { opacity: .8; transform: scale(1.08); }

/* ---------------- Abanico ---------------- */
.fan { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
/* El velo tiene que ser opaco de verdad: con poco contraste, los discos
   se confundían con el contenido de fondo. */
.fan__scrim {
  position: absolute; inset: 0;
  background: radial-gradient(130% 80% at 50% 100%, rgba(2,6,23,.90), rgba(2,6,23,.80) 55%, rgba(2,6,23,.70));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .24s ease;
}
.fan.is-open { pointer-events: auto; }
.fan.is-open .fan__scrim { opacity: 1; }

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

.fan-item {
  position: absolute; left: 0; top: 0;
  width: 92px;
  /* Reset del botón: sin esto el fondo blanco del UA tapa la etiqueta. */
  background: none; border: 0; padding: 0; margin: 0; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translate(-50%, -50%) scale(.3);
  opacity: 0; pointer-events: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .3s cubic-bezier(.34,1.4,.64,1), opacity .22s ease;
  will-change: transform, opacity;
}
.fan.is-open .fan-item { pointer-events: auto; }

/* El disco va siempre claro: el fondo del abanico es oscuro en ambos
   temas, así que un disco oscuro se perdía contra el velo. */
.fan-item__disc {
  width: 72px; height: 72px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--green-900);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
  border: 3px solid rgba(255,255,255,.9);
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), background .16s, color .16s;
}
.fan-item__disc svg { width: 34px; height: 34px; stroke-width: 2.1; }

.fan-item__label {
  font-size: .875rem; font-weight: 700; line-height: 1.2;
  text-align: center; color: #fff;
  letter-spacing: -.01em;
  padding: 4px 10px; border-radius: 99px;
  background: rgba(2,6,23,.82);
  border: 1px solid rgba(255,255,255,.16);
  white-space: nowrap;
  transition: background .16s, transform .16s;
}

.fan-item.is-active .fan-item__disc {
  transform: scale(1.18);
  background: var(--green-600); color: #fff;
  border-color: #fff;
  box-shadow: 0 0 0 6px rgba(22,163,74,.35), 0 8px 22px rgba(0,0,0,.55);
}
.fan-item.is-active .fan-item__label {
  background: var(--green-700); transform: scale(1.06);
  border-color: rgba(255,255,255,.5);
}

.fan__hint {
  position: absolute; left: 50%; bottom: calc(var(--safe-b) + 100px);
  transform: translateX(-50%);
  font-size: .8125rem; font-weight: 650; letter-spacing: .02em;
  color: #fff; padding: 6px 14px; border-radius: 99px;
  background: rgba(2,6,23,.8); border: 1px solid rgba(255,255,255,.18);
  opacity: 0; transition: opacity .24s;
  pointer-events: none; white-space: nowrap;
}
.fan.is-open.has-overflow .fan__hint { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .fan-item, .fab, .fab__icon, .fan__scrim { transition-duration: .01ms; }
}

/* ---------------- Bloques comunes ---------------- */
.hero {
  background: linear-gradient(150deg, var(--green-700), var(--green-900));
  color: #fff; border-radius: var(--r-lg);
  padding: 22px 20px; margin-bottom: 20px;
  box-shadow: var(--sh-2);
}
/* Las herramientas usan un tono distinto para que se lean como otra
   zona de la app, no como una lámina más del curso. */
.hero--tool { background: linear-gradient(150deg, #1E293B, #020617); }
.hero__eyebrow {
  font-size: .8125rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; opacity: .85; margin-bottom: 7px;
}
.hero h2 { font-size: 1.625rem; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.hero p { margin-top: 9px; opacity: .92; font-size: 1rem; line-height: 1.5; }

.section-title {
  font-size: .875rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2);
  margin: 26px 0 12px;
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  padding: 18px; margin-bottom: 16px;
}

.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex; align-items: center; gap: 14px; min-height: 72px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-1);
  padding: 14px 16px; cursor: pointer;
  transition: transform .12s, border-color .16s;
  -webkit-tap-highlight-color: transparent;
  width: 100%; text-align: left;
}
.row:active { transform: scale(.985); border-color: var(--line-2); }
.row__ico {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center; border-radius: 13px;
  background: var(--green-50); color: var(--green-700);
  font-weight: 700; font-size: 1.125rem;
  border: 1px solid var(--green-100);
}
.row__body { flex: 1; min-width: 0; }
.row__title { font-weight: 700; font-size: 1.0625rem; letter-spacing: -.01em; }
.row__sub { font-size: .9375rem; color: var(--ink-2); margin-top: 3px; line-height: 1.4; }
.row__meta { font-size: .875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.row__chev { color: var(--line-2); flex: none; }
.row__chev svg { width: 18px; height: 18px; }

.card__title {
  font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em;
  margin-bottom: 14px; color: var(--ink);
}
.card__intro { font-size: .9375rem; color: var(--ink-2); margin: -6px 0 14px; line-height: 1.5; }

/* ---------------- Stepper: el control principal ----------------
   Botones de 56px y número grande: pensado para dedos, guantes
   y usuarios que no están acostumbrados a formularios. */
.step { padding: 14px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; padding-bottom: 0; }
.step:first-child { padding-top: 0; }

.step__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.step__art {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--green-50); color: var(--green-700);
}
.step__art svg { width: 34px; height: 34px; }
.step__labels { min-width: 0; }
.step__label { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.step__help { font-size: .9375rem; color: var(--ink-2); line-height: 1.35; margin-top: 1px; }

/* Pregunta directa antes de un grupo de opciones. */
.ask {
  font-size: 1.0625rem; font-weight: 700; color: var(--ink);
  margin: 18px 0 10px;
}

.step__ctrl { display: flex; align-items: stretch; gap: 10px; }
.step__btn {
  width: 66px; height: 66px; flex: none;
  border: 2px solid var(--green-700); background: var(--green-50);
  border-radius: 16px; cursor: pointer;
  font-size: 2rem; font-weight: 600; line-height: 1; color: var(--green-700);
  display: grid; place-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, background .14s;
}
.step__btn:active:not(:disabled) { transform: scale(.94); background: var(--green-100); }
.step__btn:disabled { opacity: .35; cursor: default; border-color: var(--line-2); color: var(--ink-3); background: var(--surface-2); }

.step__value {
  flex: 1; min-width: 0; border: 2px solid var(--line-2);
  background: var(--surface-2); border-radius: 16px;
  display: flex; align-items: baseline; justify-content: center; gap: 5px;
  cursor: pointer; padding: 0 8px; min-height: 66px;
  -webkit-tap-highlight-color: transparent;
}
.step__num {
  font-size: 2.125rem; font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.step__unit { font-size: 1.0625rem; font-weight: 650; color: var(--ink-2); }
.step__input {
  flex: 1; min-width: 0; min-height: 66px;
  border: 3px solid var(--green-600); background: var(--surface);
  border-radius: 16px; text-align: center;
  font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums;
  outline: none;
}

/* ---------------- Picker visual ---------------- */
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick--wide { grid-template-columns: 1fr; }
.pick__opt {
  position: relative; text-align: left; padding: 16px; min-height: 72px;
  border: 2px solid var(--line); background: var(--surface-2);
  border-radius: 14px; cursor: pointer;
  transition: border-color .16s, background .16s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.pick__opt:active { transform: scale(.98); }
.pick__opt[aria-pressed="true"] {
  border-color: var(--green-600); background: var(--green-50);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-600) 22%, transparent);
}
.pick__opt[aria-pressed="true"]::after {
  content: '✓'; position: absolute; top: 10px; right: 12px;
  color: var(--green-700); font-weight: 800; font-size: 1.25rem;
}
.pick__opt[aria-pressed="true"] .pick__label { color: var(--green-700); }
.pick__art { color: var(--green-700); margin-bottom: 8px; }
.pick__art svg { width: 38px; height: 38px; }
.pick__label { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.pick__sub { font-size: .9375rem; color: var(--ink-2); margin-top: 4px; line-height: 1.35; }

/* ---------------- Botones ---------------- */
.btn {
  display: block; width: 100%; padding: 17px; min-height: 58px;
  border-radius: 14px; border: 2px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  font-size: 1.0625rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--sh-1);
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}
.btn:active { transform: scale(.985); }
.btn--big {
  padding: 19px; font-size: 1.1875rem; min-height: 64px;
  background: var(--green-700); color: #fff; border-color: var(--green-700);
  box-shadow: var(--sh-2);
}
.btn--stop { background: var(--red-600); border-color: var(--red-600); }
.btn--ghost { background: var(--surface-2); box-shadow: none; color: var(--ink-2); }

/* ---------------- Resultados ---------------- */
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.result {
  background: linear-gradient(150deg, var(--green-600), var(--green-900));
  color: #fff; border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--sh-2); min-width: 0;
}
.result--alt { background: linear-gradient(150deg, #475569, #0F172A); }
.result__label {
  font-size: .8125rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; opacity: .92;
}
.result__value {
  font-size: 2.25rem; font-weight: 700; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; margin-top: 3px; line-height: 1.05;
}
.result__unit { font-size: 1rem; font-weight: 650; opacity: .92; margin-left: 4px; letter-spacing: -.01em; }
.result__help { font-size: .875rem; opacity: .88; margin-top: 7px; line-height: 1.35; }

.minirow {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
.minirow__item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh-1);
}
.minirow__k { display: block; font-size: .875rem; color: var(--ink-2); font-weight: 600; }
.minirow__v {
  display: block; font-size: 1.375rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 2px;
}

.note {
  font-size: .9375rem; color: var(--ink-2); line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--green-600);
  border-radius: 10px; padding: 12px 14px; margin-top: 10px;
}
.note strong { font-weight: 700; color: var(--ink); }
.note code {
  font-family: var(--mono); font-size: .8125em;
  background: var(--surface); padding: 2px 5px; border-radius: 4px;
  border: 1px solid var(--line); white-space: nowrap;
}
.note.warn {
  border-left-color: var(--amber-700); background: var(--amber-100);
  color: var(--ink); font-weight: 550;
}

/* ---------------- Cronómetro ---------------- */
.crono { margin-top: 16px; }
.crono__time {
  text-align: center; font-size: 3.75rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.04em;
  color: var(--ink); margin-bottom: 14px; line-height: 1;
}
.crono__res {
  text-align: center; font-size: 1.0625rem; color: var(--ink-2);
  margin-top: 14px; min-height: 1.4em;
}
.crono__res strong { font-size: 1.25rem; color: var(--green-700); }

/* ---------------- Selector de boquillas ---------------- */
.noz { display: flex; flex-direction: column; gap: 10px; }
.noz__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface-2);
  transition: border-color .16s, background .16s;
}
.noz__item.is-set {
  border-color: var(--green-600); background: var(--green-50);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green-600) 18%, transparent);
}
.noz__dot {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-2);
  box-shadow: inset 0 -3px 7px rgba(0,0,0,.22);
  display: grid; place-items: center;
}
.noz__dot--plain { background: var(--surface); box-shadow: none; }
.noz__dotTxt { font-size: .875rem; font-weight: 700; color: var(--ink); }
.noz__body { flex: 1; min-width: 0; }
.noz__name { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; }
.noz__q { font-size: .875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: 1px; }
.noz__stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.noz__btn {
  width: 52px; height: 52px; border: 1px solid var(--line-2);
  background: var(--surface); border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 500;
  color: var(--ink); line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, background .14s;
}
.noz__btn:active:not(:disabled) { transform: scale(.92); background: var(--line); }
.noz__btn--add:active:not(:disabled) { background: var(--green-800); }
.noz__btn:disabled { opacity: .28; cursor: default; }
.noz__btn--add { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.noz__count {
  min-width: 42px; text-align: center; font-weight: 700;
  font-variant-numeric: tabular-nums; font-size: 1.5rem;
}

/* ---------------- Tarjeta de curso ---------------- */
.coursecard {
  display: block; width: 100%; text-align: left; padding: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  overflow: hidden; cursor: pointer;
  transition: transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.coursecard:active { transform: scale(.99); }
.coursecard__img { aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; }
.coursecard__img img { width: 100%; height: 100%; object-fit: cover; }
.coursecard__body { padding: 16px; }
.coursecard__title { font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.coursecard__sub { font-size: 1rem; color: var(--ink-2); margin-top: 5px; line-height: 1.4; }
.coursecard__meta { font-size: .9375rem; color: var(--ink-3); margin-top: 8px; font-weight: 600; }
.coursecard__prog { font-size: .9375rem; color: var(--green-700); font-weight: 700; margin-top: 6px; }

/* ---------------- Curso ---------------- */
.hero__author { font-size: .9375rem; opacity: .82; margin-top: 10px; font-weight: 600; }

/* ---------------- Lección: lámina + explicación ----------------
   La vista ocupa el alto exacto de la pantalla para que la lámina se
   vea completa y la explicación se recorra por dentro, sin que la
   página entera se mueva. */
.view--lesson {
  height: 100dvh;
  /* El hueco de abajo lleva un respiro extra: sin él la fila de avance
     queda pegada al dock y se lee como si se saliera de la pantalla. */
  padding: calc(var(--topbar-h) + var(--safe-t) + 6px) 0
           calc(var(--dock-h) + var(--safe-b) + 16px);
  display: flex; flex-direction: column; gap: 6px;
  max-width: 860px;
}
.lesson__head { padding-inline: 16px; flex: none; }
.lesson__head .crumb { margin-bottom: 4px; }
.view--lesson .pager { padding-inline: 16px; margin-top: 0; flex: none; }

.visor { flex: 1; min-height: 0; display: flex; flex-direction: column; }


.visor__stage {
  position: relative; flex: 1; min-height: 0;
  /* Los gestos son todos del visor: ni scroll ni "atrás" del navegador. */
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none; user-select: none;
}

.visor__rail {
  height: 100%;
  display: flex;
  will-change: transform;
}

.visor__pane {
  flex: 0 0 100%; width: 100%; height: 100%;
  display: flex; flex-direction: column; min-width: 0;
}
/* El contenido de cada panel llena su hueco. */
.visor__pane > .pane {
  flex: 1; min-height: 0; width: 100%;
  display: flex; flex-direction: column;
}

.visor--solo .visor__rail { overflow: hidden; }

/* Flechas para quien no descubra que se puede empujar de lado. */
.visor__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; z-index: 2;
  display: grid; place-items: center;
  border: 2px solid var(--line-2); border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--ink); cursor: pointer; box-shadow: var(--sh-2);
  transition: opacity .18s;
}
.visor__nav--prev { left: 6px; }
.visor__nav--next { right: 6px; }
.visor__nav:disabled { opacity: 0; pointer-events: none; }
.visor__nav svg { width: 24px; height: 24px; stroke-width: 2.4; }

/* --- panel de lámina, con zoom --- */
.pane--img { position: relative; background: var(--surface-2); }
.zoom {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex;
  touch-action: none;   /* los gestos los maneja el visor */
  cursor: zoom-in;
}
.zoom.is-zoomed { cursor: grab; }
/* Ocupa todo el hueco disponible; `contain` cuida la proporción, así que
   una lámina chica se agranda hasta llenar la pantalla sin deformarse. */
.zoom__canvas {
  flex: 1; min-width: 0; min-height: 0;
  transform-origin: center center;
  will-change: transform;
  display: flex;
}
.zoom__canvas img {
  width: 100%; height: 100%;
  object-fit: contain;
  user-select: none; -webkit-user-drag: none;
}


/* --- panel de explicación --- */
/* `touch-action` NO se hereda: ponerlo en el escenario no basta. Un
   descendiente con overflow que lo deje en `auto` se queda el gesto y
   cancela el del visor, y entonces el arrastre no llega a activarse.
   Por eso va declarado también aquí. `overflow-y` se conserva porque el
   visor mueve el scrollTop a mano. */
.pane--text {
  overflow-y: auto;
  padding: 4px 16px 24px;
  overscroll-behavior: contain;
  touch-action: none;
}

.lesson__title {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em;
  line-height: 1.25; margin-bottom: 16px;
}
.lesson__body { font-size: 1.0625rem; color: var(--ink-2); line-height: 1.65; }

/* Pantalla ancha: con una lámina y su explicación caben las dos a la
   vez, y el deslizamiento sobra. Con más láminas se mantiene el
   carrusel, o quedarían demasiado angostas. */
@media (min-width: 900px) {
  .visor--n2 .visor__rail {
    scroll-snap-type: none; overflow-x: hidden;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px;
  }
  .visor--n2 .visor__pane { flex: 1 1 0; }
  .visor--n2 .visor__nav { display: none; }
  .visor--n2 .pane--img { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
}
.lesson__body ul { list-style: none; }
.lesson__body li {
  position: relative; padding-left: 20px; margin-bottom: 10px;
}
.lesson__body li::before {
  content: ''; position: absolute; left: 2px; top: .62em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--green-600);
}

.row--slim { padding: 10px 12px; gap: 12px; }
.row__thumb {
  width: 76px; height: 57px; flex: none; border-radius: 9px;
  overflow: hidden; background: var(--surface-2); border: 1px solid var(--line);
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.row__thumb--empty {
  display: grid; place-items: center;
  font-weight: 700; color: var(--ink-3); font-size: .9375rem;
}
.row__ico--done { background: var(--green-600); color: #fff; }
.row__sub--done { color: var(--green-600); font-weight: 650; }

.pager { display: flex; gap: 10px; margin-top: 24px; }
.pager__btn {
  flex: 1; padding: 18px; min-height: 62px; border-radius: 14px;
  border: 2px solid var(--line-2); background: var(--surface);
  font-size: 1.0625rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--sh-1);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}
.pager__btn:active:not(:disabled) { transform: scale(.98); }
.pager__btn:disabled { opacity: .35; cursor: default; }
.pager__btn--primary { background: var(--green-700); color: #fff; border-color: var(--green-700); box-shadow: var(--sh-2); }

.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.progress__bar { height: 100%; background: var(--green-600); border-radius: 99px; transition: width .3s; }

.crumb { font-size: .9375rem; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; letter-spacing: .01em; }

.empty { text-align: center; padding: 48px 24px; color: var(--ink-2); font-size: 1.0625rem; }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .5; }

/* ---------------- Botón de índice e índice desplegable ---------------- */
.sheet { position: fixed; inset: 0; z-index: 70; }
.sheet__scrim {
  position: absolute; inset: 0; background: rgba(2,6,23,.6);
  opacity: 0; transition: opacity .22s;
}
.sheet.is-open .sheet__scrim { opacity: 1; }

/* Sube desde abajo: queda al alcance del pulgar. */
.sheet__panel {
  position: absolute; inset: auto 0 0 0;
  max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 1px solid var(--line);
  box-shadow: var(--sh-3);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  padding-bottom: var(--safe-b);
}
.sheet.is-open .sheet__panel { transform: none; }

.sheet__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 12px; flex: none;
  border-bottom: 1px solid var(--line);
}
.sheet__title {
  flex: 1; font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet__close {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--line-2); border-radius: 50%;
  background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.sheet__body { overflow-y: auto; padding: 8px; overscroll-behavior: contain; }

.sheet__item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 10px 12px; text-align: left;
  border: 0; border-radius: 12px; background: none;
  color: var(--ink); font-size: 1rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sheet__item:active { background: var(--surface-2); }
.sheet__item.is-current { background: var(--green-50); font-weight: 700; }
.sheet__num {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .875rem; font-weight: 700; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.sheet__item.is-current .sheet__num { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.sheet__label { flex: 1; min-width: 0; line-height: 1.35; }
.sheet__done { flex: none; color: var(--green-600); }
.sheet__done svg { width: 22px; height: 22px; }

/* ---------------- Portada ----------------
   Fondo claro en los dos temas: el logo es azul oscuro y sobre fondo
   oscuro se perdería. La marca manda por sobre el tema del sistema. */
.splash {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(90% 70% at 50% 42%, #FFFFFF, #EDF1F7 70%, #DFE7F2);
  color: #1B3A8C;
  transition: opacity 1s ease, visibility 1s;
}
.splash.is-gone { opacity: 0; visibility: hidden; }
.splash__logo {
  width: min(62vw, 280px); height: auto;
  animation: splashIn 1.2s cubic-bezier(.34,1.4,.64,1) both;
}
.splash__logo img { width: 100%; height: auto; }
.splash__tag {
  font-size: 1rem; font-weight: 600; color: #4A5B75;
  animation: splashIn 1.2s .36s cubic-bezier(.34,1.4,.64,1) both;
}
@keyframes splashIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .splash__logo, .splash__tag { animation: none; }
}

/* ---------------- Buscador del catálogo ---------------- */
.search__wrap { position: relative; margin-bottom: 18px; }
.search__ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
.search__ico svg { width: 24px; height: 24px; }
.search {
  width: 100%; min-height: 58px;
  padding: 12px 16px 12px 50px;
  border: 2px solid var(--line-2); border-radius: 99px;
  background: var(--surface); color: var(--ink);
  font-size: 1.0625rem;
  box-shadow: var(--sh-1);
}
.search::-webkit-search-cancel-button { -webkit-appearance: none; }
.search:focus {
  outline: none; border-color: var(--green-600);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green-600) 18%, transparent);
}

/* ---------------- Buscador dentro del curso ---------------- */
.find__input {
  flex: 1; min-width: 0; min-height: 52px;
  padding: 10px 16px;
  border: 2px solid var(--line-2); border-radius: 99px;
  background: var(--surface-2); color: var(--ink);
  font-size: 1.0625rem;
}
.find__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.find__input:focus { outline: none; border-color: var(--green-600); }
.find__hint {
  font-size: .9375rem; color: var(--ink-3);
  padding: 12px 14px; font-weight: 600;
}
.find__thumb {
  width: 56px; height: 42px; flex: none; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line); background: var(--surface-2);
}
.find__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------- Índice con módulos plegables ---------------- */
.sheet__group { border-bottom: 1px solid var(--line); }
.sheet__group:last-child { border-bottom: 0; }
.sheet__caret {
  flex: none; color: var(--ink-3);
  transition: transform .2s;
}
.sheet__caret svg { width: 22px; height: 22px; }
.sheet__item.is-open .sheet__caret { transform: rotate(90deg); }
.sheet__item.is-open { background: var(--surface-2); }
.sheet__meta {
  display: block; font-size: .8125rem; color: var(--ink-3);
  font-weight: 600; margin-top: 2px;
}
.sheet__subs { padding: 2px 0 8px; }
.sheet__sub {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 52px; padding: 8px 14px 8px 58px; text-align: left;
  border: 0; background: none; color: var(--ink-2);
  font-size: .9375rem; cursor: pointer; line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.sheet__sub:active { background: var(--surface-2); }
.sheet__sub.is-current {
  background: var(--green-50); color: var(--green-700); font-weight: 700;
  box-shadow: inset 4px 0 0 var(--green-600);
}

/* ---------------- Paso de lámina ---------------- */
.stepnav {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 0; flex: none;
}
.stepnav__btn {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--line-2); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  cursor: pointer; box-shadow: var(--sh-1);
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}
.stepnav__btn:active:not(:disabled) { transform: scale(.94); }
.stepnav__btn:disabled { opacity: .3; cursor: default; }
.stepnav__btn svg { width: 26px; height: 26px; stroke-width: 2.4; }
.stepnav__btn--next { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.stepnav__hint {
  flex: 1; text-align: center;
  font-size: .8125rem; color: var(--ink-3); font-weight: 600;
  line-height: 1.3;
}

/* La lámina acompaña el dedo al cambiar de lámina. */
.pane--img .zoom { transition: opacity .18s; }

/* Señal de que el arrastre ya se sostuvo lo suficiente: al soltar cambia
   de lámina. Sin esto, la resistencia se sentiría como que no responde. */
.visor__stage.is-ready { box-shadow: inset 0 0 0 3px var(--green-600); border-radius: var(--r); }
