:root {
  --bg: #05030f;
  --panel: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef0ff;
  --muted: #a9aed0;
  --cyan: #4fd8ff;
  --purple: #a66bff;
  --pink: #ff5fc8;
  --grad: linear-gradient(135deg, var(--cyan), var(--purple) 50%, var(--pink));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
/* animated star field behind every page */
#stars { position: fixed; inset: 0; z-index: -1; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(123, 63, 228, 0.35), transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(255, 95, 200, 0.18), transparent 50%),
    radial-gradient(ellipse at 60% 40%, rgba(79, 216, 255, 0.12), transparent 60%);
}
a { color: inherit; text-decoration: none; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn {
  display: inline-block; padding: 14px 28px; border-radius: 999px; font-weight: 700;
  background: var(--grad); color: #fff; border: none; cursor: pointer; font-size: 1rem;
  box-shadow: 0 0 30px rgba(166, 107, 255, 0.45); transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 45px rgba(166, 107, 255, 0.7); }
.btn.ghost { background: transparent; border: 1px solid var(--border); box-shadow: none; }

/* ---------- landing page ---------- */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.brand img { width: 38px; height: 38px; }
nav .links { display: flex; gap: 24px; color: var(--muted); }
nav .links a:hover { color: var(--text); }
.hero { text-align: center; padding: 70px 16px 60px; max-width: 900px; margin: 0 auto; }
.hero .logo { width: 210px; height: 210px; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 0 40px rgba(166,107,255,.6)); }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.5rem); font-weight: 800; margin: 24px 0 14px; letter-spacing: -1px; }
.hero p { color: var(--muted); font-size: 1.15rem; line-height: 1.6; max-width: 620px; margin: 0 auto 32px; }
.hero .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(3deg); } }
section.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; max-width: 1100px; margin: 0 auto; padding: 30px 16px 80px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 26px; backdrop-filter: blur(8px); }
.card .icon { font-size: 1.8rem; margin-bottom: 12px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); line-height: 1.55; }
footer { text-align: center; color: var(--muted); padding: 30px 16px; border-top: 1px solid var(--border); font-size: .9rem; }
@media (max-width: 600px) { nav .links { display: none; } }

/* ---------- chat app ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; max-width: 860px; margin: 0 auto; }
.app header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.app header button { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
#messages { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 18px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--grad); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot.typing { color: var(--muted); font-style: italic; }
.welcome { margin: auto; text-align: center; color: var(--muted); }
.welcome img { width: 110px; margin-bottom: 14px; filter: drop-shadow(0 0 25px rgba(166,107,255,.6)); }
.welcome h2 { color: var(--text); margin-bottom: 6px; }
form.composer { display: flex; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
form.composer textarea {
  flex: 1; resize: none; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 16px; padding: 12px 14px; font: inherit; max-height: 140px; outline: none;
}
form.composer textarea:focus { border-color: var(--purple); }
form.composer .btn { padding: 0 22px; }

/* brain picker + loading bar */
.app header select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; font: inherit; font-size: .85rem;
}
.app header select option { background: #120a2a; }
.progress { width: min(320px, 80vw); height: 8px; margin: 16px auto 8px; background: var(--panel); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.welcome .hint { font-size: .85rem; max-width: 360px; margin: 8px auto 0; }
@media (max-width: 520px) { .app header .brand { font-size: 1rem; } .app header select { max-width: 130px; } }
