/* =====================================================================
   Simulador eléctrico Horma — estilos
   Mismo sistema visual que hormagrup.cl (sitio-web/style.css y context/branding.md):
   - Instrument Serif para títulos (h1/h2), con una palabra en itálica terracota.
   - Big Shoulders Display 700 solo para lo estructural: botones, etiquetas, números.
   - Cuerpo en fuente de sistema.
   - Paleta: azul marino, terracota, gris concreto, blanco hueso. Tema claro.
   20/11/2026: se quitó el estilo de videojuego (letras gruesas en mayúsculas,
   bordes gruesos y sombras duras) y el tablero pasó a dibujarse como uno real:
   caja blanca, ventana con riel y automáticos blancos con palanca negra.
   Lo oscuro queda solo para el corte de luz (sombras de la escena y fx-gris).
   ===================================================================== */

:root {
  /* Marca (iguales a sitio-web/style.css) */
  --navy: #14213D;
  --navy-dark: #0d1729;
  --terracota: #C1440E;
  --terracota-osc: #8f330a;
  --terracota-cl: #e8946b;
  --gris: #6C757D;
  --gris-texto: #495057;
  --linea-c: #DEDED6;
  --hueso: #F5F5F0;
  --papel: #FFFFFF;

  --texto: #14213D;
  --texto-2: #495057;
  --texto-3: #6C757D;
  --acento: #C1440E;
  --tinte: #FBEFE8;            /* terracota muy claro, para resaltar */

  /* Estados (sobrios, solo donde informan algo) */
  --ok: #2F7D5B;
  --ok-txt: #23603F;
  --ok-fondo: #EAF3EE;
  --alerta: #C98A12;
  --alerta-txt: #855A00;
  --peligro: #B3261A;
  --peligro-txt: #9A1F15;
  --peligro-fondo: #FBECEA;
  --calor: #C1440E;
  --calor-txt: #8f330a;
  --wa: #1E9E52;

  --panel: #FFFFFF;
  --linea: 1px solid var(--linea-c);
  --sombra: 0 1px 2px rgba(20, 33, 61, .06), 0 10px 24px -16px rgba(20, 33, 61, .28);
  --radio: 4px;

  --f-titulo: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --f-cond: 'Big Shoulders Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-cuerpo: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --gutter: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-cuerpo);
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto);
  background: var(--hueso);
  overflow-x: hidden;
}

h1, h2 { font-family: var(--f-titulo); font-weight: 400; }
h3, h4 { font-family: var(--f-cond); font-weight: 700; }

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--terracota); outline-offset: 3px; border-radius: 3px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.saltar {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 3px; font-weight: 700;
}
.saltar:focus { top: 8px; }

/* ---------- Estructura ---------- */
.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
  transition: filter .5s ease;
}

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0;
  border-bottom: var(--linea);
}
.marca {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--navy); text-decoration: none;
  font-family: var(--f-cond); font-weight: 700; font-size: 17px; letter-spacing: .3px; text-transform: uppercase;
}
.marca img { display: block; }
.marca b { color: var(--terracota); font-weight: 700; }

.btn-sonido {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  background: transparent; border: var(--linea); border-radius: 3px; color: var(--navy);
  font-family: var(--f-cond); font-weight: 700; font-size: 13px; letter-spacing: .8px; text-transform: uppercase;
}
.btn-sonido:hover { border-color: var(--navy); }
.btn-sonido svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-sonido[aria-pressed="false"] .onda { display: none; }
.btn-sonido[aria-pressed="true"] .mute { display: none; }
.btn-sonido[aria-pressed="true"] { border-color: var(--terracota); color: var(--terracota); }

.aviso {
  margin-top: 28px; padding: 14px 16px;
  border-top: var(--linea);
  font-size: 13px; color: var(--texto-3); text-align: center;
}

.reel-titulo { display: none; }

/* ---------- Etiquetas (eyebrow del sitio) ---------- */
.eyebrow, .hud-num, .hoja-eti, .extra-eti, .mision-eti, .diag-paso {
  font-family: var(--f-cond); font-weight: 700; text-transform: uppercase; letter-spacing: 2px;
  color: var(--terracota);
}

/* ---------- Inicio ---------- */
.hero { padding: 40px 0 34px; border-bottom: var(--linea); }
.hero > * { max-width: 720px; }
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; font-size: 13.5px;
}
.eyebrow::before { content: ''; width: 24px; height: 2px; background: var(--terracota); display: inline-block; }
.hero h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 64px); line-height: 1.05; letter-spacing: -.3px;
  color: var(--navy);
}
.hero h1 em, .sec-titulo em, .hoja h2 em, .hud-titulo em, .pr-hero h1 em { font-style: italic; color: var(--terracota); }
.lead { margin: 16px 0 0; font-size: 18px; color: var(--texto-2); max-width: 600px; }

.sec-titulo {
  margin: 34px 0 14px;
  font-size: clamp(28px, 6vw, 36px); line-height: 1.1; letter-spacing: -.2px; color: var(--navy);
}

.misiones { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 760px) { .misiones { grid-template-columns: 1fr 1fr; } }
.misiones-cargando, .misiones-error { color: var(--texto-2); padding: 16px 0; }

