:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --text: #e8edf2;
  --muted: #8a94a0;
  --accent: #4c8bf5;
  --accent-live: #2ecc71;
  --danger: #e0574a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: calc(var(--safe-top) + 12px) 18px calc(var(--safe-bottom) + 18px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.state-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted);
  transition: background .25s, box-shadow .25s;
  flex: 0 0 auto;
}
.state-dot[data-state="connecting"] { background: #d9a441; }
.state-dot[data-state="listening"]  { background: var(--accent-live); box-shadow: 0 0 0 6px rgba(46,204,113,.15); }
.state-dot[data-state="thinking"]   { background: var(--accent); box-shadow: 0 0 0 6px rgba(76,139,245,.15); }
.state-dot[data-state="speaking"]   { background: var(--accent); box-shadow: 0 0 0 6px rgba(76,139,245,.25); }
.state-dot[data-state="error"]      { background: var(--danger); }
.state-label { color: var(--muted); font-size: 14px; }
.tasks-badge {
  margin-left: auto;
  font-size: 13px; color: var(--muted);
  background: var(--panel); padding: 4px 10px; border-radius: 999px;
}

.transcript {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.transcript .hint { color: var(--muted); text-align: center; margin: auto 0; }
.line { padding: 10px 14px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; }
.line.user { align-self: flex-end; background: #1d2836; }
.line.assistant { align-self: flex-start; background: var(--panel); }
.line.partial { opacity: .6; }

.warn {
  background: #2a2018; color: #f0c987; border: 1px solid #3a2c1a;
  padding: 10px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 12px;
}

.controls { display: flex; justify-content: center; padding-top: 8px; }
.talk {
  position: relative;
  width: 168px; height: 168px; border-radius: 50%;
  border: none; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #26456e, #142033);
  color: var(--text);
  font-size: 20px; font-weight: 600;
  transition: transform .1s ease;
}
.talk:active { transform: scale(.97); }
.talk-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(76,139,245,.3);
}
.talk.live { background: radial-gradient(circle at 50% 40%, #1e6e44, #0f2f1e); }
.talk.live .talk-ring { border-color: rgba(46,204,113,.5); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: .6; }
  50% { transform: scale(1.06); opacity: 1; }
}
.talk-core { position: relative; z-index: 1; }
