* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f5f7fa;
  color: #333
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 40px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #ecebf3;
}

header a {
  text-decoration: none;
  color: #333
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: "Sora", system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #16213e;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #eef1f6;
}

nav {
  display: flex;
  flex-wrap: wrap;
}

nav a {
  margin-left: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: .92rem;
  color: #4c566a;
  transition: .2s
}

nav a:hover {
  background: #eef1f6;
  color: #16213e
}

.centro {
  max-width: 1100px;
  margin: 40px auto;
  background: white;
  padding: 50px;
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08)
}

.centro img {
  width: 180px;
  border-radius: 50%;
  margin-bottom: 20px
}

.boton {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 24px;
  background: #e74c3c;
  color: white;
  text-decoration: none;
  border-radius: 16px
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  max-width: 1100px;
  margin: 20px auto
}

.card {
  background: white;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}

footer {
  margin-top: 50px;
  padding: 28px 20px 40px;
  text-align: center;
  color: #7a8399;
  font-size: .85rem;
}

/* ============================================================
   TOKENS — Gamificación como estrategia de aprendizaje
   Paleta: papel azul-grisáceo + azul noche + ámbar "XP" + teal
   ============================================================ */
:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --ink: #1b2233;
  --ink-soft: #4c566a;
  --muted: #7a8399;
  --navy: #16213e;
  --navy-soft: #26335c;
  --gold: #e8a33d;
  --gold-deep: #c07f21;
  --teal: #2ec4b6;
  --teal-deep: #1f9c90;
  --line: #dbe2ee;
  --lilac-pale: rgba(22, 33, 62, .06);
  --lilac-dark: var(--navy);
  --shadow-card: 0 10px 30px rgba(22, 33, 62, .07);
  --shadow-hover: 0 16px 34px rgba(22, 33, 62, .14);

  --display: "Sora", system-ui, sans-serif;
  --body: "Source Serif 4", Georgia, serif;
  --mono: "JetBrains Mono", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation: none !important;
    transition: none !important;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
}

/* ---------- XP progress bar ---------- */
.xp-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--line);
  z-index: 60;
}

.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .15s linear;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 5px;
  left: 0;
  right: 0;
  z-index: 55;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: rgba(238, 241, 246, 0.9);
  backdrop-filter: blur(8px); 
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--navy);
  font-family: var(--display);
  font-weight: 700;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--navy);
  color: var(--gold);
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
}

.brand-text {
  font-size: 1rem;
}

.map-toggle {
  display: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: .8rem;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}

.map-toggle:hover {
  background: var(--navy-soft);
}

/* ============================================================
   ÍNDICE DEL PROYECTO — botón flotante + panel lateral
   ============================================================ */
.map-fab {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--display);
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 10px 24px rgba(22, 33, 62, .28);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  animation: mapFabIn .5s ease .3s backwards, mapFabRing 2.4s ease-out 1s 2;
}

@keyframes mapFabIn {
  from { opacity: 0; transform: translateY(14px) scale(.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mapFabRing {
  0%   { box-shadow: 0 10px 24px rgba(22, 33, 62, .28), 0 0 0 0 rgba(22, 33, 62, .35); }
  70%  { box-shadow: 0 10px 24px rgba(22, 33, 62, .28), 0 0 0 14px rgba(22, 33, 62, 0); }
  100% { box-shadow: 0 10px 24px rgba(22, 33, 62, .28), 0 0 0 0 rgba(22, 33, 62, 0); }
}

.map-fab:hover {
  background: var(--navy-soft);
  transform: translateY(-2px);
}

.map-fab[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
}

.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 20, 34, .45);
  backdrop-filter: blur(3px);
}

.map-overlay[hidden] {
  display: none;
}

/* ---------- Panel ---------- */
.level-map {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: min(360px, 88vw);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(15, 20, 34, .2);
  transform: translateX(105%);
  transition: transform .35s cubic-bezier(.32, .72, 0, 1);
}

.level-map.open {
  transform: translateX(0);
}

/* Cabecera fija, con degradado de marca */
.level-map-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 22px 18px;
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: #fff;
}

.level-map-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.level-map-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.level-map-sub {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .72);
}

.map-close {
  flex-shrink: 0;
  border: none;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.map-close:hover {
  background: rgba(255, 255, 255, .26);
  transform: rotate(90deg);
}

.map-progress {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
  margin: 14px 22px 0;
}

.map-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .3s ease;
}

/* ---------- Zona de controles: buscador + acciones ---------- */
.map-controls {
  flex-shrink: 0;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.map-search {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--display);
  font-size: .85rem;
  color: var(--ink);
  background: var(--bg);
  transition: border-color .2s ease, background .2s ease;
}

