:root {
  --bg: #0a0e14;
  --panel: #111823;
  --panel-2: #0d131c;
  --accent: #2dd4bf;
  --accent-dim: #14b8a6;
  --border: #1e293b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Bricolage Grotesque', sans-serif;
  background: var(--bg);
  color: #e2e8f0;
}

.app-shell {
  background:
    radial-gradient(circle at 15% 20%, rgba(45,212,191,0.07), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(139,92,246,0.06), transparent 40%),
    linear-gradient(var(--bg), #060910);
  background-attachment: fixed;
  position: relative;
}

/* circuit grid overlay */
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(45,212,191,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,212,191,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

.title {
  font-family: 'Bricolage Grotesque', sans-serif;
  letter-spacing: -0.02em;
  color: #f1f5f9;
}
.subtitle { color: #64748b; font-family: 'JetBrains Mono', monospace; }

.header-bar {
  border-bottom: 1px solid var(--border);
  background: rgba(10,14,20,0.7);
  backdrop-filter: blur(8px);
}

.brain-dot {
  width: 22px; height: 22px; border-radius: 50%;
  transition: all 0.4s;
  flex-shrink: 0;
}
.brain-dot.pulsing { animation: pulse 1.1s infinite ease-in-out; }
.brain-dot.glow { animation: glow 2.5s infinite ease-in-out; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.35); opacity: 1; } }
@keyframes glow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  animation: rise 0.5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.section-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
}

.code-area {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: #7dd3fc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
}
.code-area:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,212,191,0.2); }

.ctl-label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 6px; font-family: 'JetBrains Mono', monospace; }

.accent-btn {
  background: var(--accent);
  color: #04211d;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Bricolage Grotesque', sans-serif;
}
.accent-btn:hover:not(:disabled) { background: #5eead4; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(45,212,191,0.3); }

.ghost-btn {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.progress-track { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width 0.2s; }

.loss-chart { background: var(--panel-2); border: 1px solid var(--border); }

.status-note {
  background: rgba(45,212,191,0.08);
  border: 1px solid rgba(45,212,191,0.25);
  color: #99f6e4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.brain-stats { border-top: 1px solid var(--border); padding-top: 8px; color: #cbd5e1; }
.stat-box { background: var(--panel-2); padding: 8px; border-radius: 8px; text-align: center; color: #64748b; border: 1px solid var(--border); }

/* Chat */
.chat-header { border-bottom: 1px solid var(--border); background: var(--panel-2); }
.chat-body { background: linear-gradient(var(--panel), var(--panel-2)); }
.chat-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,14,20,0.85); backdrop-filter: blur(2px); z-index: 5;
}
.bubble-user { background: var(--accent); color: #04211d; border-bottom-right-radius: 4px; font-weight: 500; }
.bubble-bot { background: #1e293b; color: #e2e8f0; border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.conf-badge {
  display: inline-block; margin-left: 8px; font-size: 10px; padding: 1px 6px;
  border-radius: 999px; background: rgba(255,255,255,0.15); font-family: 'JetBrains Mono', monospace;
  vertical-align: middle;
}
.chat-input-bar { border-top: 1px solid var(--border); background: var(--panel-2); }
.chat-input {
  background: var(--bg); border: 1px solid var(--border); color: #e2e8f0; outline: none;
  font-family: 'Bricolage Grotesque', sans-serif;
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,212,191,0.15); }

a { color: var(--accent); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--panel-2); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }