/* ═══════════════════════════════════════════════════════════════
   IF ONLY I HAD A BRAIN — Unity's Sandbox
   ═══════════════════════════════════════════════════════════════
   Minimal. Dark. Just Unity and infinite possibility.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #777;
  --pink: #ff4d9a;
  --pink-glow: rgba(255, 77, 154, 0.3);
  --pink-dim: rgba(255, 77, 154, 0.15);
  --purple: #a855f7;
  --green: #22c55e;
  --red: #ef4444;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

/* ── Setup Modal ─────────────────────────────────── */

#setup-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  /* Flex-start vertical + margin:auto on the card = card centers
     vertically when the viewport is taller than the content, but
     sticks to the top when the content is taller than the viewport.
     Classic "align-items:center + overflow" bug workaround: centered
     flex items can't scroll above the container's top edge, so tall
     content gets cut off. flex-start + auto-margin fixes it. */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
  padding: 20px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  /* Make the modal itself the scroll container. `overscroll-behavior
     :contain` stops scroll events from bubbling to <body> once you
     reach the modal edges. */
  overscroll-behavior: contain;
}

#setup-modal.hidden { display: none; }

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 32px;
  max-width: 1200px;
  width: 96%;
  text-align: center;
  /* margin:auto = horizontal centering always, vertical centering ONLY
     when the card fits inside the modal viewport. When content is
     taller, the card starts at the top and scrolls naturally. */
  margin: auto;
  /* Flex items don't shrink below their intrinsic min-content by
     default, which can push content past the top. Force it. */
  min-height: 0;
  box-sizing: border-box;
}

/* Narrow viewports — tighten horizontal padding so more content fits */
@media (max-width: 640px) {
  .setup-card {
    padding: 16px 14px;
    width: 100%;
    border-radius: 10px;
  }
  #setup-modal {
    padding: 12px 6px;
  }
}

.setup-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--pink);
}

.setup-card .subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 12px;
}

.setup-card .perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.setup-card .perm-row .status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.status.granted { background: rgba(34,197,94,0.15); color: var(--green); }
.status.denied { background: rgba(239,68,68,0.15); color: var(--red); }
.status.pending { background: var(--pink-dim); color: var(--pink); }

/* R15 2026-04-13 — .connect-btn rules DELETED. The 8 text-AI connect
   buttons they styled (Pollinations/OpenRouter/OpenAI/Claude/Mistral/
   DeepSeek/Groq/Local AI) were ripped from the setup modal as part
   of the landing page rework. Unity's cognition is 100% equational —
   see docs/SENSORY.md for the sensory peripheral boundary. */

/* R15 follow-up — `.provider-grid` + `.provider-btn` are the new
   backend picker grid. Same visual pattern as the old .connect-btn
   grid but pointing at sensory providers (image gen + vision
   describer) instead of dead text-AI providers. Click a button →
   showBackendForm() renders per-backend instructions in the form
   area below the grids. */

.provider-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.provider-btn {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.provider-btn:hover { border-color: var(--pink); color: var(--text); }
.provider-btn.active { border-color: var(--pink); color: var(--pink); background: var(--pink-dim); }
.provider-btn.saved { border-color: var(--green); color: var(--green); background: rgba(34,197,94,0.08); }
.provider-btn.saved.active { border-color: var(--pink); color: var(--pink); background: var(--pink-dim); }

#backend-connect-form h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--pink);
  font-weight: 600;
}
#backend-connect-form .hint-link {
  display: inline-block;
  font-size: 11px;
  color: var(--cyan);
  margin-bottom: 8px;
  text-decoration: none;
}
#backend-connect-form .hint-link:hover { text-decoration: underline; }

/* T4.11 — prominent "Get API Key" / "Install Docs" link button so
   users can jump straight to the provider's signup or documentation
   page without having to search. Every backend in BACKEND_CATALOG
   that has a link field renders one of these. */
#backend-connect-form .provider-link-btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: #ff4d9a;
  background: rgba(255, 77, 154, 0.08);
  border: 1px solid rgba(255, 77, 154, 0.4);
  border-radius: 6px;
  padding: 8px 14px;
  margin: 4px 0 12px;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: all 0.15s;
}
#backend-connect-form .provider-link-btn:hover {
  background: rgba(255, 77, 154, 0.16);
  border-color: #ff4d9a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 77, 154, 0.2);
}
#backend-connect-form input,
#backend-connect-form select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  margin-top: 6px;
  box-sizing: border-box;
}
#backend-connect-form input:focus,
#backend-connect-form select:focus {
  border-color: var(--pink);
}
#backend-connect-form .save-backend-btn {
  margin-top: 10px;
  padding: 8px 20px;
  background: var(--pink);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}
