/* ============================================================================
   estilo.css · Estilo pixel art de SK Arcade (tema claro «papel» y oscuro «CRT»)
   ============================================================================ */
:root {
  --bg: #f2e6c9; --panel: #e4d3a8; --card: #fff7e4; --text: #2b2118; --muted: #735f49; --faint: #ad9a7c; --line: #2b2118;
  --accent: #1f78c1; --accent-bg: #d6ecfa; --on-accent: #fff7e4;
  --ok: #2f9e4f; --okbg: #d9f2c7; --on-ok: #fff7e4; --bad: #c8334a; --badbg: #f9d4d4; --gold: #c98a00; --arc: #8c7a62; --dot: #e0cfa3; --hair: #d9c9a3; --grid: #efe3c6;
  --izq: 0px; --der: 0px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1c2c; --panel: #262b44; --card: #2f3656; --text: #f4f4f4; --muted: #94b0c2; --faint: #5d6f8a; --line: #0b0c16;
    --accent: #41a6f6; --accent-bg: #203a5c; --on-accent: #0b0c16;
    --ok: #38b764; --okbg: #1d3a2c; --on-ok: #0b0c16; --bad: #ef4a5f; --badbg: #42202e; --gold: #ffcd4a; --arc: #7d8fb0; --dot: #232842; --hair: #3a4166; --grid: #2a3050;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background-color: var(--bg); color: var(--text);
       background-image: radial-gradient(var(--dot) 1.5px, transparent 1.6px); background-size: 16px 16px;
       font: 15px/1.55 Consolas, "Lucida Console", "Courier New", ui-monospace, monospace; }
@media (prefers-color-scheme: dark) {
  body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60;
                background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.14) 2px 3px); }
}
button { font: inherit; color: var(--text); cursor: pointer; touch-action: manipulation; background: none; border: 0; }
.m, .m i, i { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 3px; line-height: 1.3; }
.fr > span:last-child { border-top: 2px solid currentColor; padding-top: 1px; }
.hidden { display: none !important; }
svg.pxt, svg.spr { display: inline-block; vertical-align: middle; max-width: 100%; height: auto; image-rendering: pixelated; }
.screen { max-width: 760px; margin: 0 auto; padding: 16px 16px 130px; }

/* ---------- cajas y botones pixel */
.box { --e: 4px; background: var(--card); margin: var(--e);
       box-shadow: 0 calc(-1 * var(--e)) 0 0 var(--line), 0 var(--e) 0 0 var(--line), calc(-1 * var(--e)) 0 0 0 var(--line), var(--e) 0 0 0 var(--line); }
.btn { --c: var(--ok); --on: var(--on-ok); display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 8px);
       margin: 4px; padding: 14px 12px; background: var(--c); color: var(--on);
       box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
                   inset -4px -5px 0 0 rgba(0,0,0,.28), inset 4px 4px 0 0 rgba(255,255,255,.28); }
.btn:active { transform: translateY(2px); box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line), inset 4px 5px 0 0 rgba(0,0,0,.28); }
.btn.blue { --c: var(--accent); --on: var(--on-accent); }
.btn:disabled { --c: var(--panel); --on: var(--faint); cursor: default; transform: none; }
.sbtn { background: var(--card); color: var(--text); margin: 3px; padding: 6px 10px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
        box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line), inset -3px -3px 0 0 rgba(0,0,0,.12); }
.sbtn:active { transform: translateY(2px); }
.ibtn { padding: 4px; line-height: 0; color: var(--text); }
.ibtn:hover { background: var(--panel); }

/* ---------- título */
#title { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; cursor: pointer; padding-bottom: 40px; }
#title .sub { color: var(--muted); max-width: 440px; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.bob { animation: bob .8s steps(1) infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- mesa: cuaderno a la izquierda, juego al centro, libro a la derecha */
.mesa { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; }
.panel { position: sticky; top: 0; height: 100vh; display: flex; z-index: 30; }
.panel.izq { grid-column: 1; } .centro { grid-column: 2; min-width: 0; } .panel.der { grid-column: 3; flex-direction: row-reverse; }
.lomo { width: 42px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 14px; position: relative; color: #fff1e8;
        box-shadow: inset -4px 0 0 rgba(0,0,0,.25), inset 4px 0 0 rgba(255,255,255,.15); }
.izq .lomo { background-color: #6b7a8f; border-right: 4px solid var(--line);
             background-image: repeating-linear-gradient(transparent 0 14px, rgba(0,0,0,.35) 14px 20px); }   /* espiral del cuaderno */
