:root {
  --bg: hsl(228 18% 9%);
  --panel: hsl(228 16% 14%);
  --edge: hsl(228 18% 26%);
  --text: hsl(220 20% 93%);
  --muted: hsl(220 10% 62%);
  --accent: hsl(195 75% 45%);
  --danger: hsl(5 70% 58%);
  color-scheme: dark;
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); -webkit-tap-highlight-color: transparent; }
.screen { display: none; height: 100%; flex-direction: column; padding: 24px 20px; gap: 14px; }
body[data-screen="pair"] #screen-pair,
body[data-screen="wait"] #screen-wait,
body[data-screen="talk"] #screen-talk { display: flex; }
h1 { font-size: 26px; margin: 24px 0 0; }
.lead { color: var(--muted); margin: 0; }
.muted { color: var(--muted); font-size: 15px; }
.error { color: var(--danger); min-height: 1.4em; margin: 0; }
form { display: flex; gap: 10px; }
input {
  flex: 1; min-width: 0; font: inherit; font-size: 22px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text); background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 12px 14px;
}
button {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--edge);
  border-radius: 12px; padding: 12px 16px; cursor: pointer;
}
button.primary { background: var(--accent); border-color: transparent; font-weight: 600; }
button.danger { color: var(--danger); }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; align-self: flex-start; padding: 0; }
.sas { font-size: 52px; font-weight: 700; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; margin: 24px 0 8px; text-align: center; }

#screen-talk { padding: 12px 16px 16px; gap: 8px; }
.top { min-height: 28px; text-align: center; }
.status { color: var(--muted); font-size: 15px; }
body[data-state="error"] .status { color: var(--danger); }
.stage { flex: 1; display: grid; place-items: center; align-content: center; gap: 4px; min-height: 0; }
#orb { width: min(78vw, 340px); height: min(78vw, 340px); touch-action: manipulation; outline: none; border-radius: 50%; }
.hint { color: var(--muted); margin: -10px 0 0; }
body:not([data-state="idle"]) .hint { visibility: hidden; }

.transcript {
  display: none; list-style: none; margin: 0; padding: 4px; max-height: 38vh; overflow: auto;
  flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; user-select: text;
}
body[data-transcript="on"] .transcript { display: flex; }
body[data-transcript="on"] #orb { width: min(46vw, 200px); height: min(46vw, 200px); }
.transcript li { max-width: 86%; padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; font-size: 16px; }
.transcript .user { align-self: flex-end; background: hsl(210 45% 30%); }
.transcript .assistant { align-self: flex-start; background: var(--panel); }
.transcript .interrupted::after { content: " …"; color: var(--muted); }
.transcript .tools { display: block; font-size: 12px; color: var(--muted); }

.bottom { display: flex; gap: 10px; justify-content: center; }
.bottom button { flex: 1; max-width: 140px; font-size: 15px; padding: 10px; }
.bottom button[aria-pressed="true"] { background: hsl(228 14% 24%); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--edge); border-radius: 16px; padding: 18px; width: min(90vw, 360px); }
dialog::backdrop { background: hsl(0 0% 0% / 0.55); }
dialog button { width: 100%; margin-top: 10px; }
