/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --cyan: #00e5ff;
  --cyan-dim: rgba(0, 229, 255, 0.15);
  --cyan-glow: rgba(0, 229, 255, 0.06);
  --purple: #b388ff;
  --bg: #070b12;
  --bg-panel: rgba(5, 14, 28, 0.78);
  --text: #c8d8e8;
  --text-dim: #5a7a9a;
  --border: rgba(0, 229, 255, 0.12);
  --font: 'Share Tech Mono', 'SF Mono', 'Fira Code', monospace;
}

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

/* ── Canvas ── */
#avatarCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ── Header ── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(7, 11, 18, 0.6);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.logo-mark { color: var(--cyan); font-size: 16px; }
.logo-nexus { color: var(--text); }
.logo-sep { color: var(--text-dim); }
.logo-friday { color: var(--cyan); }

.status-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

.status-dot.offline { background: #ff4444; box-shadow: 0 0 6px #ff4444; animation: none; }
.status-dot.thinking { background: var(--purple); box-shadow: 0 0 6px var(--purple); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Avatar state label ── */
.avatar-state {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(calc(-50% - 180px));
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
  pointer-events: none;
}

.state-ring {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 8px var(--cyan-dim);
  animation: ring-idle 3s ease-in-out infinite;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.state-ring.listening { border-color: #80ffff; box-shadow: 0 0 14px rgba(128,255,255,0.4); animation: ring-pulse 0.8s ease-in-out infinite; }
.state-ring.thinking  { border-color: var(--purple); box-shadow: 0 0 14px rgba(179,136,255,0.4); animation: ring-spin 1.5s linear infinite; }
.state-ring.speaking  { border-color: #e0f7ff; box-shadow: 0 0 14px rgba(224,247,255,0.5); animation: ring-pulse 0.4s ease-in-out infinite; }

@keyframes ring-idle {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
@keyframes ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.state-text {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  opacity: 0.8;
  transition: color 0.4s;
}

/* ── Right panel ── */
.right-panel {
  position: fixed;
  top: 68px;
  right: 20px;
  bottom: 96px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  opacity: 0.7;
}

.live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #69f0ae;
  box-shadow: 0 0 5px #69f0ae;
  animation: pulse-dot 1.5s ease-in-out infinite;
  margin-left: auto;
}

.reply-agent {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* Activity panel */
.activity-panel { flex: 1; min-height: 0; }

.activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-dim) transparent;
}

.activity-list::-webkit-scrollbar { width: 3px; }
.activity-list::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 2px; }

.activity-item {
  padding: 7px 14px;
  border-left: 2px solid transparent;
  transition: background 0.2s;
  animation: slide-in 0.25s ease-out;
}

.activity-item:hover { background: rgba(0,229,255,0.04); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.activity-agent {
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-bottom: 2px;
}

.activity-tool {
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.6;
}

.activity-preview {
  font-size: 11px;
  color: var(--text);
  opacity: 0.75;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.activity-preview::before { content: '▸ '; color: var(--text-dim); }

/* Agent colors */
.agent-friday    { color: #00e5ff; border-left-color: #00e5ff; }
.agent-iris      { color: #00bfa5; border-left-color: #00bfa5; }
.agent-kai       { color: #69f0ae; border-left-color: #69f0ae; }
.agent-leo       { color: #ffd740; border-left-color: #ffd740; }
.agent-zoe       { color: #f48fb1; border-left-color: #f48fb1; }
.agent-nina      { color: #ffab40; border-left-color: #ffab40; }
.agent-atlas     { color: #ff5252; border-left-color: #ff5252; }
.agent-marcus    { color: #ce93d8; border-left-color: #ce93d8; }
.agent-cortana   { color: #80deea; border-left-color: #80deea; }
.agent-unknown   { color: var(--text-dim); border-left-color: var(--text-dim); }

/* Reply panel */
.reply-panel { height: 200px; flex-shrink: 0; }

.reply-body {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-dim) transparent;
}

.reply-body::-webkit-scrollbar { width: 3px; }
.reply-body::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 2px; }

.placeholder { color: var(--text-dim); font-size: 12px; }

.cursor-blink {
  display: inline-block;
  width: 8px; height: 14px;
  background: var(--cyan);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Input bar ── */
.input-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(calc(-50% - 180px));
  width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 10px 8px 14px;
  backdrop-filter: blur(16px);
  z-index: 10;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-bar:focus-within {
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.08);
}

.mic-btn, .send-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(0,229,255,0.06);
  color: var(--cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.mic-btn:hover, .send-btn:hover {
  background: rgba(0,229,255,0.14);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0,229,255,0.2);
}

.mic-btn.recording {
  background: rgba(255, 77, 77, 0.2);
  border-color: #ff4d4d;
  color: #ff4d4d;
  box-shadow: 0 0 12px rgba(255,77,77,0.3);
  animation: mic-pulse 0.6s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,77,77,0.3); }
  50% { box-shadow: 0 0 20px rgba(255,77,77,0.6); }
}

.text-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  caret-color: var(--cyan);
}

.text-input::placeholder { color: var(--text-dim); }

/* ── Scan line overlay ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ── Grid background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}
