:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e8eaed;
  --muted: #8b93a1;
  --accent: #4f7cff;
  --bubble-user: #4f7cff;
  --bubble-assistant: #232733;
  --border: #2a2f3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

#login-screen {
  align-items: center;
  justify-content: center;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(320px, 90vw);
  background: var(--panel);
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

#login-form h1 {
  margin: 0 0 8px;
  text-align: center;
}

#login-form input,
#message-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 15px;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

button:hover {
  filter: brightness(1.1);
}

.error {
  color: #ff6b6b;
  font-size: 14px;
  margin: 0;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 18px;
  margin: 0;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 13px;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

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

.message.assistant {
  align-self: flex-start;
  background: var(--bubble-assistant);
  border-bottom-left-radius: 4px;
}

.message.pending {
  color: var(--muted);
  font-style: italic;
}

#message-form {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

#message-input {
  flex: 1;
}
