/* =====================================================================
   MacaPesos · sistema de diseño de la app
   Mismo lenguaje visual que la landing (static/css/landing.css):
   fondo oscuro, acentos neón y la tarjeta bancaria como elemento estrella.
   ===================================================================== */
:root {
  --fondo: #0b0f19;
  --fondo-2: #111827;
  --superficie: #151c2e;
  --superficie-2: #1b2440;
  --campo: #0e1424;
  --borde: rgba(148, 163, 184, .18);
  --borde-suave: rgba(148, 163, 184, .1);
  --texto: #e5e9f5;
  --texto-2: #9aa5c4;

  --morado: #8b5cf6;
  --cian: #06b6d4;
  --oro: #f59e0b;
  --oro-claro: #fbbf24;
  --verde: #10b981;
  --rojo: #f43f5e;

  --ok: #34d399;
  --ok-fondo: rgba(16, 185, 129, .12);
  --error: #fb7185;
  --error-fondo: rgba(244, 63, 94, .12);

  --brillo-morado: 0 0 24px rgba(139, 92, 246, .5);
  --brillo-cian: 0 0 24px rgba(6, 182, 212, .5);
  --brillo-oro: 0 0 24px rgba(245, 158, 11, .5);

  --fuente-titulo: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --fuente-texto: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radio-panel: 18px;
  --radio-tarjeta: 22px;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(50% 40% at 0% 0%, rgba(139, 92, 246, .14), transparent 70%),
    radial-gradient(40% 35% at 100% 0%, rgba(6, 182, 212, .1), transparent 70%),
    var(--fondo);
  background-attachment: fixed;
  color: var(--texto);
  font-family: var(--fuente-texto);
  font-size: 16px;
  line-height: 1.55;
}
h1, h2, h3 { font-family: var(--fuente-titulo); font-weight: 800; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 5vw, 42px); }
h2 { font-size: 20px; }
h3 { font-size: 17px; font-weight: 600; }
p { max-width: 75ch; }
a { color: var(--cian); text-underline-offset: 3px; }
a:hover { color: #67e8f9; }
code { font-size: 14px; word-break: break-all; color: #c4b5fd; }
img, svg { flex-shrink: 0; }

:focus-visible { outline: 3px solid var(--cian); outline-offset: 3px; border-radius: 6px; }

.visualmente-oculto {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Cabecera ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 28px;
  padding: 10px 24px;
  background: rgba(11, 15, 25, .85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--borde);
}
.marca { display: flex; align-items: center; gap: 10px; color: var(--texto); text-decoration: none; margin-right: auto; }
.marca:hover { color: var(--texto); }
.marca-logo {
  display: block; width: auto; height: 64px;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, .45));
  transition: transform .25s, filter .25s;
}
.marca:hover .marca-logo { transform: scale(1.05) rotate(-2deg); filter: drop-shadow(0 0 16px rgba(139, 92, 246, .7)); }
.marca-texto { display: flex; flex-direction: column; line-height: 1.15; }
.marca-nombre { font-family: var(--fuente-titulo); font-weight: 800; font-size: 18px; }
.marca-sub { font-size: 12px; color: var(--texto-2); }
.nav { display: flex; align-items: center; gap: 4px 22px; flex-wrap: wrap; }
.nav a {
  color: var(--texto-2); text-decoration: none; font-weight: 600; font-size: 15px;
  min-height: 44px; display: inline-flex; align-items: center;
  border-bottom: 2px solid transparent; padding-top: 2px;
  transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--texto); }
.nav a[aria-current="page"] { color: var(--texto); border-bottom-color: var(--cian); box-shadow: 0 6px 12px -8px var(--cian); }
.cabecera form { margin: 0; }
.boton-salir {
  font: 700 14px var(--fuente-texto);
  min-height: 40px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  background: rgba(139, 92, 246, .1); color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, .5);
}
.boton-salir:hover { background: rgba(139, 92, 246, .2); border-color: var(--morado); box-shadow: var(--brillo-morado); }

