:root {
  --bg-light: linear-gradient(135deg, #0b3d91 0%, #1261a6 48%, #19a7ce 100%);
  --bg-accent: linear-gradient(180deg, #f4f9ff 0%, #eaf4ff 100%);
  --item-bg: #ffffff;
  --item-hover: #e8f4ff;
  --link: #0b4f8a;
  --shadow: 0 20px 54px rgba(17, 55, 93, .16);
  --radius-lg: 20px;
  --text-soft: #eaf7ff;
  --card-border: rgba(18, 97, 166, .16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.65;
  color: #17324d;
  background:
    radial-gradient(circle at top right, rgba(25, 167, 206, .16), transparent 28%),
    radial-gradient(circle at left center, rgba(18, 97, 166, .09), transparent 32%),
    linear-gradient(180deg, #f7fbff 0%, #eaf4ff 100%);
}

/* Portada: Introducción al Análisis Matemático para Programadores */
.index-page {
  --ink: #172235;
  --ink-soft: #5f6878;
  --navy: #171b45;
  --violet: #604de8;
  --violet-dark: #4939c7;
  --coral: #ff7666;
  --gold: #ffcf66;
  --paper: #fbfaf7;
  --paper-blue: #f1f2ff;
  --line: #dedff0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(96, 77, 232, .12), transparent 24rem),
    radial-gradient(circle at 94% 40%, rgba(255, 118, 102, .1), transparent 22rem),
    #eeedf7;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.index-page [hidden] { display: none !important; }
.index-page .container#contenedor {
  width: min(1180px, calc(100% - 2rem));
  max-width: none;
  margin: 2rem auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 27, 69, .09);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(23, 27, 69, .14);
}

.index-page :is(a, button, input):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.index-page .course-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 83% 12%, rgba(96, 77, 232, .7), transparent 28rem),
    linear-gradient(135deg, #171b45 0%, #24235d 54%, #322870 100%);
}
.index-page #fila1 { background:
    radial-gradient(circle at 83% 12%, rgba(96, 77, 232, .7), transparent 28rem),
    linear-gradient(135deg, #171b45 0%, #24235d 54%, #322870 100%);
}

.index-page .course-hero::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  left: -120px;
  bottom: -150px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255, 255, 255, .025), 0 0 0 84px rgba(255, 255, 255, .02);
}

.index-page .hero-copy,
.index-page .hero-visual { position: relative; z-index: 1; }

.index-page .eyebrow {
  margin: 0 0 1.2rem;
  padding: .42rem .8rem;
  border-color: rgba(255, 207, 102, .35);
  color: var(--gold);
  background: rgba(255, 207, 102, .08);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .1em;
}

.index-page h1.title {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: clamp(2.4rem, 5.7vw, 4.85rem);
  line-height: .98;
  letter-spacing: -.055em;
  text-wrap: balance;
  text-shadow: none;
}

.index-page h1.title span {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.04em;
}

.index-page .hero-text {
  max-width: 690px;
  margin: 1.5rem 0 0;
  color: #d9d9ed;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.8rem;
}

.hero-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .7rem 1.15rem;
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.primary-action {
  color: var(--navy);
  background: var(--gold);
  box-shadow: 0 12px 25px rgba(255, 207, 102, .18);
}

.secondary-action {
  gap: .55rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06);
}

