/* Identidad: azul de plano eléctrico, los tres colores de conductores como firma, títulos condensados tipo rótulo */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/BarlowCondensed-600-latin.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/BarlowCondensed-700-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("../fonts/IBMPlexSans-400-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("../fonts/IBMPlexSans-600-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../fonts/IBMPlexMono-500-latin.woff2") format("woff2"); }

:root, [data-bs-theme="light"] {
  --me-bg: #eef1f3;
  --me-panel: #ffffff;
  --me-ink: #1b2530;
  --me-line: #cdd5dc;
  --me-accent: #1f5f8b;
  --me-fase: #7a4a26;
  --me-neutro: #4fa7d8;
  --me-pe-a: #2f9e44;
  --me-pe-b: #e8c31a;
  --me-retorno: #222a31;
  --me-lamp-off: #d7dde2;
  --me-lamp-on: #ffd34d;
  --me-ok: #2f7d4f;
  --me-bad: #b3362c;
  --bs-body-bg: var(--me-bg);
  --bs-body-color: var(--me-ink);
  --bs-primary: #1f5f8b;
  --bs-primary-rgb: 31, 95, 139;
  --bs-link-color: #1f5f8b;
  --bs-link-color-rgb: 31, 95, 139;
  --bs-border-color: var(--me-line);
  --bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --me-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --me-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
[data-bs-theme="dark"] {
  --me-bg: #12181e;
  --me-panel: #1a222a;
  --me-ink: #e4e9ee;
  --me-line: #2e3a45;
  --me-accent: #6fb3e0;
  --me-fase: #b5774a;
  --me-neutro: #6cc0ee;
  --me-retorno: #c9d1d8;
  --me-lamp-off: #2c3640;
  --me-ok: #6fcf93;
  --me-bad: #f08a80;
  --bs-body-bg: var(--me-bg);
  --bs-body-color: var(--me-ink);
  --bs-primary: #6fb3e0;
  --bs-primary-rgb: 111, 179, 224;
  --bs-link-color: #8cc4ea;
  --bs-link-color-rgb: 140, 196, 234;
  --bs-border-color: var(--me-line);
  --bs-card-bg: var(--me-panel);
}
body { background: var(--me-bg); color: var(--me-ink); }
.card { --bs-card-bg: var(--me-panel); --bs-card-border-color: var(--me-line); }
.btn-primary { --bs-btn-bg: #1f5f8b; --bs-btn-border-color: #1f5f8b; --bs-btn-hover-bg: #184b6e; --bs-btn-hover-border-color: #184b6e; --bs-btn-active-bg: #143f5d; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #6fb3e0; --bs-btn-border-color: #6fb3e0; --bs-btn-color: #0d1a24; --bs-btn-hover-bg: #8cc4ea; --bs-btn-hover-color: #0d1a24; --bs-btn-active-bg: #8cc4ea; --bs-btn-active-color: #0d1a24; }
.progress-bar { background-color: var(--me-accent); }

h1, h2, h3, .h1, .h2, .h3, .h4 { font-family: var(--me-display); font-weight: 600; letter-spacing: .01em; text-wrap: balance; }
.display-titulo { font-family: var(--me-display); font-weight: 700; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.05; }
.eyebrow { font-family: var(--me-mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bs-secondary-color); }

/* Barra superior */
.barra { background: var(--me-panel); border-bottom: 1px solid var(--me-line); }
.marca { font-family: var(--me-display); font-weight: 700; font-size: 1.35rem; display: flex; align-items: center; gap: .6rem; }
.cables { display: inline-flex; width: 44px; height: 6px; border-radius: 3px; overflow: hidden; }
.cables span { flex: 1; }
.cables .f { background: var(--me-fase); }
.cables .n { background: var(--me-neutro); }
.cables .t { background: repeating-linear-gradient(45deg, var(--me-pe-a) 0 4px, var(--me-pe-b) 4px 8px); }

/* Inicio */
.avance { background: var(--me-panel); border: 1px solid var(--me-line); border-radius: .5rem; padding: .75rem 1rem; }
.num-modulo { font-family: var(--me-mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--me-accent); }
.modulo-card { border-top: 4px solid var(--me-accent); }
.modulo-card.completo { border-top-color: var(--me-ok); }
.modulo-card.bloqueado { border-top-color: var(--me-line); opacity: .75; }
.pasos li { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; color: var(--bs-secondary-color); }
.pasos li.ok { color: var(--me-ink); }
.pasos li.ok .bi { color: var(--me-ok); }

/* Navegación de pasos del módulo */
.pasos-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1.75rem; }
.pasos-nav.con-adicional { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pasos-nav li.paso-extra .paso-num { border-style: dashed; }
.pasos-nav li > a, .pasos-nav li > span { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; border: 1px solid var(--me-line); border-radius: .5rem; background: var(--me-panel); color: inherit; text-decoration: none; height: 100%; }
.pasos-nav li.actual > a { border-color: var(--me-accent); box-shadow: inset 0 -3px 0 var(--me-accent); }
.pasos-nav li.cerrado > span { opacity: .55; }
.paso-num { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--me-mono); font-size: .85rem; border: 1.5px solid currentColor; }
.pasos-nav li.hecho .paso-num { background: var(--me-ok); border-color: var(--me-ok); color: #fff; }
.paso-txt { font-weight: 600; font-size: .95rem; min-width: 0; }
@media (max-width: 575.98px) { .paso-txt .bi { display: none; } .paso-txt { font-size: .8rem; } .pasos-nav li > a, .pasos-nav li > span { flex-direction: column; text-align: center; gap: .3rem; padding: .5rem; } }

/* Cartilla */
.indice { position: sticky; top: 1rem; }
.cartilla-sec { background: var(--me-panel); border: 1px solid var(--me-line); border-radius: .5rem; padding: 1.25rem 1.4rem; margin-bottom: 1rem; scroll-margin-top: 1rem; }
.cartilla-sec p, .cartilla-sec li { max-width: 72ch; }
.sec-num { font-family: var(--me-mono); font-size: .85rem; color: var(--me-accent); margin-right: .35rem; vertical-align: middle; }
.formula { font-family: var(--me-mono); font-size: 1.1rem; background: var(--me-bg); border-left: 4px solid var(--me-accent); padding: .7rem 1rem; margin: .5rem 0 1rem; border-radius: 0 .35rem .35rem 0; overflow-x: auto; }
.herr { display: grid; grid-template-columns: 2rem 1fr; column-gap: .6rem; border: 1px solid var(--me-line); border-radius: .5rem; padding: .75rem; height: 100%; }
.herr .bi { grid-row: span 2; font-size: 1.5rem; color: var(--me-accent); }
.herr span { font-size: .875rem; color: var(--bs-secondary-color); }
.cable { display: inline-block; width: 2rem; height: .55rem; border-radius: .3rem; vertical-align: middle; margin-right: .35rem; }
.c-marron { background: var(--me-fase); } .c-celeste { background: var(--me-neutro); } .c-negro { background: var(--me-retorno); }
.c-tierra { background: repeating-linear-gradient(45deg, var(--me-pe-a) 0 5px, var(--me-pe-b) 5px 10px); }
.cierre { padding: 1rem 0 2rem; }

/* TP */
.q-num { flex: none; width: 1.7rem; height: 1.7rem; border-radius: .3rem; background: var(--me-accent); color: #fff; display: grid; place-items: center; font-family: var(--me-mono); font-size: .8rem; }
[data-bs-theme="dark"] .q-num { color: #0d1a24; }
.tp legend { float: none; }
.respuesta-libre { white-space: pre-wrap; }

/* Panel docente */
.dato { background: var(--me-panel); border: 1px solid var(--me-line); border-radius: .5rem; padding: .75rem 1rem; display: grid; }
.dato span { font-size: .8rem; color: var(--bs-secondary-color); }
.dato strong { font-family: var(--me-display); font-size: 2rem; line-height: 1.1; }

/* Circuitos interactivos */
.widget h3 { font-size: 1.35rem; }
.svg-caja { background: var(--me-bg); border: 1px solid var(--me-line); border-radius: .5rem; overflow-x: auto; }
.svg-caja svg { display: block; width: 100%; height: auto; min-width: 320px; max-width: 720px; margin: 0 auto; }
.svg-caja text { fill: var(--me-ink); font-family: var(--me-mono); font-size: 13px; }
.svg-caja .t-chico { font-size: 11px; fill: var(--bs-secondary-color); }
.hilo { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.h-fase { stroke: var(--me-fase); } .h-neutro { stroke: var(--me-neutro); } .h-retorno { stroke: var(--me-retorno); }
.h-tierra { stroke: var(--me-pe-a); stroke-dasharray: 9 6; }
.h-amarillo { stroke: var(--me-pe-b); }
.caja { fill: var(--me-panel); stroke: var(--me-line); stroke-width: 1.5; }
.lampara { stroke: var(--me-line); stroke-width: 1.5; transition: fill .25s, opacity .25s; }
.halo { fill: none; stroke: var(--me-lamp-on); stroke-width: 3; transition: opacity .25s; }
.llave-svg { cursor: pointer; }
.llave-svg rect { fill: var(--me-panel); stroke: var(--me-ink); stroke-width: 1.5; }
.llave-svg line { stroke: var(--me-ink); stroke-width: 3.5; stroke-linecap: round; transition: all .15s; }
.llave-svg:focus-visible rect, .borne:focus-visible circle { stroke: var(--me-accent); stroke-width: 3.5; outline: none; }
.instrumento { font-family: var(--me-mono); background: var(--me-panel); border: 1px solid var(--me-line); border-radius: .4rem; padding: .4rem .7rem; display: grid; }
.instrumento span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.instrumento strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.desafio { border: 1px solid var(--me-line); border-radius: .5rem; padding: .75rem; background: var(--me-panel); }
.desafio.hecho { border-color: var(--me-ok); }
.desafio.hecho .estado { color: var(--me-ok); }
.borne { cursor: pointer; }
.borne circle { fill: var(--me-panel); stroke: var(--me-ink); stroke-width: 2; }
.borne text { pointer-events: none; }
.borne circle.hit, .borne.sel circle.hit, .borne:hover circle.hit { fill: transparent; stroke: none; }
.borne.sel circle { fill: var(--me-lamp-on); stroke: var(--me-accent); stroke-width: 3.5; }
.borne:hover circle { stroke: var(--me-accent); }
.paleta .btn { display: inline-flex; align-items: center; gap: .4rem; }
.paleta .btn.active { outline: 2px solid var(--me-accent); outline-offset: 2px; }
.lista-cables li { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; }
.checks li { display: flex; gap: .5rem; padding: .2rem 0; }
.checks .bi-check-circle-fill { color: var(--me-ok); }
.checks .bi-x-circle-fill { color: var(--me-bad); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.svg-ancho svg { min-width: 620px; }

/* Entregas con archivos */
.miniatura { width: 72px; height: 72px; object-fit: cover; border-radius: .35rem; border: 1px solid var(--me-line); }
.foto-entrega { max-width: 100%; max-height: 520px; border-radius: .4rem; border: 1px solid var(--me-line); background: #fff; }
.dato-alerta { border-color: #d9a400; box-shadow: inset 4px 0 0 #d9a400; }
.corregir { position: sticky; top: 1rem; }
fieldset[disabled] .form-control { background: var(--me-bg); }

/* Cartilla: tablas y esquemas */
.cartilla-sec .table { font-size: .9rem; }
.cartilla-sec .table th { white-space: nowrap; }
.cartilla-sec figure { margin: 1rem 0; }
.cartilla-sec figcaption { font-size: .85rem; color: var(--bs-secondary-color); margin-top: .35rem; }
.tabla-num td, .tabla-num th { text-align: center; font-variant-numeric: tabular-nums; }
.tabla-num td:first-child, .tabla-num th:first-child { text-align: left; }
.cartilla-sec .svg-caja svg { max-width: 640px; }
.esq text { font-size: 12px; }
.triangulo text { font-family: var(--me-display); font-size: 30px; font-weight: 700; }
.cable-chip { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.c-rojo { background: #c62828; } .c-azul { background: #1e4fbf; } .c-blanco { background: #f4f4f4; border: 1px solid var(--me-line); } .c-gris { background: #8a939b; }
.c-negro-real { background: #111; }
.regla-oro { display: grid; grid-template-columns: 2.4rem 1fr; gap: .75rem; align-items: start; padding: .6rem 0; border-bottom: 1px dashed var(--me-line); }
.regla-oro:last-child { border-bottom: 0; }
.regla-oro b { width: 2.4rem; height: 2.4rem; border-radius: 50%; background: #e8c31a; color: #1b2530; display: grid; place-items: center; font-family: var(--me-display); font-size: 1.4rem; }
.empalme { border: 1px solid var(--me-line); border-radius: .5rem; padding: .75rem; height: 100%; }
.empalme b { font-family: var(--me-mono); color: var(--me-accent); }
.esq .hilo { stroke-width: 3.5; }
.h-lateral { stroke: #c62828; } .h-rojo { stroke: #c62828; } .h-mbt { stroke: #8e5bd0; }
.h-muerto { stroke: var(--me-line); }
[data-bs-theme="dark"] .h-lateral, [data-bs-theme="dark"] .h-rojo { stroke: #ef6b6b; }
/* Práctica: código de colores y selectores */
.fila-color { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem .75rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--me-line); }
.fila-color:last-child { border-bottom: 0; }
.fila-color .muestra { height: .9rem; border-radius: .45rem; background: var(--me-lamp-off); border: 1px solid var(--me-line); }
.fila-color.ok .muestra { outline: 2px solid var(--me-ok); outline-offset: 2px; }
.fila-color.mal .muestra { outline: 2px solid var(--me-bad); outline-offset: 2px; }
.chip-color { display: inline-flex; align-items: center; gap: .35rem; }
.chip-color i { width: 1.1rem; height: .7rem; border-radius: .35rem; display: inline-block; border: 1px solid var(--me-line); }
.grande-dato { font-family: var(--me-display); font-size: 2.6rem; line-height: 1; }
.barra-ocupacion { height: 1.1rem; border-radius: .55rem; background: var(--me-bg); border: 1px solid var(--me-line); overflow: hidden; position: relative; }
.barra-ocupacion span { display: block; height: 100%; background: var(--me-ok); transition: width .2s; }
.barra-ocupacion.mal span { background: var(--me-bad); }
.barra-ocupacion::after { content: ""; position: absolute; left: 35%; top: -2px; bottom: -2px; border-left: 2px dashed var(--me-ink); }

/* Láminas de la cartilla (imágenes ampliables) */
.lamina { margin: 0 0 1rem; }
.lamina a { display: block; border: 1px solid var(--me-line); border-radius: .5rem; overflow: hidden; background: #fff; }
.lamina img { display: block; width: 100%; height: auto; }
.lamina a:focus-visible { outline: 3px solid var(--me-accent); outline-offset: 2px; }
.lamina figcaption { font-size: .85rem; color: var(--bs-secondary-color); margin-top: .35rem; }

/* Práctica 3: tablero y bomba */
.riel { display: flex; flex-wrap: wrap; gap: 4px; padding: .6rem; background: var(--me-bg); border: 1px solid var(--me-line); border-radius: .5rem; min-height: 5.5rem; align-items: stretch; }
.riel .mod { display: flex; flex-direction: column; justify-content: space-between; align-items: center; width: calc(var(--n, 2) * 2.1rem); min-height: 4.6rem; padding: .25rem .15rem; border-radius: .3rem; border: 1px solid var(--me-line); background: var(--me-panel); font-family: var(--me-mono); font-size: .68rem; line-height: 1.1; text-align: center; }
.riel .mod.id { background: color-mix(in srgb, var(--me-neutro) 22%, var(--me-panel)); }
.riel .mod.borne { background: color-mix(in srgb, var(--me-pe-a) 18%, var(--me-panel)); }
.riel .mod.reserva { border-style: dashed; color: var(--bs-secondary-color); background: transparent; }
.riel .mod .palanca { width: 60%; height: .9rem; border-radius: .2rem; background: var(--me-ink); opacity: .75; }
.tabla-circ select { min-width: 6.5rem; }
.bomba-svg .agua { fill: var(--me-neutro); opacity: .75; transition: height .4s, y .4s; }
.bomba-svg .rotor { transform-origin: center; transform-box: fill-box; }
.bomba-svg .rotor.gira { animation: girar 0.8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.bomba-svg .activo { stroke: var(--me-lamp-on) !important; }
.bomba-svg .bobina-on { fill: var(--me-lamp-on); }
#practica-fin[hidden] { display: none !important; }

/* Juegos */
:root { --jg-r2: #b03a2e; --jg-r3: #6b3fa0; --jg-x: #7d8792; --jg-y: #a77a1e; }
[data-bs-theme="dark"] { --jg-r2: #ef7f72; --jg-r3: #b99be6; --jg-x: #9aa6b2; --jg-y: #d9a640; }
.jg-niveles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .5rem; }
.jg-nivel { display: flex; gap: .6rem; align-items: center; text-align: left; background: var(--me-panel); color: var(--me-ink); border: 1px solid var(--me-line); border-radius: .5rem; padding: .6rem .75rem; font-weight: 600; line-height: 1.25; }
.jg-nivel:disabled { opacity: .55; }
.jg-nivel.actual { border-color: var(--me-accent); box-shadow: inset 0 -3px 0 var(--me-accent); }
.jg-num { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--me-line); font-family: var(--me-mono); }
.jg-nivel.hecho .jg-num { background: var(--me-ok); border-color: var(--me-ok); color: #fff; }
.jg-ntxt .small { font-weight: 400; }
.jg-svgwrap { padding: .5rem; }
.jg-svgwrap svg { max-width: none; min-width: 0; margin: 0; }
.jg-cable { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.jg-caja { fill: var(--me-panel); stroke: var(--me-line); stroke-width: 1.5; }
.jg-borne { fill: var(--me-panel); stroke: var(--me-ink); stroke-width: 1.5; }
.jg-lamp { stroke: var(--me-line); stroke-width: 1.5; transition: fill .2s; }
.jg-llave { cursor: pointer; }
.jg-llave rect { fill: var(--me-panel); stroke: var(--me-ink); stroke-width: 1.5; }
.jg-llave circle { fill: var(--me-ink); }
.jg-llave path { stroke: var(--me-ink); stroke-width: 1.5; fill: none; }
.jg-llave line { stroke: var(--me-ink); stroke-width: 3; stroke-linecap: round; }
.jg-llave:focus-visible rect { stroke: var(--me-accent); stroke-width: 3; }
.jg-corto { fill: var(--me-bad); font-weight: 600; }
.jg-gano { animation: jg-pop .35s ease-out; }
@keyframes jg-pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .jg-gano { animation: none; } .jg-lamp { transition: none; } }
/* Juego «Elegí el cable» */
.cb-preg { font-size: 1.15rem; padding: .9rem 1rem; border-left: 4px solid var(--me-accent); background: var(--me-bg); border-radius: .4rem; }
.cb-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; }
.cb-op { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .5rem .25rem; background: var(--me-panel); color: var(--me-ink); border: 2px solid var(--me-line); border-radius: .5rem; font-weight: 600; font-family: var(--me-mono); font-size: .9rem; }
.cb-op:hover:not(:disabled) { border-color: var(--me-accent); }
.cb-op:disabled { opacity: 1; }
.cb-op.bien { border-color: var(--me-ok); background: color-mix(in srgb, var(--me-ok) 15%, var(--me-panel)); }
.cb-op.mal { border-color: var(--me-bad); background: color-mix(in srgb, var(--me-bad) 15%, var(--me-panel)); }
.cb-ais { fill: var(--me-line); }
.cb-cu { fill: #c87533; }
/* Juego «Armá el tablero» */
.tb-caja { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-caja .mod, .tb-riel .mod { display: flex; flex-direction: column; justify-content: space-between; align-items: center; width: calc(var(--n, 2) * 2.4rem); min-height: 5rem; padding: .25rem .15rem; border-radius: .3rem; border: 1px solid var(--me-line); background: var(--me-panel); color: var(--me-ink); font-family: var(--me-mono); font-size: .68rem; line-height: 1.15; text-align: center; }
.tb-caja .mod.id, .tb-riel .mod.id { background: color-mix(in srgb, var(--me-neutro) 22%, var(--me-panel)); }
.tb-caja .mod .palanca, .tb-riel .mod .palanca { width: 60%; height: .9rem; border-radius: .2rem; background: var(--me-ink); opacity: .75; }
.tb-pieza.sel { outline: 3px solid var(--me-accent); outline-offset: 1px; transform: translateY(-2px); }
.tb-riel .mod.fija { opacity: .8; }
.tb-riel .mod.borne { background: color-mix(in srgb, var(--me-pe-a) 18%, var(--me-panel)); }
.tb-slot { cursor: pointer; }
.tb-slot.vacio { border: 2px dashed var(--me-line); background: transparent; }
.tb-slot.ok { border: 2px solid var(--me-ok); }
.tb-slot.mal { border: 2px solid var(--me-bad); background: color-mix(in srgb, var(--me-bad) 12%, var(--me-panel)); }
.tb-lugar { font-family: var(--bs-body-font-family); font-weight: 700; font-size: .66rem; color: var(--me-accent); }
.tb-mas { font-size: 1.1rem; opacity: .6; }
.tb-pieza:focus-visible, .tb-slot:focus-visible, .cb-op:focus-visible { outline: 3px solid var(--me-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tb-pieza.sel { transform: none; } }