/* ---------- Página ---------- */
.contenido { max-width: 1180px; margin: 0 auto; padding: 36px 24px 72px; animation: aparecer .4s ease; }
.encabezado { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.encabezado h1 { margin: 0; }
.acciones { display: flex; gap: 12px; flex-wrap: wrap; }
.secundario-texto, .suave { color: var(--texto-2); font-size: 14px; }

/* ---------- Botones ---------- */
.boton, button {
  font: 700 15px/1.2 var(--fuente-texto);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 12px;
  background: linear-gradient(135deg, var(--oro-claro), var(--oro)); color: #1a1205;
  border: 1px solid transparent;
  box-shadow: 0 6px 18px rgba(245, 158, 11, .22);
  text-decoration: none; cursor: pointer;
  transition: transform .2s, box-shadow .2s, background-color .2s, border-color .2s;
}
.boton:hover, button:hover { color: #1a1205; transform: translateY(-1px); box-shadow: var(--brillo-oro), 0 6px 18px rgba(245, 158, 11, .3); }
.boton:active, button:active { transform: none; }
.boton-secundario, button.secundario, .boton.secundario {
  background: rgba(6, 182, 212, .06); color: var(--texto);
  border: 1px solid rgba(6, 182, 212, .5); box-shadow: none;
}
.boton-secundario:hover, button.secundario:hover, .boton.secundario:hover {
  color: var(--texto); border-color: var(--cian); box-shadow: var(--brillo-cian);
}
button.peligro { background: linear-gradient(135deg, #fb7185, var(--rojo)); color: #fff; box-shadow: 0 6px 18px rgba(244, 63, 94, .25); }
button.peligro:hover { color: #fff; box-shadow: 0 0 24px rgba(244, 63, 94, .5); }
button:disabled, button:disabled:hover { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.boton-ancho { width: 100%; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; color: var(--texto); }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; min-height: 44px; }
input, select, textarea {
  font: 16px var(--fuente-texto); color: var(--texto);
  background: var(--campo);
  border: 1px solid var(--borde); border-radius: 12px;
  min-height: 46px; padding: 8px 14px; max-width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cian); box-shadow: var(--brillo-cian); }
input::placeholder, textarea::placeholder { color: #64708f; }
input[type="checkbox"], input[type="radio"] { min-height: auto; width: 20px; height: 20px; accent-color: var(--morado); box-shadow: none; }
input[type="file"] { padding: 10px; }
input[type="file"]::file-selector-button {
  font: 600 14px var(--fuente-texto); margin-right: 12px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--superficie-2); color: var(--texto); border: 1px solid var(--borde);
}
textarea { min-height: 88px; }
.campo-ayuda { font-size: 14px; color: var(--texto-2); margin: 6px 0 0; }

/* ---------- Paneles ---------- */
.panel, .caja {
  background: linear-gradient(180deg, var(--superficie-2), var(--superficie));
  border: 1px solid var(--borde);
  border-radius: var(--radio-panel);
  padding: 24px;
  margin-bottom: 24px;
  overflow-x: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.panel > h2:first-child, .caja > h2:first-child { margin-top: 0; }
a.caja { transition: transform .25s, border-color .25s, box-shadow .25s; }
a.caja:hover { transform: translateY(-4px); border-color: var(--morado); box-shadow: var(--brillo-morado); }

/* ---------- Mensajes ---------- */
.flash { padding: 14px 18px; border-radius: 14px; margin-bottom: 20px; font-weight: 500; animation: aparecer .35s ease; }
.flash.ok { background: var(--ok-fondo); color: var(--ok); border: 1px solid rgba(16, 185, 129, .45); box-shadow: 0 0 20px rgba(16, 185, 129, .15); }
.flash.error { background: var(--error-fondo); color: var(--error); border: 1px solid rgba(244, 63, 94, .45); box-shadow: 0 0 20px rgba(244, 63, 94, .15); }

/* ---------- Montos ---------- */
.monto { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.monto-pos, .pos { color: var(--ok); }
.monto-neg, .neg { color: var(--error); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icono-moneda { vertical-align: middle; }

/* ---------- Etiquetas y píldoras ---------- */
.etiqueta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(6, 182, 212, .12); color: #67e8f9; border: 1px solid rgba(6, 182, 212, .35);
}
.etiqueta.verde, .etiqueta-ok { background: var(--ok-fondo); color: var(--ok); border-color: rgba(16, 185, 129, .4); }
.etiqueta.gris { background: rgba(148, 163, 184, .1); color: var(--texto-2); border-color: var(--borde); }
.etiqueta.roja { background: var(--error-fondo); color: var(--error); border-color: rgba(244, 63, 94, .4); }
.etiqueta-contorno { background: transparent; border: 1px solid var(--borde); color: var(--texto-2); }

/* =====================================================================
   Tarjeta bancaria (curso y tarjeta NFC)
   ===================================================================== */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 24px; }
.tarjeta {
  --t1: #4c1d95; --t2: #0f172a; --t-brillo: rgba(139, 92, 246, .45);
  position: relative;
  aspect-ratio: 1.586;
  border-radius: var(--radio-tarjeta);
  padding: 28px;
  overflow: hidden;
  display: flex; flex-direction: column;
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .16), transparent 55%),
    linear-gradient(135deg, var(--t1), var(--t2));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 0 36px var(--t-brillo), 0 24px 48px rgba(0, 0, 0, .45);
  text-decoration: none;
  isolation: isolate;
  transition: transform .3s, box-shadow .3s;
}
.tarjeta.nivel-3 { --t1: #0e7490; --t2: #1e1b4b; --t-brillo: rgba(6, 182, 212, .45); }
.tarjeta.nivel-4 { --t1: #6d28d9; --t2: #0f172a; --t-brillo: rgba(139, 92, 246, .5); }
a.tarjeta { color: #fff; }
a.tarjeta:hover { transform: translateY(-6px) rotate(-.5deg); box-shadow: 0 0 52px var(--t-brillo), 0 30px 56px rgba(0, 0, 0, .5); }
a.tarjeta:hover .tarjeta-nombre { text-shadow: 0 0 18px rgba(255, 255, 255, .5); }
.tarjeta-deco { position: absolute; right: 0; bottom: 0; z-index: -1; }
.tarjeta-arriba { display: flex; justify-content: space-between; align-items: flex-start; }
.tarjeta-nombre {
  font-family: var(--fuente-titulo); font-weight: 800;
  font-size: clamp(44px, 14vw, 64px);
  line-height: 1; margin-top: auto;
}
.tarjeta-anio { font-size: 14px; color: rgba(255, 255, 255, .7); margin-top: 6px; letter-spacing: .08em; }
.tarjeta-abajo { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 16px; font-size: 14px; }
.pildora {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 4px 14px;
  font-size: 12px; font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .75);
  background: rgba(0, 0, 0, .2);
}
.pildora-activa { border-color: var(--oro); color: var(--oro-claro); box-shadow: 0 0 14px rgba(245, 158, 11, .35); }
.pildora-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--oro); box-shadow: 0 0 8px var(--oro); animation: latido 1.6s infinite; }

/* Tarjeta del estudiante (/t/<codigo>) */
.tarjeta-personal { animation: levitar 6s ease-in-out infinite; }
.tarjeta-personal .tarjeta-nombre { font-size: clamp(30px, 9vw, 44px); margin-top: auto; }
.tarjeta-saldo { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.tarjeta-saldo .icono-moneda { filter: drop-shadow(0 0 10px rgba(245, 158, 11, .6)); }
.tarjeta-saldo .cifra { font-family: var(--fuente-texto); font-weight: 800; font-size: 44px; font-variant-numeric: tabular-nums; line-height: 1; color: var(--oro-claro); text-shadow: var(--brillo-oro); }

/* =====================================================================
   Vista de curso
   ===================================================================== */
.curso-titulo { font-size: clamp(40px, 8vw, 60px); margin: 0; text-shadow: var(--brillo-morado); }
.curso-datos { color: var(--texto-2); font-size: 16px; margin: 6px 0 0; }

.interruptor-form { display: flex; align-items: center; gap: 14px; }
.interruptor {
  min-height: 48px; padding: 0 18px 0 8px; gap: 12px;
  background: var(--superficie); color: var(--texto);
  border: 1px solid var(--borde); box-shadow: none;
}
.interruptor:hover { color: var(--texto); border-color: var(--cian); box-shadow: var(--brillo-cian); }
.interruptor-pista {
  position: relative; width: 52px; height: 30px; border-radius: 999px;
  background: var(--campo); border: 1px solid var(--borde);
  transition: background-color .2s, border-color .2s;
}
.interruptor-pista::after {
  content: ""; position: absolute; top: 4px; left: 4px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--texto-2);
  transition: left .2s, background-color .2s;
}
.interruptor[aria-checked="true"] { border-color: var(--oro); }
.interruptor[aria-checked="true"] .interruptor-pista { background: rgba(245, 158, 11, .2); border-color: var(--oro); }
.interruptor[aria-checked="true"] .interruptor-pista::after { left: 26px; background: var(--oro); box-shadow: 0 0 10px var(--oro); }

.curso-columnas { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .curso-columnas { grid-template-columns: 1fr; } }

.lista { list-style: none; margin: 0; padding: 0; }
.lista-estudiantes li + li { border-top: 1px solid var(--borde-suave); }
.fila-estudiante {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 10px 12px; border-radius: 12px;
  color: var(--texto); text-decoration: none;
  transition: background-color .2s;
}
.fila-estudiante:hover { color: var(--texto); background: rgba(139, 92, 246, .1); }
.fila-estudiante[aria-current="true"] { background: rgba(139, 92, 246, .18); box-shadow: inset 3px 0 0 var(--morado); }
.avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--morado), var(--cian)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--fuente-titulo); font-weight: 800; font-size: 16px;
}
.fila-nombre { flex: 1; min-width: 0; font-weight: 600; }
.fila-nombre small { display: block; color: var(--texto-2); font-size: 14px; font-weight: 400; }
.fila-saldo { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--oro-claro); }

