:root {
  --bg: #0f1a2b;
  --panel: #182740;
  --text: #e8eef7;
  --muted: #8fa3bf;
  --accent: #2f7fe0;
  --live: #35c46a;
  --err: #e05252;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hidden { display: none !important; }

header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
header h1 { font-size: 18px; font-weight: 600; flex: 1; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); transition: background .2s;
}
.dot.live { background: var(--live); }
.mode { font-size: 13px; color: var(--muted); min-width: 70px; text-align: right; }

#gate {
  margin: auto; width: min(320px, 86vw);
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
#gate input {
  padding: 12px; border-radius: 10px; border: 1px solid var(--panel);
  background: var(--panel); color: var(--text); font-size: 16px;
}
#gate button {
  padding: 12px; border-radius: 10px; border: 0;
  background: var(--accent); color: white; font-size: 16px;
}
.err { color: var(--err); font-size: 13px; min-height: 1em; }

main {
  flex: 1; display: flex; flex-direction: column;
  gap: 14px; padding: 0 16px 24px; min-height: 0;
}
#transcript {
  flex: 1; overflow-y: auto; background: var(--panel);
  border-radius: 14px; padding: 12px; font-size: 15px; line-height: 1.45;
}
#transcript .u { color: var(--text); margin: 6px 0; }
#transcript .a { color: var(--muted); margin: 6px 0; }
#transcript .u::before { content: "You: "; color: var(--accent); }
#transcript .a::before { content: "CME: "; color: var(--live); }

.talk {
  align-self: center;
  width: 150px; height: 150px; border-radius: 50%;
  border: 0; background: var(--accent); color: white;
  font-size: 22px; font-weight: 600;
  box-shadow: 0 0 0 0 rgba(47,127,224,.5);
  transition: background .2s;
  touch-action: manipulation;
}
.talk.live {
  background: var(--err);
  animation: pulse 1.6s infinite;
}
.talk.speaking { animation: pulse .9s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(224,82,82,.45); }
  70%  { box-shadow: 0 0 0 22px rgba(224,82,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,82,82,0); }
}

#fleet summary { color: var(--muted); font-size: 14px; cursor: pointer; }
#agents { list-style: none; margin-top: 8px; }
#agents li {
  display: flex; justify-content: space-between;
  padding: 6px 4px; font-size: 14px;
  border-bottom: 1px solid rgba(143,163,191,.15);
}
#agents .paused { color: var(--err); }
#agents .active { color: var(--live); }
#agents .meta { color: var(--muted); font-size: 12px; }