.mision {
  position: relative; width: 100%; min-height: 112px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 18px 16px; text-align: left; color: var(--navy);
  background: var(--papel);
  border: var(--linea); border-radius: var(--radio);
  box-shadow: var(--sombra);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.mision:hover { border-color: var(--navy); }
.mision-n {
  font-family: var(--f-titulo); font-size: 52px; line-height: 1;
  color: var(--terracota); min-width: 40px; text-align: center;
}
.mision-cuerpo { display: grid; gap: 3px; }
.mision-eti { font-size: 12px; }
.mision-titulo { font-family: var(--f-cond); font-weight: 700; font-size: 22px; line-height: 1.15; }
.mision-txt { font-size: 14px; color: var(--texto-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mision-flecha {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 3px;
  font-size: 20px; color: #fff; background: var(--terracota);
  transition: background .15s ease;
}
.mision:hover .mision-flecha { background: var(--terracota-osc); }

.extras { display: grid; gap: 12px; }
@media (min-width: 760px) { .extras { grid-template-columns: 1fr 1fr; } }
.extra {
  position: relative;
  display: grid; gap: 4px; padding: 20px 18px; min-height: 120px; text-align: left;
  border-radius: var(--radio); border: var(--linea); border-top: 3px solid var(--navy);
  box-shadow: var(--sombra);
  color: var(--navy); background: var(--papel);
  transition: border-color .15s ease;
}
.extra--diag { border-top-color: var(--terracota); }
.extra:hover { border-color: var(--navy); }
.extra--diag:hover { border-color: var(--terracota); }
.extra-eti { font-size: 12px; }
.extra-titulo { font-family: var(--f-titulo); font-size: 30px; line-height: 1.1; }
.extra-txt { font-size: 14px; color: var(--texto-2); }
.aviso-js { color: var(--peligro-txt); }

/* ---------- HUD de misión ---------- */
.hud { padding: 10px 0 14px; }
.hud-fila { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.btn-volver {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 6px;
  background: transparent; border: var(--linea); border-radius: 3px; color: var(--navy);
  font-family: var(--f-cond); font-weight: 700; font-size: 13px; letter-spacing: .8px; text-transform: uppercase;
}
.btn-volver:hover { border-color: var(--navy); }
.btn-volver svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hud-num { font-size: 13px; }
.hud-fase {
  font-family: var(--f-cond); font-weight: 700; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 3px;
  background: var(--peligro-fondo); color: var(--peligro-txt); border: 1px solid rgba(179, 38, 26, .3);
}
.hud-fase[data-fase="solucion"] { background: var(--ok-fondo); color: var(--ok-txt); border-color: rgba(47, 125, 91, .35); }
.hud-titulo {
  margin: 10px 0 6px;
  font-family: var(--f-titulo); font-weight: 400;
  font-size: clamp(30px, 7vw, 46px); line-height: 1.08; letter-spacing: -.2px; color: var(--navy);
}
.hud-titulo:focus { outline: none; }
.hud-historia { margin: 0 0 12px; color: var(--texto-2); max-width: 760px; }
.hud-objetivo {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radio);
  background: var(--papel); border: var(--linea); border-left: 3px solid var(--terracota);
}
.hud-obj-eti {
  flex: none; font-family: var(--f-cond); font-weight: 700; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--terracota); margin-top: 3px;
}
.hud-objetivo p { margin: 0; font-weight: 600; }

/* ---------- Layout del juego ---------- */
.juego { display: grid; gap: 14px; }
@media (min-width: 900px) {
  .juego { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); align-items: start; }
  .juego-tablero { position: sticky; top: 12px; }
}
@media (max-width: 899px) {
  /* En el celular el tablero queda siempre a la vista, abajo */
  .juego-tablero {
    position: sticky; bottom: 0; z-index: 5;
    max-height: 46vh; overflow-y: auto; overscroll-behavior: contain;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 6px;
    background: linear-gradient(180deg, rgba(245, 245, 240, 0) 0, rgba(245, 245, 240, .97) 14px);
  }
  #p-armar .juego-tablero {
    padding-top: 10px; background: rgba(245, 245, 240, .98);
    box-shadow: 0 -12px 22px rgba(20, 33, 61, .12);
  }
  .en-iframe .juego-tablero { position: static; max-height: none; }

  /* HUD y tablero compactos para que plano + tablero quepan en una pantalla */
  #p-juego .hud { padding: 4px 0 10px; }
  #p-juego .hud-titulo { margin: 6px 0 2px; font-size: clamp(26px, 7vw, 32px); }
  #p-juego .hud-historia { font-size: 14.5px; line-height: 1.4; margin-bottom: 8px; }
  #p-juego .hud-objetivo { padding: 8px 10px; gap: 8px; }
  #p-juego .hud-objetivo p { font-size: 14.5px; line-height: 1.35; }
  #p-juego .hud-obj-eti { font-size: 11px; }
  .juego-tablero { max-height: 40vh; }
  .juego-tablero .tb-head { padding: 8px 12px 6px; }
  .juego-tablero .tb-frente { padding: 8px 10px 6px; }
  .juego-tablero .tb-cuerpo { padding: 6px 8px 8px; gap: 6px; }
  .juego-tablero .tb-grupo { padding: 4px; gap: 2px; }
  .juego-tablero .tb-dif { padding: 4px 8px; font-size: 13px; }
  .juego-tablero .tb-c { gap: 8px; padding: 4px; }
  .juego-tablero .tb-info { gap: 3px; }
  .juego-tablero .tb-nombre { font-size: 13px; }
  .juego-tablero .tb-cable, .juego-tablero .tb-a { font-size: 10.5px; }
  .juego-tablero .tb-barra { height: 6px; }
  .juego-tablero .tb-datos { font-size: 12px; }
  .juego-tablero .tb-amp { font-size: 14px; }
  .juego-tablero .tb-ico { width: 15px; height: 15px; }
}

