/* Kuromate — estilo "kawaii nocturno". Los colores de la ficha están en variables:
   cambiando estas líneas cambias el aspecto de toda la app. Primero el celular; abajo, el computador. */
:root {
  --noche: #1E1433;
  --noche-2: #2C1D4D;
  --morado: #7B4FD6;
  --rosa: #FF6FB5;
  --lila: #C9B6FF;
  --crema: #FFF6E9;
  --amarillo: #FFD34D;
  --menta: #3DDBB0;
  --naranja: #FF9F45;
  --tarjeta: rgba(255, 255, 255, 0.07);
  --borde: rgba(201, 182, 255, 0.28);
  --radio: 28px;
  --sombra: 0 6px 0 rgba(0, 0, 0, 0.25), 0 12px 26px rgba(0, 0, 0, 0.3);
  font-family: "Baloo 2", "Fredoka", system-ui, sans-serif;
  color: var(--crema);
  background: var(--noche);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% -10%, #3A2668 0%, var(--noche) 60%) fixed var(--noche);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.1; }

#app { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 16px 16px 32px; }

/* ---------- Cielo nocturno ---------- */
#cielo { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.estrella {
  position: absolute; width: var(--t); height: var(--t); border-radius: 50%;
  background: var(--crema); box-shadow: 0 0 6px var(--lila);
  animation: titilar 3s ease-in-out infinite;
}
.luna { position: absolute; width: 56px; opacity: 0.8; filter: drop-shadow(0 0 12px rgba(255, 246, 233, 0.5)); }
.luna-1 { top: 5%; right: 5%; }
.luna-2 { bottom: 10%; left: 4%; width: 32px; opacity: 0.45; transform: rotate(160deg); }

/* ---------- Botones y piezas comunes ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 10px 24px; border-radius: 999px;
  background: var(--rosa); color: #fff; font-weight: 800; font-size: 1.2rem;
  box-shadow: 0 5px 0 #C94489, 0 10px 20px rgba(255, 111, 181, 0.25);
  transition: transform 0.1s;
}
.boton:active, .tecla:active, .burbuja:active, .nivel:active, .mundo:active { transform: translateY(3px); }
.boton-grande { width: 100%; min-height: 68px; font-size: 1.45rem; }
.boton-suave { background: var(--tarjeta); color: var(--crema); border: 2px solid var(--borde); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3); }
.boton small, .etiqueta {
  font-size: 0.8rem; font-weight: 700; padding: 0 10px; border-radius: 999px;
  background: var(--lila); color: var(--noche);
}
.fila { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; width: 100%; }
.fila > * { flex: 1 1 140px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 4px 14px;
  border-radius: 999px; background: var(--tarjeta); border: 2px solid var(--borde);
  font-weight: 800; font-size: 1.15rem; white-space: nowrap;
}
.candado { opacity: 0.7; }
.tarjeta { background: var(--tarjeta); border: 2px solid var(--borde); border-radius: var(--radio); padding: 20px; backdrop-filter: blur(4px); }
.centro { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding-top: 3vh; }

/* Globo de diálogo de Moru (la colita arriba, o a la izquierda con .izq). */
.globo {
  position: relative; margin: 0; padding: 10px 16px; border-radius: 22px;
  background: var(--crema); color: var(--noche); font-weight: 600; line-height: 1.3;
}
.globo::before {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  border: 10px solid transparent; border-top: 0; border-bottom-color: var(--crema);
}
.globo.izq::before { top: 50%; left: -10px; transform: translateY(-50%); border: 10px solid transparent; border-left: 0; border-right-color: var(--crema); }

/* ---------- Moru ---------- */
.moru svg { display: block; width: 100%; height: auto; overflow: visible; }
.moru.contenta svg { animation: flotar 3s ease-in-out infinite; }
.moru.celebrando svg { animation: voltereta 0.9s ease-out; }
.moru .ala { transform-box: fill-box; transform-origin: 100% 60%; animation: aletear 1.6s ease-in-out infinite; }
.moru.celebrando .ala { animation-duration: 0.35s; }
.moru-grande { width: min(210px, 52vw); }
.moru-mini { width: 76px; flex: none; }
.moru-maestra { width: 104px; flex: none; }

