:root {
  --bg: #03040a;
  --panel: rgba(8, 14, 28, 0.55);
  --border: rgba(120, 200, 255, 0.18);
  --text: #cfe8ff;
  --muted: #6f8aa8;
  --jarvis: #00e5ff;
  --chino: #ff2bd6;
  --server: #7cff6b;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Orbitron", var(--mono);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  overflow: hidden;
}

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; }

.hud {
  position: fixed;
  z-index: 2;
  pointer-events: none;
}

.hud h2 {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 10px;
}

.hud-top {
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.3em;
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.6);
}
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; }
.brand-mark {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--jarvis);
  box-shadow: 0 0 12px var(--jarvis), 0 0 24px var(--chino);
  animation: breathe 2.4s ease-in-out infinite;
}

.link-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); backdrop-filter: blur(8px);
}
.link-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #ffb020; }
.link-status[data-state="live"] .dot { background: var(--server); box-shadow: 0 0 10px var(--server); animation: breathe 1.6s infinite; }
.link-status[data-state="offline"] .dot { background: #ff4d4d; }
.link-status[data-state="demo"] .dot { background: var(--chino); }

.hud-system, .hud-feed {
  top: 76px;
  width: 260px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.hud-system { left: 24px; }
.hud-feed { right: 24px; }

.meter { display: grid; grid-template-columns: 36px 1fr 48px; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 8px; }
.meter span { color: var(--muted); }
.meter b { text-align: right; font-weight: 600; }
.bar { height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 3px; overflow: hidden; }
.bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--server), var(--jarvis));
  box-shadow: 0 0 8px var(--jarvis);
  transition: width 0.8s ease;
}
.uptime { font-size: 12px; color: var(--muted); }
.uptime b { color: var(--text); font-weight: 600; }

#feed { list-style: none; font-size: 12px; max-height: 210px; overflow: hidden; }
#feed li {
  display: flex; gap: 8px; padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  animation: slideIn 0.35s ease-out;
}
#feed li time { color: var(--muted); }
#feed li[data-agent="jarvis"] .who { color: var(--jarvis); }
#feed li[data-agent="chino"] .who { color: var(--chino); }
#feed li.empty { color: var(--muted); border: 0; }

.hud-agents {
  bottom: 40px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 16px;
}
.agent-card {
  width: 230px; padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.agent-card[data-agent="jarvis"] { --c: var(--jarvis); }
.agent-card[data-agent="chino"] { --c: var(--chino); }
.agent-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.agent-head h3 { font-family: var(--display); font-size: 15px; letter-spacing: 0.25em; color: var(--c); }
.agent-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.agent-state { font-size: 12px; margin-bottom: 6px; min-height: 1.2em; }
.agent-count { font-size: 12px; color: var(--muted); }
.agent-count b { color: var(--text); }
.agent-card.busy { border-color: var(--c); box-shadow: 0 0 24px -6px var(--c); }
.agent-card.busy .agent-dot { animation: breathe 0.6s infinite; }
.agent-card.hit { animation: hit 0.6s ease-out; }

@keyframes breathe { 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } }
@keyframes hit { 0% { box-shadow: 0 0 40px 0 var(--c); } 100% { box-shadow: 0 0 0 0 transparent; } }

@media (max-width: 820px) {
  .hud-feed { display: none; }
  .hud-system { top: auto; bottom: 166px; left: 50%; transform: translateX(-50%); width: min(92vw, 360px); }
  .hud-agents { width: 92vw; gap: 8px; }
  .agent-card { flex: 1; width: auto; padding: 10px 12px; }
  .brand-sub { display: none; }
  .brand h1 { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* contact line at the very bottom */
.hud-contact {
  bottom: 10px; left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.hud-contact a {
  pointer-events: auto;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
}
.hud-contact a:hover { color: var(--jarvis); border-bottom-color: var(--jarvis); }

/* projects nav in the top bar */
.projects {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--muted);
  margin-left: auto; margin-right: 16px;
}
.projects a {
  pointer-events: auto;
  color: var(--text);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.projects a:hover, .projects a:focus-visible {
  color: var(--jarvis);
  border-color: var(--jarvis);
  box-shadow: 0 0 16px -4px var(--jarvis);
  outline: none;
}
@media (max-width: 820px) {
  .projects { margin-right: 8px; gap: 6px; font-size: 11px; }
  .projects-label, .projects-sep { display: none; }
}