.panel-abono { position: sticky; top: 100px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-monto, .chip-motivo {
  min-height: 44px; padding: 0 18px;
  background: var(--superficie); color: var(--texto);
  border: 1px solid var(--borde); font-weight: 700; box-shadow: none;
}
.chip-monto:hover, .chip-motivo:hover { color: var(--texto); border-color: var(--cian); box-shadow: var(--brillo-cian); }
.chip-monto[aria-pressed="true"] { background: rgba(245, 158, 11, .15); color: var(--oro-claro); border-color: var(--oro); box-shadow: var(--brillo-oro); }
.chip-motivo { font-weight: 500; font-size: 15px; }
.campo-monto { width: 9rem; }
.campo-motivo { width: 100%; }
.grupo-campos { border: 0; padding: 0; margin: 0; min-width: 0; }
.leyenda { font-weight: 600; font-size: 14px; margin: 8px 0 10px; padding: 0; }
.chips-motivo { margin-top: 10px; }
.enviar { margin: 24px 0 0; }
.separado { margin-top: 24px; }

/* =====================================================================
   Ficha / página pública de la tarjeta
   ===================================================================== */
.ficha { max-width: 560px; margin: 0 auto; }
.ficha > .panel { margin-top: 24px; }
.ficha > .tarjeta { margin: 0 auto; max-width: 520px; }
.ficha-ancha { max-width: 920px; }
.movimientos li, .canjes li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--borde-suave);
}
.movimientos li:first-child, .canjes li:first-child { border-top: 0; }
.mov-motivo { font-weight: 600; }
.mov-fecha { display: block; color: var(--texto-2); font-size: 14px; font-weight: 400; }
.canje-nombre { font-weight: 600; }
.canje-detalle { display: block; color: var(--texto-2); font-size: 14px; }
.canje-derecha { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.canje-costo { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; color: var(--oro-claro); }
.etiqueta-alcanza { background: var(--ok-fondo); color: var(--ok); border-color: rgba(16, 185, 129, .4); }
.etiqueta-alcanza::first-letter { text-transform: uppercase; }
.nota-final { text-align: center; color: var(--texto-2); font-size: 15px; margin: 8px auto 0; }
.rejilla-ops { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 24px; }

/* =====================================================================
   Tablas, rejillas y saldo
   ===================================================================== */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--borde-suave); vertical-align: top; }
