* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  height: 100vh;
  overflow: hidden;
}

#app {
  position: relative;
  height: 100vh;
  width: 100vw;
}

/* Avatar panel — fills entire window */
#avatar-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0d1117;
}

#avatar-canvas {
  width: 100%;
  height: 100%;
  max-width: 600px;
  max-height: 600px;
}

#avatar-status {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #8b949e;
  display: flex;
  align-items: center;
  gap: 6px;
}

#avatar-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#avatar-status.thinking .dot { background: #d29922; }
#avatar-status.speaking .dot { background: #58a6ff; animation: none; }
#avatar-status.listening .dot { background: #f85149; animation: none; }

/* Floating controls — bottom bar */
#controls {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #161b22dd;
  border: 1px solid #30363d;
  border-radius: 24px;
  backdrop-filter: blur(8px);
  z-index: 10;
}

#controls label {
  font-size: 12px;
  color: #8b949e;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

#controls input[type="checkbox"] {
  accent-color: #58a6ff;
}

#volume-slider {
  width: 60px;
  accent-color: #58a6ff;
}

/* Mic button — prominent center */
#mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #21262d;
  border: 2px solid #30363d;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #8b949e;
  cursor: pointer;
}

#mic-btn:hover { border-color: #58a6ff; color: #e6edf3; }

#mic-btn.active {
  background: #f8514922;
  border-color: #f85149;
  color: #f85149;
  animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 #f8514944; }
  50% { box-shadow: 0 0 0 8px #f8514900; }
}

button {
  background: none;
  border: none;
  cursor: pointer;
  color: #8b949e;
  transition: color 0.2s;
}

button:hover { color: #e6edf3; }

/* Camera PIP */
#camera-pip {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 140px;
  height: 105px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #30363d;
  background: #000;
  transition: border-color 0.3s;
  z-index: 10;
}

#camera-pip.active { border-color: #3fb950; }

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#camera-label {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #8b949e;
  background: #0d1117cc;
  padding: 1px 5px;
  border-radius: 3px;
}

#camera-pip.active #camera-label { color: #3fb950; }

#camera-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #21262d;
  border: 1px solid #30363d;
}

#camera-btn:hover { border-color: #58a6ff; }
#camera-btn.active { background: #3fb95022; border-color: #3fb950; color: #3fb950; }

/* Chat toggle button — top left */
#chat-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #161b22dd;
  border: 1px solid #30363d;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(8px);
  cursor: pointer;
  color: #8b949e;
}

#chat-toggle:hover { border-color: #58a6ff; color: #e6edf3; }
#chat-toggle.has-new { color: #58a6ff; }

/* Chat panel — slide-in overlay */
#chat-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 380px;
  display: flex;
  flex-direction: column;
  background: #161b22f0;
  border-right: 1px solid #30363d;
  backdrop-filter: blur(12px);
  z-index: 15;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

#chat-panel.open {
  transform: translateX(0);
}

#chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid #30363d;
  display: flex;
  align-items: center;
  gap: 10px;
}

#chat-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #e6edf3;
}

#chat-header .badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #1f6feb22;
  color: #58a6ff;
  border: 1px solid #1f6feb44;
}

#chat-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b949e;
}

#chat-close:hover { color: #e6edf3; background: #21262d; }

#transcript {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#transcript::-webkit-scrollbar { width: 5px; }
#transcript::-webkit-scrollbar-track { background: transparent; }
#transcript::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

.msg {
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: #1f6feb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: #21262d;
  color: #e6edf3;
  border-bottom-left-radius: 4px;
}

.msg.system {
  align-self: center;
  background: transparent;
  color: #8b949e;
  font-size: 11px;
  font-style: italic;
}

/* Input area */
#input-area {
  padding: 10px 16px;
  border-top: 1px solid #30363d;
  display: flex;
  gap: 6px;
  align-items: center;
}

#text-input {
  flex: 1;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 12px;
  color: #e6edf3;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

#text-input:focus { border-color: #58a6ff; }
#text-input::placeholder { color: #484f58; }

#send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1f6feb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#send-btn:hover { background: #388bfd; }
#send-btn:disabled { background: #21262d; color: #484f58; cursor: default; }

/* Agent selector in controls bar */
#agent-select {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

#agent-select:hover { border-color: #58a6ff; }
#agent-select:focus { border-color: #58a6ff; }

/* BG button */
#bg-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #21262d;
  border: 1px solid #30363d;
}

#bg-btn:hover { border-color: #58a6ff; }
#bg-btn.active { background: #1f6feb22; border-color: #1f6feb; color: #58a6ff; }

/* Virtual background picker */
#bg-picker {
  position: absolute;
  bottom: 100px;
  right: 20px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 0;
  z-index: 30;
  width: 240px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.bg-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #30363d;
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
}

.bg-picker-header button {
  font-size: 18px;
  color: #8b949e;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.bg-picker-header button:hover { color: #e6edf3; }

.bg-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}

.bg-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  color: #8b949e;
  font-size: 10px;
}

.bg-option:hover {
  background: #21262d;
  color: #e6edf3;
}

.bg-option.selected {
  border-color: #58a6ff;
  background: #1f6feb22;
  color: #58a6ff;
}

.bg-thumb {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #30363d;
}
