:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  --bg: #0b0e11;
  --panel: #12171d;
  --border: #26313b;
  --text: #eef3f7;
  --muted: #9aa8b5;
  --accent: #b7ff00;
  --user: #1d2933;
  --assistant: #12171d;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }

body { min-height: 100vh; }

button, textarea { font: inherit; }

.app {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 18px;
  gap: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); }

.subtitle, .meta, .status { color: var(--muted); }

.status {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--panel);
}

.chat {
  min-height: 45vh;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #0e1318;
}

.msg { display: flex; margin: 10px 0; }
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }

.bubble {
  max-width: min(780px, 88%);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
}

.user .bubble { background: var(--user); }
.assistant .bubble { background: var(--assistant); }

.composer {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: var(--panel);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 78px;
  max-height: 240px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  background: var(--accent);
  color: #101400;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button:disabled { opacity: .6; cursor: wait; }

@media (max-width: 640px) {
  .app { padding: 10px; }
  .chat { max-height: calc(100vh - 245px); }
  .composer-row { align-items: flex-end; }
  .meta { font-size: 12px; }
}
