/* ============================================================
   CIENCIAS APLICADAS I · Hoja de estilos
   - Vista de lectura (pantalla)
   - Impresión / PDF (@media print)
   - Modo diapositivas (.slideshow)
   ============================================================ */

/* ---------- Variables y tema ---------- */
:root {
  --azul:      #1f4e79;
  --azul-suave:#e8f0f8;
  --py:        #3776ab;   /* python      */
  --mat:       #2563ab;   /* matemáticas */
  --bio:       #2e7d46;   /* biología   */
  --fis:       #c2600a;   /* física     */
  --qui:       #7c3aed;   /* química    */
  --act:       #b4235e;   /* actividades */
  --texto:     #23272e;
  --texto-suave: #4b5563;
  --fondo:     #f7f6f3;
  --tarjeta:   #ffffff;
  --borde:     #e4e1da;
  --radio:     10px;
  --sombra:    0 1px 3px rgba(20, 30, 50, .08), 0 6px 20px rgba(20, 30, 50, .06);
  --fuente:    "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset básico ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ============================================================
   BARRA SUPERIOR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borde);
}

.topbar__title { display: flex; align-items: center; gap: 10px; }

.topbar__brand {
  font-weight: 700;
  color: var(--azul);
  font-size: 1.05rem;
  white-space: nowrap;
}

.topbar__actions { display: flex; gap: 10px; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: .95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--azul);
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 78, 121, .35);
}
.btn--primary:hover { background: #163c60; }

.btn--outline {
  background: #fff;
  color: var(--azul);
  border: 1px solid var(--borde);
}
.btn--outline:hover { background: var(--azul-suave); border-color: #c6d8ea; }

.btn--ghost {
  background: transparent;
  color: var(--azul);
  padding: 8px 10px;
  font-size: 1.15rem;
  display: none;
}

/* ============================================================
   ESTRUCTURA GENERAL
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  max-width: 1150px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  align-items: start;
}

/* ============================================================
   ÍNDICE LATERAL
   ============================================================ */
.sidebar {
  position: sticky;
  top: 76px;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 18px;
  box-shadow: var(--sombra);
}

.sidebar__title {
  margin: 0 0 12px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--texto-suave);
}

.toc { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--texto);
  text-decoration: none;
  font-size: .92rem;
  border-left: 3px solid transparent;
}
.toc a:hover { background: var(--azul-suave); color: var(--azul); }
.toc a.is-active { background: var(--azul-suave); border-left-color: var(--azul); color: var(--azul); font-weight: 600; }

.toc .toc__materia {
  margin-top: 10px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--texto-suave);
  padding: 0 10px;
}

.sidebar__hint {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--borde);
  font-size: .8rem;
  color: var(--texto-suave);
}
kbd {
  background: #eef1f4;
  border: 1px solid #d4d9df;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .75rem;
  font-family: inherit;
}

/* ============================================================
   CONTENIDO
   ============================================================ */
.content {
  min-width: 0;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: clamp(24px, 5vw, 56px);
}

/* Portada */
.cover {
  padding-bottom: 20px;
  border-bottom: 2px solid var(--borde);
  margin-bottom: 10px;
}
.cover__kicker {
  margin: 0 0 6px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--texto-suave);
}
.cover__title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  color: var(--azul);
  letter-spacing: -.02em;
}
.cover__subtitle {
  margin: 10px 0 0;
  font-size: clamp(1.05rem, 2.5vw, 1.4rem);
  color: var(--texto-suave);
  font-weight: 500;
}
.cover__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 18px;
  font-size: .92rem;
  color: var(--texto-suave);
}
.cover__note {
  margin-top: 22px;
  padding: 12px 16px;
  background: var(--azul-suave);
  border-radius: 8px;
  font-size: .92rem;
  color: var(--texto);
}

/* Secciones */
.slide { padding: 34px 0 8px; }

.slide h2 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  color: var(--azul);
  margin: 0 0 16px;
  line-height: 1.25;
}
.slide h3 {
  font-size: 1.15rem;
  color: var(--texto);
  margin: 26px 0 8px;
  padding-left: 10px;
  border-left: 4px solid var(--azul);
}
.slide p { margin: 10px 0; }
.slide ul, .slide ol { margin: 10px 0; padding-left: 22px; }
.slide li { margin: 5px 0; }