/* ---------- Primera vez ---------- */
.logo { margin: 0; font-size: 2.8rem; color: var(--lila); text-shadow: 0 0 18px rgba(201, 182, 255, 0.6); }
.bienvenida { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(100%, 440px); }
.entrada {
  width: 100%; padding: 12px; border-radius: 999px; border: 3px solid var(--lila);
  background: var(--noche-2); color: var(--crema); font: inherit; font-size: 1.4rem; font-weight: 700; text-align: center;
}

/* ---------- Mapa de mundos ---------- */
.cabecera { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 14px; }
.contadores { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.mundos { display: grid; gap: 18px; margin: 26px 0; }
.mundo {
  position: relative; display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 4px 14px;
  padding: 18px 16px; border-radius: var(--radio); text-align: left;
  background: linear-gradient(135deg, color-mix(in srgb, var(--color) 30%, transparent), var(--tarjeta));
  border: 2px solid color-mix(in srgb, var(--color) 60%, transparent); box-shadow: var(--sombra);
}
.mundo.apagado { filter: grayscale(0.55); opacity: 0.6; }
.planeta {
  position: relative; grid-row: 1 / span 3; width: 92px; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; font-size: 2.8rem; font-weight: 800; color: #fff;
  background: radial-gradient(circle at 30% 28%, color-mix(in srgb, var(--color) 55%, white), var(--color) 55%, color-mix(in srgb, var(--color) 65%, black));
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, 0.15), 0 0 26px color-mix(in srgb, var(--color) 55%, transparent);
}
.planeta::after { content: ""; position: absolute; inset: 40% -16%; border: 4px solid rgba(255, 246, 233, 0.5); border-radius: 50%; transform: rotate(-18deg); }
.mundo-nombre { font-size: 1.3rem; font-weight: 800; line-height: 1.1; }
.mundo-progreso { font-size: 0.95rem; opacity: 0.85; }
.barra { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: inherit; background: var(--color); }
.insignia {
  position: absolute; top: -12px; right: 16px; padding: 2px 12px; border-radius: 999px;
  background: var(--amarillo); color: var(--noche); font-weight: 800; font-size: 0.9rem;
}
.insignia.gris { background: var(--lila); }
.abajo { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Camino de niveles ---------- */
.camino-cabeza { display: flex; align-items: center; gap: 10px; }
.camino-cabeza h2 { flex: 1; margin: 0; font-size: 1.3rem; text-align: center; }
.camino { --paso: min(24vw, 130px); display: flex; flex-direction: column; align-items: center; padding: 28px 0 40px; }
.parada, .tramo { transform: translateX(calc(var(--x) * var(--paso))); }
.parada { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tramo { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; }
.tramo i { width: 10px; height: 10px; border-radius: 50%; background: var(--lila); opacity: 0.45; }
.nivel {
  width: 84px; height: 84px; border-radius: 50%; font-size: 2rem; font-weight: 800;
  background: var(--noche-2); border: 4px solid var(--borde); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}
.nivel.hecho { background: var(--rosa); border-color: #FFC2E0; color: #fff; }
.nivel.siguiente { background: var(--amarillo); border-color: #fff; color: var(--noche); animation: brillar 1.4s ease-in-out infinite; }
.nivel.bloqueado, .nivel.pronto { font-size: 1.6rem; opacity: 0.55; }
.estrellitas { color: var(--amarillo); font-size: 1.3rem; letter-spacing: 2px; }
.moru-guia { position: absolute; top: -6px; left: calc(100% + 4px); width: 62px; }
.moru-guia.izq { left: auto; right: calc(100% + 4px); }

/* ---------- Cuadros y avisos ---------- */
.modal-fondo { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(10, 5, 25, 0.72); animation: aparecer 0.2s; }
.modal {
  width: min(100%, 400px); display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px 20px; border-radius: var(--radio); background: var(--noche-2); border: 3px solid var(--lila);
  text-align: center; animation: saltar 0.3s;
}
.modal h3, .modal p { margin: 0; }
.modal h3 { font-size: 1.5rem; }
.aviso {
  position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 22px;
  background: var(--crema); color: var(--noche); font-weight: 700; text-align: center;
  box-shadow: var(--sombra); pointer-events: none; animation: aparecer 0.25s;
}

/* ---------- Reto ---------- */
.reto { display: flex; flex-direction: column; min-height: calc(100dvh - 48px); }
.reto-arriba { display: flex; align-items: center; gap: 10px; }
.boton-icono { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--tarjeta); border: 2px solid var(--borde); font-size: 1.3rem; font-weight: 800; }
.avance { flex: 1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.casilla { height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); transition: background 0.3s; }
.casilla.actual { background: var(--lila); }
.casilla.bien { background: var(--menta); }
.casilla.medio { background: linear-gradient(90deg, var(--menta) 50%, rgba(255, 255, 255, 0.14) 50%); }
.casilla.mal { background: var(--naranja); }
.mascota-reto { flex: none; width: 58px; }
.zona { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 16px 0; }
.operacion { font-size: clamp(2.6rem, 12vw, 4.2rem); font-weight: 800; line-height: 1.1; text-align: center; }
.hueco { display: inline-block; min-width: 1.6em; padding: 0 0.15em; border-bottom: 5px dashed var(--lila); color: var(--lila); }
.hueco.lleno { color: var(--crema); border-bottom-style: solid; }
.hueco.acierto { color: var(--menta); border-color: var(--menta); }
.hueco.fallo { color: var(--naranja); border-color: var(--naranja); }
.otra-vez { margin: 0; color: var(--amarillo); font-size: 1.4rem; font-weight: 800; }
.mensaje { margin: 0; color: var(--amarillo); font-size: 1.5rem; font-weight: 800; text-align: center; animation: saltar 0.4s; }

.burbujas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: min(100%, 440px); }
.burbuja {
  min-height: 88px; border-radius: 44px; font-size: 2.1rem; font-weight: 800; color: #fff;
  background: radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.4), transparent 32%), var(--morado);
  box-shadow: 0 6px 0 #4E2F99;
}
.burbuja.correcta { background: var(--menta); color: var(--noche); box-shadow: 0 6px 0 #22A07F; animation: saltar 0.4s; }
.burbuja.incorrecta { background: var(--naranja); box-shadow: 0 6px 0 #C46F1F; animation: temblar 0.4s; }

.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 360px); }
.tecla {
  min-height: 64px; border-radius: 22px; font-size: 1.9rem; font-weight: 800;
  background: var(--tarjeta); border: 2px solid var(--borde); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3);
}
.tecla.ok { background: var(--menta); color: var(--noche); }
.tecla.borrar { background: rgba(255, 111, 181, 0.25); }