.map-search:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
}

.map-actions {
  display: flex;
  gap: 8px;
}

.map-action {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}

.map-action:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---------- Lista de secciones (con scroll propio) ---------- */
.level-map-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 24px;
}

/* ---------- Encabezados de grupo temático ---------- */
.map-group-title {
  margin: 18px 6px 8px;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.map-group-title:first-child {
  margin-top: 2px;
}

.map-group {
  list-style: none;
  display: grid;
  gap: 6px;
}

.level-map li {
  position: relative;
}

.level-map a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: .87rem;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

/* Barra de acento a la izquierda de cada fila */
.level-map a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: transparent;
  transition: background .2s ease;
}

.map-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 1rem;
  line-height: 1;
  transition: background .2s ease, transform .2s ease;
}

.map-name {
  flex: 1;
  min-width: 0;
}

/* Entrada escalonada: cada fila aparece con un pequeño desfase al abrir el panel */
.level-map.open .map-group li {
  animation: mapItemIn .32s ease backwards;
}

.map-group li:nth-child(1) { animation-delay: .02s; }
.map-group li:nth-child(2) { animation-delay: .06s; }
.map-group li:nth-child(3) { animation-delay: .10s; }
.map-group li:nth-child(4) { animation-delay: .14s; }
.map-group li:nth-child(5) { animation-delay: .18s; }

@keyframes mapItemIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Hover / foco por teclado */
.level-map a:hover,
.level-map a:focus-visible {
  background: var(--bg);
  color: var(--navy);
  transform: translateX(2px);
}

.level-map a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.level-map a:hover .map-num {
  transform: scale(1.08);
}

/* Sección ya vista al hacer scroll */
.level-map li.done .map-num {
  background: rgba(90, 189, 176, .18);
}

.level-map li.done a {
  color: var(--navy);
  font-weight: 600;
}

.level-map li.done a::before {
  background: var(--teal);
}

/* Sección visible en pantalla ahora mismo */
.level-map li.current a {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(22, 33, 62, .26);
}

.level-map li.current a::before {
  background: var(--gold);
}

.level-map li.current .map-num {
  background: rgba(255, 255, 255, .16);
}

/* Sección desplegada en este momento: puntito pulsante a la derecha */
.level-map li.open-section a::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(90, 189, 176, .25);
  animation: mapPulse 1.8s ease-in-out infinite;
}

.level-map li.current.open-section a::after {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(230, 178, 74, .3);
}

@keyframes mapPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}

.level-map li[hidden] {
  display: none;
}

.map-group-title[hidden] {
  display: none;
}

.map-empty {
  margin-top: 16px;
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
}

.map-empty[hidden] {
  display: none;
}

/* ---------- Pie del panel ---------- */
.level-map-foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
}

.map-foot-hint {
  text-align: right;
}

@media (max-width: 520px) {
  .map-fab {
    right: 16px;
    bottom: 80px;
    padding: 11px 15px;
  }
  .map-fab-text {
    display: none;
  }
  .level-map-foot .map-foot-hint {
    display: none;
  }
  .level-map {
    width: 100%;
  }
}

/* References */
.references-intro{color:var(--muted);margin-bottom:16px}
.references-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media (max-width: 700px){.references-grid{grid-template-columns:1fr}}
.reference-card{
  position:relative;background:var(--bg);border:1px solid var(--line);
  border-radius:14px;padding:14px 14px 12px 46px;
  transition:.2s ease;font-size:.9rem
}
.reference-card:hover{transform:translateY(-3px);box-shadow:var(--shadow-hover);border-color:var(--teal)}
.reference-number{
  position:absolute;left:12px;top:13px;display:grid;place-items:center;
  width:24px;height:24px;border-radius:8px;background:var(--lilac-pale);
  color:var(--lilac-dark);font-weight:900;font-size:.66rem
}
.reference-card p{margin:0 0 6px;text-align:justify}
.reference-link{font-size:.8rem;font-weight:800;text-decoration:none}
.doi{color:var(--muted);font-size:.78rem;word-break:break-word}




/* ---------- Layout shell ---------- */
main {
  padding-top: 24px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 28px 54px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--teal-deep);
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.1rem, 4.6vw, 3.2rem);
  line-height: 1.18;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.hero-sub {
  margin: 22px 0 0;
  max-width: 560px;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-meta {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--mono);
  font-size: .78rem;
  padding: 9px 16px;
  border-radius: 20px;
  background: var(--navy);
  color: #fff;
}