th { color: var(--texto-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
tr:hover td { background: rgba(139, 92, 246, .05); }
form { margin: 0; }
form.linea, .linea { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 24px; }
.saldo {
  /* Cifras en la fuente de texto: el cero de Orbitron lleva barra y parece un ícono. */
  font-family: var(--fuente-texto); font-size: clamp(48px, 10vw, 64px); font-weight: 800; line-height: 1.1; margin: 6px 0;
  color: var(--oro-claro); text-shadow: var(--brillo-oro); font-variant-numeric: tabular-nums;
}
.alcanza { color: var(--ok); font-weight: 600; }
.qr { max-width: 260px; background: #fff; padding: 10px; border-radius: 12px; box-shadow: var(--brillo-cian); }

/* ---------- Pantallas de ingreso ---------- */
.ingreso-caja {
  max-width: 440px; margin: 24px auto 0;
  border-color: rgba(139, 92, 246, .5);
  box-shadow: var(--brillo-morado), 0 24px 60px rgba(0, 0, 0, .5);
}
.ingreso-caja h1 { font-size: 24px; }
.ingreso-caja input { width: 100%; }
.ingreso-caja .boton-ancho { margin-top: 8px; }
.volver { display: inline-block; margin-top: 16px; font-size: 14px; }

/* ---------- Animaciones ---------- */
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }
@keyframes latido { 50% { opacity: .35; } }
@keyframes levitar { 50% { translate: 0 -6px; } }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .cabecera { padding: 10px 16px; }
  .contenido { padding: 24px 16px 48px; }
  .panel, .caja { padding: 18px; }
  .tarjeta { padding: 22px; }
  .panel-abono { position: static; }
}

/* ---------- Impresión: siempre en claro, sin gastar tinta ---------- */
@media print {
  .cabecera, .no-imprimir { display: none; }
  body { background: #fff; color: #000; }
  .contenido { padding: 0; animation: none; }
  .panel, .caja { background: #fff; border: none; box-shadow: none; padding: 0; }
  th, .suave, .secundario-texto { color: #333; }
  th, td { border-bottom-color: #ccc; }
  tr:hover td { background: none; }
  code { color: #000; }
}

/* =====================================================================
   Escape rooms
   La cadena de candados es el elemento protagonista: una línea vertical con
   un nodo por candado. Abierto = teal, activo = latón con pulso, cerrado = atenuado.
   ===================================================================== */
:root {
  --teal: #2dd4bf;
  --teal-fondo: rgba(45, 212, 191, .12);
  --laton: #d4a84b;
  --laton-claro: #f0c96b;
  --laton-fondo: rgba(212, 168, 75, .14);
  --aviso: #fcd34d;
  --aviso-fondo: rgba(245, 158, 11, .1);
}
.flash.aviso { background: var(--aviso-fondo); color: var(--aviso); border: 1px solid rgba(245, 158, 11, .45); }
.flash ul, .er-errores ul { margin: 8px 0 0; padding-left: 20px; }
.tabla-desplazable { overflow-x: auto; }
.campo-ancho { width: 100%; }

/* Lista de juegos */
.er-saldo { font-size: 16px; color: var(--texto-2); }
.er-saldo strong { color: var(--oro-claro); font-size: 20px; }
.er-modulo { margin-bottom: 32px; }
.er-modulo > h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
a.er-tarjeta { display: block; color: inherit; text-decoration: none; }
.er-tarjeta h3 { margin-bottom: 6px; }
.er-tarjeta p { margin: 0 0 12px; }
.er-datos { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 14px; font-size: 14px; color: var(--texto-2); }
.er-datos li { display: inline-flex; align-items: center; gap: 6px; }
.er-posibles { color: var(--oro-claro); font-weight: 700; }
.er-progreso { height: 8px; border-radius: 999px; background: var(--campo); border: 1px solid var(--borde-suave); overflow: hidden; }
.er-progreso span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--cian)); border-radius: inherit; }
.er-estado { margin: 10px 0 0; font-size: 14px; color: var(--texto-2); }

/* Encabezado del juego */
.er-modulo-nombre { margin: 0 0 6px; color: var(--texto-2); font-size: 14px; }
.er-marcadores { display: flex; gap: 12px; flex-wrap: wrap; }
.er-marcador {
  display: flex; flex-direction: column; min-width: 130px; padding: 10px 16px;
  border-radius: 14px; background: var(--superficie); border: 1px solid var(--borde);
}
.er-marcador strong { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--oro-claro); }
.er-reloj strong { color: var(--texto); }
.er-reloj.er-poco strong { color: var(--aviso); }
.er-reloj.er-agotado strong { color: var(--error); font-size: 18px; }
.er-vista-previa {
  display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 24px; border-radius: 14px;
  background: rgba(139, 92, 246, .1); border: 1px dashed rgba(139, 92, 246, .6);
}
.er-vista-previa p { margin: 0; }
.er-narrativa p:first-of-type { white-space: pre-line; }
.er-escapaste { border-color: rgba(45, 212, 191, .6); box-shadow: 0 0 28px rgba(45, 212, 191, .2); }
.er-escapaste h2 { color: var(--teal); }

/* Cadena de candados */
.er-cadena { list-style: none; margin: 8px 0 32px; padding: 0; position: relative; }
.er-cadena::before {
  content: ""; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 3px; border-radius: 3px;
  background: repeating-linear-gradient(180deg, var(--borde) 0 10px, transparent 10px 16px);
}
.er-eslabon { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 18px; padding-bottom: 22px; }
.er-nodo {
  position: relative; z-index: 1; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: var(--fondo-2); border: 2px solid var(--borde); color: var(--texto-2);
}
.er-cuerpo {
  min-width: 0; padding: 16px 20px; border-radius: var(--radio-panel);
  background: linear-gradient(180deg, var(--superficie-2), var(--superficie)); border: 1px solid var(--borde);
}
.er-titulo { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 17px; margin: 0 0 8px; }
.er-premio { margin-left: auto; font-family: var(--fuente-texto); font-weight: 700; font-size: 15px; color: var(--oro-claro); }
.er-enunciado { white-space: pre-line; margin: 0 0 12px; }
.er-retro { margin: 0 0 8px; padding: 10px 14px; border-left: 3px solid var(--teal); background: var(--teal-fondo); border-radius: 0 10px 10px 0; }
.er-pista-texto { margin: 8px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--laton-fondo); color: var(--laton-claro); }

/* Abierto: teal (el tramo de línea que baja desde un candado abierto también es teal) */
.er-abierto .er-nodo { color: var(--teal); border-color: var(--teal); background: var(--teal-fondo); }
.er-abierto::before {
  content: ""; position: absolute; left: 23px; top: 24px; height: 100%; width: 3px; background: var(--teal); border-radius: 3px;
}
.er-cadena > .er-abierto:last-child::before { display: none; }
.er-abierto .er-cuerpo { border-color: rgba(45, 212, 191, .35); }
.er-abierto .er-enunciado { color: var(--texto-2); }

/* Activo: latón con pulso suave */
.er-activo .er-nodo { color: var(--laton-claro); border-color: var(--laton); background: var(--laton-fondo); animation: er-pulso 2.4s ease-in-out infinite; }
.er-activo .er-cuerpo { border-color: rgba(212, 168, 75, .6); box-shadow: 0 0 28px rgba(212, 168, 75, .15); }
.er-activo .er-titulo .etiqueta { background: var(--laton-fondo); color: var(--laton-claro); border-color: rgba(212, 168, 75, .5); }
.er-respuesta input[type="text"] { flex: 1 1 260px; }
.er-opcion { display: flex; padding: 8px 12px; margin: 0 0 8px; border-radius: 12px; border: 1px solid var(--borde); cursor: pointer; }
.er-opcion:hover { border-color: var(--laton); }
.er-opcion:has(input:checked) { border-color: var(--laton); background: var(--laton-fondo); }
.er-pistas { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--borde-suave); }
.er-pistas h3 { margin: 0 0 4px; }
.er-pista { margin-top: 10px; }
.er-boton-pista { min-height: 40px; font-size: 14px; }