/* ---------- Explicación con pizarra ---------- */
.explicacion { width: min(100%, 620px); display: flex; flex-direction: column; gap: 14px; }
.explicacion-cabeza { display: flex; align-items: center; gap: 14px; }
.pizarra {
  min-height: 250px; padding: 14px 16px 18px; border-radius: 24px; font-size: 1.15rem;
  background: #15102A; border: 8px solid #8A6BD9; box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}
.contador { color: var(--lila); font-size: 0.9rem; font-weight: 700; }
.paso { animation: aparecer 0.3s; }
.paso p { margin: 4px 0 14px; }
.puntos { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 4px; width: min(100%, calc(var(--cols) * 30px)); margin: 0 auto; }
.punto { aspect-ratio: 1; border-radius: 50%; background: var(--rosa); animation: brotar 0.3s both; }
.punto.b { background: var(--lila); }
.punto.tachado { background: transparent; border: 2px dashed var(--naranja); }
.grande { margin-top: 12px; font-size: clamp(1.7rem, 8vw, 2.6rem); font-weight: 800; text-align: center; color: var(--amarillo); overflow-wrap: anywhere; }
.grande .ceros { display: inline-block; color: var(--rosa); animation: brotar 0.6s 0.4s both; }
.lineas div { font-size: 1.5rem; font-weight: 700; text-align: center; animation: brotar 0.4s both; }

/* ---------- Lección antes del nivel ---------- */
.leccion-titulo { flex: 1; margin: 0; font-size: 1.15rem; line-height: 1.2; }
.columna { display: grid; grid-template-columns: repeat(var(--ancho), 0.68em); justify-content: center; margin-top: 8px; font-size: 2rem; font-weight: 800; line-height: 1.2; color: var(--amarillo); }
.columna span { text-align: center; animation: brotar 0.4s both; }
.columna .llevo { font-size: 1.1rem; align-self: end; color: var(--rosa); }
.columna .raya { grid-column: 1 / -1; height: 4px; margin: 4px 0; border-radius: 2px; background: var(--amarillo); animation: brotar 0.4s both; }
.operacion-chica { font-size: clamp(2rem, 10vw, 3rem); margin-bottom: 12px; }
.pista { margin: 0 0 12px; padding: 10px 14px; border-radius: 16px; background: rgba(255, 211, 77, 0.15); color: var(--amarillo); font-weight: 700; animation: saltar 0.3s; }
.pizarra .burbujas { margin: 0 auto; }
.burbuja:disabled { opacity: 0.6; }

/* Moru se puede tocar para que repita lo que dijo */
.moru-boton, .mascota-reto { background: none; border: 0; padding: 0; cursor: pointer; }

/* Filas de puntos para tocar y contar */
.puntos-tocar { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fila-puntos {
  display: grid; grid-template-columns: repeat(var(--cols), 30px); gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 2px dashed var(--borde);
}
.fila-puntos .punto { width: 30px; background: rgba(255, 111, 181, 0.25); animation: none; }
.fila-puntos.contada { border-style: solid; border-color: var(--rosa); }
.fila-puntos.contada .punto { background: var(--rosa); animation: brotar 0.3s both; }
.cuenta { margin-top: 10px; text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--lila); }

/* Video de YouTube */
.modal:has(.video) { width: min(100%, 720px); }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.credito { font-size: 0.85rem; color: var(--lila); }

/* Operación en columna para resolver (reto) */
.consigna { margin: 0; color: var(--lila); font-size: 1.15rem; font-weight: 700; }
.col-reto { display: grid; grid-template-columns: repeat(var(--ancho), 46px); gap: 6px 4px; justify-content: center; font-size: 2rem; font-weight: 800; }
.col-reto > span { display: grid; place-items: center; height: 50px; }
.col-reto .por { color: var(--lila); }
.col-reto .cero { color: var(--lila); }
.col-reto .raya { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--crema); }
.casilla-col {
  height: 50px; border-radius: 12px; font-size: 1.9rem; font-weight: 800; color: var(--crema);
  background: rgba(255, 255, 255, 0.06); border: 2px dashed var(--borde);
}
.casilla-col.llevada { height: 34px; width: 34px; justify-self: center; align-self: end; font-size: 1.1rem; color: var(--rosa); border-radius: 50%; }
.casilla-col.activa { border: 3px solid var(--amarillo); background: rgba(255, 211, 77, 0.15); }
.casilla-col.bien { border: 2px solid var(--menta); color: var(--menta); }
.casilla-col.mal { border: 2px solid var(--naranja); color: var(--naranja); }

