:root {
  --bg: #0b0d12;
  --bg-elev: #12151c;
  --bg-elev-2: #1a1f2a;
  --border: #232936;
  --text: #e7ebf3;
  --text-dim: #9aa3b2;
  --accent: #6ea8ff;
  --accent-2: #a78bfa;
  --user-bubble: #2a3346;
  --bot-bubble: #1a1f2a;
  --success: #34d399;
  --danger: #f87171;
  --radius: 14px;
  --max-w: 980px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(167,139,250,.18), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(110,168,255,.18), transparent 60%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.88em;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  color: #fff;
}
.site-nav a { margin-left: 22px; color: var(--text-dim); }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* Hero */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}
.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0 0 16px;
  background: linear-gradient(135deg, #fff, #b4c2dc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.lead { color: var(--text-dim); max-width: 620px; margin: 0 auto 28px; font-size: 1.1rem; }
.cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
}
.cta:hover { text-decoration: none; opacity: .92; }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px 0 40px;
}
.feature {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.feature h3 { margin: 0 0 8px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--text-dim); font-size: 0.96rem; }

/* Chat */
.chat-section { padding: 20px 0 60px; }
.chat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
  font-weight: 600;
}
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52,211,153,.18);
}
.messages {
  padding: 20px;
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg { display: flex; }
.msg-bot { justify-content: flex-start; }
.msg-user { justify-content: flex-end; }
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
}
.msg-bot .bubble {
  background: var(--bot-bubble);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-user .bubble {
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}
.msg-error .bubble {
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.35);
  color: var(--danger);
}
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.composer {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev-2);
}
#chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
}
#chat-input:focus { border-color: var(--accent); }
#chat-send {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 0;
  padding: 0 22px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
#chat-send:disabled { opacity: .5; cursor: not-allowed; }
.hint {
  margin: 0;
  padding: 10px 18px 14px;
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  border-top: 1px solid var(--border);
}

/* Footer */
.site-footer {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 22px 28px 32px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 0.88rem;
}

@media (max-width: 560px) {
  .site-header { padding: 16px 20px; }
  main { padding: 0 20px; }
  .hero { padding: 36px 0 24px; }
  .site-nav a { margin-left: 14px; }
}
