* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0db8f;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
}

.chat-card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eee;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.chat-header p {
  margin: 4px 0 0;
  color: #666;
  font-size: 0.9rem;
}

.messages {
  flex: 1;
  min-height: 480px;
  max-height: 680px;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 10px;
  line-height: 1.4;
  font-size: 0.95rem;
}

.message.user,
.message.error {
  white-space: pre-wrap;
}

.message.bot :first-child {
  margin-top: 0;
}

.message.bot :last-child {
  margin-bottom: 0;
}

.message.bot ul,
.message.bot ol {
  padding-left: 1.25em;
}

.message.bot h1,
.message.bot h2,
.message.bot h3 {
  font-size: 1.05rem;
  margin: 0.6em 0 0.3em;
}

.message.bot code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.9em;
}

.message.user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
}

.message.bot {
  align-self: flex-start;
  background: #f1f2f4;
  color: #1a1a1a;
}

.message.error {
  align-self: flex-start;
  background: #fde8e8;
  color: #9b1c1c;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #eee;
}

.chat-form textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  max-height: 160px;
  overflow-y: auto;
}

.chat-form textarea:focus {
  outline: none;
  border-color: #2563eb;
}

.chat-form button {
  padding: 10px 18px;
  border: none;
  background: #bc9c22;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.chat-form button:hover {
  background: #9c8019;
}

.chat-form button:disabled {
  background: #d9c688;
  cursor: not-allowed;
}