.chip-ghost {
  background: transparent;
  border: 1px dashed var(--ink-soft);
  color: var(--ink-soft);
}

.start-btn {
  display: inline-block;
  margin-top: 38px;
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
  color: var(--navy);
  background: var(--gold);
  padding: 14px 26px;
  border-radius: 12px;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 8px 0 var(--gold-deep);
}

.start-btn:hover {
  transform: translateY(2px);
  box-shadow: 0 6px 0 var(--gold-deep);
}

.start-btn:active {
  transform: translateY(8px);
  box-shadow: 0 0 0 var(--gold-deep);
}

/* ---------- Level sections ---------- */
.level {
  max-width: 820px;
  margin: 20px auto;
  padding: 26px clamp(18px, 4vw, 34px);
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  scroll-margin-top: 110px;
}

.level-alt {
  background: var(--card);
}

.level-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.level-tag {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: #fff;
  background: var(--navy);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.level-head h2 {
  font-family: var(--display);
  font-size: clamp(1.12rem, 2.2vw, 1.42rem);
  color: var(--navy);
  font-weight: 700;
  line-height: 1.3;
}

.level-body p {
  max-width: none;
  margin-left: 0;
  color: var(--ink);
  line-height: 1.75;
  margin-bottom: 16px;
}

.level-body p {
  text-align: justify;
}

.placeholder {
  color: var(--ink-soft);
  background: transparent;
  text-align: justify;
  text-indent: 0;
  padding: 0;
  margin-left: 0;
}

.placeholder-secondary {
  margin-top: 14px;
}

.placeholder-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.placeholder-list .placeholder {
  padding: 10px 14px;
}

/* Objetivos */
.obj-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.obj-card {
  background: var(--bg);
  border-radius: 13px;
  padding: 14px 16px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.obj-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.obj-card h3 {
  font-family: var(--display);
  font-size: .92rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.obj-card .placeholder,
.obj-card .placeholder-list .placeholder {
  margin-left: 0;
}

.placeholder-list li.placeholder + li.placeholder {
  margin-top: 12px;
}

@media (max-width: 700px) {
  .obj-grid {
    grid-template-columns: 1fr;
  }
}

/* Marco referencial */
.marco-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.marco-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 14px;
  border-top: 3px solid var(--teal);
  transition: transform .18s ease, box-shadow .18s ease;
}

.marco-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.marco-card h3 {
  font-family: var(--display);
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.marco-card p {
  color: var(--ink-soft);
  font-size: .85rem;
}

@media (max-width: 760px) {
  .marco-grid {
    grid-template-columns: 1fr;
  }
}

/* Metodología */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.meta-grid p {
  text-align: justify;
  color: var(--ink);
  line-height: 1.7;
}

.meta-label {
  display: block;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--teal-deep);
  margin-bottom: 8px;
}

@media (max-width: 700px) {
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

/* Resultados */
.result-slot {
  margin-top: 14px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .85rem;
  background: var(--bg);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 50px 28px 70px;
  color: var(--ink-soft);
  font-family: var(--display);
}

.footer-sub {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-soft);
  opacity: .8;
}
img {
    width: 70%;
    height: auto;
    display: block;
    margin: 20px auto;
}

/* ---------- Figuras y tablas dentro del texto ---------- */
.figura {
  max-width: 480px;
  margin: 20px auto;
  padding: 14px;
  background: var(--bg);
  border-radius: 14px;
  text-align: center;
}

.figura img {
  width: 100%;
  margin: 0 0 10px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(22, 33, 62, .12);
}

.titulo-figura {
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--teal-deep);
  margin-bottom: 4px;
}

.nombre-figura {
  font-family: var(--display);
  font-size: .92rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}

.nota-figura {
  font-size: .82rem;
  color: var(--muted);
  text-align: left;
  line-height: 1.55;
}

.nota-figura strong {
  color: var(--ink-soft);
}

.texto {
    text-align: justify;
    text-indent: 0;
    color: var(--ink);
    line-height: 1.75;
    max-width: none;
    margin: 0 0 16px 0;
}

.anexos-section {
    padding: 26px clamp(18px, 4vw, 34px);
    margin: 20px auto;
    max-width: 820px;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
}

.anexos-section h2 {
    text-align: center;
    font-family: var(--display);
    color: var(--navy);
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.anexos-intro {
    text-align: center;
    color: var(--ink-soft);
    max-width: 560px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.anexos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 700px) {
  .anexos-grid {
    grid-template-columns: 1fr;
  }
}

.anexo-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--bg);
    border-radius: 12px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.anexo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.anexo-icon {
    font-size: 1.3rem;
    background: #fff;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-card);
}

.anexo-content h3 {
    margin: 0;
    font-family: var(--mono);
    color: var(--teal-deep);
    font-size: .7rem;
    letter-spacing: .04em;
}

.anexo-content h4 {
    margin: 3px 0 6px;
    font-family: var(--display);
    color: var(--navy);
    font-size: .95rem;
}

.anexo-content p {
    margin: 0 0 8px;
    color: var(--ink-soft);
    line-height: 1.5;
    font-size: .84rem;
}

.anexo-content a {
    color: var(--teal-deep);
    text-decoration: none;
    font-weight: 700;
    font-size: .9rem;
}

.anexo-content a:hover {
    text-decoration: underline;
}

/* ============================================================
   ACORDEÓN — todas las secciones se despliegan al hacer clic
   ============================================================ */
.level-head.accordion-title {
  cursor: pointer;
  user-select: none;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
  padding: 6px 4px;
  border-radius: 14px;
  transition: background .2s ease, transform .2s ease;
}

.level-head.accordion-title:hover {
  background: var(--bg);
}

.level-head.accordion-title:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

.level-head.accordion-title h2 {
  text-align: left;
  margin: 0;
}

.level-head .level-tag {
  transition: background .25s ease, transform .25s ease;
}

.level-head.accordion-title[aria-expanded="true"] .level-tag {
  background: var(--teal-deep);
  transform: scale(1.04);
}

.level-tag-game {
  background: #000;
  color: #fff;
}

/* Pista de texto a la derecha del título */
.level-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  transition: opacity .2s ease;
  white-space: nowrap;
}

