:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b23;
  --panel-strong: #1f2937;
  --text: #f8fafc;
  --muted: #9ca3af;
  --line: rgba(255,255,255,.1);
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(56, 189, 248, .18), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(34, 197, 94, .16), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,.06);
}

.status-band {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 35, .82);
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.live {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, .12);
}

.status-dot.error {
  background: var(--danger);
}

.conversation {
  overflow-y: auto;
  padding: 4px 2px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.user {
  align-self: flex-end;
  background: #2563eb;
  color: white;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
}

.bubble.error {
  align-self: flex-start;
  background: rgba(251, 113, 133, .12);
  border: 1px solid rgba(251, 113, 133, .35);
}

.composer {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: rgba(21, 27, 35, .96);
  outline: none;
}

textarea:focus {
  border-color: rgba(56, 189, 248, .75);
}

.controls {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 10px;
}

.primary-button,
.secondary-button {
  height: 56px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #16a34a, #0ea5e9);
}

.primary-button.recording {
  background: linear-gradient(135deg, #dc2626, #f97316);
}

.secondary-button {
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.mic-icon {
  width: 14px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 10px;
  position: relative;
}

.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 9px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
  border-radius: 0 0 10px 10px;
  transform: translateX(-50%);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
