:root {
  --bg: #f4f9ff; --card: #ffffff; --ink: #10233d; --muted: #5a6f8a; --line: #dbe6f3;
  --accent: #1f7ae0; --accent-dark: #135bb0; --ok: #2fa84f; --ok-bg: #e5f7ea; --ko: #d64545; --ko-bg: #fdeaea;
  --gold: #f4b400; --fire: #ff7a1a; --lock: #b8c4d3;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1726; --card: #15243a; --ink: #eaf2ff; --muted: #9fb3cc; --line: #26405f;
          --accent: #5aa6ff; --accent-dark: #3d87e0; --ok-bg: #12351f; --ko-bg: #3a1717; --lock: #3b5170; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
button { font: inherit; cursor: pointer; }
.btn { display: block; width: 100%; border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 700;
  background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-dark); transition: transform .05s; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark); }
.btn[disabled] { background: var(--lock); box-shadow: none; cursor: default; }
.btn.sec { background: var(--card); color: var(--accent); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ok { background: var(--ok); box-shadow: 0 4px 0 #1f7a37; }
.btn.ko { background: var(--ko); box-shadow: 0 4px 0 #9e2c2c; }
.card { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: 0 6px 24px rgba(16,35,61,.07); }
input { font: inherit; width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); margin: 6px 0 12px; }
label { font-weight: 600; font-size: .9rem; color: var(--muted); }
.error { color: var(--ko); font-weight: 600; min-height: 1.5em; }
.muted { color: var(--muted); }
.centro { text-align: center; }
.espacio > * + * { margin-top: 14px; }

/* barra superior */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-weight: 700; }
.top .marca { font-size: 1.25rem; margin-right: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--card); }
.chip.fuego { color: var(--fire); } .chip.xp { color: var(--gold); }
.chip.apagado { color: var(--muted); filter: grayscale(1); }
.promo { background: linear-gradient(135deg, #1f7ae0, #6a5cff); color: #fff; border-radius: 16px; padding: 12px 14px;
  font-size: .92rem; margin-bottom: 14px; }
.meta { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meta > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .4s; }

/* pingüino */
.pingu { display: flex; align-items: flex-end; gap: 10px; margin: 6px 0 16px; }
.pingu .cara { font-size: 52px; line-height: 1; flex: none; transition: transform .2s; }
.pingu .cara.salta { animation: salta .5s; } .pingu .cara.tiembla { animation: tiembla .4s; }
.pingu .bocadillo { background: var(--card); border: 2px solid var(--line); border-radius: 16px 16px 16px 4px;
  padding: 10px 12px; font-size: .95rem; }
@keyframes salta { 30% { transform: translateY(-14px) rotate(-6deg); } 60% { transform: translateY(0); } }
@keyframes tiembla { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

/* camino */
.seccion { margin: 22px 0 8px; }
.seccion h2 { font-size: 1.05rem; } .seccion p { margin: 0; font-size: .85rem; }
.camino { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 8px 0; }
.nodo { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 200px; text-align: center; }
.nodo:nth-child(4n+2) { transform: translateX(-60px); } .nodo:nth-child(4n+4) { transform: translateX(60px); }
.nodo button { width: 76px; height: 72px; border-radius: 50%; border: 0; font-size: 1.7rem; color: #fff;
  background: var(--accent); box-shadow: 0 6px 0 var(--accent-dark); position: relative; }
.nodo.completada button { background: var(--gold); box-shadow: 0 6px 0 #c48f00; }
.nodo.bloqueada button { background: var(--lock); box-shadow: 0 6px 0 var(--line); cursor: default; }
.nodo small { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.repaso { margin: 10px 0 4px; }

/* lección */
.cab { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cerrar { background: none; border: 0; font-size: 1.6rem; color: var(--muted); padding: 0 4px; }
.progreso { flex: 1; height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progreso > i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.enunciado { font-size: 1.12rem; font-weight: 650; margin: 6px 0 16px; }
.opciones { display: grid; gap: 10px; }
.opcion { text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.opcion .letra { display: inline-block; width: 1.6em; font-weight: 800; color: var(--muted); }
.opcion.sel { border-color: var(--accent); background: rgba(31,122,224,.08); box-shadow: 0 3px 0 var(--accent); }
.opcion.bien { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 3px 0 var(--ok); }
.opcion.mal { border-color: var(--ko); background: var(--ko-bg); box-shadow: 0 3px 0 var(--ko); }
.pie { position: sticky; bottom: 0; padding: 14px 0 calc(6px + env(safe-area-inset-bottom)); background: var(--bg); }
.pie.corregida { position: static; }  /* con la corrección, que no tape las opciones */
.salir { border: 0; font-size: .8rem; color: var(--muted); }
.feedback { border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; }
.feedback.bien { background: var(--ok-bg); } .feedback.mal { background: var(--ko-bg); }
.feedback h3 { margin: 0 0 6px; } .feedback.bien h3 { color: var(--ok); } .feedback.mal h3 { color: var(--ko); }
.cita { border-left: 4px solid var(--line); padding-left: 10px; font-style: italic; margin: 8px 0 4px; font-size: .92rem; }
.fuente { font-size: .78rem; color: var(--muted); }
.fuente a { color: inherit; }
.final .grande { font-size: 3rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats div { background: var(--card); border-radius: 16px; padding: 12px 6px; text-align: center; }
.stats b { display: block; font-size: 1.4rem; }
.lista-opos button { text-align: left; }
footer.legal { margin-top: 28px; font-size: .72rem; color: var(--muted); text-align: center; }
