:root {
  --bg: #f6f6f3; --panel: #ffffff; --text: #1d1f23; --muted: #6a6f78;
  --me: #2f5bea; --me-text: #ffffff; --her: #ecece7; --line: #dcdcd5;
  --ok: #1f8a4c; --no: #b3372b; --accent: #7a4fe0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #171a20; --text: #e8e9ec; --muted: #9aa0aa;
    --me: #3d6bff; --me-text: #ffffff; --her: #23272f; --line: #2c313a;
    --ok: #3fbf74; --no: #e2614f; --accent: #a688ff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#app { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { font-weight: 650; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.device { color: var(--muted); font-size: 13px; }
.pair { padding: 24px 0; }
.pair h1 { font-size: 22px; margin: 0 0 8px; }
.pair p { color: var(--muted); }
.pair form { display: grid; gap: 14px; max-width: 360px; margin-top: 20px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; min-width: 0; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer;
  background: var(--me); color: var(--me-text); }
.error { color: var(--no); min-height: 1.4em; margin: 0; }
code { background: var(--her); padding: 1px 5px; border-radius: 5px; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.log { list-style: none; margin: 0; padding: 8px 0 16px; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--me); color: var(--me-text); border-bottom-right-radius: 5px; }
.msg.her { align-self: flex-start; background: var(--her); border-bottom-left-radius: 5px; }
.msg.note { align-self: center; color: var(--muted); font-size: 13px; background: none; padding: 2px; }
.msg.thinking { color: var(--muted); }
.confirm { align-self: stretch; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; }
.confirm .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.confirm .allow { background: var(--ok); }
.confirm .deny { background: var(--no); }
.composer { display: flex; gap: 8px; padding: 10px 0 14px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }
.mic { background: var(--her); color: var(--text); touch-action: none; user-select: none; }
.mic.recording { background: var(--no); color: #fff; }
.send { padding: 11px 14px; }
.bar-right { display: flex; align-items: center; gap: 10px; }
.voice-toggle { border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 999px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.voice-toggle[aria-pressed="false"] { opacity: .55; }
.msg.her.replay { cursor: pointer; }
.msg .src { display: block; font-size: 11px; opacity: .7; margin-bottom: 2px; }
.msg.note.action { max-width: 92%; text-align: center; }
.msg.note .src { display: inline; margin-right: 6px; }
.confirm .risk { font-size: 13px; color: var(--muted); margin: 6px 0 2px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid currentColor; margin-right: 4px; }
.badge.low { color: var(--ok); }
.badge.change { color: var(--accent); }
.badge.permanent, .badge.privacy { color: var(--no); }
.badge.root, .badge.code { color: var(--no); }
.msg .thumb { display: block; max-width: 180px; max-height: 180px; border-radius: 10px; margin-bottom: 6px; }
.choices { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.choices button { min-width: 48px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-weight: 650; font-size: 15px; cursor: pointer; }
.choices button.picked { background: var(--me); color: var(--me-text); border-color: var(--me); }
.choices button:disabled:not(.picked) { opacity: .45; }
