:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b1020;
  color: #eef2ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 35rem),
    radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.14), transparent 30rem),
    #0b1020;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
.shell { width: min(980px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 3rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.eyebrow { margin: 0 0 0.25rem; color: #93c5fd; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.55rem, 4vw, 2.25rem); letter-spacing: -0.03em; }
.model-pill { display: flex; align-items: center; gap: 0.55rem; max-width: 48%; padding: 0.65rem 0.85rem; border: 1px solid rgba(148, 163, 184, 0.24); border-radius: 999px; background: rgba(15, 23, 42, 0.72); color: #cbd5e1; font-size: 0.86rem; overflow-wrap: anywhere; }
.status-dot { width: 0.58rem; height: 0.58rem; flex: 0 0 auto; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0.25rem rgba(52, 211, 153, 0.12); }
.chat-card, .settings-card { border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 1.25rem; background: rgba(15, 23, 42, 0.84); box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.24); backdrop-filter: blur(16px); }
.chat-card { overflow: hidden; }
.messages { height: min(62vh, 650px); min-height: 380px; padding: 1.25rem; overflow-y: auto; scroll-behavior: smooth; }
.message { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; }
.user-message { flex-direction: row-reverse; }
.avatar { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: 0 0 auto; border: 1px solid rgba(148, 163, 184, 0.24); border-radius: 0.72rem; background: #111827; color: #cbd5e1; font-size: 0.7rem; font-weight: 800; }
.user-message .avatar { background: #1d4ed8; color: #eff6ff; }
.bubble { max-width: min(78%, 720px); padding: 0.85rem 1rem; border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 0.95rem; background: rgba(30, 41, 59, 0.8); color: #e2e8f0; line-height: 1.6; overflow-wrap: anywhere; }
.user-message .bubble { background: rgba(37, 99, 235, 0.92); color: #eff6ff; }
.bubble p { margin: 0; white-space: pre-wrap; }
.error-bubble { border-color: rgba(248, 113, 113, 0.45); background: rgba(127, 29, 29, 0.35); }
.status { min-height: 1.8rem; padding: 0 1.25rem 0.4rem; color: #94a3b8; font-size: 0.8rem; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; padding: 1rem; border-top: 1px solid rgba(148, 163, 184, 0.14); background: rgba(2, 6, 23, 0.42); }
textarea, input { width: 100%; border: 1px solid rgba(148, 163, 184, 0.25); border-radius: 0.85rem; outline: none; background: rgba(15, 23, 42, 0.9); color: #f8fafc; }
textarea { min-height: 2.9rem; max-height: 180px; resize: none; padding: 0.8rem 0.9rem; line-height: 1.4; }
input { padding: 0.75rem 0.85rem; }
textarea:focus, input:focus { border-color: #60a5fa; box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.13); }
.composer-actions { display: flex; align-items: flex-end; gap: 0.5rem; }
.primary-button, .secondary-button { min-height: 2.75rem; padding: 0 0.95rem; border-radius: 0.8rem; font-weight: 700; }
.primary-button { border: 1px solid #3b82f6; background: #2563eb; color: #eff6ff; }
.primary-button:hover:not(:disabled) { background: #1d4ed8; }
.secondary-button { border: 1px solid rgba(148, 163, 184, 0.24); background: rgba(30, 41, 59, 0.82); color: #cbd5e1; }
.settings-card { margin-top: 1rem; padding: 0.95rem 1rem; }
.settings-card summary { cursor: pointer; color: #cbd5e1; font-weight: 700; }
.settings-content { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.settings-content label { color: #cbd5e1; font-size: 0.88rem; font-weight: 700; }
.settings-content p { margin: 0; color: #94a3b8; font-size: 0.8rem; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 680px) {
  .shell { width: min(100% - 1rem, 980px); padding-top: 1rem; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .model-pill { max-width: 100%; }
  .messages { height: 58vh; min-height: 340px; padding: 0.85rem; }
  .bubble { max-width: 86%; }
  .composer { grid-template-columns: 1fr; }
  .composer-actions { justify-content: flex-end; }
}