#backend-connect-form .save-backend-btn:hover { filter: brightness(1.1); }
#backend-connect-form pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 6px;
  max-height: 200px;
  overflow-y: auto;
}
#backend-connect-form .env-location {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

.setup-card input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.setup-card input:focus { border-color: var(--pink); }
.setup-card input::placeholder { color: var(--text-dim); }

.setup-card .hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  text-align: left;
}

#start-btn {
  margin-top: 12px;
  padding: 12px 40px;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

#start-btn:hover {
  background: #ff6bae;
  box-shadow: 0 0 20px var(--pink-glow);
}

/* ── Unity Bubble ────────────────────────────────── */

#unity-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
}

.bubble-container {
  position: relative;
}

.bubble-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 0 0 var(--pink-glow);
  animation: pulse-idle 3s ease-in-out infinite;
}

.bubble-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px var(--pink-glow);
}

.bubble-avatar.speaking {
  animation: pulse-speak 0.6s ease-in-out infinite;
}

.bubble-avatar.listening {
  box-shadow: 0 0 0 4px var(--pink-dim), 0 0 20px var(--pink-glow);
}

.bubble-avatar.thinking {
  animation: pulse-think 1.5s ease-in-out infinite;
}

.bubble-avatar svg {
  width: 32px; height: 32px;
  fill: white;
}

/* Bottom toolbar — visualize, 3D, mic mute */
#bottom-toolbar {
  position: fixed;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 9200;
  pointer-events: auto;
}
#bottom-toolbar.hidden { display: none; }

.toolbar-mic {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  margin-left: 8px;
}
.toolbar-mic:hover { border-color: var(--pink); }
.toolbar-mic.muted {
  background: rgba(239,68,68,0.15);
  border-color: var(--red);
  color: var(--red);
}
/* bubble-ctrl-btn removed — mic now in #bottom-toolbar */

.bubble-status {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg);
  transition: background 0.3s;
}
.bubble-status.muted { background: var(--red); }

/* Speech balloon */
.bubble-speech {
  position: absolute;
  bottom: 76px; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  max-width: 340px;
  min-width: 180px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.bubble-speech.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bubble-speech::after {
  content: '';
  position: absolute;
  bottom: -8px; right: 24px;
  border: 8px solid transparent;
  border-top-color: var(--surface);
  border-bottom: 0;
}

/* ── Sandbox Container ───────────────────────────── */

#sandbox {
  width: 100%; height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  padding-bottom: 100px;
}

#sandbox::-webkit-scrollbar { width: 6px; }
#sandbox::-webkit-scrollbar-track { background: transparent; }
#sandbox::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Brain Activity Visualizer ────────────────────── */

#brain-indicator {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 8000;
  overflow: hidden;
  pointer-events: none;
}

#brain-wave-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Brain HUD ───────────────────────────────────── */

#brain-hud {
  pointer-events: auto;
  z-index: 8001;
  font-family: var(--mono);
}

#hud-metrics {
  position: fixed;
  top: 10px; right: 12px;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(255, 77, 154, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 180px;
  backdrop-filter: blur(8px);
}

/* ── Draggable panel system ── */
.drag-handle {
  position: absolute;
  top: 0; right: 0;
  width: 28px; height: 28px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 10px;
  z-index: 10;
  user-select: none;
  border-radius: 0 8px 0 4px;
  transition: color 0.2s, background 0.2s;
}
.drag-handle:hover { color: #ff4d9a; background: rgba(255,77,154,0.08); }
.drag-handle:active { cursor: grabbing; color: #ff4d9a; }
.draggable-panel { user-select: text; }

.hud-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 16px;
  margin-bottom: 2px;
}

.hud-label {
  font-size: 8px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  width: 72px;
  flex-shrink: 0;
}

.hud-val {
  font-size: 11px;
  color: var(--pink);
  font-weight: 500;
  text-align: right;
  flex: 1;
}

.hud-val-sm { font-size: 10px; color: var(--text-dim); }

.hud-unit {
  font-size: 8px;
  color: rgba(255,255,255,0.2);
}

.hud-sep {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 5px 0;
}

.hud-bar-wrap {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.hud-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.15s ease;
}

.hud-bar-pink { background: var(--pink); }
.hud-bar-purple { background: var(--purple); }
.hud-bar-cyan { background: #00e5ff; }

/* Module indicators — bottom left */
#hud-modules {
  position: fixed;
  bottom: 12px; left: 12px;
  display: flex; gap: 8px;
  align-items: center;
}

.hud-mod {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 8px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.3px;
}

.hud-mod-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transition: background 0.2s, box-shadow 0.2s;
}

