:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e5e5e0;
  --accent: #b54a2a;
  --user-bg: #1a1a1a;
  --user-fg: #fafaf7;
  --bot-bg: #ffffff;
  --bot-fg: #1a1a1a;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131311;
    --fg: #f4f3ee;
    --muted: #9a9892;
    --line: #2a2a26;
    --accent: #d96b48;
    --user-bg: #f4f3ee;
    --user-fg: #131311;
    --bot-bg: #1c1c19;
    --bot-fg: #f4f3ee;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
}

.brand-tag {
  color: var(--muted);
  font-size: 13px;
}

.topbar-links {
  display: flex;
  gap: 18px;
  font-size: 14px;
}

.topbar-links a {
  color: var(--muted);
  text-decoration: none;
}

.topbar-links a:hover {
  color: var(--accent);
}

.chat {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-intro h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 12px 0;
  letter-spacing: -0.01em;
}

.chat-intro p {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 18px 0;
  max-width: 60ch;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.suggestion {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

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

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow);
}

.message.user {
  align-self: flex-end;
  background: var(--user-bg);
  color: var(--user-fg);
  border-bottom-right-radius: 4px;
}

.message.bot {
  align-self: flex-start;
  background: var(--bot-bg);
  color: var(--bot-fg);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--line);
}

.message.bot.streaming::after {
  content: "▍";
  display: inline-block;
  animation: blink 1s steps(2) infinite;
  margin-left: 2px;
  color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0; }
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px;
  background: var(--bot-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 16px;
}

#input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 6px 4px;
  max-height: 200px;
}

#send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  border: none;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

#send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.footnote {
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  margin: 0;
  max-width: 60ch;
  align-self: center;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .topbar-links { gap: 12px; font-size: 13px; }
  .brand-tag { display: none; }
  .chat { padding: 24px 16px 60px; }
  .chat-intro h1 { font-size: 24px; }
  .message { max-width: 92%; }
}