/* Código (bloques y en línea) */
.slide pre {
  margin: 14px 0;
  padding: 14px 18px;
  background: #1e2530;
  color: #e6edf3;
  border-radius: 8px;
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.55;
  tab-size: 4;
}
.slide pre code {
  font-family: "Cascadia Code", "Consolas", "Fira Code", ui-monospace, monospace;
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.slide :not(pre) > code {
  font-family: "Cascadia Code", "Consolas", ui-monospace, monospace;
  background: #eef1f5;
  border: 1px solid #dde2e8;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: .88em;
  color: #b4235e;
}

/* Editor de código ejecutable (Skulpt) */
.runner {
  /* Tamaño de fuente del código y de su salida: se mantienen iguales. */
  --runner-fs: .9rem;
  margin: 16px 0;
  border: 1px solid #d5dbe2;
  border-radius: 10px;
  overflow: hidden;
  background: #1e2530;
  box-shadow: 0 2px 10px rgba(20, 30, 50, .08);
}
.runner__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: #161b22;
  color: #c9d1d9;
  font-size: .8rem;
}
.runner__label { font-weight: 600; letter-spacing: .03em; }
.runner__acciones { display: flex; gap: 8px; }
.runner__btn {
  border: none;
  border-radius: 6px;
  padding: 5px 13px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  background: #3572a5;
  cursor: pointer;
  transition: background .12s ease, opacity .12s ease;
}
.runner__btn--run:hover { background: #4a86bd; }
.runner__btn--reset {
  background: transparent;
  color: #9aa4b2;
  border: 1px solid #374151;
}
.runner__btn--reset:hover { color: #e6edf3; border-color: #4b5563; }
.runner__btn:disabled { opacity: .55; cursor: default; }

/* Editor con resaltado: una capa <pre> detrás y el <textarea> encima.
   Se usa ".runner ..." para ganar a las reglas generales de ".slide pre". */
.runner__editor {
  position: relative;
  background: #1e2530;
}
.runner .runner__highlight,
.runner .runner__code {
  margin: 0;
  padding: 14px 16px;
  font-family: "Cascadia Code", "Consolas", "Fira Code", ui-monospace, monospace;
  font-size: var(--runner-fs);
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}
.runner .runner__highlight {
  position: absolute;
  inset: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: hidden;
  pointer-events: none;
  color: #e6edf3;
}
.runner .runner__highlight code {
  font: inherit;
  background: none;
  padding: 0;
  color: inherit;
}
.runner .runner__code {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 58px;
  background: transparent;
  color: #e6edf3;
  caret-color: #7cc4ff;
  overflow: auto;
}
/* Cuando JS ha resaltado, el texto del textarea se vuelve invisible
   y se ve la capa de color que hay detrás. */
.runner__editor.is-highlighted .runner__code { color: transparent; }
.runner__editor.is-highlighted .runner__code:focus { background: rgba(255, 255, 255, .03); }

/* Colores del resaltado (tema oscuro tipo VS Code) */
.tok-keyword  { color: #569cd6; }
.tok-builtin  { color: #4ec9b0; }
.tok-function { color: #dcdcaa; }
.tok-string   { color: #ce9178; }
.tok-comment  { color: #6a9955; font-style: italic; }
.tok-number   { color: #b5cea8; }
.tok-operator { color: #d4d4d4; }
.runner .runner__output {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid #2b3442;
  background: #10151c;
  color: #9fe8b0;
  font-family: "Cascadia Code", "Consolas", "Fira Code", ui-monospace, monospace;
  font-size: var(--runner-fs);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}
.runner .runner__output--error { color: #ff9a9a; }

/* Etiquetas de materia */
.tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
  color: #fff;
}
.tag--mat { background: var(--mat); }
.tag--bio { background: var(--bio); }
.tag--fis { background: var(--fis); }
.tag--qui { background: var(--qui); }
.tag--act { background: var(--act); }
.tag--py  { background: var(--py); }

/* Matemáticas en línea */
.math {
  margin: 12px 0;
  padding: 10px 16px;
  background: #f4f6f9;
  border-radius: 8px;
  font-size: 1.05rem;
}
.formula {
  text-align: center;
  font-weight: 600;
  color: var(--azul);
  border: 1px dashed #c6d8ea;
  background: var(--azul-suave);
}
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 3px; line-height: 1.1; }
.frac__num { padding: 0 6px; border-bottom: 1.5px solid currentColor; }
.frac__den { padding: 0 6px; }

/* Cajas */
.box {
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: 8px;
  border-left: 5px solid var(--azul);
  background: #f4f6f9;
}
.box__title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.box--example { border-left-color: var(--mat); background: #eef4fb; }
.box--example .box__title { color: var(--mat); }
.box--resumen { border-left-color: var(--bio); background: #eef7f0; }
.box--resumen .box__title { color: var(--bio); }
.box--dato { border-left-color: var(--fis); background: #fdf3e8; }
.box--dato .box__title { color: var(--fis); }
.box p { margin: 6px 0; }
.box ul { margin: 6px 0 0; }

/* Tablas */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: .95rem;
}
caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  color: var(--texto-suave);
  padding-bottom: 6px;
  font-size: .9rem;
}
th, td {
  border: 1px solid var(--borde);
  padding: 9px 12px;
  text-align: left;
}
thead th { background: var(--azul); color: #fff; font-weight: 600; }
tbody tr:nth-child(even) { background: #f8f9fb; }

/* Actividades */
.actividades li { margin: 10px 0; }

/* Pie de página */
.page-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--borde);
  text-align: center;
  color: var(--texto-suave);
  font-size: .85rem;
}

/* ============================================================
   VISOR DE DIAPOSITIVAS
   ============================================================ */
.slideshow {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--fondo);
  color: var(--texto);
  display: flex;
  flex-direction: column;
}
.slideshow[hidden] { display: none; }

.slideshow__progress {
  height: 5px;
  background: var(--borde);
}
.slideshow__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--azul), var(--qui));
  transition: width .25s ease;
}

.slideshow__close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 10;
  background: var(--tarjeta);
  color: var(--azul);
  border: 1px solid var(--borde);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .15s ease;
  box-shadow: var(--sombra);
}
.slideshow__close:hover { background: var(--azul-suave); }

.slideshow__stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 56px 70px;
}

.slide-view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 60px 80px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.slide-view.is-active { opacity: 1; visibility: visible; }

/* Fragmentos: cada bloque aparece de uno en uno al avanzar. Se ocultan con
   "visibility" (no con "display") para que la diapositiva no se mueva. */
.slide-view .fragment {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}
.slide-view .fragment.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear 0s;
}
@media (prefers-reduced-motion: reduce) {
  .slide-view .fragment { transform: none; transition: opacity 0s, visibility 0s; }
}

.slide-view__inner {
  width: min(100%, 920px);
  max-height: 100%;
  overflow: auto;
}

.slide-view h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 10px; line-height: 1.1; }
.slide-view h2 { font-size: clamp(1.5rem, 3.6vw, 2.3rem); margin: 0 0 16px; line-height: 1.2; }
.slide-view h3 { font-size: 1.2rem; margin: 20px 0 8px; }
.slide-view p, .slide-view li { font-size: clamp(1rem, 2vw, 1.2rem); }
.slide-view table { font-size: 1rem; }
/* Código y salida más grandes en modo diapositivas (mismo tamaño) */
.slide-view .runner { --runner-fs: clamp(1rem, 1.9vw, 1.5rem); }
.slide-view .runner__highlight,
.slide-view .runner__code {
  line-height: 1.6;
}
.slide-view .runner__bar,
.slide-view .runner__btn { font-size: clamp(.85rem, 1.3vw, 1.05rem); }

.slide-view--cover { text-align: center; }
.slide-view--cover .slide-view__kicker {
  font-size: .95rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--texto-suave);
  margin: 0 0 12px;
}
.slide-view--cover .slide-view__subtitle { color: var(--texto-suave); font-size: 1.25rem; }

