:root {
  --bg: #0f1220;
  --panel: #1a1f33;
  --text: #e8eaf2;
  --muted: #9aa3c0;
  --accent: #5b8cff;
  --user: #2a3350;
  --bot: #20304a;
  --error: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 640px;
  padding: 24px 18px 40px;
}

h1 { font-size: 1.4rem; margin: 8px 0 4px; }
.hint { color: var(--muted); font-size: 0.9rem; margin-top: 0; }

.log {
  background: var(--panel);
  border-radius: 14px;
  padding: 14px;
  min-height: 260px;
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.4;
  white-space: pre-wrap;
}
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 4px; }
.msg.bot  { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 4px; }
.msg.bot.thinking { color: var(--muted); font-style: italic; }

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.mic {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  font-size: 1.8rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}
.mic:active { transform: scale(0.94); }
.mic.listening { background: var(--error); animation: pulse 1.2s infinite; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5); }
  70%  { box-shadow: 0 0 0 16px rgba(255, 107, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.status { color: var(--muted); }
.error { color: var(--error); }
.hidden { display: none !important; }

.muted { color: var(--muted); }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.overlay-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 28px 24px;
  max-width: 380px;
  text-align: center;
}
.overlay-card h2 { margin: 0 0 8px; }
.overlay-card p { color: var(--muted); margin: 0 0 20px; }

.start-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--accent);
  color: white;
  cursor: pointer;
}
.start-btn:active { transform: scale(0.96); }
.start-btn:disabled { opacity: 0.5; cursor: not-allowed; }
