/* Visor del avatar (agent-viewer.html): el avatar a pantalla completa y un indicador discreto. */
:root {
  --bg: #1e2430;
  --hud-bg: rgba(0, 0, 0, 0.45);
  --hud-fg: #e8eaf0;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--hud-fg);
  font: 13px/1.4 system-ui, sans-serif;
}

/* Fondo de escena (scene-effects.mjs) bajo el avatar: ocupa toda la ventana y no recibe el ratón. */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#avatar {
  position: fixed;
  inset: 0;
}

#hud {
  position: fixed;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--hud-bg);
  max-width: calc(100vw - 24px);
}

#hud.hidden { display: none; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}

.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

#hud-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sound {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
}

#start {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(360px, calc(100vw - 32px));
  height: 120px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--hud-fg);
  font: 600 18px/1.3 system-ui, sans-serif;
  cursor: pointer;
}

#start small {
  display: block;
  margin-top: 8px;
  font-weight: 400;
  font-size: 12px;
  opacity: 0.8;
}

#start[hidden] { display: none; }

/* Indicador de en qué llamada está (arriba, centrado). */
#focus {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--hud-bg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#focus[hidden], #caption[hidden] { display: none; }

/* Subtítulo del agente: abajo, grande, con contorno para leerse sobre cualquier fondo. */
#caption {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  width: min(900px, calc(100vw - 32px));
  text-align: center;
  font: 700 clamp(18px, 3.2vw, 34px)/1.25 system-ui, sans-serif;
  color: #fff;
  -webkit-text-stroke: 0.2em #000;
  paint-order: stroke fill;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#cc, #dlg {
  border: 0;
  background: transparent;
  color: inherit;
  font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.55;
}

#cc[aria-pressed="true"], #dlg[aria-pressed="true"] { opacity: 1; }

/* Panel de diálogo a la derecha (D lo pliega). */
#dialogue {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(340px, 40vw);
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

#dialogue.folded { display: none; }

#dialogue header {
  padding: 8px 12px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

#dialogue header small { font-weight: 400; opacity: 0.7; }

#dialogue-list {
  flex: 1;
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  overflow-y: auto;
}

#dialogue-list li { margin: 0 0 10px; overflow-wrap: anywhere; }
#dialogue-list .meta { display: block; font-size: 11px; opacity: 0.65; }
#dialogue-list .said .text { color: #9ecbff; }
#dialogue-empty { margin: 0; padding: 12px; opacity: 0.6; }
#dialogue-list:not(:empty) + #dialogue-empty { display: none; }
