:root {
  --cyan: #54d7ff;
  --cyan-bright: #bdf0ff;
  --amber: #ffb257;
  --dim: rgba(84, 215, 255, 0.55);
  --line: rgba(84, 215, 255, 0.35);
  --panel-bg: rgba(3, 12, 20, 0.55);
  --bg: #02060c;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--cyan);
  font-family: Consolas, "Segoe UI", monospace;
}

#cam, #hands, #holo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#cam {
  /* contain = entire camera frame visible, no crop; must match FIT in app.js */
  object-fit: contain;
  transform: scaleX(-1);
  filter: saturate(0.8) contrast(1.1) brightness(0.72);
}

#hands, #holo {
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- top-left identity ---------- */

#hud {
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 5;
  text-shadow: 0 0 12px rgba(84, 215, 255, 0.45);
}

.brand {
  letter-spacing: 0.46em;
  font-size: 14px;
  color: var(--cyan-bright);
}

#status {
  margin-top: 10px;
  font-size: 20px;
  letter-spacing: 0.14em;
  animation: flicker 4s infinite;
}

#cam-name {
  margin-top: 8px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

#cam-select {
  margin-top: 8px;
  max-width: 280px;
  padding: 4px 6px;
  font-size: 11px;
  font-family: inherit;
  letter-spacing: 0.04em;
  color: var(--cyan);
  background: rgba(4, 14, 24, 0.85);
  border: 1px solid var(--line);
}

#cam-select:empty { display: none; }

#cam-warning {
  margin-top: 8px;
  max-width: 300px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--amber);
  border-left: 2px solid var(--amber);
  padding-left: 8px;
}

#cam-warning.hidden { display: none; }

@keyframes flicker {
  0%, 93%, 100% { opacity: 1; }
  94% { opacity: 0.55; }
  95% { opacity: 0.9; }
  97% { opacity: 0.65; }
}

/* ---------- side panels ---------- */

.panel-hud {
  position: fixed;
  top: 50%;
  z-index: 5;
  width: 230px;
  padding: 16px 18px 18px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  backdrop-filter: blur(3px);
  letter-spacing: 0.08em;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s ease;
  pointer-events: none;
}

.panel-hud.left  { left: 32px;  transform: translate(-24px, -50%); }
.panel-hud.right { right: 32px; transform: translate(24px, -50%); }

.panel-hud.bottom-left {
  top: auto;
  bottom: 64px;
  left: 32px;
  width: 200px;
  transform: translate(-24px, 0);
}

body.online .panel-hud.bottom-left { transform: translate(0, 0); }

#roster .agent {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--dim);
}

#roster .agent i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex-shrink: 0;
}

#roster .agent.busy i {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulse 0.9s infinite;
}

#roster .agent span { color: var(--cyan-bright); letter-spacing: 0.12em; }

#roster .agent em {
  margin-left: auto;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.08em;
}

#roster .agent.busy em { color: var(--amber); }

@keyframes pulse {
  50% { opacity: 0.35; }
}

body.online .panel-hud { opacity: 1; pointer-events: auto; }
body.online .panel-hud.left,
body.online .panel-hud.right { transform: translate(0, -50%); }

.panel-hud::before,
.panel-hud::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
}

.panel-hud::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}

.panel-hud::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--amber);
  border-right: 2px solid var(--amber);
}

.panel-hud header {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--cyan-bright);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  text-shadow: 0 0 10px rgba(84, 215, 255, 0.5);
}

.panel-hud .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--dim);
}

.panel-hud .row b {
  font-weight: 400;
  color: var(--cyan-bright);
  text-shadow: 0 0 8px rgba(84, 215, 255, 0.4);
}

.bar {
  margin-top: 10px;
  height: 5px;
  border: 1px solid var(--line);
  background: rgba(84, 215, 255, 0.06);
}

.bar i {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  box-shadow: 0 0 10px rgba(84, 215, 255, 0.6);
  transition: width 0.2s ease;
}

#voice-btn, #mic-btn, #eyes-btn {
  margin-top: 12px;
  width: 100%;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}

#voice-btn:hover, #mic-btn:hover, #eyes-btn:hover { background: rgba(84, 215, 255, 0.12); }

#mic-btn, #eyes-btn { margin-top: 8px; }
#mic-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- JARVIS subtitle ---------- */

#subtitle {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translate(-50%, 8px);
  z-index: 6;
  max-width: min(720px, 84vw);
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 18px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

#subtitle.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#subtitle .tag {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--amber);
}

#subtitle-text {
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: var(--cyan-bright);
  text-shadow: 0 0 10px rgba(84, 215, 255, 0.4);
}

/* ---------- bottom hint ---------- */

.hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
  opacity: 0;
  transition: opacity 0.9s ease;
}

body.online .hint { opacity: 1; }

/* ---------- boot sequence ---------- */

#boot {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-content: center;
  gap: 10px;
  background: rgba(2, 6, 12, 0.4);
  pointer-events: none;
}

#boot.hidden { display: none; }

#boot .line {
  font-size: 15px;
  letter-spacing: 0.22em;
  color: var(--cyan-bright);
  text-shadow: 0 0 14px rgba(84, 215, 255, 0.7);
  animation: boot-in 0.35s ease both;
}

#boot .line:first-child {
  font-size: 26px;
  letter-spacing: 0.5em;
}

@keyframes boot-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- start gate ---------- */

#gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 12, 0.72);
  backdrop-filter: blur(8px);
}

#gate.hidden { display: none; }

.panel {
  position: relative;
  width: min(460px, 90vw);
  padding: 36px 32px;
  border: 1px solid var(--line);
  background: rgba(4, 14, 24, 0.92);
  box-shadow: 0 0 40px rgba(84, 215, 255, 0.12);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}

.panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--amber);
  border-right: 2px solid var(--amber);
}

.panel h1 {
  letter-spacing: 0.4em;
  font-size: 24px;
  font-weight: 500;
  color: var(--cyan-bright);
  text-shadow: 0 0 16px rgba(84, 215, 255, 0.6);
}

.panel .sub {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--amber);
}

.panel p {
  margin-top: 14px;
  color: var(--dim);
  line-height: 1.5;
}

.fine { font-size: 11px; }

#start {
  margin-top: 22px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  font-family: inherit;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
}

#start:hover {
  background: rgba(84, 215, 255, 0.12);
  box-shadow: 0 0 18px rgba(84, 215, 255, 0.25);
}
