/* Mundo Primaria · Entrenadores · v0.8.7 (21-11-2026: a 360 px o menos los botones de nivel con nombre miden 44 px de alto,
 * no 42, como pide un dedo; 0.8.5 del 17-11-2026: Primi en todos, ver el final del fichero). Colores del tema mp-2020.
 * 0.8.3 (Mikel, 16-11-2026): la palabra «Nivel» delante de los botones con número (en las tablas, «Paso»). Solo CSS.
 * 0.8.4: a 320 px el hueco entre círculos gana también al de problemas y repartos (seis círculos en una fila).
 * Ordenador: la cuenta a la izquierda; a la derecha, el acompañante y el teclado (cabe en poca altura,
 * que encima va el anuncio). Móvil: todo apilado (acompañante, cuenta, teclado). */
.mpe {
  --mpe-turquesa: #29a5bc;
  --mpe-petroleo: #1b6f80;
  --mpe-claro: #e7fafd;
  --mpe-marino: #0b3d6e;
  --mpe-texto: #393f40;
  --mpe-suave: #5d6b70;
  --mpe-linea: #d3ecf1;
  --mpe-llevada: #e67e22;
  --mpe-bien: #1f9d63;
  --mpe-ayuda: #f2a516;
  --mpe-mal: #e0474c;
  --mpe-celda: 76px;
  --mpe-letra: 58px;
  --mpe-signo: 44px;
  box-sizing: border-box;
  max-width: 1170px; /* todo el ancho de la página (0.5.0); la cuenta y el teclado siguen juntos, en .mpe-zona */
  min-height: 480px;
  margin: 24px auto 48px;
  padding: 32px;
  background: #fff;
  border: 2px solid #9fd2dd;
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(11, 61, 110, .08);
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--mpe-texto);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.mpe *, .mpe *::before, .mpe *::after { box-sizing: border-box; }
.mpe.mpe-listo { min-height: 0; }
.mpe .mpe-sinjs { margin: 0; padding: 0; font-size: 17px; }
.mpe p { text-align: left; hyphens: none; }
/* Solo en la página propia del entrenador (texto="estrecho"): el texto de debajo, con su mismo ancho */
.mpe.mpe-texto-estrecho ~ h2, .mpe.mpe-texto-estrecho ~ h3, .mpe.mpe-texto-estrecho ~ p, .mpe.mpe-texto-estrecho ~ ul, .mpe.mpe-texto-estrecho ~ ol { max-width: 920px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
.mpe button { font-family: inherit; text-transform: none; letter-spacing: normal; margin: 0; box-shadow: none; }
.mpe button:focus { outline: none; }
.mpe button:focus-visible { outline: 3px solid var(--mpe-marino); outline-offset: 3px; }

/* ---------- título del recuadro ---------- */
.mpe .mpe-titular { margin: 0 0 24px; padding: 0; text-align: left; }
.mpe h2.mpe-titulo { margin: 0; padding: 0; border: 0; background: none; font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 26px; font-weight: 800; line-height: 1.2; color: var(--mpe-marino); text-align: left; text-transform: none; letter-spacing: normal; }
.mpe h2.mpe-titulo::before, .mpe h2.mpe-titulo::after { content: none; }
.mpe p.mpe-subtitulo { margin: 6px 0 0; padding: 0; font-size: 15px; line-height: 1.4; color: var(--mpe-suave); }

/* ---------- cabecera: niveles y progreso ---------- */
.mpe .mpe-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.mpe .mpe-niv { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.mpe .mpe-niveles { display: flex; gap: 8px; }
.mpe .mpe-nivel {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 2px solid var(--mpe-linea); background: #fff; color: var(--mpe-petroleo);
  font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.mpe .mpe-nivel:hover { border-color: var(--mpe-turquesa); }
.mpe .mpe-nivel[aria-pressed="true"] { background: var(--mpe-turquesa); border-color: var(--mpe-turquesa); color: #fff; }
/* Niveles con nombre (0.8.2): cuando los niveles son temas, el botón dice el tema («Polígonos», «Redondear») */
.mpe .mpe-niveles.mpe-con-temas { flex-wrap: wrap; gap: 8px; }
.mpe .mpe-nivel.mpe-tema { width: auto; height: 44px; padding: 0 16px; border-radius: 22px; font-size: 15px; white-space: nowrap; }
/* «Nivel» delante de los números (0.8.3): solo los círculos «1 2 3» no decían qué eran. Sale del aria-label del grupo
 * («Nivel»; en las tablas, «Paso»), así vale para todos los aparatos sin tocar su JS. El «/ ""» es para que el lector
 * de pantalla no lo lea dos veces (el grupo ya se anuncia así). Los de nombre (mpe-con-temas) no lo llevan. */
.mpe .mpe-niveles:not(.mpe-con-temas)::before {
  content: attr(aria-label); content: attr(aria-label) / "";
  align-self: center; margin-right: 6px; font-size: 16px; font-weight: 700; line-height: 1.2; color: var(--mpe-petroleo); white-space: nowrap;
}
.mpe .mpe-desc { margin: 0; padding: 0; font-size: 15px; line-height: 1.4; color: var(--mpe-suave); }
.mpe .mpe-desc strong { color: var(--mpe-marino); font-weight: 700; }
.mpe .mpe-progreso { display: flex; gap: 8px; margin-left: auto; }
.mpe .mpe-punto { width: 14px; height: 14px; border-radius: 50%; background: #dcecef; transition: background .2s; }
.mpe .mpe-punto.actual { background: #fff; box-shadow: inset 0 0 0 3px var(--mpe-turquesa); }
.mpe .mpe-punto.bien { background: var(--mpe-bien); }
.mpe .mpe-punto.ayuda { background: var(--mpe-ayuda); }

/* ---------- zona de juego ---------- */
.mpe .mpe-zona {
  display: grid; margin-top: 32px;
  grid-template-columns: 1fr 340px; grid-template-areas: "cuenta guia" "cuenta pie";
  grid-template-rows: auto auto; align-content: center; column-gap: 48px; row-gap: 24px;
  max-width: 880px; margin-left: auto; margin-right: auto;
}
.mpe .mpe-cuenta { grid-area: cuenta; align-self: center; }
.mpe .mpe-guia { grid-area: guia; align-self: end; }
.mpe .mpe-pie { grid-area: pie; align-self: start; }

/* La cuenta: rejilla de signo + columnas de cifras */
.mpe .mpe-cuenta {
  display: grid; justify-content: center; align-content: center;
  grid-template-columns: var(--mpe-signo) repeat(var(--mpe-cols, 2), var(--mpe-celda));
  grid-template-rows: 24px var(--mpe-alto-llevada, 56px) repeat(var(--mpe-sumandos, 2), var(--mpe-celda)) 16px calc(var(--mpe-celda) + 8px);
}
/* Sin llevadas no hace falta la fila de las casillas naranjas */
.mpe .mpe-cuenta.mpe-sin-llevadas { --mpe-alto-llevada: 16px; }
.mpe .mpe-cuenta > div { position: relative; z-index: 1; }
.mpe .mpe-cuenta > .mpe-banda { z-index: 0; margin: 0 4px; border-radius: 18px; background: transparent; transition: background .2s; }
.mpe .mpe-cuenta > .mpe-banda.activa { background: var(--mpe-claro); }
.mpe .mpe-etq { align-self: end; justify-self: center; font-size: 13px; font-weight: 700; letter-spacing: .06em; color: #8fb0b8; line-height: 1; }
.mpe .mpe-cifra, .mpe .mpe-signo {
  display: flex; align-items: center; justify-content: center;
  font-size: var(--mpe-letra); font-weight: 700; line-height: 1; color: var(--mpe-marino);
  font-variant-numeric: tabular-nums;
}
.mpe .mpe-signo { color: var(--mpe-petroleo); }
.mpe .mpe-cuenta > .mpe-raya { align-self: center; height: 5px; border-radius: 3px; background: var(--mpe-marino); }
.mpe .mpe-hueco {
  align-self: end; justify-self: center; width: calc(var(--mpe-celda) - 10px); height: var(--mpe-celda);
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--mpe-linea); border-radius: 16px; background: #fff;
  font-size: var(--mpe-letra); font-weight: 700; line-height: 1; color: var(--mpe-marino); font-variant-numeric: tabular-nums;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.mpe .mpe-hueco.activo { border-color: var(--mpe-turquesa); box-shadow: 0 0 0 6px rgba(41, 165, 188, .18); animation: mpe-latido 1.8s ease-in-out infinite; }
.mpe .mpe-hueco.mal { border-color: var(--mpe-mal); color: var(--mpe-mal); box-shadow: none; animation: mpe-tiembla .35s ease-in-out; }
.mpe .mpe-hueco.puesta { border-color: transparent; background: transparent; box-shadow: none; animation: mpe-pon .25s ease-out; }
.mpe .mpe-hueco.dada, .mpe .mpe-llevada.dada { color: #8a9aa0; }
.mpe.mpe-hecha .mpe-hueco.puesta { color: var(--mpe-bien); animation: mpe-salto .45s ease-out both; animation-delay: calc(var(--mpe-i, 0) * 70ms); }
.mpe .mpe-llevada {
  align-self: center; justify-self: center; width: 40px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed transparent; border-radius: 10px;
  font-size: 24px; font-weight: 700; line-height: 1; color: var(--mpe-llevada);
}
.mpe .mpe-llevada.activo { border-color: var(--mpe-llevada); background: #fff6ec; animation: mpe-latido-ll 1.8s ease-in-out infinite; }
.mpe .mpe-llevada.activo.mal { border-color: var(--mpe-mal); background: #fff0f0; color: var(--mpe-mal); animation: mpe-tiembla .35s ease-in-out; }
.mpe .mpe-llevada.puesta { animation: mpe-pon .25s ease-out; }
/* Restas con llevadas. «Sumando»: la llevada va abajo, pegada a la izquierda de la cifra que se resta.
 * «Restando»: arriba va la cifra que queda, la de debajo sale tachada y la columna de la derecha gana un 1 pequeño. */
.mpe .mpe-cuenta > .mpe-llevada.mpe-llevada-abajo { z-index: 2; align-self: start; justify-self: start; width: 26px; height: 32px; margin: 2px 0 0 -9px; font-size: 22px; border-radius: 8px; }
.mpe .mpe-cuenta.mpe-resta-restando .mpe-llevada { width: 46px; }
/* «Sumando»: el signo se aparta a la izquierda para dejar sitio a la llevada de la primera columna */
.mpe .mpe-cuenta.mpe-resta-sumando .mpe-signo { justify-content: flex-start; margin-left: -14px; }
.mpe .mpe-llevada.con-diez { letter-spacing: .02em; }
.mpe .mpe-cifra.tachada { color: #9db3ba; }
.mpe .mpe-cifra.tachada::after { content: ""; position: absolute; left: 50%; top: 50%; width: 62%; height: 4px; margin: -2px 0 0 -31%; border-radius: 2px; background: var(--mpe-llevada); transform: rotate(-52deg); animation: mpe-pon .25s ease-out; }
.mpe .mpe-cifra .mpe-diez { position: absolute; left: 1px; top: 8px; font-size: calc(var(--mpe-letra) * .45); line-height: 1; color: var(--mpe-llevada); animation: mpe-pon .25s ease-out; }
/* Selector de la manera de restar */
.mpe .mpe-maneras { display: none; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.mpe.mpe-modo-llevo .mpe-opciones { display: flex; }
.mpe.mpe-modo-llevo .mpe-maneras { display: flex; }
.mpe.mpe-modo-llevo .mpe-interruptor { display: none; }
.mpe.mpe-en-final .mpe-opciones { display: none; }
.mpe .mpe-maneras-etq { font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--mpe-suave); margin-right: 4px; }
.mpe .mpe-manera { height: 40px; padding: 0 18px; border-radius: 20px; border: 2px solid var(--mpe-linea); background: #fff; color: var(--mpe-petroleo); font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.mpe .mpe-manera:hover { border-color: var(--mpe-turquesa); }
.mpe .mpe-manera[aria-pressed="true"] { background: var(--mpe-turquesa); border-color: var(--mpe-turquesa); color: #fff; }

/* Multiplicaciones (0.8.0). Por una cifra: como la suma, con la fila del resultado. Por dos o más: una fila por cada
 * cifra de abajo, otra raya y la suma; ahí las cifras son algo menores para que quepa a lo alto. */
.mpe .mpe-cuenta.mpe-mult { grid-template-rows: 24px var(--mpe-alto-llevada, 56px) repeat(2, var(--mpe-celda)) 16px repeat(var(--mpe-parciales, 1), calc(var(--mpe-celda) + 8px)); }
.mpe .mpe-cuenta.mpe-mult.mpe-mult-varias { --mpe-celda: 64px; --mpe-letra: 48px; grid-template-rows: 24px var(--mpe-alto-llevada, 48px) repeat(2, var(--mpe-celda)) 16px repeat(var(--mpe-parciales, 2), calc(var(--mpe-celda) + 6px)) 20px calc(var(--mpe-celda) + 8px); }
/* La cifra de abajo por la que se está multiplicando */
.mpe .mpe-cuenta.mpe-mult .mpe-por::before { content: ""; position: absolute; z-index: -1; left: 4px; right: 4px; top: 4px; bottom: 4px; border-radius: 18px; background: transparent; transition: background .2s; }
.mpe .mpe-cuenta.mpe-mult .mpe-por.activa::before { background: #fdebd8; }
.mpe .mpe-cuenta.mpe-mult .mpe-por.activa { color: #b85c0c; }

/* Suma de cabeza, en fila: «8 + 7 = [ ]» y los puntos para contar */
.mpe .mpe-cuenta.mpe-fila { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; min-height: 250px; }
.mpe .mpe-fila-op { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: var(--mpe-letra); font-weight: 700; line-height: 1; color: var(--mpe-marino); font-variant-numeric: tabular-nums; }
.mpe .mpe-fila-op .mpe-fila-signo { color: var(--mpe-petroleo); }
.mpe .mpe-fila-op .mpe-hueco { align-self: center; width: calc(var(--mpe-celda) * 1.7); height: calc(var(--mpe-celda) + 8px); margin-left: 4px; }
.mpe .mpe-puntos { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 54px; }
.mpe .mpe-puntos-fila { display: flex; gap: 6px; }
.mpe .mpe-punto-c { width: 22px; height: 22px; border-radius: 50%; background: var(--mpe-turquesa); animation: mpe-pon .25s ease-out both; }
.mpe .mpe-punto-c.b { background: var(--mpe-llevada); }
.mpe .mpe-punto-c:nth-child(6) { margin-left: 12px; }
/* Restas: los puntos que se quitan, tachados */
.mpe .mpe-punto-c.q { position: relative; background: #fde9d6; box-shadow: inset 0 0 0 2px #f3c59b; }
.mpe .mpe-punto-c.q::before, .mpe .mpe-punto-c.q::after { content: ""; position: absolute; left: 50%; top: 50%; width: 130%; height: 3px; margin: -1.5px 0 0 -65%; border-radius: 2px; background: var(--mpe-llevada); transform: rotate(45deg); }
.mpe .mpe-punto-c.q::after { transform: rotate(-45deg); }

/* División larga («casita»): dividendo, divisor en su casita, cociente debajo y los restos bajo el dividendo */
.mpe { --mpe-dcelda: 54px; --mpe-dfila: 66px; --mpe-dletra: 46px; }
.mpe .mpe-cuenta.mpe-casita {
  grid-template-columns: 30px repeat(var(--mpe-dcols, 3), var(--mpe-dcelda)) 28px repeat(var(--mpe-ccols, 2), var(--mpe-dcelda));
  grid-template-rows: repeat(var(--mpe-dfilas, 2), var(--mpe-dfila)); align-content: start; padding: 8px 0;
}
/* Con las restas escritas hay el doble de filas: un poco más bajas */
.mpe .mpe-cuenta.mpe-casita.mpe-con-resta { --mpe-dfila: 60px; }
.mpe .mpe-dcifra.mpe-div-menos { color: var(--mpe-petroleo); justify-content: flex-end; padding-right: 2px; font-size: calc(var(--mpe-dletra) * .8); }
.mpe .mpe-cuenta > .mpe-div-raya { z-index: 0; align-self: end; height: 4px; margin: 0 2px -2px; border-radius: 2px; background: var(--mpe-marino); }
/* Interruptor «Escribir las restas» (solo en la división larga) */
.mpe .mpe-opciones { display: none; margin-top: 20px; }
.mpe.mpe-modo-casita .mpe-opciones { display: flex; }
.mpe.mpe-en-final .mpe-opciones { display: none; }
.mpe .mpe-interruptor { display: inline-flex; align-items: center; gap: 12px; padding: 6px 4px; border: 0; background: none; color: var(--mpe-suave); font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.mpe .mpe-interruptor-pista { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; background: #c9dde3; transition: background .15s; }
.mpe .mpe-interruptor-pista::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.mpe .mpe-interruptor[aria-checked="true"] { color: var(--mpe-marino); }
.mpe .mpe-interruptor[aria-checked="true"] .mpe-interruptor-pista { background: var(--mpe-turquesa); }
.mpe .mpe-interruptor[aria-checked="true"] .mpe-interruptor-pista::after { transform: translateX(20px); }
.mpe .mpe-dcifra { display: flex; align-items: center; justify-content: center; font-size: var(--mpe-dletra); font-weight: 700; line-height: 1; color: var(--mpe-marino); font-variant-numeric: tabular-nums; }
.mpe .mpe-dcifra.bajada { color: var(--mpe-llevada); animation: mpe-baja .35s ease-out; }
/* La cifra del dividendo que ya se ha bajado: rayita naranja debajo, como el tic del cuaderno */
.mpe .mpe-dcifra.usada::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 22px; height: 4px; margin-left: -11px; border-radius: 2px; background: var(--mpe-llevada); animation: mpe-pon .25s ease-out; }
.mpe .mpe-cuenta > .mpe-div-caja { z-index: 0; margin: 4px -6px 4px -14px; border-left: 5px solid var(--mpe-marino); border-bottom: 5px solid var(--mpe-marino); border-radius: 0 0 0 4px; }
.mpe .mpe-cuenta > .mpe-div-marca { z-index: 0; margin: 5px 1px; border-radius: 14px; background: transparent; transition: background .2s; }
.mpe .mpe-cuenta > .mpe-div-marca.activa { background: var(--mpe-claro); }
.mpe .mpe-hueco.mpe-dhueco { align-self: center; width: calc(var(--mpe-dcelda) - 8px); height: calc(var(--mpe-dfila) - 10px); border-radius: 13px; font-size: var(--mpe-dletra); }
@keyframes mpe-baja { from { transform: translateY(-24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* El acompañante y su bocadillo */
.mpe .mpe-guia { display: flex; align-items: center; gap: 16px; }
.mpe .mpe-personaje { width: 88px; height: 88px; flex: none; }
.mpe .mpe-personaje svg, .mpe .mpe-personaje img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mpe.mpe-con-personaje .mpe-personaje { width: 104px; height: 104px; }
.mpe.mpe-con-personaje .mpe-personaje-grande { width: 170px; height: 170px; }
/* Cifras como en el cuaderno (1.º y 2.º): la fuente solo trae 0-9; el resto sigue en Montserrat */
.mpe.mpe-cole { font-family: "Cifras MP", Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif; }
.mpe .mpe-bocadillo {
  position: relative; flex: 1; margin: 0; padding: 14px 18px; min-height: 76px;
  display: flex; align-items: center;
  border-radius: 18px; background: var(--mpe-claro); color: var(--mpe-marino);
  font-size: 16px; font-weight: 600; line-height: 1.4;
}
.mpe .mpe-bocadillo::before {
  content: ""; position: absolute; top: 50%; left: -9px; margin-top: -10px;
  border: 10px solid transparent; border-left: 0; border-right-color: var(--mpe-claro);
}
.mpe .mpe-bocadillo.pista { background: #fff3e2; color: #8a4b0f; }
.mpe .mpe-bocadillo.pista::before { border-right-color: #fff3e2; }
.mpe .mpe-bocadillo.bien { background: #e6f6ee; color: #146c43; }
.mpe .mpe-bocadillo.bien::before { border-right-color: #e6f6ee; }

/* Teclado y «Siguiente» (ocupan el mismo sitio) */
.mpe .mpe-pie { min-height: 122px; display: flex; align-items: center; justify-content: center; }
.mpe .mpe-teclado { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mpe .mpe-tecla {
  height: 56px; padding: 0; border-radius: 14px;
  border: 2px solid var(--mpe-linea); border-bottom: 5px solid #b9dfe7; background: #fff;
  font-size: 26px; font-weight: 700; line-height: 1; color: var(--mpe-marino); cursor: pointer;
  transition: border-color .12s, transform .08s;
}
.mpe .mpe-tecla:hover { border-color: var(--mpe-turquesa); }
.mpe .mpe-tecla:active { transform: translateY(2px); border-bottom-width: 3px; }
.mpe .mpe-tecla-extra { display: none; }
.mpe.mpe-modo-fila .mpe-tecla-extra { display: block; }
.mpe .mpe-tecla-borrar { grid-column: span 2; font-size: 24px; color: var(--mpe-petroleo); }
.mpe .mpe-tecla-ok { grid-column: span 3; background: var(--mpe-turquesa); border-color: var(--mpe-turquesa); border-bottom-color: var(--mpe-petroleo); color: #fff; }
.mpe .mpe-tecla-ok:hover { background: #2394a9; border-color: #2394a9; border-bottom-color: var(--mpe-petroleo); }
.mpe .mpe-siguiente, .mpe .mpe-boton {
  height: 64px; padding: 0 40px; border: 0; border-bottom: 5px solid var(--mpe-petroleo); border-radius: 16px;
  background: var(--mpe-turquesa); color: #fff; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: background .15s, transform .08s;
}
.mpe .mpe-siguiente:hover, .mpe .mpe-boton:hover { background: #2394a9; }
.mpe .mpe-siguiente:active, .mpe .mpe-boton:active { transform: translateY(2px); }
.mpe .mpe-siguiente { display: none; width: 100%; }
.mpe.mpe-hecha .mpe-teclado { display: none; }
.mpe.mpe-hecha .mpe-siguiente { display: block; }

/* ---------- final de la ronda ---------- */
.mpe .mpe-final { display: none; }
.mpe.mpe-en-final .mpe-zona { display: none; }
.mpe.mpe-en-final .mpe-final { display: block; margin: 32px auto 0; max-width: 960px; }
.mpe .mpe-final-cab { display: flex; align-items: center; justify-content: center; gap: 32px; }
.mpe .mpe-personaje-grande { width: 150px; height: 150px; }
.mpe .mpe-final .mpe-final-titulo { margin: 0; padding: 0; font-size: 32px; font-weight: 800; line-height: 1.2; color: var(--mpe-marino); }
.mpe .mpe-final .mpe-final-sub { margin: 8px 0 0; padding: 0; font-size: 17px; line-height: 1.4; color: var(--mpe-suave); }
.mpe .mpe-estrellas { display: flex; gap: 8px; margin-top: 16px; }
.mpe .mpe-estrella { width: 36px; height: 36px; animation: mpe-pon .3s ease-out both; }
.mpe .mpe-estrella svg { display: block; width: 100%; height: 100%; fill: #dcecef; }
.mpe .mpe-estrella.llena svg { fill: var(--mpe-ayuda); }
.mpe .mpe-acciones { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 32px; }
.mpe .mpe-boton-2 { background: #fff; color: var(--mpe-petroleo); border: 2px solid var(--mpe-turquesa); border-bottom: 5px solid var(--mpe-turquesa); }
.mpe .mpe-boton-2:hover { background: var(--mpe-claro); }
.mpe .mpe-acciones a.mpe-boton { display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; color: var(--mpe-petroleo); }
.mpe .mpe-estrellas.mpe-estrellas-muchas { gap: 6px; }
.mpe .mpe-estrellas-muchas .mpe-estrella { width: 30px; height: 30px; }
.mpe .mpe-mas.mpe-mas-pares { grid-template-columns: repeat(2, 1fr); }
.mpe .mpe-mas .mpe-t-siguiente { background: #f1fbfd; border-color: #cfe8ee; }
.mpe .mpe-mas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 48px; }
.mpe .mpe-mas .mpe-tarjeta {
  display: block; padding: 20px 24px; border: 2px solid #e3f2f5; border-radius: 18px; background: #fff;
  color: var(--mpe-texto); text-decoration: none; transition: border-color .15s;
}
.mpe .mpe-mas .mpe-tarjeta:hover { border-color: var(--mpe-turquesa); text-decoration: none; }
.mpe .mpe-tarjeta strong { display: block; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--mpe-marino); }
.mpe .mpe-tarjeta span { display: block; margin-top: 8px; font-size: 15px; line-height: 1.4; color: var(--mpe-suave); }
.mpe .mpe-mas .mpe-t-aula { background: #fff8ee; border-color: #fbe3c2; }
.mpe .mpe-mas .mpe-t-aula:hover { border-color: var(--mpe-llevada); }
.mpe .mpe-t-aula strong { color: #8a4b0f; }

@keyframes mpe-latido { 0%, 100% { box-shadow: 0 0 0 6px rgba(41, 165, 188, .18); } 50% { box-shadow: 0 0 0 9px rgba(41, 165, 188, .10); } }
@keyframes mpe-latido-ll { 0%, 100% { box-shadow: 0 0 0 4px rgba(230, 126, 34, .16); } 50% { box-shadow: 0 0 0 7px rgba(230, 126, 34, .08); } }
@keyframes mpe-salto { 0% { transform: translateY(0); } 40% { transform: translateY(-10px) scale(1.08); } 100% { transform: translateY(0); } }
@keyframes mpe-pon { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes mpe-tiembla { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .mpe * { animation: none !important; transition: none !important; } }

/* ---------- pantalla grande (0.5.0): monitor, pizarra o tableta grande ----------
 * Cifras y teclas mayores solo si la pantalla es ancha Y alta: en un portátil bajo el teclado se saldría por abajo.
 * El bocadillo y las pistas no crecen (se partirían en más líneas). La división larga crece menos: tiene muchas filas. */
@media (min-width: 1200px) and (min-height: 860px) {
  .mpe { --mpe-celda: 92px; --mpe-letra: 70px; --mpe-signo: 52px; --mpe-dcelda: 62px; --mpe-dfila: 74px; --mpe-dletra: 52px; }
  .mpe .mpe-zona { max-width: 1040px; grid-template-columns: 1fr 410px; column-gap: 64px; margin-top: 40px; }
  .mpe .mpe-cuenta.mpe-casita.mpe-con-resta { --mpe-dfila: 66px; }
  .mpe .mpe-cuenta.mpe-fila { min-height: 290px; gap: 36px; }
  .mpe .mpe-punto-c { width: 26px; height: 26px; }
  .mpe .mpe-puntos { min-height: 62px; }
  .mpe .mpe-nivel { width: 50px; height: 50px; font-size: 20px; }
  .mpe .mpe-niveles:not(.mpe-con-temas)::before { font-size: 17px; }
  .mpe .mpe-nivel.mpe-tema { width: auto; height: 48px; padding: 0 18px; font-size: 16px; }
  .mpe .mpe-teclado { gap: 12px; }
  .mpe .mpe-tecla { height: 68px; font-size: 30px; border-radius: 16px; }
  .mpe .mpe-pie { min-height: 148px; }
  .mpe .mpe-siguiente { height: 72px; font-size: 22px; }
  .mpe.mpe-con-personaje .mpe-personaje { width: 120px; height: 120px; }
  .mpe .mpe-cuenta.mpe-mult.mpe-mult-varias { --mpe-celda: 76px; --mpe-letra: 58px; }
}

/* ---------- tableta ---------- */
@media (max-width: 860px) {
  .mpe { --mpe-celda: 66px; --mpe-letra: 50px; --mpe-signo: 38px; --mpe-dcelda: 46px; --mpe-dfila: 58px; --mpe-dletra: 40px; }
  .mpe .mpe-zona { grid-template-columns: 1fr 300px; column-gap: 32px; }
  .mpe .mpe-mas, .mpe .mpe-mas.mpe-mas-pares { grid-template-columns: 1fr; }
  .mpe .mpe-cuenta.mpe-mult.mpe-mult-varias { --mpe-celda: 60px; --mpe-letra: 46px; }
}
/* ---------- móvil: todo apilado ---------- */
@media (max-width: 640px) {
  .mpe { --mpe-celda: 56px; --mpe-letra: 42px; --mpe-signo: 34px; --mpe-dcelda: 42px; --mpe-dfila: 54px; --mpe-dletra: 36px; padding: 20px 16px 24px; border-radius: 22px; margin: 16px auto 32px; }
  .mpe .mpe-titular { margin-bottom: 20px; }
  .mpe .mpe-titular, .mpe h2.mpe-titulo, .mpe p.mpe-subtitulo { text-align: center; }
  .mpe h2.mpe-titulo { font-size: 21px; }
  .mpe p.mpe-subtitulo { font-size: 14px; }
  .mpe .mpe-cab { flex-direction: column; align-items: stretch; gap: 12px; }
  .mpe .mpe-niv { flex-direction: column; align-items: stretch; gap: 12px; }
  .mpe .mpe-niveles { justify-content: space-between; }
  .mpe .mpe-nivel { width: 48px; height: 48px; }
  /* «Nivel» en su propia línea, encima: al lado no caben seis círculos */
  .mpe .mpe-niveles:not(.mpe-con-temas) { flex-wrap: wrap; row-gap: 10px; }
  .mpe .mpe-niveles:not(.mpe-con-temas)::before { width: 100%; margin: 0; text-align: center; font-size: 15px; }
  /* con nombre: en filas, cada una a todo el ancho */
  .mpe .mpe-niveles.mpe-con-temas { justify-content: center; gap: 8px; }
  .mpe .mpe-nivel.mpe-tema { flex: 1 1 auto; width: auto; height: 44px; padding: 0 14px; font-size: 15px; }
  .mpe .mpe-desc { text-align: center; font-size: 14px; }
  .mpe .mpe-largo { display: none; }
  .mpe .mpe-progreso { justify-content: center; margin-left: 0; }
  .mpe .mpe-zona { grid-template-columns: 1fr; grid-template-areas: "guia" "cuenta" "pie"; row-gap: 20px; margin-top: 20px; }
  .mpe .mpe-guia { align-self: auto; }
  .mpe .mpe-personaje, .mpe.mpe-con-personaje .mpe-personaje { width: 68px; height: 68px; }
  .mpe.mpe-con-personaje .mpe-personaje-grande { width: 130px; height: 130px; }
  .mpe .mpe-bocadillo { min-height: 64px; padding: 10px 14px; font-size: 15px; }
  .mpe .mpe-cuenta { grid-template-rows: 20px var(--mpe-alto-llevada, 44px) repeat(var(--mpe-sumandos, 2), var(--mpe-celda)) 14px calc(var(--mpe-celda) + 6px); }
  .mpe .mpe-cuenta.mpe-sin-llevadas { --mpe-alto-llevada: 12px; }
  .mpe .mpe-llevada { width: 34px; height: 30px; font-size: 20px; }
  .mpe .mpe-cuenta > .mpe-llevada.mpe-llevada-abajo { width: 22px; height: 26px; margin: 2px 0 0 -8px; font-size: 18px; }
  .mpe .mpe-cuenta.mpe-resta-restando .mpe-llevada { width: 40px; }
  .mpe .mpe-cuenta.mpe-mult { grid-template-rows: 20px var(--mpe-alto-llevada, 44px) repeat(2, var(--mpe-celda)) 14px repeat(var(--mpe-parciales, 1), calc(var(--mpe-celda) + 6px)); }
  .mpe .mpe-cuenta.mpe-mult.mpe-mult-varias { --mpe-celda: 52px; --mpe-letra: 40px; grid-template-rows: 20px var(--mpe-alto-llevada, 40px) repeat(2, var(--mpe-celda)) 14px repeat(var(--mpe-parciales, 2), calc(var(--mpe-celda) + 4px)) 18px calc(var(--mpe-celda) + 6px); }
  .mpe .mpe-maneras { justify-content: center; }
  .mpe .mpe-maneras-etq { width: 100%; text-align: center; margin: 0; }
  .mpe .mpe-cuenta.mpe-fila { gap: 24px; min-height: 0; padding: 12px 0 4px; }
  /* Las columnas encogen si la división no cabe a lo ancho */
  .mpe .mpe-cuenta.mpe-casita { grid-template-columns: 22px repeat(var(--mpe-dcols, 3), minmax(0, var(--mpe-dcelda))) 20px repeat(var(--mpe-ccols, 2), minmax(0, var(--mpe-dcelda))); grid-template-rows: repeat(var(--mpe-dfilas, 2), var(--mpe-dfila)); }
  .mpe .mpe-hueco.mpe-dhueco { justify-self: stretch; width: auto; margin: 0 2px; border-width: 2px; border-radius: 10px; }
  .mpe .mpe-cuenta.mpe-casita.mpe-con-resta { --mpe-dfila: 50px; }
  .mpe .mpe-opciones { justify-content: center; margin-top: 12px; }
  .mpe .mpe-cuenta.mpe-casita.mpe-ancha { --mpe-dcelda: 38px; --mpe-dletra: 32px; }
  .mpe .mpe-cuenta.mpe-casita.mpe-muy-ancha { --mpe-dletra: 28px; }
  .mpe .mpe-cuenta > .mpe-div-caja { margin-left: -11px; border-width: 4px; }
  .mpe .mpe-fila-op { gap: 12px; }
  .mpe .mpe-puntos { min-height: 46px; gap: 8px; }
  .mpe .mpe-puntos-fila { gap: 5px; }
  .mpe .mpe-punto-c { width: 19px; height: 19px; }
  .mpe .mpe-estrellas.mpe-estrellas-muchas { flex-wrap: wrap; justify-content: center; }
  .mpe .mpe-final-cab { flex-direction: column; gap: 16px; text-align: center; }
  .mpe .mpe-estrellas { justify-content: center; }
  .mpe .mpe-personaje-grande { width: 110px; height: 110px; }
  .mpe .mpe-final .mpe-final-titulo { font-size: 26px; }
  .mpe .mpe-acciones { flex-direction: column; align-items: stretch; }
  .mpe .mpe-mas { margin-top: 32px; }
}
@media (max-width: 360px) {
  .mpe .mpe-cuenta.mpe-casita.mpe-ancha { --mpe-dletra: 28px; }
  .mpe .mpe-cuenta.mpe-casita.mpe-muy-ancha { --mpe-dletra: 24px; }
  .mpe { --mpe-celda: 50px; --mpe-letra: 38px; --mpe-signo: 28px; --mpe-dcelda: 38px; --mpe-dfila: 50px; --mpe-dletra: 34px; }
  .mpe .mpe-nivel { width: 42px; height: 42px; }
  .mpe .mpe-nivel.mpe-tema { width: auto; height: 44px; padding: 0 10px; font-size: 14px; } /* 0.8.7: 44, no 42 */
  .mpe .mpe-cuenta.mpe-mult.mpe-mult-varias { --mpe-celda: 48px; --mpe-letra: 36px; }
}
/* Móvil muy estrecho (320 px): seis círculos en una sola fila */
@media (max-width: 340px) {
  .mpe .mpe-niv .mpe-niveles:not(.mpe-con-temas) { column-gap: 4px; } /* .mpe-niv: más fuerte que el «gap: 8px» de problemas y repartos */
  .mpe .mpe-niveles:not(.mpe-con-temas) > .mpe-nivel:not([class*="-sonido"]) { width: 40px; height: 40px; }
}

/* ---------- 0.8.5 (Mikel, 17-11-2026): Primi en TODOS los entrenadores ----------
 * Antes estaba a prueba solo en partes (partes-0.1.1 a 0.1.4). La clase mpe-primi la pone el PHP en todos.
 * Los selectores son a propósito más fuertes que los de cada aparato (que se cargan después y ponían a Primi al lado,
 * con el pico del bocadillo a la izquierda), para que valga igual en todos sin tocar sus hojas.
 * 1) Primi ENCIMA de su bocadillo, sin moverse de su sitio (columna de la derecha en el ordenador; entre el ejercicio
 *    y los botones en el móvil). El bocadillo usa todo el ancho y su pico apunta hacia arriba, a Primi. */
.mpe.mpe-primi div.mpe-guia { flex-direction: column; align-items: flex-start; gap: 10px; }
.mpe.mpe-primi.mpe-con-personaje .mpe-guia > div.mpe-personaje { width: 76px; height: 76px; margin-left: 10px; }
.mpe.mpe-primi .mpe-guia > .mpe-bocadillo { align-self: stretch; flex: none; min-height: 92px; }
.mpe.mpe-primi .mpe-guia > .mpe-bocadillo::before { top: -10px; left: 38px; margin-top: 0; border-width: 0 10px 10px; border-style: solid; border-color: transparent transparent var(--mpe-claro); }
.mpe.mpe-primi .mpe-guia > .mpe-bocadillo.pista::before { border-color: transparent transparent #fff3e2; }
.mpe.mpe-primi .mpe-guia > .mpe-bocadillo.bien::before { border-color: transparent transparent #e6f6ee; }
/* 2) La frase de debajo del título la dice Primi: su dibujo pequeño a la IZQUIERDA (nunca en medio de la frase) y, si hay
 *    audio de esa frase, el botón para oírla (mpe_primi_oir() en el PHP): a la derecha en el ordenador, debajo en el móvil. */
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi img.mpe-mini { flex: none; width: 40px; height: 40px; }
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi .mpe-primi-oir {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  margin-left: 4px; border: 2px solid var(--mpe-linea); border-bottom-width: 4px; border-radius: 50%;
  background: #fff; color: var(--mpe-marino); cursor: pointer; line-height: 1;
}
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi .mpe-primi-oir:hover { border-color: var(--mpe-turquesa); }
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi .mpe-primi-oir[aria-pressed="true"] { background: var(--mpe-marino); border-color: var(--mpe-marino); color: #fff; }
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi .mpe-primi-oir svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi .mpe-primi-oir svg path:first-child { fill: currentColor; }
@media (max-width: 640px) {
  .mpe.mpe-primi div.mpe-guia { gap: 8px; }
  .mpe.mpe-primi.mpe-con-personaje .mpe-guia > div.mpe-personaje { width: 56px; height: 56px; margin-left: 8px; }
  .mpe.mpe-primi .mpe-guia > .mpe-bocadillo { min-height: 68px; }
  .mpe.mpe-primi .mpe-guia > .mpe-bocadillo::before { left: 26px; }
  /* En el móvil el botón va DEBAJO de la frase (Mikel, 17-11): al lado le quitaba ancho y la frase ocupaba una línea más. */
  .mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi {
    display: grid; grid-template-columns: 36px minmax(0, max-content); justify-content: center; align-items: center;
    column-gap: 10px; row-gap: 16px; text-align: left;
  }
  .mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi img.mpe-mini { grid-column: 1; grid-row: 1; width: 36px; height: 36px; }
  .mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi > span { grid-column: 2; grid-row: 1; }
  .mpe.mpe-primi .mpe-titular p.mpe-subtitulo.mpe-con-primi .mpe-primi-oir { grid-column: 2; grid-row: 2; justify-self: start; margin-left: 0; }
}
