:root {
  --bg: #0b0c10;
  --fg: #e8e8e8;
  --muted: #8a8d94;
  --accent: #5cdb95;
  --danger: #ff6b6b;
  --card: #1a1d24;
  --border: #2a2e38;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
main { max-width: 640px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 100vh; gap: 20px; }
header { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }
.status { font-size: 12px; padding: 4px 10px; border-radius: 12px; background: var(--card); color: var(--muted); }
.status-idle { color: var(--muted); }
.status-connecting { color: #ffd166; background: #2d2618; }
.status-live { color: var(--accent); background: #142819; }
.status-error { color: var(--danger); background: #2a1517; }
#setup { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
#setup p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
#token-input { width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); color: var(--fg); border-radius: 8px; font-family: ui-monospace, monospace; font-size: 13px; margin-bottom: 8px; }
#token-save { width: 100%; padding: 10px; background: var(--accent); color: #0b0c10; border: none; border-radius: 8px; font-weight: 600; font-size: 15px; }
#main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.talk-button { width: 220px; height: 220px; border-radius: 50%; background: var(--card); border: 3px solid var(--border); color: var(--fg); font-size: 18px; font-weight: 600; cursor: pointer; transition: all 120ms ease; -webkit-tap-highlight-color: transparent; }
.talk-button:active { transform: scale(0.96); }
.talk-button.live { border-color: var(--accent); background: #142819; color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.talk-button.connecting { border-color: #ffd166; background: #2d2618; color: #ffd166; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(92, 219, 149, 0.4); } 50% { box-shadow: 0 0 0 20px rgba(92, 219, 149, 0); } }
#hint { color: var(--muted); font-size: 13px; text-align: center; }
#log-section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
#log-section summary { cursor: pointer; color: var(--muted); font-size: 13px; }
#log { margin: 12px 0 0; padding: 0; list-style: none; max-height: 200px; overflow-y: auto; font-family: ui-monospace, monospace; font-size: 11px; }
#log li { padding: 3px 0; border-top: 1px solid var(--border); color: var(--muted); word-break: break-word; }
#log li:first-child { border-top: none; }
#log li.event-tool { color: #88c0d0; }
#log li.event-error { color: var(--danger); }
#log li.event-result { color: var(--accent); }
footer { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }
