:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f6821f;
  --accent-dim: #f6821f33;
  --user: #1f6feb;
  --ai: #238636;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}
header h1 { margin: 0; font-size: 1.6rem; }
header p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

main {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.25rem;
}
@media (max-width: 800px) {
  main { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.panel h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }

textarea, input[type="text"] {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem;
  font: inherit;
}
textarea { min-height: 200px; resize: vertical; }

button {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.6rem;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.status { color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; min-height: 1.2em; }

.messages {
  min-height: 300px;
  max-height: 480px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.msg {
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user { background: var(--accent-dim); border-left: 3px solid var(--accent); }
.msg.ai { background: #2386361f; border-left: 3px solid var(--ai); }
.msg .role { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }

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