.escena-cont { position: relative; }
.escena-barra {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 12px;
}
.escena-total { font-family: var(--f-cond); font-weight: 700; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--texto-2); }
.escena-total strong {
  color: var(--navy); font-size: 20px; letter-spacing: 0; margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Escena (plano) ---------- */
.esc {
  position: relative; aspect-ratio: 4 / 3; width: 100%;
  border-radius: var(--radio); overflow: hidden;
  background: #FBFAF6;
  border: var(--linea);
  box-shadow: var(--sombra);
}
.esc::after { content: none; }
.esc-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.esc-fondo { fill: #ECEBE4; }
.esc-piso--cocina, .esc-piso--living, .esc-piso--hall { fill: #FBFAF6; }
.esc-piso--lavadero, .esc-piso--bano { fill: #F1F2F0; }
.esc-piso--dormitorio, .esc-piso--dormitorio2 { fill: #F8F6F0; }
.esc-piso--cochera { fill: #E9E8E2; }
.esc-luz { mix-blend-mode: multiply; transition: opacity .6s ease; }
.esc-muebles * { fill: #fff; stroke: rgba(20, 33, 61, .28); stroke-width: 1.1; }
.esc-muebles .esc-alfombra { fill: rgba(193, 68, 14, .07); stroke: rgba(193, 68, 14, .25); }
.esc-muros rect { fill: none; stroke: var(--navy); stroke-width: 2.5; }
.esc-muros .esc-muro-ext { stroke-width: 5; }
.esc-etiquetas text { font-family: var(--f-cond); font-weight: 700; font-size: 9.5px; letter-spacing: 1.5px; fill: var(--gris); }
/* Cuando se corta un circuito, su recinto queda a oscuras: el único momento oscuro del simulador */
.esc-sombras rect { fill: #0B1328; opacity: 0; transition: opacity .5s ease; pointer-events: none; }
.esc-tablero rect { fill: #fff; stroke: var(--navy); stroke-width: 1.6; }
.esc-tablero path { stroke: var(--navy); stroke-width: 1.4; }
.esc-tablero text { font-family: var(--f-cond); font-weight: 700; font-size: 9px; letter-spacing: 1.4px; fill: var(--navy); }

/* Cables (ruta desde el tablero) */
.cable {
  fill: none; stroke: var(--c); stroke-width: 2; stroke-opacity: .25;
  stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .3s ease, stroke-width .3s ease, stroke-opacity .3s ease;
}
.cable[data-nivel="ok"], .cable[data-nivel="alerta"] {
  stroke-width: 2.6; stroke-opacity: .95; stroke-dasharray: 7 6;
  animation: flujo var(--vel, 1.4s) linear infinite;
}
.cable[data-nivel="alerta"] { stroke: var(--alerta); stroke-width: 3; }
.cable[data-nivel="disparo"] {
  stroke: var(--peligro); stroke-width: 3.2; stroke-opacity: 1; stroke-dasharray: 7 6;
  animation: flujo .3s linear infinite, parpadeo .3s steps(2) infinite;
}
.cable[data-nivel="calor"] {
  stroke: var(--calor); stroke-width: 5; stroke-opacity: 1; stroke-dasharray: none;
  animation: calor .7s ease-in-out infinite alternate;
  filter: url(#esc-calor);
}
.cable[data-nivel="cortado"] { stroke: #9AA0A6; stroke-opacity: .8; stroke-dasharray: 2 6; }
@keyframes flujo { to { stroke-dashoffset: -26; } }
@keyframes parpadeo { 50% { stroke-opacity: .45; } }
@keyframes calor { from { stroke: #C1440E; } to { stroke: #e8946b; } }

/* Enchufes en los muros: el color del borde es su circuito (el mismo del número en el tablero) */
.esc-encs, .esc-aps { position: absolute; inset: 0; pointer-events: none; }
.enc {
  position: absolute; transform: translate(-50%, -50%);
  width: 30px; height: 30px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.enc-cara {
  position: relative; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--c);
  box-shadow: 0 1px 2px rgba(20, 33, 61, .25);
  transition: transform .15s ease, background .2s ease;
}
/* Las dos patas del enchufe */
.enc-cara::before, .enc-cara::after {
  content: ''; position: absolute; top: 50%; width: 2px; height: 2px; margin-top: -1px; border-radius: 50%; background: var(--navy);
}
.enc-cara::before { left: 3px; }
.enc-cara::after { right: 3px; }
.enc:hover .enc-cara { transform: scale(1.25); }
.enc--ocupado { pointer-events: none; }
.enc--fuerza .enc-cara {
  width: 16px; height: 16px; border-radius: 3px; background: var(--c); border-color: var(--c);
  display: grid; place-items: center; color: #fff; font-family: var(--f-cuerpo); font-size: 9px; font-weight: 800; line-height: 1;
}
.enc--fuerza .enc-cara::before, .enc--fuerza .enc-cara::after { content: none; }
.enc.es-sin-luz .enc-cara { border-style: dashed; border-color: #9AA0A6; background: #EEF0F1; color: #6C757D; }
.enc.es-marcado .enc-cara { animation: marcar .6s ease-in-out 6; }
@keyframes marcar { 50% { transform: scale(1.5); box-shadow: 0 0 0 5px rgba(179, 38, 26, .35); border-color: var(--peligro); } }
.esc-leyenda { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--texto-2); }
.ley-enc {
  display: inline-block; width: 12px; height: 12px; margin: 0 6px 0 0; vertical-align: -1px;
  border-radius: 50%; border: 2.5px solid var(--terracota); background: #fff;
}
.ley-enc--fuerza {
  width: 13px; height: 13px; margin-left: 10px; border-radius: 3px; border: 0; background: var(--navy);
  color: #fff; font-size: 8px; font-weight: 800; line-height: 13px; text-align: center; vertical-align: 0;
}

/* Lista de aparatos para enchufar */
.port-lista { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 4px; }
.port {
  display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  min-height: 56px; padding: 8px 10px; text-align: left; border-radius: 3px;
  background: #fff; border: 1px solid #C9C8C1; color: var(--navy);
}
.port:hover { border-color: var(--terracota); background: var(--tinte); }
.port-ico { grid-row: 1 / 3; display: grid; place-items: center; width: 30px; height: 30px; }
.port-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.port-nombre { font-weight: 700; font-size: 14px; line-height: 1.2; }
.port-w { font-size: 12.5px; color: var(--texto-2); font-variant-numeric: tabular-nums; }

/* Aparatos */
.ap {
  pointer-events: auto;
  position: absolute; transform: translate(-50%, -24px);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 48px; min-height: 48px; padding: 0;
  background: none; border: 0; color: var(--navy);
  -webkit-tap-highlight-color: transparent;
}
.ap-ico {
  position: relative; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--papel);
  border: 1.5px solid var(--navy);
  box-shadow: 0 2px 6px rgba(20, 33, 61, .15);
  transition: background .2s ease, border-color .2s ease, box-shadow .25s ease, transform .15s ease;
}
.ap-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ap:hover .ap-ico { transform: scale(1.06); }
.ap:active .ap-ico { transform: scale(.95); }
.ap-txt {
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  padding: 2px 6px 3px; border-radius: 3px; background: rgba(255, 255, 255, .95);
  border: var(--linea);
  white-space: nowrap;
}
.ap-nombre { font-family: var(--f-cond); font-weight: 700; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }
.ap-w { font-size: 10.5px; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.ap-anillo {
  position: absolute; top: 0; left: 50%; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  border: 2px solid var(--c); opacity: 0; pointer-events: none;
}
.ap.es-on .ap-ico {
  background: var(--c); border-color: var(--c); color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent);
}
.ap.es-on .ap-w { color: var(--navy); font-weight: 700; }
.ap.es-on .ap-txt { border-color: var(--c); }
.ap.es-on .ap-anillo { animation: pulso 1.8s ease-out infinite; }
.ap.es-sin-luz .ap-ico { border-style: dashed; border-color: #9AA0A6; color: #9AA0A6; background: #EEF0F1; box-shadow: none; }
.ap[aria-pressed="true"].es-sin-luz .ap-txt::after { content: 'sin corriente'; font-size: 10px; font-weight: 700; color: var(--peligro-txt); }
@keyframes pulso { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }

/* Efectos de escena */
.esc-fx { position: absolute; inset: 0; pointer-events: none; }
.esc.fx-corte { animation: sacudida .35s ease; }
.esc.fx-descarga { animation: sacudida .5s ease; }
.esc.fx-descarga .esc-fx { animation: destello .7s ease-out; }
.ap.fx-chispa .ap-ico { animation: chispa .7s ease-out; }
@keyframes sacudida {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); }
  60% { transform: translate(-2px, 1px); } 80% { transform: translate(1px, 0); }
}
@keyframes destello {
  0% { background: rgba(255, 255, 255, 0); }
  12% { background: rgba(255, 255, 255, .7); }
  25% { background: rgba(255, 255, 255, .1); }
  38% { background: rgba(255, 255, 255, .5); }
  100% { background: rgba(255, 255, 255, 0); }
}
@keyframes chispa {
  0% { box-shadow: 0 0 0 0 rgba(193, 68, 14, .7); }
  100% { box-shadow: 0 0 0 24px rgba(193, 68, 14, 0); }
}

/* ---------- Tablero (componente): dibujado como un tablero real ----------
   Caja plástica blanca → tapa con ventana → riel con los módulos.
   Automático: módulo blanco, rótulo C10/C16, palanca negra (arriba = encendido).
   Diferencial: módulo doble, palanca azul y botón de prueba T. */
.tb {
  border-radius: 6px;
  background: #FDFDFB;
  border: 1px solid #D4D2CA;
  box-shadow: var(--sombra), inset 0 0 0 4px #F3F2EE;
  overflow: hidden;
  color: var(--navy);
}
.tb-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: var(--linea);
}
.tb-titulo { font-family: var(--f-cond); font-weight: 700; font-size: 16px; letter-spacing: 1.5px; text-transform: uppercase; }
.tb-total { font-size: 13px; color: var(--texto-2); }
.tb-total-n { font-family: var(--f-cond); font-weight: 700; font-size: 20px; color: var(--terracota); font-variant-numeric: tabular-nums; }

.tb-frente { padding: 14px 14px 12px; background: #F7F6F2; border-bottom: var(--linea); }
.tb-frente-nota { margin: 6px 0 0; font-size: 12px; color: var(--peligro-txt); font-weight: 600; text-align: center; }
.tb-ventana {
  --mod: 40px;
  width: fit-content; max-width: 100%; margin: 0 auto;
  padding: 10px 12px 8px; border-radius: 3px;
  background: #E7E5DF;
  box-shadow: inset 0 2px 5px rgba(20, 33, 61, .18), inset 0 0 0 1px rgba(20, 33, 61, .12);
  overflow-x: auto;
}
.tb-riel {
  display: flex; align-items: flex-start; gap: 1px; width: max-content; margin: 0 auto;
  padding-top: 2px;
  background: linear-gradient(180deg, transparent 0 34%, #B9BCC0 34% 38%, #D7D9DB 38% 58%, #B9BCC0 58% 62%, transparent 62%) no-repeat;
  background-size: 100% calc(var(--mod) * 2.3);
}
.tb-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tb-mod {
  position: relative; width: var(--mod); height: calc(var(--mod) * 2.3); padding: 5px 0 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F6F3 60%, #ECECE8 100%);
  border: 1px solid #C9C8C1; border-radius: 2px;
  box-shadow: 0 1px 2px rgba(20, 33, 61, .18);
  color: var(--navy); cursor: default;
}
.tb-mod--dif { width: calc(var(--mod) * 2 + 1px); }
.tb-mod--ciega {
  width: calc(var(--mod) * var(--u, 1) + var(--u, 1) * 1px - 1px);
  background: linear-gradient(180deg, #E9E8E3, #DCDBD5); border-color: #C4C3BC; box-shadow: none;
}
.tb-mod-txt { font-family: var(--f-cuerpo); font-weight: 700; font-size: 10px; line-height: 1; color: #3A3F47; }
.tb-mod-fila { display: flex; align-items: center; gap: 6px; }
.tb-mod-t {
  display: grid; place-items: center; width: 13px; height: 13px; border-radius: 50%;
  background: #E3E4E6; border: 1px solid #A9ADB2; font-size: 8px; font-weight: 700; color: #3A3F47; line-height: 1;
}
.tb-mod-ventana {
  position: relative; width: calc(var(--mod) * .42); height: calc(var(--mod) * 1.05);
  background: #2B2E33; border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
}
.tb-mod-lever {
  position: absolute; left: 1px; right: 1px; top: 1px; height: 46%;
  background: linear-gradient(180deg, #4A4E55, #1E2125);
  border-radius: 1px; border-top: 2px solid #5C6067;
  transition: top .18s cubic-bezier(.5, 1.6, .6, 1);
}
.tb-mod--dif .tb-mod-lever { background: linear-gradient(180deg, #4D6FA3, #1F3F75); border-top-color: #6B8BBE; }
.tb-mod-pie { margin-top: auto; width: 70%; height: 4px; border-top: 1px solid #D3D2CB; }
.tb-mod.es-abajo .tb-mod-lever { top: calc(54% - 1px); }
.tb-palanca[data-nivel="cortado"] .tb-mod-ventana { opacity: .55; }
.tb-palanca.es-rearmable { cursor: pointer; animation: llamar 1.2s ease-in-out infinite; }
@keyframes llamar { 50% { box-shadow: 0 0 0 3px rgba(193, 68, 14, .55), 0 1px 2px rgba(20, 33, 61, .18); } }
.tb-rotulo {
  min-width: 20px; padding: 0 5px; border-radius: 2px; text-align: center;
  font-family: var(--f-cuerpo); font-weight: 700; font-size: 12px; line-height: 17px;
  background: #fff; color: var(--cc, var(--navy)); border: 1px solid #D4D2CA; border-bottom: 2px solid var(--cc, var(--navy));
}
.tb-slot--dif .tb-rotulo { color: var(--gris); border-bottom-color: #D4D2CA; }
.tb-mod.es-resaltado { outline: 2px solid var(--terracota); outline-offset: 2px; }

.tb-cuerpo { padding: 10px; display: grid; gap: 8px; }
.tb-grupo { border-radius: 3px; border: var(--linea); padding: 6px; display: grid; gap: 4px; background: #fff; }
.tb-grupo--sin { border: 1px dashed rgba(179, 38, 26, .55); background: #FFFBFA; }
.tb-dif {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px; border-radius: 3px; font-size: 13.5px;
  background: var(--ok-fondo);
}
.tb-dif em { color: var(--alerta-txt); font-style: normal; font-weight: 700; }
.tb-dif-ico .tb-ico { stroke: var(--ok); }
.tb-dif-txt { flex: 1; min-width: 0; }
.tb-dif-estado {
  font-family: var(--f-cond); font-weight: 700; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ok-txt);
}
.tb-dif.es-disparado { background: var(--peligro-fondo); }
.tb-dif.es-disparado .tb-dif-estado { color: var(--peligro-txt); }
.tb-dif--falta { background: transparent; color: var(--peligro-txt); font-weight: 600; padding: 4px 6px; }
.tb-dif--falta .tb-ico { stroke: var(--peligro); }
.tb-btn-rearmar {
  min-height: 44px; padding: 0 16px; border-radius: 3px; border: 0;
  background: var(--terracota); color: #fff;
  font-family: var(--f-cond); font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  animation: llamar 1.2s ease-in-out infinite;
}
.tb-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.tb-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; }

.tb-c {
  display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start;
  padding: 6px 6px 6px 4px; border-radius: 3px;
  transition: background .3s ease;
}
.tb-n {
  display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; border-radius: 3px;
  font-family: var(--f-cuerpo); font-weight: 700; font-size: 13px; color: #fff; background: var(--cc, var(--navy));
}
.tb-info { min-width: 0; display: grid; gap: 5px; }
.tb-nombre { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; line-height: 1.25; }
.tb-nombre > span:first-child { min-width: 0; }
.tb-a, .tb-cable {
  flex: none; font-size: 11.5px; font-weight: 600; color: var(--texto-2);
  padding: 0 6px; border-radius: 3px; border: var(--linea); background: #fff;
}
.tb-a { margin-left: auto; }
.tb-barra { position: relative; height: 8px; border-radius: 2px; background: #ECEBE5; overflow: hidden; }
.tb-relleno {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: var(--ok); transition: width .45s cubic-bezier(.3, .8, .3, 1), background .3s ease;
}
.tb-marca { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed rgba(20, 33, 61, .5); }
.tb-datos { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.tb-amp { font-family: var(--f-cond); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.tb-estado { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ok-txt); }

.tb-c[data-nivel="alerta"] .tb-relleno { background: var(--alerta); }
.tb-c[data-nivel="alerta"] .tb-estado { color: var(--alerta-txt); }
.tb-c[data-nivel="sobrecarga"] { background: var(--peligro-fondo); }
.tb-c[data-nivel="sobrecarga"] .tb-relleno {
  background: repeating-linear-gradient(135deg, var(--peligro) 0 8px, #D9645A 8px 16px);
  animation: rayas .5s linear infinite;
}
.tb-c[data-nivel="sobrecarga"] .tb-estado { color: var(--peligro-txt); }
.tb-c[data-nivel="calor"] { background: var(--tinte); }
.tb-c[data-nivel="calor"] .tb-relleno { background: linear-gradient(90deg, var(--terracota), var(--terracota-cl)); }
.tb-c[data-nivel="calor"] .tb-estado { color: var(--calor-txt); }
.tb-c[data-nivel="disparo"] { background: var(--peligro-fondo); }
.tb-c[data-nivel="disparo"] .tb-relleno { background: var(--peligro); opacity: .45; }
.tb-c[data-nivel="disparo"] .tb-estado { color: var(--peligro-txt); }
.tb-c[data-nivel="disparo"] .tb-amp, .tb-c[data-nivel="cortado"] .tb-amp { color: var(--texto-3); }
.tb-c[data-nivel="cortado"] .tb-estado { color: var(--texto-3); }
@keyframes rayas { to { background-position: 22.6px 0; } }

.tb .tb-c.es-resaltado, .tb .tb-dif.es-resaltado { outline: 2px solid var(--terracota); outline-offset: 1px; background: var(--tinte); }

/* ---------- Botones (iguales a los del sitio) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 26px; border-radius: 3px; border: 1px solid transparent;
  font-family: var(--f-cond); font-weight: 700; font-size: 15px; letter-spacing: .8px; text-transform: uppercase;
  text-decoration: none; text-align: center; line-height: 1.15;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primario { color: #fff; background: var(--terracota); }
.btn-primario:hover:not(:disabled) { background: var(--terracota-osc); }
.btn-sec { background: transparent; color: var(--navy); border-color: var(--linea-c); }
.btn-sec:hover:not(:disabled) { border-color: var(--navy); background: rgba(20, 33, 61, .04); }
.btn-wa { color: #fff; background: var(--wa); }
.btn-wa:hover { background: #17803F; }
.btn-ancho { width: 100%; }
.btn-tocar {
  min-height: 46px; font-size: 14px; color: #fff; background: var(--navy);
  animation: llamar 1.6s ease-in-out infinite;
}
.btn-tocar:hover { background: var(--navy-dark); }
.btn-link {
  min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--texto-2);
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-x {
  margin-left: auto; min-height: 36px; min-width: 44px; padding: 0 10px; border-radius: 3px;
  background: #fff; border: 1px solid rgba(179, 38, 26, .45); color: var(--peligro-txt); font-size: 13px; font-weight: 600;
}

/* ---------- Aviso grande (corte, descarga, misión completada) ---------- */
.banner {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  display: grid; place-items: center;
  opacity: 0; visibility: hidden;
}
.banner.es-visible { opacity: 1; visibility: visible; animation: banner-salida 2.1s ease forwards; }
.banner-banda {
  width: 100%; padding: 20px 16px 18px; text-align: center;
  background: rgba(20, 33, 61, .95);
  border-top: 3px solid var(--terracota);
  display: grid; gap: 4px;
}
.banner.es-visible .banner-banda { animation: banda .35s ease-out both; }
.banner-txt {
  font-family: var(--f-titulo); font-weight: 400; font-style: italic;
  font-size: clamp(36px, 9vw, 72px); line-height: 1.05;
  color: #fff;
}
.banner-sub { font-family: var(--f-cond); font-weight: 700; font-size: clamp(13px, 3.2vw, 16px); letter-spacing: 2px; text-transform: uppercase; color: var(--terracota-cl); }
.banner[data-tipo="protegido"] .banner-banda, .banner[data-tipo="completada"] .banner-banda { border-top-color: #6FBF98; }
.banner[data-tipo="protegido"] .banner-sub, .banner[data-tipo="completada"] .banner-sub { color: #A9D9C0; }
@keyframes banda { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes banner-salida { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }

/* Corte de luz: la página se apaga un momento y vuelve */
body.fx-gris .app { filter: grayscale(.7) brightness(.55); }

/* ---------- Hoja (tarjeta explicativa) ---------- */
.hoja-fondo {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 33, 61, .45);
  opacity: 0; transition: opacity .2s ease;
}
.hoja-fondo.es-visible { opacity: 1; }
.hoja {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .9, .3, 1);
  color: var(--navy);
}
.hoja.es-visible { transform: translateY(0); }
.hoja-int {
  max-width: 620px; margin: 0 auto;
  padding: 24px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  background: var(--papel);
  border-top: 3px solid var(--terracota);
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -16px 40px rgba(20, 33, 61, .22);
}
.hoja[data-tipo="completada"] .hoja-int, .hoja[data-tipo="solucion"] .hoja-int { border-top-color: var(--ok); }
@media (min-width: 700px) {
  .hoja { bottom: auto; top: 50%; transform: translateY(-40%); opacity: 0; transition: transform .28s ease, opacity .2s ease; }
  .hoja.es-visible { transform: translateY(-50%); opacity: 1; }
  .hoja-int { border-radius: 6px; padding: 28px 28px 24px; box-shadow: 0 24px 60px rgba(20, 33, 61, .3); }
}
.hoja-eti { margin: 0 0 6px; font-size: 13px; }
.hoja-eti--ok { color: var(--ok-txt); }
.hoja h2 { margin: 0 0 14px; font-size: clamp(30px, 7vw, 38px); line-height: 1.08; letter-spacing: -.2px; }
.hoja p { margin: 0 0 12px; color: var(--texto-2); }
.hoja-sec { font-size: 14px; padding: 10px 12px; border-radius: 3px; background: var(--hueso); }
.hoja-reel-cta { font-family: var(--f-cond); font-weight: 700; font-size: 20px; letter-spacing: 1px; text-transform: uppercase; color: var(--terracota) !important; text-align: center; }
.cuenta {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 3px;
  background: var(--hueso); border-left: 3px solid var(--peligro);
}
.hoja[data-tipo="completada"] .cuenta { border-left-color: var(--ok); background: var(--ok-fondo); }
.cuenta p { margin: 0 0 6px; color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.cuenta p:last-child { margin-bottom: 0; }
.hoja-acciones { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: min(92vw, 460px); padding: 12px 16px; border-radius: 4px;
  background: var(--navy); border-left: 3px solid var(--terracota); color: #fff;
  box-shadow: 0 10px 30px rgba(20, 33, 61, .3); font-size: 15px; font-weight: 600; text-align: center;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.es-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Arma tu tablero ---------- */
.armar { display: grid; gap: 14px; }
@media (min-width: 900px) {
  .armar { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); align-items: start; }
}
.armar-editor { display: grid; gap: 14px; }
.panel {
  padding: 18px 16px; border-radius: var(--radio);
  background: var(--panel); border: var(--linea); box-shadow: var(--sombra);
}
.panel h3 { margin: 0 0 12px; display: flex; align-items: center; gap: 10px; font-size: 22px; line-height: 1.15; }
.panel-n {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 3px;
  background: var(--terracota); color: #fff; font-weight: 700; font-size: 16px;
}
.panel-ayuda { margin: -4px 0 12px; font-size: 14px; color: var(--texto-2); }
.arm-lista { display: grid; gap: 10px; margin-bottom: 12px; }
.arm-item { padding: 12px; border-radius: 3px; background: var(--hueso); border: var(--linea); }
.arm-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; }
.arm-campos { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 480px) { .arm-campos { grid-template-columns: 1fr 1.6fr; } }
.armar label { display: grid; gap: 4px; font-size: 13px; color: var(--texto-2); font-weight: 600; }
.armar select, .diag-select {
  min-height: 46px; width: 100%; padding: 0 12px; border-radius: 3px;
  background: #fff; border: 1px solid #C9C8C1; color: var(--navy); font-size: 16px;
}
.arm-aviso { margin: 8px 0 0; font-size: 13px; color: var(--calor-txt); font-weight: 600; }
.arm-vacio { margin: 0; font-size: 14px; color: var(--peligro-txt); }
.arm-ap {
  display: grid !important; grid-template-columns: 38px 1fr minmax(120px, 42%); align-items: center; gap: 10px !important;
  color: var(--navy) !important; font-size: 15px !important;
}
.arm-ap-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1.5px solid var(--navy); }
.arm-ap-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.arm-ap-nombre small { display: block; color: var(--texto-2); font-weight: 500; }
.arm-checks { border: 0; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.arm-checks legend { font-size: 13px; color: var(--texto-2); font-weight: 600; margin-bottom: 6px; padding: 0; }
.arm-check {
  display: inline-flex !important; grid-auto-flow: column; align-items: center; gap: 8px !important;
  min-height: 44px; padding: 0 12px; border-radius: 3px; border: 1px solid #C9C8C1; background: #fff;
  color: var(--navy) !important; cursor: pointer;
}
.arm-check input { width: 20px; height: 20px; accent-color: var(--terracota); }
.arm-nota { margin: 0 0 8px; font-size: 14px; color: var(--texto-2); }
.arm-resultado { padding: 18px 16px; border-radius: var(--radio); background: var(--panel); border: var(--linea); box-shadow: var(--sombra); }
.arm-resultado:focus { outline: none; }
.arm-puntaje { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 14px; }
.arm-puntaje-n { font-family: var(--f-titulo); font-size: 72px; line-height: .95; color: var(--terracota); }
.arm-puntaje[data-ok="true"] .arm-puntaje-n { color: var(--ok); }
.arm-puntaje-de { font-family: var(--f-titulo); font-size: 26px; color: var(--texto-3); }
.arm-puntaje p { flex-basis: 100%; margin: 0; font-weight: 600; }
.arm-reglas { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.arm-reglas li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px; border-radius: 3px; background: var(--ok-fondo); }
.arm-regla-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: 13px; background: var(--ok); color: #fff; }
.arm-reglas li[data-ok="false"] { background: var(--peligro-fondo); }
.arm-reglas li[data-ok="false"] .arm-regla-ico { background: var(--peligro); color: #fff; }
.arm-reglas p { margin: 4px 0 0; font-size: 14px; color: var(--texto-2); }
.arm-reglas small { display: block; margin-top: 4px; font-size: 12px; color: var(--texto-3); }
.arm-nota-final { font-size: 13px; color: var(--texto-3); }

/* ---------- Diagnóstico ---------- */
.diag {
  max-width: 640px; padding: 22px 18px; border-radius: var(--radio);
  background: var(--panel); border: var(--linea); box-shadow: var(--sombra);
}
.diag-progreso { height: 4px; border-radius: 2px; background: #ECEBE5; overflow: hidden; }
.diag-progreso span { display: block; height: 100%; background: var(--terracota); transition: width .3s ease; }
.diag-paso { margin: 12px 0 0; font-size: 12.5px; }
.diag-q { margin: 6px 0 14px; font-family: var(--f-titulo); font-weight: 400; font-size: clamp(28px, 6.5vw, 36px); line-height: 1.1; }
.diag-q:focus { outline: none; }
.diag-q--2 { margin-top: 22px; }
.diag-ayuda { margin: -6px 0 14px; color: var(--texto-2); font-size: 15px; }
.op-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.op {
  min-height: 54px; padding: 10px 12px; border-radius: 3px; text-align: center;
  background: #fff; border: 1px solid #C9C8C1; color: var(--navy);
  font-weight: 600; font-size: 16px; transition: border-color .15s ease, background .15s ease;
}
.op:hover { border-color: var(--navy); }
.op[aria-pressed="true"] { border-color: var(--terracota); background: var(--tinte); box-shadow: inset 0 0 0 1px var(--terracota); }
.op[aria-pressed="true"]::before { content: '✓ '; color: var(--terracota); }
.diag-select { margin-bottom: 14px; }
.diag .btn-link { margin-top: 8px; }
.diag-res-titulo { margin: 0 0 12px; font-family: var(--f-titulo); font-weight: 400; font-size: clamp(30px, 7vw, 40px); line-height: 1.08; }
.diag-res-titulo:focus { outline: none; }
.diag-res-titulo strong { font-weight: 400; font-style: italic; color: var(--terracota); }
.diag-res-porque { color: var(--texto); font-size: 17px; }
.diag-res-nota { font-size: 14px; color: var(--texto-3); }
.diag-res-msg { margin: 10px 0 0; font-size: 13.5px; color: var(--texto-2); padding: 10px 12px; border-radius: 3px; background: var(--hueso); }
.diag-res-msg span { display: block; font-weight: 700; color: var(--texto-3); margin-bottom: 2px; }
.diag-fuera { padding: 14px; border-radius: 3px; background: var(--tinte); border-left: 3px solid var(--terracota); color: var(--texto); }
.diag-res .hoja-eti { margin-bottom: 4px; }

/* ---------- Dentro de un iframe que crece con el contenido ----------
   Los elementos "fijos" se ubican en la parte del iframe que la persona está viendo
   (--vp-top y --vp-h los calcula app.js). */
.en-iframe { --vp-top: 0px; --vp-h: 100vh; }
.en-iframe .banner, .en-iframe .hoja-fondo { position: absolute; inset: auto 0; top: var(--vp-top); height: var(--vp-h); }
.en-iframe .hoja { position: absolute; bottom: auto; top: calc(var(--vp-top) + var(--vp-h)); transform: translateY(0); max-height: calc(var(--vp-h) * .9); }
.en-iframe .hoja.es-visible { transform: translateY(-100%); }
.en-iframe .toast { position: absolute; bottom: auto; top: calc(var(--vp-top) + var(--vp-h) - 90px); }
@media (min-width: 700px) {
  .en-iframe .hoja { top: calc(var(--vp-top) + var(--vp-h) / 2); transform: translateY(-40%); }
  .en-iframe .hoja.es-visible { transform: translateY(-50%); }
}

/* ---------- Modo reel (9:16, para grabar pantalla) ---------- */
body.modo-reel { overflow: hidden; }
.modo-reel .app {
  width: min(100vw, calc(100vh * 9 / 16)); height: 100vh; max-width: none;
  padding: 14px 14px 10px; display: flex; flex-direction: column; overflow: hidden;
  background: var(--hueso);
  box-shadow: 0 0 0 1px var(--linea-c);
}
.modo-reel .top { padding: 0 0 6px; }
.modo-reel .btn-sonido { display: none; }
.modo-reel .marca { font-size: 15px; }
.modo-reel .reel-titulo {
  display: block; margin: 8px 0 8px; color: var(--navy);
  font-family: var(--f-titulo); font-weight: 400;
  font-size: clamp(28px, 4.4vh, 44px); line-height: 1.05;
}
.modo-reel .reel-titulo span { color: var(--terracota); font-style: italic; }
.modo-reel main { flex: 1; min-height: 0; }
.modo-reel .hud { padding: 0 0 8px; }
.modo-reel .hud .btn-volver, .modo-reel .hud-historia, .modo-reel .hud-titulo { display: none; }
.modo-reel .hud-num, .modo-reel .hud-fase { font-size: 14px; }
.modo-reel .hud-objetivo, .modo-reel .escena-total { display: none; }
.modo-reel .escena-barra:not(:has(.btn-tocar:not([hidden]))) { display: none; }
.modo-reel .juego { grid-template-columns: 1fr !important; gap: 10px; }
.modo-reel .juego-tablero { position: static; max-height: none; margin: 0; padding: 0; background: none; overflow: visible; }
.modo-reel .escena-barra { margin-top: 6px; }
.modo-reel .tb-head { padding: 8px 12px 6px; }
.modo-reel .tb-frente { padding: 8px 10px 6px; }
.modo-reel .tb-cuerpo { padding: 6px 8px 8px; gap: 6px; }
.modo-reel .tb-nombre { font-size: 15px; }
.modo-reel .aviso { margin-top: auto; padding: 6px 0 0; font-size: 11px; border: 0; }
.modo-reel .banner-txt { font-size: clamp(38px, 6vh, 64px); }
.modo-reel .hoja-int { max-width: min(100vw, calc(100vh * 9 / 16)); }
.modo-reel .hoja { top: auto; bottom: 0; transform: translateY(100%); opacity: 1; }
.modo-reel .hoja.es-visible { transform: translateY(0); }
.modo-reel .hoja-int { border-radius: 6px 6px 0 0; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 420px) {
  .hero { padding: 28px 0 26px; }
  .lead { font-size: 16.5px; }
  .ap-ico { width: 36px; height: 36px; }
  .ap-ico svg { width: 20px; height: 20px; }
  .ap-anillo { width: 36px; height: 36px; margin-left: -18px; }
  .ap-nombre { font-size: 10.5px; }
  .ap-w { font-size: 9.5px; }
  .ap-txt { padding: 1px 4px 2px; }
  .esc-etiquetas text { font-size: 11px; }
  .mision { gap: 12px; }
  .mision-n { font-size: 42px; min-width: 30px; }
  .mision-titulo { font-size: 20px; }
  .mision-flecha { width: 32px; height: 32px; font-size: 18px; }
  .tb-ventana { --mod: 34px; padding: 8px 8px 6px; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .cable[data-nivel] { stroke-dasharray: none !important; }
  .banner.es-visible { animation: none; opacity: 1; }
}

/* Dentro de la página de WordPress (iframe): la página ya tiene el logo y el título */
.en-iframe .marca, .en-iframe #p-inicio .hero { display: none; }
.en-iframe .top { justify-content: flex-end; border-bottom: 0; padding-top: 0; }
.en-iframe #p-inicio .sec-titulo:first-of-type { margin-top: 4px; }
