:root {
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --border: #dde3ea;
  --text: #1c2430;
  --muted: #6b7684;
  --accent: #1f5fd6;
  --accent-soft: #e8effc;
  --danger: #c62828;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.shell {
  max-width: 760px;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 16px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.voice-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-picker label {
  color: var(--muted);
  font-size: 0.9rem;
}

select,
input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
}

.ghost {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
  min-height: 0;
}

.empty {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: var(--muted);
}

.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--accent-soft);
}

.bubble.error {
  align-self: center;
  background: var(--canvas);
  color: var(--danger);
  border: 1px solid var(--border);
}

.timing {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.7;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.status {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
}

.mic {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.mic svg {
  width: 38px;
  height: 38px;
  fill: #ffffff;
}

.mic:hover {
  transform: scale(1.05);
}

.mic.recording {
  background: var(--danger);
  animation: pulse 1.2s ease-in-out infinite;
}

.mic.busy {
  opacity: 0.55;
  cursor: progress;
}

@keyframes pulse {
  50% {
    transform: scale(1.08);
  }
}

.typed {
  display: flex;
  gap: 8px;
  width: 100%;
}

.typed input {
  flex: 1;
}

[hidden] {
  display: none !important;
}

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

.gate-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.gate-card .subtitle {
  margin-bottom: 12px;
}

.gate-card label {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-error {
  margin: 0;
  min-height: 1.2em;
  color: var(--danger);
  font-size: 0.9rem;
}

.primary {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
}
