:root {
  --bg: #faf9f8;
  --surface: #ffffff;
  --border: #e1dfdd;
  --text: #242424;
  --text-muted: #6b6b6b;
  --accent: #5b5fc7;
  --accent-soft: #eceafd;
  --bubble-user: #f3f2f1;
  --danger: #d13438;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.header-text p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 1px 0 0;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: var(--radius);
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: var(--text);
  border-bottom-right-radius: 2px;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--text);
  border-bottom-left-radius: 2px;
}

.bubble.assistant.speaking {
  box-shadow: 0 0 0 1px var(--accent);
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

#textInput {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

#textInput:focus {
  border-color: var(--accent);
}

.send-btn {
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.send-btn:hover { opacity: 0.9; }

.mic-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mic-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mic-btn.listening {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: pulse-red 1.2s infinite;
}

.call-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.call-btn:hover {
  border-color: #107c10;
  color: #107c10;
}

.call-btn.active {
  background: #107c10;
  border-color: #107c10;
  color: #fff;
  animation: pulse-green 1.2s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(209, 52, 56, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(209, 52, 56, 0); }
  100% { box-shadow: 0 0 0 0 rgba(209, 52, 56, 0); }
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 124, 16, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(16, 124, 16, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 124, 16, 0); }
}
