* { box-sizing: border-box; }
:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1c2230;
  --line: #2a3142;
  --text: #e8ecf2;
  --muted: #8893a7;
  --accent: #ff8e3c;
  --accent-2: #5cc8ff;
  --green: #5ed27a;
  --red: #e15a5a;
}
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Noto Sans Devanagari", sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
}
header {
  padding: 14px 22px;
  background: linear-gradient(180deg, #1a2030 0%, #131722 100%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.seal {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #1a1207;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.1px; }
.sub { color: var(--muted); font-size: 12px; }
.controls { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); }
.controls select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 6px;
}
.badge {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; font-size: 11px; color: var(--muted);
}
main {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  max-width: 900px; width: 100%; margin: 0 auto; padding: 16px 22px 0;
}
.chat {
  flex: 1; overflow-y: auto; padding: 12px 4px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.welcome {
  padding: 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px;
}
.welcome p { margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 12px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.examples button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 6px 10px; border-radius: 999px; cursor: pointer; font-size: 12px;
}
.examples button:hover { border-color: var(--accent-2); }
.bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap;
}
.bubble.user { align-self: flex-end; background: var(--accent); color: #1a1207; }
.bubble.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.bubble.system { align-self: center; background: transparent; color: var(--muted); font-size: 12px; font-style: italic; }
.sources {
  margin-top: 6px; font-size: 11px; color: var(--muted);
}
.sources::before { content: "Sources: "; color: var(--accent-2); }
.thinking {
  align-self: flex-start; color: var(--muted); font-size: 12px;
  background: var(--panel); border: 1px dashed var(--line); padding: 8px 12px; border-radius: 12px;
}
.composer {
  display: flex; gap: 8px; padding: 12px 4px 16px;
  border-top: 1px solid var(--line);
}
.composer input[type="text"] {
  flex: 1; padding: 12px 14px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); border-radius: 10px; font: inherit;
}
.composer input[type="text"]:focus { outline: none; border-color: var(--accent-2); }
.composer button {
  padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit;
}
.composer button:hover { border-color: var(--accent-2); }
.mic {
  position: relative; padding: 0 16px; font-size: 20px; min-width: 52px;
  display: flex; align-items: center; justify-content: center;
}
.mic .mic-pulse {
  position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
}
.mic.recording {
  background: var(--red); border-color: var(--red); color: #fff;
}
.mic.recording .mic-pulse {
  opacity: 1;
  box-shadow: 0 0 0 0 rgba(225, 90, 90, 0.6);
  animation: mic-pulse 1.4s infinite cubic-bezier(0.66, 0, 0, 1);
}
.mic.speaking {
  background: var(--accent-2); border-color: var(--accent-2); color: #061018;
}
.mic.speaking .mic-pulse {
  opacity: 1;
  box-shadow: 0 0 0 0 rgba(92, 200, 255, 0.5);
  animation: mic-pulse 1.4s infinite cubic-bezier(0.66, 0, 0, 1);
}
@keyframes mic-pulse {
  to { box-shadow: 0 0 0 14px rgba(225, 90, 90, 0); }
}

.voice-status {
  text-align: center; font-size: 12px; color: var(--muted);
  min-height: 16px; padding: 4px 0; letter-spacing: 0.2px;
}
.voice-status[data-kind="listening"] { color: var(--red); }
.voice-status[data-kind="speaking"]  { color: var(--accent-2); }

#send { background: var(--accent); color: #1a1207; border-color: var(--accent); font-weight: 600; }
