/* Morado — live style (paleta sobria: ciruela + violeta) */
:root {
  font-size: 16px;
  --gap: 0.75rem;
  --touch: 2.75rem;
  --radius: 0.75rem;
  --record-size: 4.5rem;
  --record-size-lg: 5.5rem;
  --morado: #7c3aed;
  --morado-deep: #5b21b6;
  --morado-soft: #c4b5fd;
  --bg-home: #120b1e;
  --ink: #f5f1fa;
  --muted: #a79fc0;
}
* { box-sizing: border-box; }
/* hidden siempre gana (los display de autor lo pisaban y dejaban botones visibles). */
[hidden] { display: none !important; }
html, body {
  height: 100%;
  overscroll-behavior: none; /* Elimina rebote elástico (pull-to-refresh/bounce) en iOS/Android */
  touch-action: manipulation; /* Evita zoom accidental por doble-tap */
}
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0; padding: 0; background: #000; color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* Video elements: no touch zoom */
video { touch-action: none; }

/* ===== HOME + CREADOR (Morado; el creador comparte layout de ingreso) ===== */
body[data-role="home"],
body[data-role="creator"] {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: 2rem 1rem; text-align: center;
  background: radial-gradient(120% 60% at 50% 0%, #241640 0%, var(--bg-home) 60%) fixed, var(--bg-home);
  color: var(--ink);
}
.tk-nav { display: none; }
.home-card { max-width: 28rem; width: 100%; }
.pwa-hint {
  display: flex; align-items: center; gap: 0.6rem; text-align: left;
  font-size: 0.85rem; color: var(--ink);
  background: rgba(124,58,237,.12); border: 1px solid rgba(139,92,246,.4);
  border-radius: var(--radius); padding: 0.65rem 0.8rem; margin-bottom: 1rem;
}
.pwa-hint b { color: #fff; }
.pwa-hint button {
  flex: none; margin-left: auto; min-height: 0; padding: 0.3rem 0.6rem;
  background: none; color: var(--muted); font-size: 0.9rem;
}
.home-card h1 { font-size: clamp(1.5rem, 6vw, 2rem); margin: 0 0 0.25rem; font-weight: 600; }
.brand { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 0.25rem; }
.brand-mark { flex: none; filter: drop-shadow(0 2px 8px rgba(124,58,237,.45)); }
.how { margin: 1.25rem auto 0; max-width: 24rem; text-align: left; border: 1px solid rgba(139,92,246,.25); border-radius: var(--radius); padding: 0.75rem 1rem; background: rgba(124,58,237,.06); }
.how summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.how ol { margin: 0.6rem 0 0.25rem; padding-left: 1.25rem; font-size: 0.9rem; color: #ccc; }
.how li { margin: 0.3rem 0; }
.how li strong { color: #fff; }
.home-foot { margin-top: 1.5rem; font-size: 0.75rem; color: var(--muted); }
.subtitle { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.5rem; }
.row { display: flex; flex-wrap: wrap; gap: var(--gap); margin: var(--gap) 0; }
label { display: block; width: 100%; text-align: left; font-size: 0.85rem; color: #ccc; margin-bottom: 0.35rem; }
input {
  width: 100%; padding: 0.75rem 1rem; border-radius: var(--radius);
  border: 1px solid #333; background: #111; color: #fff; font-size: 1rem;
  min-height: var(--touch);
}
input::placeholder { color: #666; }
input:focus { outline: none; border-color: var(--morado); }
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--morado-soft); outline-offset: 2px;
}
button {
  padding: 0.75rem 1.5rem; border-radius: var(--radius); border: none;
  font-size: 1rem; font-weight: 600; cursor: pointer; min-height: var(--touch);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn-primary { background: var(--morado); color: #fff; width: 100%; }
.btn-primary:active { transform: scale(0.98); background: var(--morado-deep); }
.btn-secondary {
  background: transparent; color: var(--ink); border: 1px solid rgba(139,92,246,.5);
}
.btn-secondary:active { background: #f0f0f0; }
h3 { font-size: 0.95rem; color: #888; margin: 1.5rem 0 0.5rem; font-weight: 500; }

/* ===== NAV (solo Home) ===== */
.tk-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.75rem 1rem; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tk-nav b { font-size: 1.1rem; margin-right: auto; }
.tk-nav a {
  text-decoration: none; color: #fff; padding: 0.5rem 1rem; border-radius: var(--radius);
  background: transparent; border: 1px solid transparent; min-height: var(--touch);
  display: inline-flex; align-items: center; transition: background 0.15s, border-color 0.15s;
}
.tk-nav a:hover, .tk-nav a:focus { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }

/* ===== FULLSCREEN STAGE (Host & Viewer) ===== */
/* iOS 26 fix: height: 100dvh (dynamic viewport) evita que la barra de direcciones empuje contenido.
   Overlays usan position: absolute dentro del stage (relative).
   El botón inferior usa bottom: env(safe-area-inset-bottom) para quedar SOBRE la home indicator. */
.host-stage, .viewer-stage {
  position: relative; width: 100%; height: 100vh; height: 100dvh;
  background: #000; overflow: hidden; display: flex; flex-direction: column;
}
/* Host preview: espejo solo visual (CSS) para que el anfitrión se vea natural */
#host-preview {
  width: 100%; height: 100%; object-fit: cover; display: block; flex: 1;
  transform: scaleX(-1);
}
/* Viewer player: SIN espejo, video tal cual llega */
#viewer-player {
  width: 100%; height: 100%; object-fit: cover; display: block; flex: 1;
}

/* ===== TOP BARS ===== */
/* iOS 26 fix: position: absolute dentro de .host-stage/.viewer-stage (relative) */
/* Vignette: legibilidad de overlays sobre video claro (bajo topbars z10 y stats z5). */
.host-stage::after, .viewer-stage::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 22%, transparent 50%, rgba(0,0,0,.68));
}
.live-duration, .status-duration { opacity: .75; font-variant-numeric: tabular-nums; }
.viewer-topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.likes-pill {
  position: absolute; right: 1rem; bottom: 5.5rem; z-index: 10;
  background: rgba(0,0,0,.6); padding: 0.4rem 0.75rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; color: #ff6b81; pointer-events: none;
}
.likes-pill[hidden] { display: none; }
.heart-float {
  position: absolute; z-index: 11; pointer-events: none; color: #ff3b5c;
  font-size: 1.75rem; animation: heart-up 1.4s ease-out forwards;
}
@keyframes heart-up {
  from { opacity: 1; transform: translateY(0) scale(0.6) rotate(-8deg); }
  to { opacity: 0; transform: translateY(-9rem) scale(1.25) rotate(10deg); }
}
/* Modo inmersivo: un toque esconde overlays (el video sigue). */
.viewer-stage.ui-hidden .viewer-topbar,
.viewer-stage.ui-hidden .viewer-join,
.viewer-stage.ui-hidden .stats-overlay,
.viewer-stage.ui-hidden #viewer-log,
.viewer-stage.ui-hidden .likes-pill { opacity: 0; pointer-events: none; }
.viewer-topbar, .viewer-join, .stats-overlay, #viewer-log, .likes-pill { transition: opacity 0.25s ease; }
#host-info-sheet[hidden] { display: none; }
#host-info-sheet {
  position: absolute; inset: 0; z-index: 200; padding: 1rem;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
#host-info-close { position: absolute; top: 0.5rem; right: 0.5rem; min-height: 0; background: none; border: none; color: #666; font-size: 1.2rem; cursor: pointer; }
#people-sheet[hidden] { display: none; }
#people-sheet {
  position: fixed; inset: 0; z-index: 200; padding: 1rem;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.people-list { list-style: none; margin: 0.5rem 0 0; padding: 0; max-height: 40vh; overflow: auto; text-align: left; }
.people-list li { padding: 0.55rem 0.25rem; border-bottom: 1px solid #eee; font-size: 0.95rem; }
.people-list li:last-child { border-bottom: none; }
.people-list .people-empty { color: #888; text-align: center; }
.btn-mute {
  width: var(--record-size); height: var(--record-size); border-radius: 50%;
  background: rgba(255,255,255,.92); color: #000; border: none; font-size: 1.4rem;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.btn-mute:active { transform: scale(0.92); }
.btn-mute.muted { background: #ff3b30; color: #fff; }
.host-controls { gap: 1.25rem; align-items: center; }
.host-topbar, .viewer-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(env(safe-area-inset-top, 0px), 0.75rem) 1rem 1rem; pointer-events: none;
}
.host-topbar > *, .viewer-topbar > * { pointer-events: auto; }

/* Live indicator (Host) */
.live-indicator {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(0,0,0,0.6); padding: 0.4rem 0.75rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.live-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #ff3b30;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
/* Badge degradado: sin chunk real hace segundos (cámara/mic caídos o zombi) */
#host-live-badge.degraded { background: rgba(255,59,48,.85); }
#host-live-badge.degraded .live-dot { background: #fff; animation: pulse 0.5s infinite; }
.viewer-count { color: #fff; margin-left: 0.25rem; }
#viewer-viewer-count {
  background: rgba(0,0,0,.6); padding: 0.4rem 0.75rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
#viewer-viewer-count[hidden] { display: none; }

/* Connection status (Viewer) */
.connection-status {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(0,0,0,0.6); padding: 0.4rem 0.75rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 500;
  margin-left: env(safe-area-inset-left, 0); /* Account for left safe area */
}
.status-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #ffcc00;
  animation: blink 1s infinite;
}
.connection-status.connected .status-dot { background: #30d158; animation: none; }
.connection-status.ended .status-dot { background: #8e8e93; animation: none; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* FAB close */
.tk-fab {
  width: var(--touch); height: var(--touch); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; text-decoration: none; font-size: 1.25rem;
  background: rgba(0,0,0,0.45); border: none;
}

/* Host topbar actions (share button) */
.host-topbar-actions {
  display: flex; align-items: center; gap: 0.5rem;
  padding-right: env(safe-area-inset-right, 0);
}
.btn-icon-only {
  width: var(--touch); height: var(--touch); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0,0,0,0.45); border: none;
  font-size: 1.25rem; cursor: pointer;
  flex-shrink: 0; /* Prevent shrinking on narrow screens */
}
.btn-icon-only:hover { background: rgba(0,0,0,0.6); }
.more-glyph { font-weight: 800; font-size: 1.1em; line-height: 1; letter-spacing: 0; }
.creator-link { color: var(--morado-soft); font-size: 0.9rem; }
.handle-box { margin: 0.75rem 0; padding: 0.75rem 1rem; border: 1px solid rgba(139,92,246,.25); border-radius: var(--radius); background: rgba(124,58,237,.06); }
.handle-box p { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.handle-have { color: var(--ink) !important; font-weight: 700; word-break: break-all; }
.handle-row { display: flex; gap: 0.5rem; }
.handle-row input { flex: 1; min-width: 0; }
.handle-row button { width: auto; flex: none; padding-left: 1rem; padding-right: 1rem; }
.handle-msg { min-height: 1.2em; font-size: 0.85rem; margin-bottom: 0 !important; }
.share-room { font-weight: 800; font-size: 1.05rem; letter-spacing: 0.04em; margin: 0.6rem 0 0; }
#share-qr { display: flex; justify-content: center; background: #fff; border-radius: var(--radius); padding: 0.75rem; }
#host-menu-sheet[hidden] { display: none; }
#host-menu-sheet {
  position: absolute; inset: 0; z-index: 200; padding: 1rem;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.menu-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.menu-item {
  width: 100%; padding: 0.8rem 1rem; border-radius: var(--radius);
  background: #f2f2f5; color: #111; border: 1px solid #e2e2e6;
  font-size: 1rem; font-weight: 600; cursor: pointer; text-align: left;
}
.menu-item:active { background: #e8e8ec; }
.menu-item.menu-danger { color: #b3261e; border-color: rgba(179,38,30,.35); }

/* ===== HOST DOCK — auth/cuenta/nombre/error SIEMPRE sobre los controles ===== */
/* .host-controls es absolute (alto = record-size + safe-area). El dock vive en flujo
   al fondo de .host-stage y reserva ese alto como padding inferior: nada choca con EMITIR.
   Vacío (todo hidden, ej. en vivo) colapsa a 0 y el video queda full-bleed. */
.host-dock {
  --dock-clear: calc(var(--record-size) + max(env(safe-area-inset-bottom, 0px), 1.5rem) + 2.25rem);
  position: relative; z-index: 5;
  padding: 0 1rem var(--dock-clear);
}
.host-dock:not(:has(> :not([hidden]))) { padding-left: 0; padding-right: 0; padding-bottom: 0; }
.host-dock .host-auth { margin: 0 0.5rem 0.75rem; }
.host-dock .account-line { margin: 0 0 0.5rem; padding: 0; }
.host-dock .handle-box { margin: 0.5rem 0 0; }

/* Login host + cuenta (solo emitir requiere cuenta). */
.host-auth { margin: 0 1.5rem 1rem; }
.host-auth[hidden] { display: none; }
.auth-hint { font-size: 0.8rem; color: #aaa; text-align: center; margin: 0.5rem 0 0; }
.account-line {
  text-align: center; font-size: 0.8rem; color: #aaa; margin: 0 0 0.5rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 1rem;
}
.account-line[hidden] { display: none; }
.mod-notice {
  text-align: center; font-size: 0.8rem; color: #aaa; margin: 0 0 0.5rem;
  padding: 0 1rem;
}
.mod-notice[hidden] { display: none; }

/* ===== HOST CONTROLS — Botón circular grande ===== */
/* iOS 26 fix: position: absolute dentro de .host-stage (relative, height: 100vh).
   bottom: env(safe-area-inset-bottom) lo coloca SOBRE la home indicator, no detrás. */
.host-controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: center;
  padding: 1.5rem 1rem max(env(safe-area-inset-bottom, 0px), 1.5rem); pointer-events: none;
}
.host-controls > * { pointer-events: auto; }
.btn-record {
  width: var(--record-size); height: var(--record-size); border-radius: 50%;
  padding: 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem; background: #fff; color: #000; border: 4px solid #fff; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.btn-record:active { transform: scale(0.92); }
.btn-record .btn-icon { font-size: 1.5rem; line-height: 1; }
.btn-record .btn-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.btn-record.btn-stop { background: #ff3b30; border-color: #ff3b30; color: #fff; }
.btn-record.btn-stop .btn-icon { font-size: 1.2rem; }

/* Desktop: stage centrado tipo móvil */
/* En desktop usamos fixed (sin bug iOS 26), en móvil relative+absolute */
@media (min-width: 48rem) {
  .host-stage, .viewer-stage {
    position: fixed; max-width: 28rem; left: 50%; right: auto; transform: translateX(-50%);
    height: 100dvh; /* desktop también usa dvh para consistencia */
  }
  .btn-record { width: var(--record-size-lg); height: var(--record-size-lg); }
  /* Botón más grande en desktop: el dock reserva el alto extra. */
  .host-dock { --dock-clear: calc(var(--record-size-lg) + max(env(safe-area-inset-bottom, 0px), 1.5rem) + 2.25rem); }
}

/* Link overlay */
/* iOS 26 fix: position: absolute dentro de .host-stage (relative) */
#host-link {
  position: absolute; top: 4.5rem; left: 1rem; right: 4rem; z-index: 10;
  padding: 0.5rem 0.75rem; font-size: 0.8rem; background: rgba(0,0,0,0.6);
  border-radius: var(--radius); color: #fff; word-break: break-all;
  padding-top: env(safe-area-inset-top, 0);
}
#host-link a { color: #fff; text-decoration: underline; }
#host-link:empty { display: none; }

/* Viewer join bar (solo si no hay room en URL) */
/* iOS 26 fix: position: absolute dentro de .viewer-stage (relative) */
.viewer-join {
  position: absolute; top: 4rem; left: 1rem; right: 1rem; z-index: 10;
  display: flex; gap: 0.5rem; pointer-events: none;
  padding-top: env(safe-area-inset-top, 0);
}
.viewer-join > * { pointer-events: auto; }
.viewer-join input { flex: 1; min-width: 0; background: rgba(255,255,255,0.95); color: #000; }
.viewer-join button { white-space: nowrap; background: #fff; color: #000; }

/* Stats overlay (debug) */
/* iOS 26 fix: position: absolute dentro de .viewer-stage (relative) */
.stats-overlay {
  position: absolute; left: 1rem; bottom: 1rem; z-index: 5;
  font-size: 0.75rem; color: #fff; text-shadow: 0 1px 3px #000;
  background: rgba(0,0,0,0.5); padding: 0.4rem 0.6rem; border-radius: var(--radius);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Viewer log (debug, overlay inferior) */
/* iOS 26 fix: position: absolute dentro de .viewer-stage (relative) */
#viewer-log {
  position: absolute; left: 1rem; right: 1rem; bottom: 5.5rem; z-index: 5;
  max-height: 15dvh; margin: 0; padding: 0.75rem;
  background: rgba(0,0,0,0.55); color: #ddd; font-size: 0.7rem;
  border-radius: var(--radius); overflow: auto; white-space: pre-wrap; word-break: break-word;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
#viewer-log:empty { display: none; }

/* ===== MODAL ANTORCHA (mismo marco que compartir) ===== */
#torch-modal[hidden] { display: none; }
#torch-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem;
}
#torch-close { position: absolute; top: 0.5rem; right: 0.5rem; min-height: 0; background: none; color: #666; }
.torch-code {
  font-size: 2rem; font-weight: 800; letter-spacing: 0.3rem; text-align: center;
  background: rgba(139,92,246,.12); border: 1px dashed rgba(139,92,246,.65);
  border-radius: var(--radius); padding: 0.75rem 0.5rem 0.75rem 0.8rem; margin: 0.75rem 0 0.25rem;
  color: #111; font-variant-numeric: tabular-nums; user-select: all;
}
#torch-share { min-height: var(--touch); }
#torch-copy { width: 100%; margin: 0.75rem 0 0; min-height: var(--touch); }

/* ===== MODAL COMPARTIR ===== */
#share-modal[hidden] { display: none; }
#share-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem;
}
.share-card {
  background: #fff; color: #111; border-radius: 1rem; padding: 1.5rem;
  width: min(22rem, 92vw); text-align: center; position: relative;
}
#share-close { position: absolute; top: 0.5rem; right: 0.5rem; min-height: 0; background: none; color: #666; }
#share-qr { margin: 0.75rem auto; width: 200px; height: 200px; max-width: 100%; }
#share-qr img, #share-qr canvas, #share-qr table { margin-inline: auto; }
.share-hint { font-size: 0.8rem; color: #666; margin: 0.25rem 0 0; }
#share-copy { width: 100%; margin: 0.75rem 0; background: #000; color: #fff; }
.share-card .row { justify-content: center; }
.share-app {
  padding: 0.6rem 1rem; border: 1px solid #ddd; border-radius: var(--radius);
  text-decoration: none; color: #111; min-height: var(--touch);
  display: inline-flex; align-items: center; background: #fff;
}
.share-app:hover { background: #f5f5f5; }
.share-app svg { width: 1.15em; height: 1.15em; flex: none; }
.xlogo { font-weight: 900; font-size: 1.15em; letter-spacing: -0.02em; line-height: 1; }

/* Toast no bloqueante (reemplaza alert nativo). */
.toast {
  position: fixed; left: 50%; bottom: max(env(safe-area-inset-bottom, 0px), 1.5rem); transform: translateX(-50%);
  z-index: 300; background: rgba(20,20,24,.95); color: #fff; border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px; padding: 0.7rem 1.25rem; font-size: 0.9rem; font-weight: 500;
  max-width: min(26rem, 92vw); text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.toast[hidden] { display: none; }

/* ===== DEBUG PANEL (config avanzada oculta) ===== */
.debug-panel {
  position: fixed; bottom: 1rem; right: 1rem; left: 1rem; max-width: 28rem; margin-inline: auto;
  background: rgba(255,255,255,0.98); color: #111; border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3); z-index: 150; overflow: hidden;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: none; } }
.debug-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid #eee; font-weight: 600; font-size: 0.9rem;
}
#debug-close { background: none; border: none; color: #666; font-size: 1.2rem; padding: 0; line-height: 1; }
.debug-body { padding: 1rem; font-size: 0.85rem; }
.debug-body label { display: block; margin-bottom: 0.5rem; }
.debug-body input { width: 100%; padding: 0.6rem; border-radius: var(--radius); border: 1px solid #ddd; background: #fff; color: #111; }
.debug-hint { margin: 0.75rem 0 0; font-size: 0.75rem; color: #666; }
.debug-hint code { background: #f0f0f0; padding: 0.1rem 0.3rem; border-radius: 0.25rem; font-size: 0.8em; }
.debug-danger { margin-top: 1rem; border-top: 1px solid #eee; padding-top: 1rem; }
.debug-danger h3 { margin: 0 0 0.5rem; font-size: 0.9rem; color: #b3261e; }
.btn-danger {
  background: #fff; color: #b3261e; border: 1px solid #b3261e;
  width: 100%;
}
.btn-danger:active { background: #fbe9e7; }
.btn-danger.armed { background: #b3261e; color: #fff; }

/* Aviso legal: modal bloqueante de entrada. */
#legal-gate[hidden] { display: none; }
#legal-gate {
  position: fixed; inset: 0; z-index: 300; padding: 1rem; overflow: auto;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.legal-card { text-align: left; }
.legal-card h2 { margin: 0 0 0.75rem; font-size: 1.15rem; text-align: center; }
.legal-text { font-size: 0.88rem; line-height: 1.5; color: #333; }
.legal-text p { margin: 0.6rem 0; }
.legal-card .btn-primary { width: 100%; margin-top: 0.75rem; background: #000; color: #fff; }
.legal-card .row { justify-content: center; }

/* ===== HOST RECOVERY PROMPT (persistencia sesión) ===== */
.recovery-prompt {
  background: rgba(255,255,255,0.98); color: #111; border-radius: var(--radius);
  padding: 1.5rem; margin: 1rem; max-width: 28rem; margin-inline: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3); text-align: center;
  animation: slideUp 0.2s ease;
}
.recovery-prompt h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.recovery-prompt p { margin: 0.5rem 0; font-size: 0.9rem; line-height: 1.4; }
.recovery-prompt strong { color: #000; }
.recovery-prompt .row { justify-content: center; gap: 0.75rem; }
.recovery-prompt .btn-secondary {
  background: #fff; color: #000; border: 1px solid #ddd;
}
.recovery-prompt .btn-secondary:active { background: #f0f0f0; }
/* ===== Extras ===== */
.stats-overlay:empty, #viewer-log:empty { display: none; }
#host-error {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem; border-radius: var(--radius); background: rgba(30,8,8,.92);
  border: 1px solid rgba(255,59,48,.6); color: #fff; font-size: 0.9rem; font-weight: 600;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.unmute-btn {
  position: absolute; left: 50%; bottom: max(env(safe-area-inset-bottom, 0px), 1.5rem); transform: translateX(-50%);
  z-index: 10; background: rgba(0,0,0,0.65); color: #fff; border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px; padding: 0.6rem 1.25rem; font-size: 0.9rem; white-space: nowrap;
}
.unmute-btn[hidden], #host-error[hidden] { display: none; }