.level-head.accordion-title:hover .level-hint {
  opacity: 1;
}

.level-head.accordion-title[aria-expanded="true"] .level-hint::before {
  content: "Contraer";
}

.level-head.accordion-title[aria-expanded="false"] .level-hint::before {
  content: "Desplegar";
}

/* Icono circular +/- */
.toggle-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: 12px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--navy);
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform .3s ease, background .25s ease, color .25s ease;
}

.level-head.accordion-title:hover .toggle-icon {
  background: var(--navy);
  color: #fff;
}

.toggle-icon::before {
  content: "+";
}

.level-head.accordion-title[aria-expanded="true"] .toggle-icon {
  transform: rotate(135deg);
  background: var(--navy);
  color: #fff;
}

/* Cuerpo plegable */
/* Por defecto TODO empieza contraído (no depende de JS ni de que este cargue a tiempo) */
.level-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  pointer-events: none;
  transition: max-height .4s ease, opacity .3s ease, padding-top .3s ease;
}

.level-head.accordion-title[aria-expanded="true"] + .level-body {
  max-height: none;
  opacity: 1;
  padding-top: 26px;
  pointer-events: auto;
}

/* La sección resalta cuando está abierta o es la actual */
.level {
  transition: box-shadow .3s ease, transform .3s ease;
}

.level:has(.accordion-title[aria-expanded="true"]) {
  box-shadow: var(--shadow-hover);
}

.level.is-current {
  outline: 2px solid var(--teal);
  outline-offset: 0;
}

/* ============================================================
   PRÁCTICA INTERACTIVA — actividades por habilidad
   ============================================================ */
.skill-score {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 22px 0 6px;
}

.score-chip {
  font-family: var(--mono);
  font-size: .85rem;
  background: var(--navy);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
}

.score-chip strong {
  color: var(--gold);
}

.skill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 18px 0 30px;
}

.skill-tab {
  font-family: var(--display);
  font-weight: 700;
  font-size: .9rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  padding: 10px 18px;
  border-radius: 14px;
  cursor: pointer;
  transition: .2s;
}

.skill-tab:hover {
  border-color: var(--teal);
  color: var(--navy);
}

.skill-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.skill-panel {
  display: none;
  animation: fadeIn .3s ease;
}

.skill-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 10px;
}

.game-card-head h3 {
  font-family: var(--display);
  color: var(--navy);
}

.game-pill {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--teal);
  border: 1px dashed var(--teal);
  padding: 4px 10px;
  border-radius: 14px;
}

.skill-instructions {
  text-align: center;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 auto 20px;
}

.game-btn {
  font-family: var(--display);
  font-weight: 700;
  font-size: .9rem;
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--gold-deep);
  transition: transform .15s, box-shadow .15s;
  display: block;
  margin: 0 auto;
}

.game-btn:hover:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--gold-deep);
}

.game-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.game-btn.yes {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 6px 0 #1f9c90;
}

.game-btn.no {
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.game-btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.game-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  max-width: 560px;
  margin: 22px auto 0;
}

