:root {
  --bg: #fdf6ec;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #6b6b6b;
  --accent: #c2410c;
  --accent-soft: #fde2cf;
  --red: #b91c1c;
  --shadow: 0 6px 18px rgba(0,0,0,0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans Devanagari", Roboto, system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.5;
}

header {
  text-align: center;
  padding: 28px 16px 8px;
}
header h1 {
  margin: 0;
  font-size: 56px;
  letter-spacing: 2px;
  color: var(--accent);
}
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 18px; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.device-config {
  display: grid; gap: 10px; margin-bottom: 18px;
}
.device-row {
  display: flex; align-items: center; gap: 10px;
}
.device-row label {
  min-width: 140px;
  font-size: 18px;
  color: var(--muted);
  font-weight: 600;
}
.device-row select {
  flex: 1;
  padding: 8px 12px;
  font-size: 17px;
  border: 2px solid var(--accent-soft);
  border-radius: 10px;
  background: white;
  font-family: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  font-size: 22px;
  font-weight: 600;
}

button.big {
  width: 100%;
  padding: 28px 22px;
  font-size: 28px;
  border-radius: 18px;
}

button.mic {
  background: var(--accent);
  color: white;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform 0.1s, background 0.2s;
}
button.mic:active { transform: scale(0.98); }
button.mic.recording {
  background: var(--red);
  animation: pulse 1.2s infinite;
}
.mic-icon { font-size: 56px; }
.mic-label { font-size: 22px; font-weight: 600; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(185,28,28,0.6); }
  70%  { box-shadow: 0 0 0 18px rgba(185,28,28,0); }
  100% { box-shadow: 0 0 0 0 rgba(185,28,28,0); }
}

button.primary { background: var(--accent); color: white; }
button.ghost { background: var(--accent-soft); color: var(--accent); }
button.small { padding: 8px 14px; font-size: 15px; border-radius: 10px; }

button.enable-mic {
  width: 100%;
  background: var(--accent);
  color: white;
  font-size: 18px;
  padding: 14px 18px;
  margin-bottom: 4px;
}
button.enable-mic.hidden { display: none; }

.status {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 18px;
  min-height: 24px;
}

.text-fallback { margin-top: 16px; }
.text-fallback summary { color: var(--muted); cursor: pointer; }
.text-row { display: flex; gap: 8px; margin-top: 10px; }
.text-row input {
  flex: 1; padding: 12px 14px; font-size: 20px;
  border: 2px solid var(--accent-soft); border-radius: 12px;
}

.transcript-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px; padding-bottom: 8px;
  border-bottom: 1px solid var(--accent-soft);
}
.transcript-header h3 {
  margin: 0; font-size: 18px; color: var(--accent); font-weight: 600;
}

.transcript { margin-top: 14px; display: grid; gap: 10px; min-height: 100px; }
.bubble {
  padding: 14px 18px; border-radius: 16px; max-width: 92%;
  font-size: 22px;
  animation: bubbleIn 0.25s ease-out;
}
.bubble.user      { background: #eef2ff; color: #1e3a8a; align-self: flex-end; margin-left: auto; }
.bubble.assistant { background: var(--accent-soft); color: var(--ink); }

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-state {
  text-align: center; padding: 30px 16px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 48px; opacity: 0.6; }
.empty-state p { margin: 8px 0; font-size: 18px; }
.empty-state .hint { font-size: 15px; font-style: italic; opacity: 0.8; }

/* VU meter (live mic level) */
.vu-row {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 0 150px;  /* aligns under select, after label column */
}
.vu-meter {
  flex: 1; height: 10px; background: var(--accent-soft);
  border-radius: 6px; overflow: hidden;
}
.vu-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #16a34a, #facc15, #ef4444);
  transition: width 60ms linear;
}
.vu-label { font-size: 13px; color: var(--muted); min-width: 70px; }

/* Speaking indicator (AI talking) */
.speaking-indicator {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 8px;
}
.speaking-indicator.hidden { display: none; }
.speaking-indicator span {
  width: 6px; height: 18px;
  background: var(--accent);
  border-radius: 3px;
  animation: speakBars 1s infinite ease-in-out;
}
.speaking-indicator span:nth-child(2) { animation-delay: 0.15s; }
.speaking-indicator span:nth-child(3) { animation-delay: 0.3s; }
.speaking-indicator em {
  margin-left: 8px; color: var(--accent); font-style: normal;
  font-size: 15px; font-weight: 600;
}
@keyframes speakBars {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}
