:root {
  --primary: #4f46e5;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.app-container {
  width: 90%;
  max-width: 650px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 80vh;
}

header {
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

header h1 { margin: 0; color: var(--primary); font-size: 1.5rem; }
header p { margin: 4px 0 0; color: #6b7280; font-size: 0.9rem; }

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafafa;
}

.message {
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.user-msg {
  align-self: flex-end;
  background-color: var(--primary);
  color: white;
}

.ai-msg {
  align-self: flex-start;
  background-color: #e5e7eb;
  color: var(--text);
}

.system-msg {
  align-self: center;
  background: transparent;
  color: #6b7280;
  font-style: italic;
  font-size: 0.85rem;
}

.input-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

input[type="text"] {
  flex: 1;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
}

button {
  padding: 12px 20px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

button:hover { opacity: 0.9; }
button:disabled { background-color: #9ca3af; }