:root {
  --bg: #0b1215;
  --panel: #121c21;
  --panel-2: #1a262c;
  --text: #e8eef0;
  --muted: #8aa0a8;
  --accent: #ffb224;
  --accent-ink: #1a1200;
  --user: #2b3f4a;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--panel);
}
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--accent); }
.brand span { color: var(--text); }
.header-right { display: flex; gap: 8px; align-items: center; }
.chip {
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn { background: none; border: none; color: var(--muted); font-size: 22px; padding: 6px; }

main {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; 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(--panel-2); border-bottom-left-radius: 4px; }
.msg.info { align-self: center; color: var(--muted); font-size: 13px; background: none; padding: 2px; text-align: center; }
.msg.error { align-self: center; color: var(--danger); font-size: 14px; background: none; }

footer { background: var(--panel); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.status { color: var(--muted); font-size: 13px; text-align: center; min-height: 18px; margin-bottom: 8px; }
.status.hot { color: var(--accent); }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.mic {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(255, 178, 36, 0.35);
  touch-action: manipulation;
}
.mic.listening { animation: pulse 1.2s infinite; background: #ff4d4d; color: #fff; }
.mic.thinking { background: var(--panel-2); color: var(--muted); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.55); }
  70% { box-shadow: 0 0 0 22px rgba(255, 77, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

.pill {
  background: var(--panel-2);
  color: var(--text);
  border: none;
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 14px;
  min-width: 120px;
}
.pill.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.type-row { display: flex; gap: 8px; margin-top: 10px; }
.type-row input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid #253238;
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
}
.type-row .pill { min-width: 0; }

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid #253238;
  border-radius: 16px;
  width: min(480px, 92vw);
  max-height: 86dvh;
  overflow-y: auto;
  padding: 20px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h2 { margin: 0 0 6px; }
dialog h3 { margin: 18px 0 6px; font-size: 15px; color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; background: var(--panel-2); border: 1px solid #253238; color: var(--text); border-radius: 10px; padding: 12px; }
button { cursor: pointer; }
dialog button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid #253238;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
}
dialog button.primary { background: var(--accent); color: var(--accent-ink); border: none; font-weight: 700; }
.wide { width: 100%; margin-top: 10px; }
.system-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.system-list button { text-align: left; }
.system-list button.current { border-color: var(--accent); color: var(--accent); }