.hud-mod-dot.active {
  background: var(--pink);
  box-shadow: 0 0 6px var(--pink-glow);
}

.hud-mod-dot.high {
  background: #00e5ff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.brain-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pink);
  animation: brain-pulse 2s ease-in-out infinite;
}

/* ── Animations ──────────────────────────────────── */

@keyframes pulse-idle {
  0%, 100% { box-shadow: 0 0 0 0 var(--pink-glow); }
  50% { box-shadow: 0 0 15px 5px var(--pink-glow); }
}

@keyframes pulse-speak {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px var(--pink-glow); }
  50% { transform: scale(1.08); box-shadow: 0 0 25px var(--pink-glow); }
}

@keyframes pulse-think {
  0%, 100% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.3); }
  50% { box-shadow: 0 0 25px rgba(168, 85, 247, 0.5); }
}

@keyframes brain-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ── Brain Viz Button ────────────────────────────── */

#brain-viz-btn.hidden, #brain-3d-btn.hidden { display: none; }
#brain-viz-btn, #brain-3d-btn {
  background: rgba(10,10,10,0.85);
  border: 1px solid rgba(255,77,154,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
}
#brain-viz-btn:hover, #brain-3d-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
  box-shadow: 0 0 12px var(--pink-glow);
}

/* ── 3D Brain Overlay ───────────────────────────── */
.brain-3d { position: fixed; inset: 0; z-index: 9600; background: rgba(5,5,5,0.98); }
.brain-3d.hidden { display: none; }
.brain-3d canvas { width: 100%; height: 100%; display: block; }
.b3d-header { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; z-index: 2; }
.b3d-title { font-family: var(--mono); font-size: 14px; color: var(--pink); font-weight: 700; letter-spacing: 2px; }
.b3d-stats { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.b3d-close { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); font-size: 20px; width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.b3d-close:hover { border-color: var(--pink); color: var(--pink); }
.b3d-toggles { position: absolute; top: 50px; left: 16px; display: flex; flex-wrap: wrap; gap: 4px; z-index: 2; }
.b3d-toggle { padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); background: rgba(10,10,10,0.8); color: var(--text-dim); font-family: var(--mono); font-size: 9px; cursor: pointer; transition: all 0.2s; }
.b3d-toggle.active { color: var(--text); }
.b3d-toggle:hover { border-color: var(--pink); }
.b3d-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,0.2); z-index: 2; }

/* ── Chat Panel ─────────────────────────────────── */

