:root {
  --bg: #0f1115;
  --surface: #161922;
  --surface-2: #1f2330;
  --accent: #5d8bff;
  --accent-soft: rgba(93, 139, 255, 0.16);
  --text: #e8ebf2;
  --text-dim: #8b93a7;
  --border: #232838;
  --bubble-user: #2a3550;
  --bubble-bot: #1c2030;
  --radius: 14px;
  --space: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px var(--space);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
  flex: 1;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
}

.reset {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
}

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

.log {
  padding: var(--space);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.row {
  display: flex;
  gap: 8px;
  max-width: 100%;
}

.row.user {
  justify-content: flex-end;
}

.row.bot {
  justify-content: flex-start;
}

.bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  max-width: min(80%, 560px);
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bubble-bot);
  border: 1px solid var(--border);
}

.row.user .bubble {
  background: var(--bubble-user);
  border-color: transparent;
  border-bottom-right-radius: 4px;
}

.row.bot .bubble {
  border-bottom-left-radius: 4px;
}

.bubble.pending::after {
  content: "▍";
  color: var(--accent);
  margin-left: 1px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.meta {
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 6px;
  align-self: flex-end;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 12px var(--space);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.input {
  flex: 1;
  resize: none;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font: inherit;
  outline: none;
  max-height: 160px;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.send {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0 18px;
  font-weight: 600;
  cursor: pointer;
}

.send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