/* Cerrado: atenuado y difuminado */
.er-cerrado .er-cuerpo { opacity: .5; background: var(--superficie); }
.er-cerrado .er-nodo { opacity: .55; }
.er-enunciado-oculto { margin: 0; filter: blur(3px); user-select: none; color: var(--texto-2); }

@keyframes er-pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 75, .45); }
  50% { box-shadow: 0 0 0 10px rgba(212, 168, 75, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .er-activo .er-nodo { animation: none; box-shadow: 0 0 0 4px rgba(212, 168, 75, .35); }
}

/* Panel */
.er-tabla td { vertical-align: middle; }
.er-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.er-acciones a, .er-enlace { font-size: 14px; font-weight: 600; }
button.er-enlace {
  min-height: 32px; padding: 0; background: none; border: 0; box-shadow: none;
  color: var(--cian); text-decoration: underline; text-underline-offset: 3px;
}
button.er-enlace:hover { color: #67e8f9; transform: none; box-shadow: none; }
button.er-enlace.er-peligro { color: var(--error); }
button.er-enlace:disabled { color: var(--texto-2); text-decoration: none; }
.er-form .grupo-campos { margin-top: 16px; }
.er-columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0 18px; }
.er-columnas input, .er-columnas select { width: 100%; }
.er-bloque { padding: 4px 0 0; }
.er-opcion-form { display: grid; grid-template-columns: 24px 28px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 10px; }
.er-opcion-form .er-letra { margin: 0; font-family: var(--fuente-titulo); }
.er-pista-form { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 0 14px; }
.er-pista-form input { width: 100%; }
.er-lista-candados { list-style: none; margin: 0; padding: 0; }
.er-lista-candados li {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--borde-suave);
}
.er-lista-candados li:first-child { border-top: 0; }
.er-lista-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; min-width: 0; flex: 1 1 380px; }
.er-lista-enunciado { flex-basis: 100%; }
.er-zona-peligro { border-color: rgba(244, 63, 94, .35); }

@media (max-width: 600px) {
  .er-eslabon { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
  .er-nodo { width: 36px; height: 36px; }
  .er-nodo svg { width: 18px; height: 18px; }
  .er-cadena::before, .er-abierto::before { left: 17px; }
  .er-cuerpo { padding: 14px; }
  .er-marcador { min-width: 0; flex: 1; }
  .er-pista-form { grid-template-columns: 1fr; }
}