.game-option-btn {
  font-family: var(--body);
  font-size: .95rem;
  background: #fff;
  border: 2px solid var(--line);
  padding: 14px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: .2s;
}

.game-option-btn:hover:not(:disabled) {
  border-color: var(--teal);
}

.game-option-btn.correct {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.game-option-btn.wrong {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.game-feedback {
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  min-height: 1.6em;
  margin-top: 18px;
  color: var(--navy);
}

.challenge-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg);
  border: 2px dashed var(--gold);
  border-radius: 13px;
  padding: 16px;
  text-align: center;
  font-family: var(--display);
  font-size: .95rem;
  color: var(--navy);
}

.timer-bar-track {
  max-width: 520px;
  margin: 16px auto 0;
  height: 10px;
  background: var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 1s linear;
}

.self-check {
  text-align: center;
  margin-top: 20px;
}

.self-check p {
  margin-bottom: 12px;
  color: var(--ink-soft);
}

.self-check .game-btn {
  display: inline-block;
  margin: 0 6px;
}

.memory-meta {
  text-align: center;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 440px;
  margin: 0 auto;
}

@media (max-width: 560px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.memory-card {
  aspect-ratio: 1 / 1;
  background: var(--navy);
  color: transparent;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: .78rem;
  text-align: center;
  padding: 6px;
  cursor: pointer;
  transition: transform .2s, background .2s, color .2s;
}

.memory-card.flipped,
.memory-card.matched {
  background: #fff;
  color: var(--navy);
  border: 2px solid var(--teal);
}

.memory-card.matched {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  cursor: default;
}

.memory-card:active:not(.matched) {
  transform: scale(.96);
}

.game-input {
  font-family: var(--body);
  font-size: 1rem;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  max-width: 260px;
  width: 100%;
}

.game-input:focus {
  outline: none;
  border-color: var(--teal);
}

.virtual-assistant {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: var(--navy);
  border-radius: 50%;
  box-shadow: var(--shadow-hover);
}

.pulse {
  animation: pulseScore .5s ease;
}

@keyframes pulseScore {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---------- Texto sin sangría y justificado (ajuste global) ---------- */
.level-body,
.level-body p,
.level-body li,
.placeholder,
.texto,
.meta-grid p,
.reference-card p,
.anexos-section p {
  text-indent: 0;
  margin-left: 0;
  padding-left: 0;
  max-width: none;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.level-body h2,
.level-body h3,
.level-body h4,
.titulo-figura,
.nombre-figura {
  text-align: left;
}

.figura .titulo-figura,
.figura .nombre-figura {
  text-align: center;
}

/* La figura es un bloque cerrado: nunca se mezcla con el texto */
figure.figura {
  display: block;
  max-width: 480px;
  margin: 20px auto;
  padding: 14px;
  background: var(--bg);
  border-radius: 14px;
  text-align: center;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

figure.figura:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

figure.figura img {
  width: 100%;
  height: auto;
  margin: 0 0 14px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(22, 33, 62, .12);
}

figure.figura .nota-figura {
  text-align: justify;
  text-indent: 0;
  margin: 0;
}


/* ---------- Anclas por debajo del header fijo ---------- */
.level,
.anexos-section,
.hero,
section[id] {
  scroll-margin-top: 92px;
}

html {
  scroll-behavior: smooth;
}

/* ============================================================
   INTERACTIVIDAD ADICIONAL — aparición al hacer scroll,
   logros con confeti y barra de dominio por habilidad
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s ease, transform .55s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Tarjetas ligeramente inclinables al pasar el mouse (efecto vivo) */
.tilt-card {
  transition: transform .15s ease, box-shadow .15s ease;
  will-change: transform;
}

/* Toast de logros */
#achievementToasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.achievement-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--navy);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: .85rem;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(22, 33, 62, .3);
  border: 1px solid rgba(255, 255, 255, .12);
  animation: toastIn .35s ease, toastOut .4s ease 2.6s forwards;
}

.achievement-toast .badge {
  font-size: 1.2rem;
}

.achievement-toast strong {
  color: var(--gold);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(.96); }
}

/* Confeti */
.confetti-piece {
  position: fixed;
  top: -12px;
  z-index: 199;
  width: 8px;
  height: 12px;
  pointer-events: none;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(105vh) rotate(540deg);
    opacity: .9;
  }
}

/* Barra de dominio por habilidad (progreso dentro del juego) */
.skill-mastery {
  max-width: 440px;
  margin: 14px auto 0;
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.skill-mastery-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .4s ease;
}

/* Botón de volver arriba */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 150px;
  z-index: 45;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 1.1rem;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--navy);
  color: #fff;
}