/* Controles */
.slideshow__controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 8px 14px;
  backdrop-filter: blur(6px);
  box-shadow: var(--sombra);
}
.slideshow__nav {
  background: transparent;
  border: none;
  color: var(--azul);
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s ease;
  line-height: 1;
}
.slideshow__nav:hover { background: var(--azul-suave); }
.slideshow__counter { font-size: .9rem; color: var(--texto-suave); min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }
/* Puntos: cuántos bloques de la diapositiva actual se han mostrado */
.slideshow__dots { display: inline-flex; align-items: center; gap: 5px; }
.slideshow__dots[hidden] { display: none; }
.slideshow__dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--borde);
  transition: background .2s ease, transform .2s ease;
}
.slideshow__dots .dot.is-on { background: var(--azul); transform: scale(1.15); }

/* ============================================================
   ÍNDICE GENERAL (portada + tarjetas de capítulos)
   ============================================================ */
.indice {
  max-width: 1150px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.indice__portada { padding-bottom: 24px; margin-bottom: 24px; }
.indice__portada .cover__title { font-size: clamp(1.8rem, 4.5vw, 2.8rem); }

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  text-decoration: none;
  color: var(--texto);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.chapter-card:hover {
  transform: translateY(-3px);
  border-color: var(--azul);
  box-shadow: 0 8px 24px rgba(20, 30, 50, .12);
}
.chapter-card h2 { display: flex; align-items: center; margin: 0; font-size: 1.2rem; color: var(--azul); }
.chapter-card__num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  height: 1.7em;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--azul-suave);
  color: var(--azul);
  font-size: .8em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chapter-card p { margin: 0; font-size: .92rem; color: var(--texto-suave); }
