:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f8fafc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(100%, 520px);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
}

.eyebrow {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(28px, 7vw, 44px); letter-spacing: -0.04em; }
.description { color: #475569; line-height: 1.6; margin: 12px 0 28px; }

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  color: #334155;
  font-weight: 700;
}

.status-dot { width: 10px; height: 10px; border-radius: 999px; background: #f59e0b; }
.status-dot.ready { background: #22c55e; }
.status-dot.listening { background: #ef4444; animation: pulse 1s infinite; }
.status-dot.thinking { background: #8b5cf6; }
.status-dot.speaking { background: #0ea5e9; }
.status-dot.error { background: #dc2626; }

.connection-panel {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
}

.connection-panel h2 { margin: 0 0 12px; font-size: 15px; }
.connection-panel label { display: block; margin-bottom: 7px; color: #334155; font-size: 13px; font-weight: 750; }
.connection-panel p { margin: 9px 0 0; color: #64748b; font-size: 12px; line-height: 1.4; }
.connection-controls { display: flex; gap: 8px; }
.connection-controls input {
  min-width: 0;
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.connection-controls button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: #334155;
  color: white;
  font-weight: 750;
}

.session-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  margin: 0 0 20px;
}
.session-facts div { min-width: 0; }
.session-facts dt { color: #64748b; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.session-facts dd { margin: 2px 0 0; color: #334155; font-size: 13px; overflow-wrap: anywhere; }

.talk-button {
  width: 100%;
  min-height: 160px;
  border: 0;
  border-radius: 24px;
  background: #111827;
  color: white;
  font-size: 22px;
  font-weight: 850;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform 120ms ease, background 120ms ease;
}

.talk-button:hover { background: #1e293b; }
.talk-button:active, .talk-button.active { transform: scale(0.985); background: #991b1b; }
.talk-button:disabled { cursor: not-allowed; opacity: 0.5; }

.action-confirmation {
  margin-top: 20px;
  padding: 16px;
  border: 2px solid #f59e0b;
  border-radius: 16px;
  background: #fffbeb;
}
.action-confirmation h2 { margin: 0 0 8px; font-size: 16px; }
.action-confirmation p { margin: 0 0 14px; color: #334155; line-height: 1.5; }
.action-confirmation-controls { display: flex; gap: 10px; }
.action-confirmation-controls button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  background: #166534;
  color: white;
  font-weight: 750;
}
.action-confirmation-controls button:last-child { background: #475569; }
.action-confirmation-controls button:disabled { opacity: 0.5; }

.diagnostics {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
}

.diagnostics h2 { margin: 0 0 12px; font-size: 15px; }
.diagnostics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
.diagnostics-grid div { min-width: 0; }
.diagnostics-grid dt { color: #64748b; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.diagnostics-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; font: 12px/1.4 ui-monospace, monospace; }

.log {
  margin-top: 20px;
  min-height: 84px;
  max-height: 200px;
  overflow: auto;
  background: #f1f5f9;
  border-radius: 16px;
  padding: 14px;
  color: #475569;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

@keyframes pulse { 50% { opacity: 0.35; transform: scale(1.35); } }

@media (max-width: 420px) {
  .shell { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .card { padding: 20px; border-radius: 22px; }
  .diagnostics-grid, .session-facts { grid-template-columns: 1fr; }
  .action-confirmation-controls { flex-direction: column; }
}