.der .lomo { background-color: #a5281b; border-left: 4px solid var(--line); }                                 /* lomo del libro */
.lomo .ic { background: var(--card); padding: 4px; line-height: 0; box-shadow: 0 0 0 3px var(--line); }
.lomo .vt { writing-mode: vertical-rl; font-weight: 700; letter-spacing: .25em; font-size: 13px; background: rgba(0,0,0,.45); padding: 8px 3px; }
.lomo .aviso { position: absolute; top: 4px; right: 2px; background: var(--gold); color: #2b2118; font-weight: 700; font-size: 11px; padding: 0 4px; box-shadow: 0 0 0 2px var(--line); animation: blink .8s steps(1) infinite; }
.cuerpo { width: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--card); }
.panel.abierto .cuerpo { width: 330px; }
.izq.abierto .cuerpo { border-right: 4px solid var(--line); } .der.abierto .cuerpo { border-left: 4px solid var(--line); }
.pcab { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 4px solid var(--line); line-height: 0; flex: none; }
.pcab .ibtn { display: none; }
.ppie { display: flex; justify-content: space-between; align-items: center; padding: 6px; border-top: 4px solid var(--line); font-size: 12.5px; color: var(--muted); flex: none; }
.hoja { flex: 1; overflow-y: auto; min-width: 0; }
/* el cuaderno y el libro son de papel: sus colores no cambian con el tema */
#cuHoja { color: #23304d; padding: 0 14px 28px 52px; line-height: 28px; font-size: 15px;
          font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
          background-color: #fffbe8; background-attachment: local;
          background-image: linear-gradient(90deg, transparent 40px, #e08a8a 40px, #e08a8a 42px, transparent 42px), repeating-linear-gradient(transparent 0 27px, #b9cde4 27px 28px); }
#cuHoja .ctit { font-weight: 700; color: #a5281b; text-decoration: underline; text-underline-offset: 4px; }
#cuHoja .nota { position: relative; margin-top: 28px; }
#cuHoja .nota .nid { position: absolute; left: -46px; top: 0; font: 700 11px/28px Consolas, monospace; color: #a5281b; }
#cuHoja .nota.nueva { animation: escribe 1.6s steps(8); }
@keyframes escribe { 0% { background: #ffe680; clip-path: inset(0 100% 0 0); } 60% { background: #ffe680; clip-path: inset(0 0 0 0); } 100% { background: transparent; } }
#cuHoja .vacia { margin-top: 28px; color: #8a96ad; }
/* figuras guardadas en el cuaderno: siempre sobre papel claro (el cuaderno no cambia con el tema) y a lo ancho de la hoja */
#cuHoja .cfig { display: block; width: 100%; margin: 6px 0 4px; padding: 0; border: 0; background: none; cursor: zoom-in; line-height: normal; pointer-events: auto; }
#cuHoja .cfig > * { pointer-events: none; }
#cuHoja .cfig .fgw, #cuHoja .cfig .box { --card: #fffdf6; --text: #23304d; --muted: #5b6476; --faint: #9aa3b5; --arc: #6b7a8f; --hair: #d9d2bf; --grid: #ece6d4;
                                         --accent: #1f78c1; --accent-bg: #dbeaf7; --bad: #c8334a; --gold: #c98a00; --panel: #e8e1cd; background-color: #fffdf6; margin: 0; }
#cuHoja .cfig svg { min-width: 0 !important; }
#cuHoja .cfig::after { content: "toca para ver en grande"; display: block; font: 700 10px/1.6 Consolas, monospace; text-transform: uppercase; color: #8a96ad; text-align: right; }
.cfig-grande { margin-top: 8px; }
.cfig-grande svg { max-width: none !important; }   /* «ver en grande» sí ocupa todo el ancho de la ventana */
#cuHoja table { border-collapse: collapse; line-height: 1.5; font-size: 13px; }
#cuHoja td, #cuHoja th { border: 1px solid #7f8fb0; padding: 0 6px; text-align: center; font-weight: 400; }
#liIdx { margin: 8px 10px 0; padding: 5px; font: inherit; font-size: 13px; background: #f6f1e4; color: #2a2118; border: 3px solid var(--line); flex: none; }
#liHoja { background: #f6f1e4; color: #2a2118; margin: 8px 10px; padding: 14px 16px; border: 3px solid var(--line); font: 15px/1.6 Georgia, "Times New Roman", serif; }
#liHoja .lcap { font: 700 11px Consolas, monospace; text-transform: uppercase; letter-spacing: .08em; color: #a5281b; }
#liHoja h3 { margin: 4px 0 8px; font-size: 19px; border-bottom: 2px solid #2a2118; padding-bottom: 4px; }
#liHoja p { margin: 8px 0; }
#liHoja ul { padding-left: 20px; margin: 8px 0; }
#liHoja .formula { background: #e9e1cc; padding: 10px; text-align: center; font-size: 17px; margin: 10px 0; overflow-x: auto; }
#liHoja .real { border-left: 5px solid #1f78c1; background: #dfeaf3; padding: 8px 10px; margin: 12px 0; font-size: 14px; }
#liHoja .real b:first-child { display: block; font: 700 11px Consolas, monospace; text-transform: uppercase; letter-spacing: .08em; color: #1f78c1; }
@media (max-width: 1279px) {
  /* pantallas angostas: cuaderno y libro son pestañas flotantes que se abren encima del juego */
  .panel { position: fixed; top: 0; height: 100%; }
  .panel.izq { left: 0; } .panel.der { right: 0; }
  .panel:not(.abierto) { top: 34%; height: 132px; }
  .panel:not(.abierto) .lomo { border-top: 4px solid var(--line); border-bottom: 4px solid var(--line); }
  .panel.abierto .cuerpo { width: min(calc(100vw - 60px), 350px); }
  .pcab .ibtn { display: block; }
  .centro { padding: 0 34px; }
}

/* ---------- Mapa de Habilidades */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hud { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; align-items: center; font-weight: 700; }   /* en celular, la bolsa baja a otro renglón */
.hud .box { --e: 3px; padding: 3px 9px; display: flex; gap: 6px; align-items: center; }
.mission { padding: 12px; margin-top: 18px; }
.mission .mh { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.treewrap { margin-top: 22px; }
.treewrap h2 { text-align: center; margin: 0; color: var(--accent); line-height: 0; }
.thint { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.world { position: relative; padding: 10px 0; }
.world svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trow { display: flex; justify-content: center; gap: 28px; margin: 56px 0; position: relative; z-index: 1; }
.lvl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 150px; }
.tile { --c: var(--accent); width: 72px; height: 72px; display: grid; place-items: center; color: var(--on-accent); background: var(--c);
        box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
                    inset -5px -6px 0 0 rgba(0,0,0,.28), inset 5px 5px 0 0 rgba(255,255,255,.3), 0 10px 0 0 rgba(0,0,0,.18); }
.tile:active { transform: translateY(3px); }
.lvl.bonus .tile { --c: #a86bf0; color: #fff; }
.lvl.done .tile { --c: var(--gold); color: var(--line); }
.lvl.lock .tile { --c: var(--panel); color: var(--faint); }
.lvl.boss .tile { width: 84px; height: 84px; }
.lvl.new .tile { animation: nace .6s steps(4); }
@keyframes nace { 0% { transform: scale(.4); } 60% { transform: scale(1.2); } }
.lvl .name, .lvl .st { color: var(--text); background: var(--bg); padding: 2px 4px; line-height: 0; text-align: center; }
.lvl .st:empty { display: none; }
.lvl.lock .name { color: var(--faint); }
.lvl .tag { position: absolute; top: -13px; right: 22px; background: var(--gold); color: #2b2118; padding: 2px 4px; line-height: 0; z-index: 2;
            box-shadow: 0 -2px 0 0 var(--line), 0 2px 0 0 var(--line), -2px 0 0 0 var(--line), 2px 0 0 0 var(--line); }
footer { margin-top: 34px; color: var(--faint); font-size: 12.5px; border-top: 4px dotted var(--faint); padding-top: 10px;
         display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
footer button { font-size: 12px; color: var(--muted); text-decoration: underline; }

/* ---------- ejercicio */
.bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 5; }
.segs { flex: 1; display: flex; gap: 4px; height: 18px; padding: 3px; background: var(--line); }
.segs i { flex: 1; background: var(--panel); }
.segs i.on { background: var(--ok); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.3); }
.segs i.now { background: var(--gold); animation: blink 1s steps(1) infinite; }
.hearts { display: flex; gap: 4px; align-items: center; line-height: 0; color: var(--text); }
.hearts b, .bolsa b { font: 700 16px/1 Consolas, monospace; }
.hearts .lost { animation: blink .25s steps(1) 4; }
.combo { color: var(--gold); }
.dlg { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px 10px; margin: 14px 4px 8px; position: relative; cursor: pointer; }
.dlg .who { position: absolute; top: -14px; left: 12px; background: var(--gold); color: #2b2118; padding: 2px 6px; line-height: 0;
            box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line); }
.dlg .txt { flex: 1; min-height: 46px; padding-top: 4px; }
.dlg .caret { color: var(--gold); animation: blink .7s steps(1) infinite; margin-left: 4px; }
.pspr.happy { animation: hop .5s steps(3); }
.pspr.sad { animation: shk .4s steps(4); }
@keyframes hop { 33% { transform: translateY(-10px); } 66% { transform: translateY(-4px); } }
@keyframes shk { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.shake { animation: shk .35s steps(4); }
.exid { margin: 16px 4px 0; color: var(--bad); line-height: 0; }
.exref { display: block; margin: 10px 4px 0 auto; padding: 0; background: none; border: 0; cursor: copy;   /* identificador discreto del ejercicio */
         font: 10px/1 Consolas, "Lucida Console", monospace; letter-spacing: .04em; color: var(--faint); opacity: .7; }
.exref:hover { opacity: 1; color: var(--muted); }
.task { font-size: 17px; font-weight: 700; margin: 8px 4px 12px; line-height: 1.4; }
.pausa { margin: 0 4px 12px; padding: 8px 12px; background: var(--badbg); color: var(--bad); display: flex; align-items: center; gap: 12px;
         box-shadow: 0 -3px 0 0 var(--bad), 0 3px 0 0 var(--bad), -3px 0 0 0 var(--bad), 3px 0 0 0 var(--bad); }
.pausa b { font-size: 20px; }
.bajar { position: fixed; left: 50%; transform: translateX(-50%); z-index: 11; padding: 7px 12px; line-height: 0; cursor: pointer;   /* «hay más abajo» */
         background: var(--gold); color: #2b2118; border: 0; box-shadow: 0 0 0 3px var(--line), 0 4px 0 3px var(--line);
         animation: blink .8s steps(1) infinite; }   /* parpadea como el aviso de nota nueva del cuaderno */
.actbar { position: fixed; left: var(--izq); right: var(--der); bottom: 0; background: var(--bg); border-top: 4px solid var(--line); padding: 12px 16px 14px; z-index: 10; }
.actbar > div, .sheet > div { max-width: 760px; margin: 0 auto; }
.sheet { position: fixed; left: var(--izq); right: var(--der); bottom: 0; z-index: 20; transform: translateY(110%); transition: transform .18s steps(4); padding: 16px; border-top: 4px solid var(--line); }
.sheet.show { transform: none; }
.sheet.ok { background: var(--okbg); } .sheet.bad { background: var(--badbg); }
.sheet .sttl { display: flex; align-items: center; gap: 10px; }
.sheet.ok .sttl { color: var(--ok); } .sheet.bad .sttl { color: var(--bad); }
.sheet .smsg { margin: 8px 0 12px; max-height: 38vh; overflow-y: auto; }
.sheet.bad .btn { --c: var(--bad); --on: #fff; }
.anotado { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.aviso-r { margin-top: 10px; padding: 6px 10px; border-left: 5px solid var(--bad); background: rgba(0,0,0,.06); font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); opacity: 0; z-index: 35; pointer-events: none;
         background: var(--line); color: #f4f4f4; padding: 8px 14px; max-width: min(92vw, 560px); text-align: center; font-size: 14px;
         box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line); transition: opacity .15s steps(2); }
.toast.show { opacity: 1; }
.toast.good { background: var(--ok); color: var(--on-ok); }
.fly { position: fixed; z-index: 36; pointer-events: none; color: var(--gold); display: flex; align-items: center; gap: 4px; animation: fly .9s steps(6) forwards; }
.fly.menos { color: var(--bad); }
/* experiencia en el ejercicio: barra compacta, orbes que vuelan a ella y golpes al llegar */
.pxp { display: flex; align-items: center; gap: 6px; line-height: 0; }
.pxp .nvl { min-width: 22px; height: 22px; }
.pxp .xpbar { width: 70px; }
.pxp small { font: 700 11px/1 Consolas, monospace; color: var(--muted); white-space: nowrap; }
.pxp.gana .xpbar { animation: xpgolpe .18s steps(2); }
.pxp.gana .xpbar i { animation: xpbrillo .25s steps(2) forwards; }
.pxp.subio { animation: xpsube .7s steps(4); }
.pxp.pierde .xpbar { animation: xpgolpe .3s steps(3); box-shadow: 0 0 0 2px var(--bad); }
@keyframes xpgolpe { 50% { transform: scale(1.25, 1.5); } }
@keyframes xpbrillo { from { background: #c4ecff; } to { background: #29adff; } }
@keyframes xpsube { 0%, 50% { filter: brightness(2.2) drop-shadow(0 0 6px var(--gold)); transform: scale(1.2); } }
.orbe { position: fixed; z-index: 37; width: 0; height: 0; pointer-events: none; }
.orbe i { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; background: #29adff; transform: rotate(45deg);   /* experiencia: azul */
          box-shadow: inset -3px -3px 0 #1d6fa5, inset 3px 3px 0 #c4ecff, 0 0 0 2px #12355b, 0 0 10px 2px rgba(41, 173, 255, .6); }
#dxp.pum { display: inline-block; animation: xpsube .6s steps(3); color: var(--gold); }
@media (max-width: 560px) { .pxp small { display: none; } .pxp .xpbar { width: 44px; } }
.xpm { color: var(--bad); }
/* experiencia: nivel y barra de avance (en el mapa y al dominar una habilidad) */
.xpbox, .nivel { display: flex; align-items: center; gap: 8px; line-height: 0; }
.nivel { padding: 10px 14px; margin-bottom: 14px; justify-content: center; flex-wrap: wrap; color: var(--accent); }
.xpbox { padding: 4px 10px 4px 4px !important; gap: 8px !important; }
.nvl { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 3px; background: var(--gold); color: #1d2250;
       box-shadow: 0 0 0 2px var(--line); }
.xpr { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; line-height: 0; }
.xpfila { display: inline-flex; align-items: center; gap: 6px; }
.xpbar { display: inline-block; width: 90px; height: 10px; background: var(--panel); box-shadow: 0 0 0 2px var(--line); }
.xpbar i { display: block; height: 100%; background: #29adff; }   /* la experiencia es azul; el dorado es de las monedas */
.nivel .xpbar { width: 160px; }
/* insignias de nivel: pixel art a tamaño real, ampliado sin suavizar */
.insignia { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; flex: none; }
.insignia.grande { width: 96px; height: 96px; }
.insignia.chica { width: 48px; height: 48px; }
.insignia.sin-dibujo, .insignia.bloqueada { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
       background: var(--panel); color: var(--accent); box-shadow: inset 0 0 0 3px var(--line); }
.insignia.bloqueada { opacity: .45; color: var(--muted); }
.vitrina-t { margin: 6px 0 8px; color: var(--accent); line-height: 0; }
.vitrina { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-height: 220px; overflow-y: auto; padding: 4px; margin-bottom: 14px; }
.tnivel { display: flex; align-items: center; gap: 12px; text-align: left; }
.tnivel i { font-size: 13px; }
.xpbox small, .nivel small { font: 700 11px/1 Consolas, monospace; color: var(--muted); white-space: nowrap; }
@keyframes fly { to { transform: translateY(-54px); opacity: 0; } }

/* ---------- flujograma */
/* figuras de los ejercicios (flujogramas, gráficas, plano s, diagramas de bloques): NO son pixel art.
   Se dibujan vectoriales y finas, como en un libro, sobre papel cuadriculado, para no perder resolución ni claridad */
.fgw { overflow-x: auto; background: var(--card); border: 1px solid var(--hair); margin: 0 3px;
       background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 20px 20px; }
svg.fg { width: 100%; min-width: 560px; height: auto; display: block; }
svg.fg text { fill: var(--text); }
.cand { animation: flow .8s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -24; } }
.nring.cur { animation: blink .6s steps(1) infinite; }
.meter { padding: 8px 12px; margin-top: 16px; min-height: 42px; }
.meter small { color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 700; margin-right: 6px; font-family: Consolas, monospace; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.bag { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.chip { background: var(--card); margin: 3px; padding: 3px 10px; animation: hop .4s steps(2);
        box-shadow: 0 -3px 0 0 var(--k), 0 3px 0 0 var(--k), -3px 0 0 0 var(--k), 3px 0 0 0 var(--k); }
.count { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 13px; }

/* ---------- opciones, pares, fichas, tachar */
.opts { display: grid; gap: 14px; margin-top: 14px; }
.opt { text-align: left; padding: 12px 14px; font-size: 17px; display: flex; gap: 12px; align-items: center; }
.opt .k { flex: none; color: var(--muted); font-family: Consolas, monospace; font-weight: 700; }
.opt.sel { background: var(--accent-bg); --line: var(--accent); }
.opt.sel .k { color: var(--accent); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.pair { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.fb { display: flex; align-items: center; gap: 10px; margin: 18px 4px; font-size: 20px; }
.fb .pre { white-space: nowrap; }
.fstack { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.fbar { height: 4px; background: var(--text); }
.ln { flex: 1; min-height: 58px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; padding: 6px; border: 3px dashed var(--faint); cursor: pointer; }
.ln.act { border-color: var(--accent); background: var(--accent-bg); }
.ln .ph { color: var(--faint); font-size: 12px; text-transform: uppercase; font-family: Consolas, monospace; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; padding-top: 16px; border-top: 4px dotted var(--faint); }
.ftile { background: var(--card); margin: 3px; padding: 6px 12px; font-size: 19px;
         box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line), inset -3px -4px 0 0 rgba(0,0,0,.12); }
.ftile:active { transform: translateY(2px); }
.ftile.ghost { background: var(--panel); color: transparent; box-shadow: 0 -3px 0 0 var(--panel), 0 3px 0 0 var(--panel), -3px 0 0 0 var(--panel), 3px 0 0 0 var(--panel); pointer-events: none; }
.eq { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; font-size: 20px; margin: 20px 0 8px; }
.term { background: var(--card); margin: 3px; padding: 5px 12px 3px; display: flex; flex-direction: column; align-items: center; line-height: 1.25; font-size: 20px;
        box-shadow: 0 -3px 0 0 var(--k), 0 3px 0 0 var(--k), -3px 0 0 0 var(--k), 3px 0 0 0 var(--k), 0 7px 0 0 var(--k); }
.term small { font-size: 12px; color: var(--k); }
.term.x { opacity: .55; transform: translateY(4px); box-shadow: 0 -3px 0 0 var(--k), 0 3px 0 0 var(--k), -3px 0 0 0 var(--k), 3px 0 0 0 var(--k); }
.term.x .tv { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 4px; }
.note { color: var(--muted); font-size: 13.5px; text-align: center; margin: 6px 0; }

/* ---------- catálogo de tipos: ordenar, clasificar, emparejar, completar, calcular */
.lista { display: grid; gap: 8px; margin: 16px 4px 4px; padding-left: 34px; font-family: Consolas, monospace; color: var(--muted); }
.lista li { padding-left: 4px; }
.lista .ftile { width: 100%; text-align: left; color: var(--text); font-family: inherit; }
.lista .ph { list-style: none; margin-left: -30px; color: var(--faint); font-size: 12px; text-transform: uppercase; }
.ftile.sel { background: var(--accent-bg); box-shadow: 0 -3px 0 0 var(--accent), 0 3px 0 0 var(--accent), -3px 0 0 0 var(--accent), 3px 0 0 0 var(--accent); }
.bank .ph { color: var(--faint); font-size: 12px; text-transform: uppercase; font-family: Consolas, monospace; }
.grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.grupo { min-height: 96px; padding: 8px; border: 3px dashed var(--faint); display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; cursor: pointer; }
.grupo h4 { width: 100%; margin: 0 0 4px; font: 700 12px Consolas, monospace; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.grupo.act { border-color: var(--accent); background: var(--accent-bg); }
.pares { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; margin-top: 16px; }
.pares .col { display: grid; gap: 12px; align-content: start; }
.pares .ftile { text-align: left; position: relative; }
.pares .ftile.par { box-shadow: 0 -3px 0 0 var(--k), 0 3px 0 0 var(--k), -3px 0 0 0 var(--k), 3px 0 0 0 var(--k); }
.pares .ftile[data-n]::after { content: attr(data-n); position: absolute; top: -10px; right: -10px; background: var(--k); color: #fff; font: 700 11px/1 Consolas, monospace; padding: 3px 5px; }
.formula-c { flex-wrap: wrap; justify-content: center; line-height: 2.2; }
.hueco { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; min-height: 42px; padding: 2px 10px; margin: 0 4px; vertical-align: middle;
         border: 3px dashed var(--faint); font: inherit; color: var(--faint); cursor: pointer; }
.hueco.lleno { border-style: solid; border-color: var(--line); color: var(--text); background: var(--card); }
.hueco.act { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.calc { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 4px; font-size: 21px; flex-wrap: wrap; }
.calc input { width: 150px; font: 700 22px Consolas, monospace; padding: 8px 10px; border: 3px solid var(--line); background: var(--card); color: var(--text); text-align: center; }
.calc input:focus { outline: none; border-color: var(--accent); }
svg.fg3 circle.cur { animation: blink .6s steps(1) infinite; }

/* ---------- laboratorio */
.sl { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px 18px; margin-top: 16px; }
.sl div { display: flex; align-items: center; gap: 8px; }
.sl label { min-width: 28px; }
.sl .star label { color: var(--gold); font-weight: 800; }
.sl output { min-width: 38px; text-align: right; }
input[type=range] { flex: 1; min-width: 0; -webkit-appearance: none; appearance: none; height: 10px; background: var(--panel); outline: 3px solid var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 22px; background: var(--accent); border: 3px solid var(--line); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 12px; height: 20px; background: var(--accent); border: 3px solid var(--line); border-radius: 0; }
.gauge { display: flex; gap: 2px; height: 22px; padding: 3px; background: var(--line); margin: 18px 4px 4px; }
.gauge i { flex: 1; background: var(--panel); }
.gauge i.z { background: var(--bad); opacity: .55; }
.gauge i.on { background: var(--accent); opacity: 1; }
.glab { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 0 4px; }
.res { padding: 10px 12px; margin-top: 16px; }
.res b { font-size: 17px; }
.okt { color: var(--ok); font-weight: 700; }
.badt { color: var(--bad); font-weight: 700; }

/* ---------- ventanas y fin de habilidad */
.modal { position: fixed; inset: 0; background: rgba(10,10,20,.6); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal > .box { max-width: 640px; width: calc(100% - 8px); max-height: 86vh; overflow-y: auto; padding: 18px; }
.modal .mt { color: var(--accent); margin-bottom: 10px; line-height: 0; }
table.diag { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.diag th, table.diag td { border-bottom: 2px solid var(--panel); padding: 4px 8px; text-align: left; }
table.diag th { font-size: 11.5px; text-transform: uppercase; color: var(--muted); }
.screen.done { text-align: center; padding-top: 30px; }   /* solo la pantalla de resultados (no los bloques dominados del mapa) */
.screen.done .h { color: var(--gold); margin: 12px 0; }
.stars { display: flex; justify-content: center; gap: 12px; margin: 10px 0; }
.stars span { opacity: 0; animation: appear .01s steps(1) forwards; }
@keyframes appear { to { opacity: 1; } }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin: 20px 0; }
.stats3 .box { padding: 8px 4px; }
.stats3 small { display: block; font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.stats3 b { font-size: 20px; }
.unlock { text-align: left; padding: 12px 14px; --line: var(--accent); }
.unlock .ut { color: var(--accent); margin-bottom: 8px; line-height: 0; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; image-rendering: pixelated; }
#wipe { position: fixed; inset: 0; z-index: 55; pointer-events: none; display: grid; }
#wipe i { background: var(--line); opacity: 0; }
html.quieto *, html.quieto *::before, html.quieto *::after { animation: none !important; transition: none !important; }   /* animaciones reducidas (menú de sonido) */

/* ---------- zonas: bloques del Mapa de Habilidades */
.zona { margin-top: 30px; }
.zona + .zona { margin-top: 70px; }
.zcab { padding: 12px 14px; position: relative; z-index: 1; }
.zcab .ztag { color: var(--bad); line-height: 0; display: flex; align-items: center; gap: 10px; }
.zcab .zok { background: var(--ok); color: var(--on-ok); padding: 3px 5px; line-height: 0; }
.zcab .ztit { color: var(--accent); margin: 10px 0 6px; line-height: 0; }
.zcab .zsub { color: var(--muted); font-size: 13px; }
.zcab .zobj { margin-top: 8px; }
.zcab .zobj b { color: var(--accent); }
.zfig { margin-top: 8px; }
.zfig summary { cursor: pointer; color: var(--accent); font-size: 12.5px; text-decoration: underline; margin-bottom: 8px; }
.zona.cerrada .zcab { background: var(--panel); }
.zona.cerrada .ztit { color: var(--faint); }
.hnom { margin: 0 4px; color: var(--muted); font-size: 12.5px; }
.saltarT { margin: 6px 4px 0; text-align: right; }
.testnav { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 6px 4px 0; }   /* modo test: saltar ejercicios */
.testnav span { margin-right: auto; font: 700 10px Consolas, monospace; letter-spacing: .08em; color: var(--bad); }
.testnav .sbtn:disabled { opacity: .4; cursor: default; }
.testresp { margin: 6px 4px 0; padding: 8px 12px; border: 2px dashed var(--bad); font-size: 14px; }   /* modo test: la respuesta correcta */
.testresp > b:first-child { color: var(--bad); font: 700 11px Consolas, monospace; letter-spacing: .06em; display: block; margin-bottom: 4px; }
.testresp ol { margin: 0; padding-left: 22px; }
.screen.done .hsub { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
#cuHoja .czona { font: 700 11px/28px Consolas, monospace; text-transform: uppercase; letter-spacing: .06em; color: #6b7a8f; }
table.diag th.dz { background: var(--panel); color: var(--text); }


/* ---------- tutorial de la zona: primera parada de cada bloque */
.lvl.tut .tile { --c: #c2c3c7; color: #2b2118; }
.lvl.tut.done .tile { --c: var(--gold); }
.lvl.tut .saltaz { margin-top: 2px; font-size: 11px; padding: 3px 8px; }

/* ---------- botones de la barra del mapa */
.volver { display: inline-flex; align-items: center; gap: 10px; margin: 4px 4px 18px; padding: 6px 12px 6px 8px; background: #1d2250; color: #fff1e8; line-height: 0;
          box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line), inset -3px -4px 0 0 rgba(0,0,0,.3); }
.volver:hover { background: #2a3170; }
.volver:active { transform: translateY(2px); }

/* ---------- zona Función de transferencia: plano s, gráficas y diagrama de bloques */
.tfplot, .tfplano, .tfbloque { padding: 6px; margin-top: 8px; }
.tfplano svg { max-width: 470px; margin: 0 auto; }
.tfsvg { width: 100%; height: auto; display: block; }
.tfgrid { stroke: var(--hair); stroke-width: 1; }
.tfeje { stroke: var(--text); stroke-width: 1.5; }
.tftxt { fill: var(--muted); font: 12px Consolas, monospace; }
.tfvar { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-style: italic; }
.tfcurva { stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.tfpunto { fill: var(--faint); }
.tfpolo { stroke: var(--bad); stroke-width: 3; stroke-linecap: round; fill: none; }
.tfcero { stroke: var(--accent); stroke-width: 3; }
.tfcaja { fill: var(--accent-bg); stroke: var(--text); stroke-width: 1.8; }
.tflinea { stroke: var(--text); stroke-width: 1.8; }
.tfpunta { fill: var(--text); }
.tfgtxt { fill: var(--text); font-size: 24px; }
.tfetq { fill: var(--text); font-size: 19px; }

/* ---------- Mapa de Habilidades: tablero azul pizarra (tono medio) que se arrastra y se acerca (es una ilustración: colores fijos) */
#tree.tabl { max-width: none; padding-bottom: 12px; }
.mapbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.mapbar .sp { flex: 1; }
.mapbar .volver { margin: 3px; }
.radial { position: relative; height: calc(100vh - 150px); min-height: 360px; overflow: hidden; touch-action: none; cursor: grab; user-select: none;
          background-color: #2b3a55; background-image: radial-gradient(#3e5274 1.2px, transparent 1.5px); background-size: 22px 22px;
          box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line); margin: 4px; }
.radial.moviendo { cursor: grabbing; }
.lienzo { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.lienzo.suave { transition: transform .3s steps(6); }
.lienzo svg.trazos { position: absolute; left: 0; top: 0; pointer-events: none; }
.lienzo .lvl { position: absolute; transform: translate(-50%, -72px); width: 160px; gap: 5px; z-index: 2; }   /* el centro del cuadro (144 px) queda justo en el punto donde llegan las conexiones */
.lienzo .lvl .tile { width: 144px; height: 144px; display: flex; flex-direction: column; align-items: center; justify-content: center;
                     gap: 7px; padding: 4px; line-height: 0; }   /* el número arriba y el nombre abajo, centrados en el cuadro */
.lienzo .lvl .tile .tn { line-height: 0; text-align: center; }
.lienzo .lvl .tile .tn svg { margin: 2px 0; }
.lienzo .lvl.lock .tile .tn { opacity: .8; }
.lienzo .lvl.boss .tile { width: 144px; height: 144px; --c: #ff6c6c; }   /* jefe final: mismo tamaño, con corona */
.lienzo .lvl .name, .lienzo .lvl .st { background: #1f2c45; color: #e8f6ff; padding: 3px 5px; }
.lienzo .lvl.lock .name { color: #a3b1cb; }
.lienzo .lvl .st { font-size: 11px; color: #b8c6dc; line-height: 1.2; }
.lienzo .lvl.tut .tile { --c: #e8f6ff; color: #0d1326; }
.lienzo .lvl.tut.done .tile { --c: #ffd23f; }
.lienzo .lvl.done .tile { --c: #ffd23f; color: #0b0c16; }
.lienzo .lvl.lock .tile { --c: #52628a; color: #d3dbec; }
.lienzo .lvl.bonus .tile { --c: #a86bf0; color: #fff; }
.lienzo .lvl.bonus.done .tile { --c: #ffd23f; color: #0b0c16; }
.radial .mttl { position: absolute; left: 10px; top: 10px; max-width: calc(100% - 80px); color: #b8c6dc; line-height: 1.6; pointer-events: none; z-index: 5; background: rgba(31,44,69,.9); padding: 4px 8px; }
.radial .zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 4; }
.radial .zoom button { background: #3a4a72; color: #fff1e8; min-width: 40px; height: 36px; padding: 0 6px; line-height: 0;
                       box-shadow: 0 -3px 0 0 #0b0c16, 0 3px 0 0 #0b0c16, -3px 0 0 0 #0b0c16, 3px 0 0 0 #0b0c16; }
.radial .zoom button:active { transform: translateY(2px); }
.radial .leyenda { position: absolute; left: 10px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; color: #c2c3c7; line-height: 0; z-index: 4;
                   background: rgba(31,44,69,.9); padding: 7px 10px; pointer-events: none; }
.radial .leyenda span { display: flex; align-items: center; gap: 6px; }
.radial .leyenda i { width: 12px; height: 12px; display: inline-block; box-shadow: 0 0 0 2px #0b0c16; }
.leyenda .ley-disp { background: var(--accent); } .leyenda .ley-dom { background: #ffd23f; } .leyenda .ley-blq { background: #52628a; }
.leyenda .ley-bon { background: #a86bf0; } .leyenda .ley-tut { background: #e8f6ff; }
.fz .fzt { line-height: 1.4; margin-bottom: 6px; }
.fz .fzb { display: grid; gap: 10px; margin-top: 12px; }
.fz .fzb .btn { width: calc(100% - 8px); }

/* la periferia de cada zona se ve siempre, con su título y estrellas en arco; de lejos, la red se simplifica: cuadros y líneas, sin nombres */
.lienzo.lejos .lvl .st, .lienzo.lejos .lvl .tag, .lienzo.lejos .lvl .tagn { visibility: hidden; }
.lienzo.lejos .lvl .tile .tn { display: none; }                         /* de lejos, sin nombre: el número (o candado o corona) */
.lienzo.lejos .lvl .tile > svg { transform: scale(2.6); }                /* crece y queda al centro del cuadro */
.lienzo .tzona { font: 700 18px Consolas, "Lucida Console", monospace; letter-spacing: .12em;   /* el tamaño lo pone ajustarTitulos */
                 paint-order: stroke; stroke: #2b3a55; stroke-width: 6px; stroke-linejoin: round; }

/* ---------- etiquetas sobre los bloques: NUEVO, REPASAR y PENDIENTE (tutorial de zona) */
/* Chispa avanzando por una conexión, y el flujo que la recorre */
/* la habilidad donde se perdieron las vidas se bloquea: destello rojo y sacudida */
.lienzo .lvl.seBloquea .tile { animation: seBloquea 1.2s steps(6); }
@keyframes seBloquea { 0%, 40% { background-color: #c8334a; transform: translateX(-4px); } 20%, 60% { background-color: #c8334a; transform: translateX(4px); } 80% { transform: translateX(0); } }
.lienzo .lvl .tagn.tagt { background: #e8f6ff; color: #0d1326; }
.lienzo .lvl .tagn.tagm { background: #2fd3d3; color: #0b0c16; }   /* MEJORAR: dominada con menos de 3 estrellas */
/* cuatro flechas alrededor de lo que está a la venta, apuntando al cuadro (144 px, centrado en el bloque de 160)
   y moviéndose hacia él: «aquí se desbloquea comprando» */
.lienzo .lvl .flecha { position: absolute; z-index: 3; line-height: 0; pointer-events: none; filter: drop-shadow(0 2px 0 #0b0c16); }
.lienzo .lvl .f-arriba { top: -30px; left: calc(50% - 17.5px); animation: f-baja .8s steps(1) infinite; }
.lienzo .lvl .f-abajo  { top: 154px; left: calc(50% - 17.5px); animation: f-sube .8s steps(1) infinite; }
.lienzo .lvl .f-izq    { top: 54.5px; left: -22px; animation: f-der .8s steps(1) infinite; }
.lienzo .lvl .f-der    { top: 54.5px; right: -22px; animation: f-izq .8s steps(1) infinite; }
@keyframes f-baja { 50% { transform: translateY(5px); } }
@keyframes f-sube { 50% { transform: translateY(-5px); } }
@keyframes f-der  { 50% { transform: translateX(5px); } }
@keyframes f-izq  { 50% { transform: translateX(-5px); } }
@media (prefers-reduced-motion: reduce) { .lienzo .lvl .flecha { animation: none; } }
.lienzo .lvl .tagn { position: absolute; top: -13px; left: 22px; background: #ff4d9d; color: #fff; padding: 2px 4px; line-height: 0; z-index: 2;
                     box-shadow: 0 -2px 0 0 #0b0c16, 0 2px 0 0 #0b0c16, -2px 0 0 0 #0b0c16, 2px 0 0 0 #0b0c16; animation: blink 1.2s steps(1) infinite; }
.btn.ghost { --c: #1d2250; --on: #fff1e8; }
.leyenda .ley-nue { background: #ff4d9d; }

/* ---------- menú: REDES DE HABILIDADES (tarjetas sobre el mismo tablero azul pizarra del mapa) */
.redes { text-align: center; padding-top: 22px; max-width: 980px; }
.redes .rbar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 14px; }
.redes .rbar #rsalir { margin: 3px auto 3px 3px; }   /* a la izquierda; lo demás queda a la derecha */
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-top: 26px; padding: 18px; text-align: left;
         background-color: #2b3a55; background-image: radial-gradient(#3e5274 1.2px, transparent 1.5px); background-size: 22px 22px;
         box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line); }
.rcard { display: flex; gap: 14px; align-items: center; padding: 14px; background: #1f2c45; color: #e8f6ff; text-align: left; cursor: pointer; line-height: normal;
         box-shadow: 0 -3px 0 0 #0b0c16, 0 3px 0 0 #0b0c16, -3px 0 0 0 #0b0c16, 3px 0 0 0 #0b0c16, inset -3px -4px 0 0 rgba(0,0,0,.3); }
.rcard:hover { background: #26365a; }
.rcard:active { transform: translateY(2px); }
.rcard.actual { box-shadow: 0 -3px 0 0 #2fd3d3, 0 3px 0 0 #2fd3d3, -3px 0 0 0 #2fd3d3, 3px 0 0 0 #2fd3d3; }
.rcard.tut { grid-column: 1 / -1; }
.rcard.tut.pide { box-shadow: 0 -3px 0 0 #e8f6ff, 0 3px 0 0 #e8f6ff, -3px 0 0 0 #e8f6ff, 3px 0 0 0 #e8f6ff; }
.rcard.tut.hecha .ricono { filter: drop-shadow(0 0 6px #ffd23f); }
.rcard.cerrada { color: #8d9ab8; cursor: not-allowed; }
.rcard .ricono { position: relative; flex: none; line-height: 0; }
.rcard .rcand { position: absolute; inset: 0; display: grid; place-items: center; }
.rcard .rtxt { display: flex; flex-direction: column; gap: 8px; line-height: 0; min-width: 0; }
.rcard .rtxt small { color: #a9b8d0; }
.rcard .rdat { font-size: 12.5px; line-height: 1.4; color: #b8c6dc; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rcard .rbarra { display: block; height: 8px; background: #2b3a55; box-shadow: 0 0 0 2px #0b0c16; }
.rcard .rbarra i { display: block; height: 100%; background: #ffd23f; }
.rcard .sbtn { align-self: flex-start; line-height: normal; }


/* ---------- ajustes de sonido */
.aj { display: grid; gap: 18px; margin-top: 10px; text-align: left; }
.ajf { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center; }
.ajf .ajn { color: var(--accent); line-height: 0; }
.ajf .btn { width: auto; min-width: 150px; }
.ajf input[type=range] { width: 100%; }
.ajf input[type=range]:disabled { opacity: .4; }
/* ---------- certificado de estudio (es un documento: letra serif y fondo de papel, no pixel art) */
.cinput { width: 100%; padding: 8px; font: inherit; font-size: 16px; background: var(--card); color: var(--text); border: 3px solid var(--line); margin: 6px 0 4px; }
.certif { position: fixed; inset: 0; z-index: 70; background: rgba(11, 12, 22, .78); overflow-y: auto; padding: 20px 12px 40px; }
.choja { max-width: 820px; margin: 0 auto; background: #fffdf6; color: #1d2433; padding: 40px 48px; font: 15px/1.55 Georgia, "Times New Roman", serif;
         border: 10px double #1f3c6e; text-align: center; font-variant-numeric: lining-nums; }
.choja .ctabla { overflow-x: auto; }
.choja .cmarca { color: #c98a00; line-height: 0; }
.choja h1 { font: 700 32px/1.2 Georgia, serif; letter-spacing: .05em; margin: 18px 0 6px; color: #1f3c6e; text-transform: uppercase; }
.choja .cotorga { margin: 8px 0 0; color: #5b6476; font-style: italic; }
.choja .cnombre { font-size: 30px; font-style: italic; margin: 6px auto 12px; border-bottom: 2px solid #c98a00; display: inline-block; padding: 0 24px 4px; }
.choja .ctexto { max-width: 640px; margin: 0 auto 16px; }
.choja .cdatos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.choja .cdatos div { border: 1px solid #c9cfdb; padding: 8px 6px; }
.choja .cdatos b { display: block; font-size: 20px; color: #1f3c6e; }
.choja .cdatos small { color: #5b6476; }
.choja table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; text-align: left; }
.choja th, .choja td { border-bottom: 1px solid #c9cfdb; padding: 5px 8px; }
.choja th { color: #1f3c6e; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.choja td small { color: #5b6476; }
.choja .cfirma { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 50px; flex-wrap: wrap; text-align: left; }
.choja .cfirma > div:first-child { min-width: 250px; }
.choja .cfirma span { display: block; border-top: 1px solid #1d2433; margin-bottom: 4px; }
.choja .cfirma small { display: block; color: #5b6476; }
.choja .cfecha { text-align: right; font-size: 13px; color: #5b6476; }
.choja .cnota { font-size: 11.5px; color: #7a8294; margin-top: 24px; }
.cbotones { max-width: 820px; margin: 14px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .choja { padding: 24px 14px; } .choja table { font-size: 12px; } .choja th, .choja td { padding: 4px 4px; } .choja .cdatos { grid-template-columns: repeat(2, 1fr); } .choja h1 { font-size: 23px; } .choja .cnombre { font-size: 23px; } }
@media print {
  body > *:not(.certif), body::after { display: none !important; }
  body { background: #fff; }
  .certif { position: static; background: none; padding: 0; overflow: visible; }
  .cbotones { display: none; }
  .choja { max-width: none; }
  @page { margin: 12mm; }
}
.ajf .ajsel { grid-column: 1 / -1; width: 100%; padding: 6px; font: inherit; font-size: 14px; background: var(--card); color: var(--text); border: 3px solid var(--line); }
.ajf .ajsel:disabled { opacity: .4; }
.ajf .ajp { font-family: ui-monospace, Consolas, monospace; font-weight: 700; min-width: 4ch; text-align: right; }


/* ---------- sprites de objetos reales (nucleo/objetos.js): un ícono arriba del nombre de un sistema */
.ftile .obj { display: block; margin: 2px auto 6px; }
.objn { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; vertical-align: middle; }
.objn small { font-size: 11px; color: var(--muted); }
/* sprites animados: cada cuadro se ve una fracción del ciclo (2, 3 o 4 cuadros) */
html.quieto .objfr:not(:first-child) { display: none; }   /* animaciones reducidas: el sprite se queda en su primer cuadro */
@keyframes objf2 { 0% { visibility: visible; } 50%, 100% { visibility: hidden; } }
@keyframes objf3 { 0% { visibility: visible; } 33.34%, 100% { visibility: hidden; } }
@keyframes objf4 { 0% { visibility: visible; } 25%, 100% { visibility: hidden; } }
@keyframes objf8 { 0% { visibility: visible; } 12.5%, 100% { visibility: hidden; } }
.pspr .ch-habla, .pspr.habla .ch-reposo { display: none; }   /* Chispa: en reposo o hablando */
.pspr.habla .ch-habla { display: inline; }
.pspr > span { line-height: 0; }
.objfig { display: flex; justify-content: center; margin: 4px 0 10px; line-height: 0; }

/* ---------- notación matemática (LaTeX con KaTeX): solo las fórmulas; el resto de la tipografía no cambia */
.katex { font-size: 1.12em; }
.task .katex, .txt .katex, .smsg .katex, #liHoja p .katex, #liHoja li .katex { line-height: 1.2; }   /* las fracciones del renglón no separan de más las líneas */
.katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.tex-error { color: var(--bad); border-bottom: 2px dotted var(--bad); font-family: Consolas, monospace; font-size: .9em; }
.hueco-t { display: inline-block; min-width: 2.2em; padding: .15em .35em; margin: .12em .1em; border: 2px dashed var(--faint); border-radius: 4px;
           text-align: center; cursor: pointer; color: var(--faint); }
.hueco-t.lleno { border-style: solid; border-color: var(--line); color: var(--text); background: var(--card); }
.hueco-t.act { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }

/* ---------- vidas, monedas y tienda */
.bolsa { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px; cursor: pointer; color: var(--text); line-height: 0; }
.bolsa .bv, .bolsa .bm, .pmon { display: inline-flex; align-items: center; gap: 5px; }
.pmon { line-height: 0; color: var(--text); }
.pmon.gana { animation: xpgolpe .18s steps(2); }
.pmon.lleno { animation: monlleno .6s steps(4); }
@keyframes monlleno { 0%, 50% { filter: brightness(2.2) drop-shadow(0 0 6px #ffd23f); transform: scale(1.35); } }
.fly.fmon { color: #ffd23f; gap: 6px; }
.bolsa.brilla .bm { filter: brightness(1.6) drop-shadow(0 0 5px #ffd23f); }
.bolsa.pum .bm { animation: monlleno .6s steps(4); }
.dmon.pum { animation: xpsube .6s steps(3); }
.moneda { position: fixed; z-index: 38; width: 0; height: 0; pointer-events: none; }
.moneda svg { position: absolute; left: -12px; top: -12px; filter: drop-shadow(0 0 4px rgba(255, 210, 63, .7)); }
.monm { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); }
.aviso-v { margin-top: 10px; padding: 6px 10px; border-left: 5px solid var(--ok); background: rgba(0,0,0,.06); font-size: 14px; }
.compra { margin-top: 14px; }
.compra .btn { gap: 10px; }
.stats3 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important; }
.dmon { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); }
.tienda { display: grid; gap: 12px; }
.tbolsa { display: flex; justify-content: center; gap: 18px; padding: 10px; line-height: 0; }
.tbolsa .bv, .tbolsa .bm { display: inline-flex; align-items: center; gap: 6px; }
.tart { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; }
.tart .tic { display: flex; flex-wrap: wrap; gap: 3px; line-height: 0; }
.tart .ttx { line-height: 0; }
.tart .ttx small { display: block; margin-top: 8px; font-size: 12px; line-height: 1.3; color: var(--muted); }
.tart .btn { width: auto; gap: 6px; padding: 8px 12px; }
@media (max-width: 560px) { .bolsa { gap: 6px; padding: 3px 6px; } }

/* ---------- habilidades y zonas a la venta: requisitos listos, falta pagar con monedas */
.lvl.venta .tile, .lienzo .lvl.boss.venta .tile { --c: #3a3354; color: var(--gold); animation: venta 1.6s steps(2) infinite; }
.lvl.venta .ptile { display: inline-flex; align-items: center; gap: 4px; line-height: 0; }
@keyframes venta { 50% { box-shadow: 0 -4px 0 0 var(--gold), 0 4px 0 0 var(--gold), -4px 0 0 0 var(--gold), 4px 0 0 0 var(--gold),
                                    inset -5px -6px 0 0 rgba(0,0,0,.28), inset 5px 5px 0 0 rgba(255,255,255,.3), 0 10px 0 0 rgba(0,0,0,.18); } }
@media (prefers-reduced-motion: reduce) { .lvl.venta .tile { animation: none; } }
.leyenda .ley-ven { background: #3a3354; box-shadow: 0 0 0 2px #ffd23f !important; }

/* pantalla de carga mientras llega una zona (versión publicada) */