.hero-actions a:hover { transform: translateY(-2px); }
.primary-action:hover { color: var(--navy); background: #ffda85; }
.secondary-action:hover { color: #fff; background: rgba(255, 255, 255, .12); }

.course-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.3rem;
  margin: 2.4rem 0 0;
}

.course-facts div {
  position: relative;
  padding-left: 1rem;
  border-left: 2px solid rgba(255, 207, 102, .55);
}

.course-facts dt { color: #fff; font-size: 1.05rem; line-height: 1.1; }
.course-facts dd { margin: .25rem 0 0; color: #aeb0d1; font-size: .78rem; }

.hero-visual {
  min-height: 390px;
  align-self: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 22px;
  background: rgba(12, 14, 49, .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 26px 50px rgba(5, 8, 35, .22);
  backdrop-filter: blur(8px);
}

.hero-visual svg { display: block; width: 100%; height: 330px; margin-top: 25px; }
.grid-lines { fill: none; stroke: rgba(255, 255, 255, .09); stroke-width: 1; }
.axis { fill: none; stroke: rgba(255, 255, 255, .42); stroke-width: 1.5; }
.curve { fill: none; stroke: url(#curveGradient); stroke-width: 6; stroke-linecap: round; }
.tangent { fill: none; stroke: #9b90ff; stroke-width: 2; stroke-dasharray: 8 8; }
.curve-point { fill: var(--gold); stroke: #fff; stroke-width: 3; }

.formula {
  position: absolute;
  z-index: 2;
  padding: .45rem .7rem;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 27, 69, .8);
  font-family: Georgia, serif;
  font-style: italic;
  box-shadow: 0 10px 22px rgba(5, 8, 35, .2);
}

.formula-one { top: 38px; right: 30px; }
.formula-two { left: 28px; bottom: 58px; color: var(--gold); }
.visual-caption {
  position: absolute;
  right: 24px;
  bottom: 15px;
  margin: 0;
  color: #afb0d0;
  font-size: .73rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.visual-caption span { display: inline-block; width: 6px; height: 6px; margin-right: .35rem; border-radius: 50%; background: var(--coral); }

.course-intro,
.learning-path,
.course-program { padding: clamp(2.3rem, 5vw, 4.5rem); }

.course-intro {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(2rem, 6vw, 6rem);
  background: var(--paper);
}
.index-page #fila2 { background: var(--paper); }

.section-kicker {
  margin: 0 0 .6rem;
  color: var(--violet);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.index-page h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.intro-copy > p {
  margin: 0 0 1rem;
  color: #424b5b;
  font-size: 1.05rem;
  line-height: 1.8;
}

.prerequisite {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem 1.1rem;
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #e1d9bb;
  border-radius: 10px;
  background: #fff9e9;
}

.prerequisite strong { color: #6d5112; white-space: nowrap; }
.prerequisite span { color: #665f4e; }

.learning-path { border-block: 1px solid var(--line); background: var(--paper-blue); }
.section-heading,
.program-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}
.section-heading > p { max-width: 420px; margin: 0; color: var(--ink-soft); }

.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.concept-grid article {
  min-height: 210px;
  padding: 1.25rem;
  border: 1px solid #dcdded;
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.concept-grid article:hover { transform: translateY(-4px); border-color: #bbb6ec; box-shadow: 0 14px 30px rgba(50, 44, 120, .09); }
.concept-grid article > span { color: var(--violet); font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.concept-grid h3 { margin: 2.6rem 0 .5rem; color: var(--navy); font-family: Georgia, serif; font-size: 1.45rem; }
.concept-grid p { margin: 0; color: var(--ink-soft); font-size: .92rem; line-height: 1.55; }

.course-program { background: #fff; }
.index-page #fila3 { background: #fff; }
.program-header { align-items: center; }
.program-summary { margin: .7rem 0 0; color: var(--ink-soft); }
.program-summary span { color: var(--violet); font-weight: 750; }

.topic-search { width: min(100%, 330px); }
.topic-search label { display: block; margin-bottom: .4rem; color: var(--ink-soft); font-size: .77rem; font-weight: 700; }
.search-control {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 48px;
  padding: 0 .8rem;
  border: 1px solid #d9dbe8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(23, 27, 69, .05);
}
.search-control:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(96, 77, 232, .12); }
.search-control svg { width: 19px; fill: none; stroke: #777e8e; stroke-width: 2; stroke-linecap: round; }
.search-control input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; }
.search-control input::placeholder { color: #9a9eaa; }
.search-control kbd { padding: .15rem .42rem; border: 1px solid #dedfe8; border-radius: 5px; color: #777e8e; background: #f5f5f8; font: .72rem/1.3 inherit; box-shadow: none; }

.progress-panel {
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  border: 1px solid #e4e4ed;
  border-radius: 10px;
  background: #f8f8fb;
}
.progress-panel > div:first-child { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; color: var(--ink-soft); font-size: .78rem; }
.progress-panel strong { color: var(--navy); }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: #e1e1eb; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--coral)); transition: width .35s ease; }

.index-page .list-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  overflow: visible;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.index-page .list-group#menu { font-size: 1rem; }

.index-page .list-group-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
  min-height: 94px;
  padding: 1rem;
  border: 1px solid #e2e3eb !important;
  border-radius: 12px !important;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 5px 16px rgba(23, 27, 69, .035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.index-page .list-group-item:hover {
  z-index: 1;
  padding-left: 1rem;
  border-color: #bcb7ed !important;
  color: var(--ink);
  background: #fdfcff;
  box-shadow: 0 12px 26px rgba(50, 44, 120, .1);
  transform: translateY(-2px);
}

.topic-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  color: var(--violet);
  background: #efedff;
  font-size: .78rem;
  font-weight: 850;
  transition: color .18s ease, background-color .18s ease;
}
.topic-copy { min-width: 0; }
.topic-copy strong { display: block; margin-bottom: .28rem; color: var(--navy); font-size: .97rem; line-height: 1.25; }
.topic-copy small { display: block; color: var(--ink-soft); font-size: .78rem; line-height: 1.4; }
.topic-arrow { color: #a3a5b1; font-size: 1.15rem; transition: transform .18s ease, color .18s ease; }
.list-group-item:hover .topic-arrow { color: var(--violet); transform: translateX(3px); }
.list-group-item.is-visited .topic-number { color: #fff; background: var(--violet); }
.list-group-item.is-visited .topic-number::after { content: "✓"; position: absolute; margin: 33px 0 0 33px; display: grid; width: 16px; height: 16px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: #28a27a; font-size: .58rem; }
.no-results { margin: 1rem 0 0; padding: 1.2rem; border: 1px dashed #cfd0df; border-radius: 10px; color: var(--ink-soft); text-align: center; background: #f8f8fb; }

.index-page .course-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(2rem, 5vw, 4.5rem);
  color: #b8b9d0;
  background: var(--navy);
  font-size: .82rem;
}
.index-page .course-footer p { margin: 0; }
.index-page .course-footer a { color: var(--gold); text-decoration: none; }

@media (max-width: 900px) {
  .index-page .course-hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 300px; }
  .hero-visual svg { height: 260px; }
  .course-intro { grid-template-columns: 1fr; gap: 1.5rem; }
  .concept-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .index-page .container#contenedor { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .index-page .course-hero { padding: 2rem 1.25rem 2.5rem; }
  .index-page h1.title { font-size: clamp(2.3rem, 13vw, 3.5rem); }
  .hero-visual { display: none; }
  .course-facts { gap: 1rem; }
  .course-intro, .learning-path, .course-program { padding: 2.5rem 1.25rem; }
  .section-heading, .program-header { align-items: stretch; flex-direction: column; gap: 1rem; }
  .topic-search { width: 100%; }
  .concept-grid, .index-page .list-group { grid-template-columns: 1fr; }
  .concept-grid article { min-height: 170px; }
  .concept-grid h3 { margin-top: 1.8rem; }
  .prerequisite { grid-template-columns: 1fr; }
  .index-page .course-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .course-facts div { width: calc(50% - .5rem); }
  .index-page .list-group-item { grid-template-columns: 38px minmax(0, 1fr); }
  .topic-number { width: 38px; height: 38px; }
  .topic-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .index-page *, .index-page *::before, .index-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Layout */
.container#contenedor {
  max-width: 1100px;
  margin: 2rem auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.row { display: flex; flex-wrap: wrap; }
.row > .col { flex: 1 1 100%; padding: 1rem; }
.row.align-right { justify-content: flex-end; }

#fila1 { background: var(--bg-light); }
#fila2 { background: var(--bg-accent); }
#fila3 { background: var(--bg-accent); }

/* Header */
.eyebrow {
  display: inline-block;
  margin: 0 0 .75rem 0;
  padding: .35rem .8rem;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255,255,255,.08);
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
h1.title {
  font-size: clamp(2rem, 6vw, 4em);
  margin: 0 0 .25em 0;
  color: #fff;
  text-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.hero-text {
  max-width: 850px;
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 2vw, 1.2rem);
}
.header-actions { text-align: right; }
.header-actions a { display: inline-block; margin: .5rem 1rem .5rem 0; }

.btn {
  display: inline-block;
  padding: .5rem 1rem;
  border-radius: .375rem;
  text-decoration: none;
  font-weight: 600;
  transition: filter .15s ease-in-out;
}
.btn:hover { filter: brightness(0.95); }
.btn-success { background: #198754; color: #fff; }

.course-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.highlight-card {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(18, 97, 166, .14);
  box-shadow: 0 10px 26px rgba(17, 55, 93, .10);
}

.highlight-label {
  display: block;
  margin-bottom: .35rem;
  color: #436b8f;
  font-size: .92rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.highlight-card strong {
  color: #0b3d63;
  font-size: 1.05rem;
}

.section-intro {
  margin-bottom: 1.25rem;
}

.section-intro h2 {
  margin: 0 0 .35rem 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #0b4f8a;
}

.section-intro p {
  margin: 0;
  color: #3b6689;
}

/* Menu list */
.list-group { box-shadow: 0 10px 28px rgba(11, 33, 55, .14); border-radius: .9rem; overflow: hidden; border: 1px solid var(--card-border); }
.list-group#menu { font-size: 1.5em; }
.list-group-item {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--item-bg);
  color: var(--link);
  text-decoration: none;
  border-top: 1px solid #d8e8f7;
  transition: background-color .2s ease, transform .2s ease, padding-left .2s ease;
}
.list-group-item:first-child { border-top: 0; }
.list-group-item:hover {
  background: var(--item-hover);
  transform: translateX(4px);
  padding-left: 1.2rem;
}

.list-group-item.is-active {
  background: linear-gradient(90deg, #d9efff 0%, #f3f9ff 100%);
  box-shadow: inset 4px 0 0 #168aad;
}


.text-center { text-align: center; }
.pagination { list-style: none; padding: 0; margin: 1rem 0; }
.pagination li { display: inline-block; margin: 0 .25rem; }
.pagination a { display: inline-block; padding: .5rem .75rem; background: #fff; border: 1px solid #ddd; border-radius: .25rem; text-decoration: none; color: inherit; }
.pagination .active a { background: #e9ecef; }

@media (min-width: 768px) {
  .row > .col { flex: 1 1 50%; }
  #fila1 > .col:first-child { flex: 1 1 70%; }
  #fila1 > .col:last-child { flex: 1 1 30%; }
  #fila2 .col, #fila3 .col { flex-basis: 100%; }
}

@media (min-width: 768px) {
  body.tema-page .row > .col {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

body.tema-page {
  background: #edf6ff;
}
.tema-page .container#contenedor { padding: 1rem; }
.titulodetalle {
  background: linear-gradient(135deg, #0b3d91 0%, #1261a6 52%, #19a7ce 100%);
  border-radius: 18px;
  box-shadow: 0 20px 46px rgba(17, 55, 93, .22);
  padding: 1.25rem 1.4rem;
  margin: 1rem 0 2rem 0;
}
.titulodetalle h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  color: #fff;
  text-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.tema-page .titulodetalle .eyebrow { margin-bottom: .6rem; }
.tema-page .titulodetalle .hero-text {
  margin-top: .75rem;
  max-width: 900px;
}
.cuerpodetalle {
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(245, 250, 255, .98) 100%);
  border: 1px solid #d1e5f7;
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 18px 40px rgba(17, 55, 93, .10);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}
.cuerpodetalle p {
  margin: 0 0 1em 0;
  text-align: justify;
  text-justify: inter-word;
  color: #17324d;
  font-weight: 400;
}
.cuerpodetalle h2 {
  margin: 1.6rem 0 .6rem;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  color: #0b4f8a;
}
.cuerpodetalle section:first-of-type h2 { margin-top: 0; }
.cuerpodetalle ul { padding-left: 1.25rem; margin: 0 0 1em 0; }
.cuerpodetalle ol { padding-left: 1.25rem; margin: 0 0 1em 0; }
.cuerpodetalle li { color: #17324d; font-weight: 400; }
.cuerpodetalle a { color: #0b67b2; }
.tema-page .table {
  --bs-table-striped-bg: rgba(220, 239, 255, .62);
}
.tema-page .table thead th {
  background: #d9efff;
  color: #0b3d63;
}
.recuadro {
  background: linear-gradient(180deg, #f8fcff 0%, #edf7ff 100%);
  text-align:left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:1rem;
  padding:.75rem 1rem;
  border: 1px solid #bdd9f0;
  border-left: 4px solid #168aad;
  border-radius: 6px;
  color: #17324d;
  box-shadow: 0 8px 20px rgba(17, 55, 93, .08);
  overflow-x:auto;
  margin: .75rem 0 1.25rem 0;
  position: relative;
}

.recuadro-codigo {
  background: #fff8c7;
  border-color: #eadf8f;
  border-left-color: #d6a700;
  cursor: text;
}

.recuadro-codigo pre,
.recuadro-codigo code {
  background: transparent;
}

.recuadro-codigo pre {
  margin: 0;
  padding: 0;
}

.recuadro-codigo code {
  display: block;
  text-indent: 0;
  white-space: pre;
  min-height: 1.65em;
  outline: none;
}

.recuadro-codigo code[contenteditable="true"],
.recuadro-codigo code[contenteditable="plaintext-only"] {
  caret-color: #0b4f8a;
}

.recuadro-codigo.is-editing {
  box-shadow: 0 0 0 3px rgba(22, 138, 173, .18), 0 8px 20px rgba(17, 55, 93, .08);
}

.recuadro-codigo:hover .run-btn,
.recuadro-codigo:focus-within .run-btn {
  opacity: 1;
  transform: translateY(0);
}

.run-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: .85rem;
  color: #0b4f8a;
  background: rgba(255,255,255,.95);
  border: 1px solid #0b4f8a;
  border-radius: 999px;
  padding: .15rem .65rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  cursor: pointer;
}

.run-btn:hover,
.run-btn:focus {
  opacity: 1;
  transform: translateY(-1px);
  outline: none;
}

.resultado-ejecucion {
  margin-top: -.6rem;
  background: #eef8ff;
  border-color: #bdd9f0;
  border-left-color: #168aad;
  white-space: pre-wrap;
}

.recuadrooculto { display: none; }
.botonretorno { font-size: 1.1rem; margin-top: 1rem; }
.botonretorno a {
  display: inline-block;
  padding: .7rem 1.2rem;
  background: linear-gradient(135deg, #0b4f8a 0%, #168aad 100%);
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 12px 28px rgba(17, 55, 93, .24);
}
.botonretorno a:hover { filter: none; transform: translateY(-1px); }
.botonretorno a.boton-online {
  padding: .85rem 1.4rem;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 52%, #67e8f9 100%);
  border: 0;
  border-radius: 999px;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.botonretorno a.boton-online:hover {
  filter: none;
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(15, 118, 110, .35);
}
.botonretorno a.boton-online:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(15, 118, 110, .24);
}
ul li { margin-bottom: .75rem; }

/* Responsive ad placeholders similar to tema.htm */
.uno { width: 320px; height: 100px; }
@media (min-width: 500px) { .uno { width: 320px; height: 100px; } }
@media (min-width: 800px) { .uno { width: 336px; height: 280px; } }

.dos { width: 320px; height: 100px; }
@media (min-width: 500px) { .dos { width: 320px; height: 100px;} }
@media (min-width: 800px) { .dos { width: 336px; height: 280px; } }

/* Media elements */
.cuerpodetalle img, .cuerpodetalle video { max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 0 6px #aaa; }
.modal { position: fixed; inset: 0; display: none; z-index: 1000; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-dialog { position: relative; max-width: 900px; width: calc(100% - 2rem); margin: 5vh auto; background: #fff; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.25); overflow: hidden; }
.modal-header, .modal-footer { padding: .75rem 1rem; background: #f6f6f6; }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1rem; max-height: 70vh; overflow: auto; }
.modal-close { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.modal .recuadro { margin: 0; }
.cuerpodetalle .screenshot { display:block; margin:.5rem auto 1rem; }
.cuerpodetalle code {
  background: #fff9c4;
  border-radius: .25rem;
  padding: .1em .3em;
}

pre { margin: .75rem 0 1.25rem 0; overflow-x: auto; }
pre code.hljs { display: block; padding: 1rem; border-radius: 6px; }
.recuadro pre { margin: 0; }
.recuadro pre code.hljs { padding: 0; background: transparent; }

@media (max-width: 767px) {
  .container#contenedor { margin: 1rem; }
  .list-group#menu { font-size: 1.1rem; }
  .course-highlights { grid-template-columns: 1fr 1fr; }
  .list-group-item:hover {
    transform: none;
    padding-left: 1rem;
  }
}

/* Tema de Introducción al Análisis Matemático */
.analysis-topic-page {
  --analysis-ink: #172235;
  --analysis-soft: #5f6878;
  --analysis-navy: #171b45;
  --analysis-violet: #604de8;
  --analysis-violet-dark: #4939c7;
  --analysis-coral: #ff7666;
  --analysis-gold: #ffcf66;
  --analysis-paper: #fbfaf7;
  --analysis-paper-blue: #f1f2ff;
  --analysis-line: #dedff0;
  color: var(--analysis-ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(96, 77, 232, .12), transparent 25rem),
    radial-gradient(circle at 92% 42%, rgba(255, 118, 102, .09), transparent 24rem),
    #eeedf7;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.analysis-topic-page .container#contenedor {
  width: min(1220px, calc(100% - 2rem));
  max-width: none;
  margin: 2rem auto;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(23, 27, 69, .09);
  border-radius: 26px;
  background: var(--analysis-paper);
  box-shadow: 0 30px 80px rgba(23, 27, 69, .14);
}

.analysis-topic-page :is(a, button, input, select, summary):focus-visible {
  outline: 3px solid var(--analysis-gold);
  outline-offset: 3px;
}

.lesson-hero {
  position: relative;
  padding: clamp(1.4rem, 4vw, 3.4rem) clamp(1.4rem, 5vw, 4.5rem) clamp(2.4rem, 6vw, 5rem);
  overflow: hidden;
  border-radius: 25px 25px 0 0;
  color: #fff;
  background:
    radial-gradient(circle at 84% 20%, rgba(96, 77, 232, .7), transparent 25rem),
    linear-gradient(135deg, #171b45 0%, #24235d 56%, #322870 100%);
}

.lesson-hero::after {
  content: "∞";
  position: absolute;
  right: -2rem;
  bottom: -7rem;
  color: rgba(255, 255, 255, .035);
  font: 22rem/1 Georgia, serif;
  pointer-events: none;
}

.lesson-breadcrumb {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  color: #acaed0;
  font-size: .78rem;
}

.lesson-breadcrumb a { color: var(--analysis-gold); text-decoration: none; }
.lesson-breadcrumb a:hover { text-decoration: underline; }
.lesson-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  gap: 3rem;
}

.lesson-eyebrow,
.analysis-topic-page .section-number {
  margin: 0 0 .7rem;
  color: var(--analysis-violet);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.lesson-eyebrow { color: var(--analysis-gold); }
.lesson-hero h1 {
  max-width: 850px;
  margin: 0;
  color: #fff;
  font-size: clamp(2.25rem, 5.2vw, 4.7rem);
  line-height: 1;
  letter-spacing: -.05em;
  text-wrap: balance;
}
.lesson-hero h1 em {
  color: var(--analysis-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}
.lesson-lead {
  max-width: 750px;
  margin: 1.3rem 0 0;
  color: #d6d7eb;
  font-size: clamp(1rem, 1.7vw, 1.17rem);
  line-height: 1.7;
}
.lesson-meta { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.5rem; }
.lesson-meta span {
  padding: .38rem .7rem;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  color: #c8c9df;
  background: rgba(255, 255, 255, .055);
  font-size: .72rem;
}
.lesson-symbol {
  display: grid;
  width: 200px;
  height: 200px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
  background: rgba(12, 14, 49, .26);
  box-shadow: inset 0 0 0 24px rgba(255, 255, 255, .025), 0 24px 50px rgba(5, 8, 35, .18);
}
.lesson-symbol span { color: var(--analysis-gold); font: italic 6rem/.8 Georgia, serif; }
.lesson-symbol-function span { font-size: 3.5rem; letter-spacing: -.06em; }
.lesson-symbol-change span { font-size: 4.2rem; letter-spacing: -.06em; }
.lesson-symbol-percent span { font-size: 3.6rem; letter-spacing: -.07em; }
.lesson-symbol-rate span { font-size: 2.75rem; letter-spacing: -.08em; }
.lesson-symbol-discrete span { font-size: 2.65rem; letter-spacing: -.08em; }
.lesson-symbol-interval span { font-size: 3.15rem; letter-spacing: -.08em; }
.lesson-symbol-neighborhood span { font-size: 2.8rem; letter-spacing: -.08em; }
.lesson-symbol small { margin-top: -3rem; color: #b8bad6; font-size: .69rem; letter-spacing: .08em; text-transform: uppercase; }

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  padding: clamp(1.5rem, 5vw, 4.5rem);
}

.analysis-topic-page .lesson-content {
  width: min(100%, 920px);
  min-width: 0;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--analysis-ink);
  font-size: 1.04rem;
}

.lesson-content > section {
  padding: 0 0 clamp(2.8rem, 6vw, 5rem);
  margin: 0 0 clamp(2.8rem, 6vw, 5rem);
  border-bottom: 1px solid var(--analysis-line);
  scroll-margin-top: 1.5rem;
}
.lesson-content > section:last-of-type { margin-bottom: 2rem; }
.analysis-topic-page .lesson-content h2 {
  margin: 0 0 1.2rem;
  color: var(--analysis-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.5vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.analysis-topic-page .lesson-content h3 {
  margin: 2rem 0 .7rem;
  color: var(--analysis-navy);
  font-size: 1.22rem;
}
.analysis-topic-page .lesson-content p {
  max-width: 78ch;
  margin: 0 0 1em;
  color: #3f4859;
  font-weight: 400;
  line-height: 1.78;
  text-align: left;
}
.analysis-topic-page .lesson-content li {
  color: #3f4859;
  font-weight: 400;
  line-height: 1.62;
}
.analysis-topic-page .lesson-content code {
  border-radius: 5px;
  color: #4939c7;
  background: #efedff;
}
.analysis-topic-page .lesson-content pre code {
  color: inherit;
  background: transparent;
}

.question-list {
  display: grid;
  gap: .65rem;
  margin: 1.2rem 0 1.5rem;
  padding: 0;
  list-style: none;
}
.question-list li {
  position: relative;
  margin: 0;
  padding: .8rem 1rem .8rem 2.7rem;
  border: 1px solid #e5e3ef;
  border-radius: 9px;
  background: #faf9fd;
}
.question-list li::before {
  content: "?";
  position: absolute;
  left: .85rem;
  top: .76rem;
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--analysis-violet);
  font-size: .72rem;
  font-weight: 850;
}

.lesson-callout {
  margin: 1.5rem 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid #d9d5f3;
  border-left: 4px solid var(--analysis-violet);
  border-radius: 8px;
  background: var(--analysis-paper-blue);
}
.lesson-callout.caution { border-color: #ead9b5; border-left-color: #d99b27; background: #fff9e9; }
.lesson-callout.practice { border-color: #cfe6dc; border-left-color: #288564; background: #effaf5; }
.callout-label {
  display: block;
  margin-bottom: .3rem;
  color: var(--analysis-violet-dark);
  font-size: .69rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.caution .callout-label { color: #875b0d; }
.practice .callout-label { color: #20694f; }
.analysis-topic-page .lesson-callout p { margin: 0; }

.analysis-topic-page .lesson-table {
  margin: 1.25rem 0 1.5rem;
  border: 1px solid #dfdeea;
  border-radius: 10px;
  overflow: hidden;
  color: #374052;
  font-size: .91rem;
}
.analysis-topic-page .lesson-table caption { color: var(--analysis-soft); font-size: .8rem; }
.analysis-topic-page .lesson-table thead th {
  border-color: #343165;
  color: #fff;
  background: var(--analysis-navy);
}
.analysis-topic-page .lesson-table tbody td { border-color: #e8e7ee; background: #fff; }
.analysis-topic-page .lesson-table tbody tr:nth-child(even) td { background: #f7f6fb; }

.lesson-concepts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .8rem;
  margin: 1.5rem 0 2.2rem;
}
.lesson-concepts article {
  min-height: 210px;
  padding: 1.2rem;
  border: 1px solid #dddbea;
  border-radius: 14px;
  background: #fff;
}
.lesson-concepts article > span { color: var(--analysis-violet); font: italic 2rem/1 Georgia, serif; }
.lesson-concepts h3 { margin: 2.4rem 0 .5rem; font-family: Georgia, serif; }
.analysis-topic-page .lesson-concepts p { margin: 0; color: var(--analysis-soft); font-size: .88rem; line-height: 1.55; }

.math-display {
  margin: 1.3rem 0;
  padding: 1.15rem;
  border: 1px solid #ddd9f5;
  border-radius: 10px;
  color: var(--analysis-navy);
  background: linear-gradient(135deg, #f2f0ff, #faf9ff);
  font: italic clamp(1.25rem, 3vw, 1.7rem)/1.35 Georgia, serif;
  text-align: center;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  margin: 1.4rem 0;
}
.comparison-grid > div { padding: 1.25rem; border: 1px solid #deddea; border-radius: 12px; background: #fff; }
.comparison-grid > div:last-child { border-color: #d9d5f3; background: #f5f3ff; }
.comparison-label { color: var(--analysis-violet) !important; font-size: .7rem; font-weight: 850 !important; letter-spacing: .1em; text-transform: uppercase; }
.comparison-grid h3 { margin: .2rem 0 .5rem; font-family: Georgia, serif; }
.analysis-topic-page .comparison-grid p:last-child { margin: 0; font-size: .9rem; line-height: 1.6; }

.process-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: 12px;
  color: #fff;
  background: var(--analysis-navy);
  font-size: .79rem;
}
.process-strip span { padding: .45rem .65rem; border: 1px solid rgba(255,255,255,.15); border-radius: 6px; background: rgba(255,255,255,.06); }
.process-strip b { color: var(--analysis-gold); }

.step-list { margin: 1.5rem 0 2rem; padding: 0; list-style: none; }
.step-list li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 1rem 0;
  border-top: 1px solid #e5e4ec;
}
.step-list li:first-child { border-top: 0; }
.step-list li > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  color: var(--analysis-violet);
  background: #efedff;
  font-weight: 850;
}
.step-list strong { color: var(--analysis-navy); }
.analysis-topic-page .step-list p { margin: .2rem 0 0; font-size: .91rem; line-height: 1.5; }

.analysis-topic-page .recuadro-codigo {
  margin: 1.25rem 0 1.5rem;
  padding: 1.1rem;
  border: 1px solid #2e3263;
  border-left: 4px solid var(--analysis-violet);
  border-radius: 10px;
  color: #f1f1fa;
  background: #171b35;
  box-shadow: 0 14px 32px rgba(23, 27, 69, .12);
}
.analysis-topic-page .recuadro-codigo code { caret-color: var(--analysis-gold); }
.analysis-topic-page .recuadro-codigo.is-editing { box-shadow: 0 0 0 3px rgba(96,77,232,.18), 0 14px 32px rgba(23,27,69,.12); }
.analysis-topic-page .run-btn {
  border-color: rgba(255,255,255,.25);
  color: var(--analysis-navy);
  background: var(--analysis-gold);
}
.analysis-topic-page .resultado-ejecucion {
  border-color: #d8d4f2;
  border-left-color: var(--analysis-violet);
  color: var(--analysis-ink);
  background: #f3f1ff;
}

.definition-list { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1.4rem 0; }
.definition-list div { padding: 1rem; border: 1px solid #e0dfea; border-radius: 10px; background: #fff; }
.definition-list dt { margin-bottom: .35rem; color: var(--analysis-navy); }
.definition-list dd { margin: 0; color: var(--analysis-soft); font-size: .88rem; line-height: 1.55; }

.analysis-lab {
  margin: 1.5rem 0;
  overflow: hidden;
  border: 1px solid #353268;
  border-radius: 16px;
  background: var(--analysis-navy);
  box-shadow: 0 20px 42px rgba(23, 27, 69, .16);
}
.analysis-lab canvas { display: block; width: 100%; height: 380px; }
.lab-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  color: #fff;
}
.lab-heading span { color: var(--analysis-gold); font-size: .64rem; font-weight: 850; letter-spacing: .12em; }
.analysis-topic-page .lab-heading h3 { margin: .15rem 0 0; color: #fff; font-size: 1.05rem; }
.analysis-topic-page .lab-heading p { margin: 0; color: #cbcce0; font-family: ui-monospace, monospace; font-size: .85rem; }
#changeCanvas { display: block; width: 100%; height: 380px; }
.lab-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,.1);
  background: #f4f3fa;
}
.lab-controls label { color: var(--analysis-navy); font-size: .78rem; font-weight: 750; }
.lab-controls select,
.lab-controls input { display: block; width: 100%; margin-top: .45rem; accent-color: var(--analysis-violet); }
.lab-controls select { min-height: 38px; padding: .35rem .5rem; border: 1px solid #cccbdc; border-radius: 7px; color: var(--analysis-ink); background: #fff; }
.lab-controls button {
  min-height: 40px;
  padding: .5rem .8rem;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--analysis-violet);
  font: inherit;
  font-size: .78rem;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}
.lab-controls button:hover { background: var(--analysis-violet-dark); }
.lab-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-top: 1px solid #dcdae9;
  background: #dcdae9;
}
.lab-results > div { padding: .85rem 1rem; background: #fff; }
.lab-results small { display: block; margin-bottom: .25rem; color: var(--analysis-soft); font-size: .68rem; }
.lab-results strong { color: var(--analysis-navy); font-size: .9rem; font-variant-numeric: tabular-nums; }
.analysis-topic-page .lab-status {
  max-width: none;
  margin: 0;
  padding: .8rem 1.2rem;
  color: #4a4861;
  background: #f4f3fa;
  font-size: .82rem;
}

.mistake-list { display: grid; gap: .65rem; margin-top: 1.4rem; }
.mistake-list details,
.analysis-topic-page .lesson-content > section > details {
  border: 1px solid #dfdeea;
  border-radius: 10px;
  background: #fff;
}
.mistake-list summary,
.analysis-topic-page .lesson-content > section > details > summary {
  padding: .9rem 1rem;
  color: var(--analysis-navy);
  font-weight: 750;
  cursor: pointer;
}
.mistake-list details[open] summary,
.analysis-topic-page .lesson-content > section > details[open] > summary { border-bottom: 1px solid #ebeaf0; color: var(--analysis-violet-dark); }
.analysis-topic-page .mistake-list details p { margin: 0; padding: 1rem; font-size: .92rem; }
.analysis-topic-page .lesson-content > section > details { margin: 1rem 0 2rem; }
.analysis-topic-page .lesson-content > section > details > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
.analysis-topic-page .lesson-content > section > details > p:first-of-type { margin-top: 1rem; }

.summary-card {
  padding: 1.3rem 1.4rem;
  border: 1px solid #d9d5f3;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0edff, #fbfaff);
}
.summary-card ul { margin: 0; padding-left: 1.2rem; }
.summary-card li::marker { color: var(--analysis-violet); }

.lesson-navigation {
  display: grid;
  grid-template-columns: 1fr .72fr 1fr;
  gap: .8rem;
}
.lesson-navigation a {
  display: grid;
  align-items: center;
  gap: .2rem .8rem;
  min-height: 88px;
  padding: 1rem;
  border: 1px solid #ddddea;
  border-radius: 12px;
  color: var(--analysis-navy);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.lesson-navigation a:hover { transform: translateY(-2px); border-color: #bcb7ed; box-shadow: 0 10px 22px rgba(50,44,120,.09); }
.lesson-navigation small { color: var(--analysis-soft); font-size: .7rem; }
.lesson-navigation strong { font-size: .88rem; }
.index-link,
.back-link { grid-template-columns: auto 1fr; }
.index-link span,
.back-link span { grid-row: 1 / 3; color: var(--analysis-violet); }
.next-link { grid-template-columns: 1fr auto; text-align: right; }
.next-link span { grid-column: 2; grid-row: 1 / 3; color: var(--analysis-violet); }

@media (max-width: 920px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-hero-grid { grid-template-columns: 1fr; }
  .lesson-symbol { display: none; }
  .lab-controls { grid-template-columns: 1fr 1fr; }
  .lab-results { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .analysis-topic-page .container#contenedor { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .lesson-hero { border-radius: 0; }
  .lesson-layout { padding: 1.25rem; }
  .lesson-concepts,
  .comparison-grid,
  .definition-list,
  .lesson-navigation { grid-template-columns: 1fr; }
  .process-strip { align-items: stretch; flex-direction: column; text-align: center; }
  .process-strip b { transform: rotate(90deg); }
  .lab-controls { grid-template-columns: 1fr; }
  .analysis-lab canvas { height: 330px; }
  .lesson-navigation .next-link { text-align: left; }
  .next-link { grid-template-columns: 1fr auto; }
}

@media (max-width: 430px) {
  .lesson-meta { align-items: flex-start; flex-direction: column; }
  .lab-results { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .analysis-topic-page *,
  .analysis-topic-page *::before,
  .analysis-topic-page *::after { transition: none !important; }
}
