/* Calm and readable: white page, one navy accent, large captions, the light ring as the only motion. */
:root {
  --bg: #FFFFFF;
  --ink: #16202B;
  --muted: #5B6673;
  --line: #E3E8EE;
  --soft: #F4F7FA;
  --navy: #1F3A5F;
  --listen: #3E7CC4;
  --ok: #1E7A4C;
  --bad: #B3261E;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.5; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--navy); position: relative; }
.mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--navy); }
h1 { font-size: 1.25rem; margin: 0; letter-spacing: .2px; }
.sub { margin: 0; color: var(--muted); font-size: .9rem; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: .8rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.mono { font-family: var(--mono); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; padding: 24px;
  max-width: 1200px; margin: 0 auto; }
.talk { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.captions { min-height: 46vh; max-height: 60vh; overflow-y: auto; padding: 8px 4px;
  display: flex; flex-direction: column; gap: 14px; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 36ch; }
.empty-title { font-size: 1.35rem; color: var(--ink); margin-bottom: 6px; }
.turn { max-width: 78%; padding: 14px 18px; border-radius: 18px; font-size: 1.35rem; line-height: 1.45; }
.turn .who { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px; }
.turn.user { align-self: flex-end; background: var(--soft); }
.turn.assistant { align-self: flex-start; border: 1px solid var(--line); border-left: 4px solid var(--navy); }
.turn.assistant.safety { border-left-color: var(--bad); }

.controls { display: flex; align-items: center; gap: 12px; }
.mic { position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: var(--navy); color: #fff; cursor: pointer; display: grid; place-items: center; }
.mic svg { width: 28px; height: 28px; fill: currentColor; position: relative; }
.mic:disabled { background: #9AA6B2; cursor: not-allowed; }
.mic .ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid transparent; }
body[data-state="listening"] .mic .ring { border-color: var(--listen); animation: pulse 1.2s ease-in-out infinite; }
body[data-state="thinking"] .mic .ring { border-color: var(--navy); border-top-color: transparent; animation: spin 1s linear infinite; }
body[data-state="speaking"] .mic .ring { border-color: var(--navy); opacity: .55; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }

.composer { flex: 1; min-width: 0; display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 14px; }
.composer input:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.composer button, .voice { font: inherit; padding: 12px 18px; border-radius: 14px; cursor: pointer; }
.composer button { border: 0; background: var(--navy); color: #fff; }
.voice { border: 1px solid var(--line); background: #fff; color: var(--ink); white-space: nowrap; }
.voice[aria-pressed="false"] { color: var(--muted); }
button:focus-visible { outline: 3px solid var(--listen); outline-offset: 2px; }
.status { min-height: 1.3em; margin: 0; color: var(--muted); font-size: .9rem; }
.demo-notice { margin: 0; font-size: .9rem; font-weight: 600; }
.demo-notice[hidden] { display: none; }
.mic-note { margin: 0; color: var(--muted); font-size: .8rem; }

.try { color: var(--muted); font-size: .95rem; }
.try summary { cursor: pointer; }
.try ol { margin: 8px 0 0; padding-left: 22px; }

.panel { border: 1px solid var(--line); border-radius: 16px; padding: 18px; align-self: start;
  position: sticky; top: 16px; min-width: 0; }
.panel h2 { margin: 0; font-size: 1rem; }
.panel-sub { margin: 4px 0 12px; color: var(--muted); font-size: .85rem; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.log li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--soft); }
.log .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.log .tool-name { font-family: var(--mono); font-weight: 600; color: var(--navy); font-size: .9rem;
  overflow-wrap: anywhere; }
.log .time { font-family: var(--mono); color: var(--muted); font-size: .75rem; }
.log .tool-summary { margin: 2px 0 0; font-size: .85rem; color: var(--ink); }
.log li[data-ok="false"] .tool-name { color: var(--bad); }
.log-empty { color: var(--muted); font-size: .9rem; margin: 0; }

.foot { padding: 14px 24px 24px; color: var(--muted); font-size: .85rem; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .panel { position: static; }
  .turn { max-width: 92%; font-size: 1.2rem; }
  .controls { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .composer { flex: 1 1 calc(100% - 80px); }
  .composer button { padding: 12px 14px; }
  .voice { margin-left: auto; }
  .top { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-state] .mic .ring { animation: none; }
}
