* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #7c5cfc;
  --user-bg: #2a2a3e;
  --assistant-bg: #1e1e1e;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#messages {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 15px;
  max-width: 85%;
  white-space: pre-wrap;
  word-wrap: break-word;
}

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

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

.message.error {
  background: #2a1a1a;
  border: 1px solid #3a2020;
  color: #e05252;
  align-self: flex-start;
}

.typing {
  align-self: flex-start;
  padding: 12px 16px;
  display: flex;
  gap: 6px;
}

.typing span {
  width: 8px;
  height: 8px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

#input-form {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

#input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

#input:focus {
  border-color: var(--accent);
}

#send-btn {
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

#send-btn:hover {
  opacity: 0.9;
}

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

@media (max-width: 600px) {
  .message { max-width: 95%; }
  header { padding: 12px 16px; }
  footer { padding: 12px 16px; }
  #input { padding: 10px 14px; }
  #send-btn { padding: 10px 16px; }
}
