:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #1c1b29;
  --muted: #6b6a80;
  --border: #e2e1ee;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --ok: #157347;
  --warn: #9a6700;
  --error: #b42318;
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14131c;
    --surface: #1d1c28;
    --text: #ecebf5;
    --muted: #a19fb8;
    --border: #2f2d40;
    --accent: #7c74ff;
    --ok: #4ade80;
    --warn: #fbbf24;
    --error: #f87171;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 100vh; }
.top { display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.pill { font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.icon-btn { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; font-size: 1rem; cursor: pointer; }

.mic {
  align-self: center; width: 112px; height: 112px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-text); display: grid; place-items: center;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform 0.15s ease;
}
.mic svg { width: 48px; height: 48px; fill: currentColor; stroke: currentColor; }
.mic:hover { transform: scale(1.04); }
.mic:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 4px; }
[data-state="listening"] .mic { animation: pulse 1.2s ease-in-out infinite; background: var(--error); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--error) 45%, transparent); } 50% { box-shadow: 0 0 0 18px transparent; } }
@media (prefers-reduced-motion: reduce) { [data-state="listening"] .mic { animation: none; } }
.hint { text-align: center; color: var(--muted); margin: 0; font-size: 0.9rem; }

.composer { display: flex; flex-direction: column; gap: 8px; }
textarea, input[type="password"] {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.kbd-hint { color: var(--muted); font-size: 0.78rem; flex: 1; }
button { font: inherit; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button:disabled { opacity: 0.6; cursor: progress; }

.status { padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-weight: 500; overflow-wrap: anywhere; }
.status[data-kind="ok"] { border-color: var(--ok); color: var(--ok); }
.status[data-kind="warn"] { border-color: var(--warn); color: var(--warn); }
.status[data-kind="error"] { border-color: var(--error); color: var(--error); }

.items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.items li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.items a { color: var(--accent); text-decoration: none; font-weight: 500; }
.items small { color: var(--muted); }

dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); padding: 18px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog h2 { margin: 0 0 12px; font-size: 1.05rem; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
dialog label.check { flex-direction: row; align-items: center; gap: 8px; }
.settings-msg { min-height: 1.2em; margin: 0; font-size: 0.85rem; color: var(--muted); }
