/* Traductor en directo. Un solo estilo para todas las páginas: azul, claro u oscuro según el móvil. */
:root {
  --fondo: #f4f7fc;
  --superficie: #ffffff;
  --texto: #0f1b2d;
  --suave: #55657e;
  --borde: #d5ddea;
  --azul: #1456b8;
  --azul-fuerte: #0e428f;
  --azul-claro: #e4eefc;
  --sobre-azul: #ffffff;
  --verde: #14804a;
  --rojo: #b3261e;
  --ambar: #9a5b00;
  --letra: 1.25rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0a111e;
    --superficie: #121b2d;
    --texto: #e9effb;
    --suave: #9cabc4;
    --borde: #26334c;
    --azul: #7fb2ff;
    --azul-fuerte: #a9cbff;
    --azul-claro: #17294a;
    --sobre-azul: #06142c;
    --verde: #4fd08a;
    --rojo: #ff8a80;
    --ambar: #f1b24a;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--borde);
  background: var(--superficie);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  min-height: 44px;
}
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--azul);
  outline-offset: 2px;
}
a.boton { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit;
  border: 1px solid var(--borde); background: var(--superficie); border-radius: 10px; padding: 0.6rem 0.9rem;
  min-height: 44px; }
button.principal, a.boton.principal { background: var(--azul); border-color: var(--azul); color: var(--sobre-azul); font-weight: 600; }
button.peligro { border-color: var(--rojo); color: var(--rojo); }
button:disabled { opacity: 0.55; cursor: default; }
a { color: var(--azul); }
svg.icono { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ Página del oyente */
body.oyente { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.barra {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem 0.9rem; padding-top: max(0.6rem, env(safe-area-inset-top));
  background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.marca { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: 600; }
.titulos { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.titulos > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-sala { align-self: flex-start; min-height: 0; padding: 0.1rem 0.6rem; margin-top: 0.15rem; font-size: 0.85rem;
  font-weight: 600; border-radius: 999px; border-color: var(--azul); color: var(--azul-fuerte); background: var(--azul-claro);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-sala::after { content: " ▾"; }
.banda { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0.9rem; background: var(--azul-claro); color: var(--azul-fuerte); border-bottom: 1px solid var(--borde);
  font-weight: 600; }
.banda-botones { display: flex; gap: 0.5rem; }
.banda-botones button { min-height: 40px; padding: 0.35rem 0.8rem; }
.aviso-botones { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin-top: 1rem; }
.lista-salas { display: flex; flex-direction: column; gap: 0.6rem; }
.lista-salas button { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1rem; font-size: 1.1rem; text-align: left; }
.lista-salas button span { font-size: 0.9rem; color: var(--suave); white-space: nowrap; }
.lista-salas button span.vivo { color: var(--verde); font-weight: 600; }
.lista-salas button.elegido { border-color: var(--azul); background: var(--azul-claro); }
.lista-salas button.seguir { justify-content: center; color: var(--azul-fuerte); }
.desplegable { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px dashed var(--borde); }
.punto { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--suave); flex: none; }
.punto.directo { background: var(--verde); }
.punto.pausa { background: var(--ambar); }
.punto.cortado { background: var(--rojo); }
.boton-idioma {
  display: flex; align-items: center; gap: 0.45rem; font-weight: 600; border-color: var(--azul);
  color: var(--azul-fuerte); background: var(--azul-claro); border-radius: 999px; padding: 0.5rem 0.9rem;
}
.texto {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1rem 1.5rem;
  font-size: var(--letra); line-height: 1.55; scroll-behavior: auto;
}
.texto p { margin: 0 0 0.9em; overflow-wrap: break-word; }
.texto .nuevo { animation: aparecer 0.5s ease-out; }
@keyframes aparecer { from { background: var(--azul-claro); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .texto .nuevo { animation: none; } }
.texto .original { color: var(--suave); font-style: italic; }
.provisional { color: var(--suave); }
.mas { text-align: center; margin-bottom: 1rem; }
.escribiendo { display: flex; gap: 0.35rem; padding: 0.4rem 0 0.8rem; }
.escribiendo span { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--suave);
  animation: latir 1.2s infinite ease-in-out; }
.escribiendo span:nth-child(2) { animation-delay: 0.2s; }
.escribiendo span:nth-child(3) { animation-delay: 0.4s; }
@keyframes latir { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .escribiendo span { animation: none; opacity: 0.6; } }
.aviso { margin: 12vh auto 0; max-width: 28rem; text-align: center; color: var(--suave); }
.aviso h1 { font-size: 1.3rem; color: var(--texto); margin: 0 0 0.6rem; }
.linea-fin { text-align: center; color: var(--suave); font-size: 0.95rem; margin: 1.2rem 0; }
.a-directo {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 6.2rem; z-index: 2;
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--azul); color: var(--sobre-azul); border-color: var(--azul); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); font-weight: 600;
}
.pie {
  background: var(--superficie); border-top: 1px solid var(--borde);
  padding: 0.5rem 0.75rem; padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}
.botones { display: flex; gap: 0.5rem; align-items: stretch; }
.botones button { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.15rem; flex: 1; min-width: 0; padding: 0.4rem 0.3rem; font-size: 0.85rem; line-height: 1.2; }
.botones button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.botones button[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: var(--sobre-azul); }
.botones .letra { flex: 0 0 3.2rem; font-weight: 700; font-size: 1.05rem; }
.nota { margin: 0.45rem 0 0; font-size: 0.78rem; color: var(--suave); text-align: center; }
dialog {
  border: 1px solid var(--borde); border-radius: 16px; background: var(--superficie); color: var(--texto);
  width: min(30rem, calc(100vw - 2rem)); max-height: min(85dvh, 44rem); padding: 1rem;
}
dialog::backdrop { background: rgba(5, 12, 25, 0.6); }
dialog h2 { margin: 0 0 0.8rem; font-size: 1.15rem; }
.lista-idiomas { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.lista-idiomas button { font-size: 1.1rem; font-weight: 600; padding: 0.9rem 0.6rem; }
.lista-idiomas button.elegido { background: var(--azul); border-color: var(--azul); color: var(--sobre-azul); }
.cuerpo-resumen { white-space: pre-wrap; font-size: 1.05rem; overflow-y: auto; max-height: 55dvh; }
.pie-dialogo { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 0.9rem; }
.pie-dialogo small { color: var(--suave); }

/* ------------------------------------------------------------------ Tele */
body.pantalla { background: #000; color: #fff; height: 100dvh; overflow: hidden; display: flex; }
.columna { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 2.5vh 3vw; }
.columna + .columna { border-left: 2px solid #26334c; }
.columna h2 { margin: 0 0 1.5vh; font-size: 2.2vh; font-weight: 600; color: #8fb8ff; letter-spacing: 0.04em; }
.columna .lineas { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  font-size: clamp(1.6rem, 5.2vh, 4.5rem); line-height: 1.3; }
.columna .lineas p { margin: 0 0 0.5em; overflow-wrap: break-word; }
.columna .lineas p.vieja { opacity: 0.55; }
.columna .lineas p.provisional { color: #9cabc4; }
.pantalla .estado-tele { position: fixed; top: 1.5vh; right: 2vw; font-size: 1.8vh; color: #9cabc4; }

/* ------------------------------------------------------------------ Páginas de gestión (emisor, panel, entrar) */
body.gestion { padding: 1rem; max-width: 64rem; margin: 0 auto; }
.gestion h1 { font-size: 1.4rem; margin: 0.2rem 0 0.2rem; }
.gestion h2 { font-size: 1.1rem; margin: 0 0 0.7rem; }
.subtitulo { color: var(--suave); margin: 0 0 1rem; }
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: 14px; padding: 1rem;
  margin-bottom: 1rem; }
.fila { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.fila.separada { justify-content: space-between; }
.campo { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.campo label { font-weight: 600; }
select, input[type="text"], input[type="password"] {
  border: 1px solid var(--borde); border-radius: 10px; padding: 0.6rem 0.7rem; background: var(--fondo);
  min-height: 44px; width: 100%;
}
.casilla { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.8rem; }
.casilla input { width: 1.2rem; height: 1.2rem; margin-top: 0.2rem; }
.etiqueta { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px; padding: 0.15rem 0.65rem;
  font-size: 0.85rem; font-weight: 600; border: 1px solid var(--borde); }
.etiqueta.bien { color: var(--verde); border-color: var(--verde); }
.etiqueta.mal { color: var(--rojo); border-color: var(--rojo); }
.etiqueta.ojo { color: var(--ambar); border-color: var(--ambar); }
.medidor { height: 14px; border-radius: 7px; background: var(--fondo); border: 1px solid var(--borde);
  overflow: hidden; }
.medidor div { height: 100%; width: 0; background: var(--verde); transition: width 0.1s linear; }
.medidor div.alto { background: var(--rojo); }
.boton-grande { font-size: 1.2rem; padding: 0.9rem 1.4rem; min-width: 11rem; }
.monitor { height: 16rem; overflow-y: auto; background: var(--fondo); border: 1px solid var(--borde);
  border-radius: 10px; padding: 0.7rem; font-size: 1.05rem; }
.monitor p { margin: 0 0 0.5em; }
.monitor .provisional { color: var(--suave); }
.dato { color: var(--suave); font-size: 0.92rem; }
.mensaje { border-radius: 10px; padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; border: 1px solid var(--borde); }
.mensaje.error { border-color: var(--rojo); color: var(--rojo); }
.mensaje.bien { border-color: var(--verde); color: var(--verde); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { color: var(--suave); font-weight: 600; font-size: 0.9rem; }
.qr { width: 11rem; height: 11rem; background: #fff; border-radius: 10px; padding: 0.3rem; }
.dos-columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.url { font-family: ui-monospace, Consolas, monospace; font-size: 0.9rem; overflow-wrap: anywhere; }
.sala { border-top: 1px solid var(--borde); padding: 0.8rem 0; }
.sala:first-of-type { border-top: 0; padding-top: 0; }

/* ------------------------------------------------------------------ Cartel para imprimir */
/* El cartel es siempre claro (se imprime), aunque el equipo esté en modo oscuro. */
body.cartel { color-scheme: light; --superficie: #ffffff; --texto: #0f1b2d; --borde: #d5ddea; --azul: #1456b8;
  background: #fff; color: #0f1b2d; text-align: center; padding: 2rem 1.5rem; max-width: 44rem;
  margin: 0 auto; }
.cartel h1 { font-size: 2.4rem; margin: 0.5rem 0; color: #1456b8; }
.cartel .idiomas-cartel { font-size: 1.35rem; line-height: 1.7; margin: 0 0 1.2rem; }
.cartel img { width: min(70vw, 22rem); height: auto; }
.cartel .pasos { font-size: 1.15rem; margin: 1.2rem 0 0.5rem; }
.cartel .direccion { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; overflow-wrap: anywhere; }
.cartel .iglesia { margin-top: 1.5rem; color: #55657e; }
@media print { .no-imprimir { display: none !important; } body.cartel { padding: 0; } }