.chapter-card .tag { align-self: flex-start; }

/* Etiqueta de materia dentro de la portada de un capítulo */
.cover__subtitle .tag {
  font-size: .85rem;
  padding: 5px 16px;
}

/* Portada clonada dentro del visor de diapositivas */
.slide-view--cover .cover__kicker {
  font-size: .95rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--texto-suave);
  margin: 0 0 12px;
}
.slide-view--cover .cover__title { color: var(--azul); }
.slide-view--cover .cover__subtitle { color: var(--texto-suave); font-size: 1.25rem; margin-top: 14px; }
.slide-view--cover .cover__subtitle .tag { font-size: .95rem; padding: 6px 18px; }
.slide-view--cover .cover__meta {
  justify-content: center;
  color: var(--texto-suave);
  margin-top: 18px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px 12px 40px; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: 60;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
  }
  .sidebar.is-open { transform: translateX(0); }
  .btn--ghost { display: inline-flex; }
  .btn__label { display: none; }
  .btn { padding: 10px 12px; }
  .topbar { padding: 8px 12px; }
  .slide-view { padding: 24px 22px 80px; }
  .slideshow__stage { padding: 10px 8px 64px; }
}

/* ============================================================
   IMPRESIÓN / PDF
   Nota: @page usa margin: 0 para que el navegador NO imprima
   su encabezado/pie (URL, fecha, nº de página). Los márgenes
   se simulan con padding interno.
   ============================================================ */
@media print {
  :root { --fondo: #fff; --tarjeta: #fff; }

  html, body { margin: 0; padding: 0; background: #fff; color: #000; font-size: 11pt; }

  /* Ocultar elementos interactivos */
  .topbar,
  .sidebar,
  .slideshow,
  .page-footer,
  .sidebar__hint {
    display: none !important;
  }

  /* Por si se imprime con algún bloque aún sin revelar */
  .fragment { opacity: 1 !important; visibility: visible !important; transform: none !important; }

  .layout {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .content {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0 2cm; /* márgenes laterales en todas las páginas */
    max-width: none;
  }

  /* La portada ocupa su propia página */
  .cover {
    page-break-after: always;
    break-after: page;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh; /* 100vh = una página al no haber margen en @page */
    padding: 0;
    text-align: center;
  }
  .cover__meta { justify-content: center; }
  .cover__note { display: none; }
  .cover__title { color: #000; }
  .cover__kicker, .cover__subtitle { color: #333; }

  /* Cada sección empieza en página nueva */
  .slide {
    page-break-before: always;
    break-before: page;
    padding: 2cm 0;
  }
  .slide:first-of-type { page-break-before: auto; }

  .slide h2, .slide h3 { page-break-after: avoid; break-after: avoid; color: #000; }
  .slide h3 { border-left-color: #000; }

  p, li { orphans: 3; widows: 3; }

  table, .box, .math, img, figure {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Colores de cajas en escala de grises / claros */
  .tag { color: #000; background: #eee !important; border: 1px solid #999; }
  .chapter-card__num { background: #eee; color: #000; border: 1px solid #999; }
  .math { background: #f2f2f2; }
  .formula { background: #f2f2f2; border: 1px solid #999; color: #000; }
  .slide pre { background: #f4f4f4; color: #000; border: 1px solid #bbb; }
  .slide :not(pre) > code { background: #eee; color: #000; border-color: #bbb; }
  .runner { border: 1px solid #bbb; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .runner__bar { background: #eee; color: #000; }
  .runner__acciones { display: none; }
  .runner .runner__highlight { display: none; }
  .runner__editor.is-highlighted .runner__code { color: #000; }
  .runner .runner__code { background: #f4f4f4; color: #000; border-bottom: 1px solid #bbb; }
  .runner .runner__output { background: #fff; color: #000; border-top: 1px solid #bbb; }
  .runner .runner__output--error { color: #900; }
  .box, .box--example, .box--resumen, .box--dato { background: #f4f4f4; border-left: 3px solid #555; }
  .box__title { color: #000; }

  thead th { background: #ddd !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  th, td { border-color: #bbb; }
  tbody tr:nth-child(even) { background: #f5f5f5; }

  .frac__num { border-bottom-color: #000; }

  a { color: #000; text-decoration: none; }

  /* Índice general impreso */
  .indice { max-width: none; padding: 0; }
  .chapter-card { break-inside: avoid; page-break-inside: avoid; }

  @page { size: A4; margin: 0; } /* margen 0 evita el encabezado/pie del navegador */
}