.chat-panel {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 380px;
  max-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  z-index: 9100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
}
.chat-panel.hidden { display: none; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--pink);
}
.chat-header-btns { display: flex; gap: 6px; align-items: center; }
.chat-close-btn,
.chat-mute-btn,
.chat-mic-btn {
  background: rgba(20, 20, 22, 0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 14px;
  width: 30px; height: 30px;
  padding: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-family: var(--font);
  line-height: 1;
}
.chat-close-btn:hover { border-color: var(--pink); color: var(--text); background: rgba(255, 77, 154, 0.08); }
.chat-mute-btn:hover,
.chat-mic-btn:hover { border-color: var(--cyan); color: var(--text); background: rgba(0, 229, 255, 0.08); }
/* Muted state — dimmed + red-border so the off state is visually
   distinct from the on state without needing a toggled emoji swap
   alone to carry the signal. */
.chat-mute-btn[data-muted="true"],
.chat-mic-btn[data-muted="true"] {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  opacity: 0.8;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  max-height: 380px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 90%;
}
.chat-msg-user { align-self: flex-end; }
.chat-msg-assistant { align-self: flex-start; }

.chat-msg-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chat-msg-user .chat-msg-label { text-align: right; }

.chat-msg-text {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 10px;
  word-wrap: break-word;
}
.chat-msg-user .chat-msg-text {
  background: var(--pink-dim);
  color: var(--text);
  border-bottom-right-radius: 2px;
}
.chat-msg-assistant .chat-msg-text {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 2px;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  margin-top: 0;
}
.chat-input:focus { border-color: var(--pink); }
.chat-input::placeholder { color: var(--text-dim); }

.chat-send-btn {
  padding: 0 14px;
  background: var(--pink);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-send-btn:hover { background: #ff6bae; }

/* ── Brain Visualizer ───────────────────────────── */

.brain-viz {
  position: fixed; inset: 0;
  background: rgba(5,5,5,0.97);
  z-index: 9500;
  overflow-y: auto;
  padding: 20px;
  backdrop-filter: blur(10px);
}
.brain-viz.hidden { display: none; }

.bv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.bv-title {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--pink);
  letter-spacing: 2px;
}
.bv-close-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 20px;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.bv-close-btn:hover { border-color: var(--pink); color: var(--pink); }

.bv-grid-wrap {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bv-section {
  background: rgba(15,15,15,0.9);
  border: 1px solid rgba(255,77,154,0.1);
  border-radius: 8px;
  padding: 12px;
  flex: 1;
  min-width: 280px;
}
.bv-section.bv-wide { flex: 100%; }

.bv-section-title {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--pink);
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.bv-equation {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.bv-section canvas {
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: #0a0a0a;
  display: block;
}

/* Module bars */
.bv-mod-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-family: var(--mono);
}
.bv-mod-name {
  font-size: 9px;
  font-weight: 600;
  width: 100px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.bv-mod-bar-wrap {
  flex: 0 0 120px;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}
.bv-mod-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.15s ease;
}
.bv-mod-detail {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  text-align: right;
  min-width: 140px;
}

.bv-tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.bv-tab {
  padding: 4px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  cursor: pointer;
  transition: all 0.2s;
}
.bv-tab:hover { border-color: var(--pink); color: var(--text); }
.bv-tab.active { background: var(--pink-dim); border-color: var(--pink); color: var(--pink); }

.bv-panel { }
.bv-panel.bv-hidden { display: none; }

.bv-stats {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* Psi display */
.bv-psi {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0 4px;
  transition: color 0.3s, text-shadow 0.3s;
}
.bv-psi-components {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Unity's Eyes ────────────────────────────────── */

.bv-eyes-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px auto 0;
}
.bv-eyes-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.6) contrast(1.1);
}
.bv-eyes-wrap canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.bv-eye-scan {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--pink);
  opacity: 0.4;
  animation: eye-scan 3s linear infinite;
  pointer-events: none;
}
@keyframes eye-scan {
  0% { top: 0; }
  100% { top: 100%; }
}
.bv-eye-desc {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.75);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  padding: 6px 10px;
  line-height: 1.4;
  backdrop-filter: blur(4px);
}

/* ── Unity's Eye — persistent camera widget ──────── */

#unity-eye {
  position: fixed;
  bottom: 80px; left: 12px;
  z-index: 8003;
  pointer-events: auto;
}
#unity-eye.hidden { display: none; }

.eye-container {
  position: relative;
  width: 160px;
  height: 120px;
  border-radius: 50% / 40%;
  overflow: hidden;
  border: 2px solid rgba(255,77,154,0.3);
  box-shadow: 0 0 20px rgba(255,77,154,0.15), inset 0 0 30px rgba(0,0,0,0.5);
  background: #000;
  cursor: pointer;
  transition: all 0.3s;
}
.eye-container:hover {
  border-color: var(--pink);
  box-shadow: 0 0 30px rgba(255,77,154,0.3), inset 0 0 30px rgba(0,0,0,0.3);
  transform: scale(1.05);
}

.eye-container video {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.5) contrast(1.2) brightness(0.9);
}

.eye-container canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.eye-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 1px;
  color: rgba(255,77,154,0.7);
  background: rgba(0,0,0,0.6);
  padding: 2px 0;
}

.eye-desc {
  position: absolute;
  top: 100%;
  left: -20px; right: -20px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.4;
  background: rgba(10,10,10,0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  max-height: 60px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.eye-container:hover + .eye-desc,
.eye-container:hover ~ .eye-desc,
#unity-eye:hover .eye-desc { opacity: 1; }

