:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --panel: #fffdf8;
  --accent: #6b4f2a;
  --accent-dark: #4a3419;
  --text: #2c2418;
  --border: #d8cdb8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 640px;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app-header {
  text-align: center;
}

.portrait {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  margin-bottom: 0.5rem;
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--accent-dark);
  font-style: italic;
}

.view {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#login-form label {
  font-weight: bold;
}

#login-form input,
#chat-form textarea {
  font-size: 1rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-family: inherit;
}

button:hover {
  background: var(--accent-dark);
}

.error {
  color: #a02020;
  margin: 0;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message.user {
  background: #e8e0cf;
  align-self: flex-end;
}

.message.assistant {
  background: #f0ece0;
  border: 1px solid var(--border);
  align-self: flex-start;
}

.message.pending {
  opacity: 0.6;
  font-style: italic;
}

#chat-form {
  display: flex;
  gap: 0.5rem;
}

#chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 3rem;
}

.logout {
  margin-top: 1rem;
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
}

.logout:hover {
  background: var(--border);
}