/* ---------- Resultado ---------- */
.resultado h2 { margin: 0; font-size: 2.2rem; }
.estrellas-grandes { display: flex; gap: 10px; font-size: 4.2rem; line-height: 1; }
.estrellas-grandes span { color: rgba(255, 255, 255, 0.15); }
.estrellas-grandes .llena { color: var(--amarillo); text-shadow: 0 0 22px rgba(255, 211, 77, 0.7); animation: brotar 0.5s both; }
.aciertos { margin: 0; font-size: 1.3rem; font-weight: 700; }
.nuevo { margin: 0; color: var(--menta); font-size: 1.25rem; font-weight: 800; }
.resultado .fila { max-width: 520px; }
.confeti { position: fixed; inset: 0; z-index: 10; overflow: hidden; pointer-events: none; }
.confeti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: caer linear both; }

/* ---------- Animaciones ---------- */
@keyframes titilar { 50% { opacity: 0.25; transform: scale(0.7); } }
@keyframes flotar { 50% { transform: translateY(-6px); } }
@keyframes voltereta { 0% { transform: translateY(0) rotate(0); } 45% { transform: translateY(-24px) rotate(-180deg); } 100% { transform: translateY(0) rotate(-360deg); } }
@keyframes aletear { 50% { transform: scaleX(0.82) rotate(6deg); } }
@keyframes brillar { 50% { transform: scale(1.07); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35), 0 0 30px 8px rgba(255, 211, 77, 0.6); } }
@keyframes saltar { 0% { transform: scale(0.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes temblar { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes brotar { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
@keyframes aparecer { from { opacity: 0; } }
@keyframes caer { to { transform: translateY(110vh) rotate(720deg); } }

/* Si el aparato pide menos movimiento, quitamos las animaciones largas. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Computador y tabletas ---------- */
@media (min-width: 640px) {
  #app { padding: 24px 24px 40px; }
  .cabecera { grid-template-columns: auto 1fr auto; }
  .contadores { grid-column: auto; }
  .mundos { grid-template-columns: 1fr 1fr; }
  .abajo { max-width: 540px; margin: 0 auto; }
  .camino-cabeza h2 { font-size: 1.7rem; }
  .moru-mini { width: 92px; }
}

/* Moru se mueve mientras habla (clase que pone js/voz.js en el body). */
@keyframes moru-hablando {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-3px) rotate(-2deg); }
  75% { transform: translateY(-1px) rotate(2deg); }
}
.moru-habla .moru-maestra .moru,
.moru-habla .mascota-reto .moru,
.moru-habla .cabecera .moru-mini,
.moru-habla .bienvenida .moru-grande { animation: moru-hablando 0.5s ease-in-out infinite; transform-origin: 50% 90%; }
@media (prefers-reduced-motion: reduce) {
  .moru-habla .moru { animation: none !important; }
}

/* ---------- Etapa 2: los 4 mundos ---------- */
/* Cada mundo pinta su camino y sus niveles hechos con su color (--color). */
.camino .nivel.hecho { background: var(--color, var(--rosa)); }
.camino-cabeza h2 { color: var(--color, var(--crema)); }
.operacion-mini { font-size: clamp(1.5rem, 7vw, 2.4rem); }
.enunciado { margin: 0; max-width: 560px; font-size: 1.35rem; font-weight: 700; line-height: 1.35; text-align: center; }
.ayuda { margin: 0; color: var(--lila); font-size: 1rem; text-align: center; }

/* Fracciones escritas una sobre otra. */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin: 0 0.08em; }
.frac > span { padding: 0 0.12em; }
.frac > span:first-child { border-bottom: 0.08em solid currentColor; padding-bottom: 0.06em; }
.frac > span:last-child { padding-top: 0.06em; }
.frac .hueco { min-width: 1.2em; }
.operacion .frac { font-size: 0.8em; }
.burbuja .frac { font-size: 0.8em; }

/* Dibujos de fracciones (pizza y barra). */
.figuras { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin: 10px 0; }
.figura-caja { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 1.3rem; color: var(--amarillo); }
.figura { display: block; overflow: visible; }
.figura.pizza { width: 96px; height: 96px; }
.figura.barra { width: min(240px, 70vw); height: auto; }
.grande-fig .figura.pizza { width: 150px; height: 150px; }
.grande-fig .figura.barra { width: min(300px, 80vw); }
.parte { fill: rgba(201, 182, 255, 0.14); stroke: var(--crema); stroke-width: 2; transition: fill 0.2s; }
.parte.pintada { fill: var(--rosa); }
.tocable .parte { cursor: pointer; }
.pintar { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* Burbujas de 3 (signos) y burbujas con dibujos. */
.burbujas.tres { grid-template-columns: repeat(3, 1fr); }
.burbujas.con-dibujos .burbuja { min-height: 110px; padding: 10px; display: grid; place-items: center; }
.burbujas.con-dibujos .figura.pizza { width: 80px; height: 80px; }
.burbujas.con-dibujos .figura.barra { width: 100%; }

/* Teclado con coma (una fila más) y casillas dobles: fracción o cociente + residuo. */
.teclado.con-coma .tecla.ok { grid-column: 1 / -1; }
.entrada-doble { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.doble { display: flex; align-items: center; gap: 14px; }
.fraccion-entrada { flex-direction: column; gap: 6px; }
.raya-frac { width: 100px; height: 5px; border-radius: 3px; background: var(--crema); }
.campo-caja { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--lila); font-weight: 700; }
.campo {
  min-width: 92px; height: 64px; padding: 0 10px; border-radius: 18px; font-size: 2.2rem; font-weight: 800; color: var(--crema);
  background: var(--tarjeta); border: 3px dashed var(--lila);
}
.campo.activo { border: 3px solid var(--amarillo); background: rgba(255, 211, 77, 0.15); }
.campo.bien { border: 3px solid var(--menta); color: var(--menta); }
.campo.mal { border: 3px solid var(--naranja); color: var(--naranja); }

/* División en galera: dividendo con sus restas a la izquierda, divisor y cociente a la derecha. */
.galera { display: flex; justify-content: center; align-items: flex-start; gap: 4px; margin-top: 8px; }
.galera .columna { justify-content: end; margin-top: 0; }
.galera-der { display: flex; flex-direction: column; font-size: 2rem; font-weight: 800; line-height: 1.2; color: var(--amarillo); }
.galera-der .divisor { padding: 0 10px; border-left: 4px solid var(--amarillo); border-bottom: 4px solid var(--amarillo); }
.galera-der .cociente { padding: 0 10px; color: var(--menta); }

/* ---------- Etapa 3: premios y diagnóstico ---------- */
/* Camino: niveles abiertos (por el diagnóstico) que no son el que brilla. */
.nivel.abierto { border-color: var(--lila); color: var(--crema); }

/* Diagnóstico: casillas neutras (no se marca bien o mal) y el nombre del mundo. */
.casilla.hecha { background: var(--lila); }
.diagnostico .casilla.actual { background: var(--color, var(--amarillo)); }
.diagnostico .avance { gap: 3px; }
.rotulo-mundo { margin: 10px 0 0; text-align: center; font-weight: 800; font-size: 1.1rem; color: var(--color, var(--lila)); }
.lista-desde { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; width: min(100%, 420px); text-align: left; }
.lista-desde li { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 20px; background: var(--tarjeta); border: 2px solid color-mix(in srgb, var(--color) 60%, transparent); }
.planeta.mini { grid-row: auto; flex: none; width: 46px; font-size: 1.4rem; }
.planeta.mini::after { border-width: 3px; }

/* Stickers. */
.sticker { display: block; }
.sticker svg { display: block; width: 100%; height: auto; overflow: visible; }
.coleccion { margin: 22px 0; }
.coleccion h3 { margin: 0 0 10px; color: var(--color); font-size: 1.4rem; }
.coleccion h3 small { color: var(--lila); font-size: 0.95rem; font-weight: 700; }
.stickers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sticker-caja {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 8px; border-radius: 22px;
  background: var(--tarjeta); border: 2px solid color-mix(in srgb, var(--color) 45%, transparent);
}
.sticker-caja .sticker { width: 100%; max-width: 90px; }
.sticker-caja.falta { border-style: dashed; border-color: var(--borde); }
.sticker-caja.falta .sticker svg { filter: brightness(0) invert(1) opacity(0.16); }
.sticker-nombre { font-size: 0.85rem; font-weight: 700; line-height: 1.1; text-align: center; }
.sticker-caja.falta .sticker-nombre { opacity: 0.6; }
.sticker-grande { width: min(180px, 50vw); animation: saltar 0.5s; }
.sticker-nuevo {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; border-radius: 24px;
  background: rgba(255, 211, 77, 0.14); border: 2px solid var(--amarillo); color: var(--amarillo);
  font-weight: 800; font-size: 1.15rem; text-align: left; animation: brotar 0.6s 1.2s both;
}
.sticker-nuevo .sticker { width: 74px; animation: voltereta 0.9s 1.6s both; }
.sticker-nuevo strong { display: block; color: var(--crema); font-size: 1.35rem; }

/* Armario. */
.armario { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 12px; }
.armario-moru { display: grid; place-items: center; min-height: 230px; }
.armario-detalle { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(100%, 440px); min-height: 70px; text-align: center; }
.armario-detalle p { margin: 0; }
.armario-nombre { font-size: 1.25rem; }
.prendas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.prenda {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 22px;
  background: var(--tarjeta); border: 2px solid var(--borde); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3);
}
.prenda:active { transform: translateY(3px); }
.prenda-dibujo { display: grid; place-items: center; width: 100%; height: 64px; }
.prenda-dibujo svg { max-width: 86%; max-height: 64px; overflow: visible; }
.prenda-nombre { font-size: 0.9rem; font-weight: 700; line-height: 1.1; text-align: center; }
.prenda-precio { font-size: 0.95rem; font-weight: 800; color: var(--amarillo); }
.prenda.tiene { border-color: var(--menta); }
.prenda.tiene .prenda-precio { color: var(--menta); }
.prenda.puesta { background: color-mix(in srgb, var(--menta) 22%, transparent); border-width: 3px; }
.prenda.elegida { border: 3px solid var(--amarillo); }

@media (min-width: 640px) {
  .stickers { grid-template-columns: repeat(8, 1fr); }
  .prendas { grid-template-columns: repeat(4, 1fr); max-width: 640px; }
}
.sticker-caja { justify-content: flex-start; }
.moru-habla .armario-moru .moru, .moru-habla .bienvenida .moru-grande { animation: moru-hablando 0.5s ease-in-out infinite; transform-origin: 50% 90%; }

/* ---------- Etapa 4: sesión, PIN, zona de papá ---------- */
.formulario { gap: 12px; }
.titulo-form { margin: 0; font-size: 1.5rem; }
.texto-form { margin: 0; line-height: 1.35; text-align: center; }
.campo-texto { font-size: 1.15rem; text-align: left; padding: 12px 18px; }
.error-form { margin: 0; padding: 8px 14px; border-radius: 14px; background: rgba(255, 159, 69, 0.18); color: var(--naranja); font-weight: 700; }
.boton:disabled { opacity: 0.6; }

/* PIN */
.pin h2 { margin: 0; font-size: 1.7rem; }
.candado-grande { font-size: 3rem; }
.pin-puntos { display: flex; gap: 18px; margin: 6px 0 4px; }
.pin-puntos i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--lila); transition: background 0.15s; }
.pin-puntos i.lleno { background: var(--lila); }
.pin-puntos.temblar { animation: temblar 0.4s; }
.teclado-pin { display: flex; justify-content: center; width: 100%; }
.pin .fila { max-width: 420px; }

/* Meta del día en el mapa */
.meta-dia { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-weight: 700; --color: var(--amarillo); }
.meta-dia.cumplida { color: var(--amarillo); }

/* Zona de papá */
.papa { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.papa-seccion { padding: 16px; border-radius: var(--radio); background: var(--tarjeta); border: 2px solid var(--borde); }
.papa-seccion h3 { margin: 0 0 12px; font-size: 1.3rem; color: var(--lila); }
.papa-cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.dato { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 16px; background: rgba(0, 0, 0, 0.2); }
.dato strong { font-size: 1.35rem; line-height: 1.1; }
.dato span { font-size: 0.85rem; opacity: 0.8; line-height: 1.2; }
.nota { margin: 8px 0 0; font-size: 0.92rem; opacity: 0.85; line-height: 1.35; }
.papa-mundo { padding: 12px 0 14px; border-top: 2px solid var(--borde); }
.papa-mundo:first-of-type { border-top: 0; padding-top: 0; }
.papa-mundo-cabeza { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.papa-mundo-cabeza strong { display: block; color: var(--color); font-size: 1.15rem; }
.papa-mundo-cabeza small { display: block; line-height: 1.2; }
.barras { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 96px; margin-top: 12px; align-items: end; }
.barra-dia { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.barra-dia i { display: block; width: 70%; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--color); }
.barra-dia small { font-size: 0.8rem; opacity: 0.75; }
.barra-n { font-size: 0.75rem; font-weight: 700; }
.papa-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.papa-lista li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); border-left: 5px solid var(--color); line-height: 1.3; }
.papa-lista small { flex: none; color: var(--amarillo); font-weight: 700; }
.ajuste { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ajuste-nombre { font-weight: 800; }
.fila-nombre { display: flex; gap: 8px; }
.fila-nombre .entrada { flex: 1; min-width: 0; }
.fila-nombre .boton { min-height: 48px; padding: 6px 18px; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opcion { min-width: 48px; min-height: 44px; padding: 4px 14px; border-radius: 999px; border: 2px solid var(--borde); background: rgba(0, 0, 0, 0.2); font-weight: 800; }
.chip-opcion.activo { background: var(--lila); color: var(--noche); border-color: var(--lila); }
.teclado-pin .tecla.ok { visibility: hidden; }
