:root {
  --bg: #0b0b10;
  --panel: #14141c;
  --line: #2a2a38;
  --text: #f4f2ef;
  --muted: #9a97a8;
  --accent: #7c5cff;
  --accent2: #ff6bcb;
  --sidebar: #0e0e14;
  --radius: 16px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Space Grotesk", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); font-family: var(--font); background: var(--bg); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1rem .85rem; gap: .75rem;
}
.side-top { display: flex; flex-direction: column; gap: .75rem; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.logo-mark { color: var(--accent2); }
.brand .ai { color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border-radius: 999px; padding: .55rem 1rem; font-weight: 600; font-size: .88rem;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
}
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn.block { width: 100%; }
.btn.ghost { border-color: var(--line); background: transparent; color: var(--text); }
.side-label { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin-top: .5rem; }
.history { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: .35rem; }
.history button {
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: .55rem .65rem; border-radius: 10px; cursor: pointer; font: inherit; font-size: .86rem;
}
.history button:hover, .history button.active { background: #1a1a24; color: var(--text); }
.side-foot { border-top: 1px solid var(--line); padding-top: .6rem; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; }
.main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background-image:
    radial-gradient(800px 400px at 20% -10%, rgba(124,92,255,.28), transparent 60%),
    radial-gradient(600px 320px at 90% 0%, rgba(255,107,203,.16), transparent 55%);
}
.top {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.06); backdrop-filter: blur(12px);
  background: rgba(11,11,16,.55); position: sticky; top: 0; z-index: 5;
}
.burger { display: none; background: none; border: 0; color: var(--text); font-size: 1.25rem; cursor: pointer; }
.modes { display: flex; gap: .35rem; flex-wrap: wrap; }
.mode {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: .35rem .75rem; font: inherit; font-size: .82rem; cursor: pointer;
}
.mode.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.top-right { margin-left: auto; }
.pro { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: .35rem; }
.hero { max-width: 760px; margin: 0 auto; padding: 3.5rem 1.25rem 2rem; text-align: center; }
.eyebrow {
  display: inline-block; padding: .25rem .7rem; border-radius: 999px;
  border: 1px solid rgba(124,92,255,.45); color: #cbbdff; font-size: .78rem; margin-bottom: 1rem;
}
.hero h1 {
  font-family: var(--display); font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1;
  margin: 0 0 .9rem; letter-spacing: -.03em; font-weight: 600;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, #d7c9ff, #ffb3e0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: var(--muted); margin: 0 auto 1.4rem; max-width: 520px; }
.search-box {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: .8rem; box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.search-row { display: flex; gap: .5rem; align-items: flex-end; }
.search-box textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text);
  font: inherit; font-size: 1.02rem; padding: .5rem; min-height: 44px; max-height: 140px;
}
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.chips button {
  border: 1px solid var(--line); background: #101018; color: var(--muted);
  border-radius: 999px; padding: .32rem .7rem; font-size: .78rem; cursor: pointer; font-family: inherit;
}
.chips button:hover { color: var(--text); border-color: var(--accent); }
.results { max-width: 800px; width: 100%; margin: 0 auto; padding: 1rem 1.25rem 2.5rem; flex: 1; display: flex; flex-direction: column; }
.thread { display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.bubble-q {
  align-self: flex-end; max-width: 85%; background: #1a1530; border: 1px solid rgba(124,92,255,.35);
  padding: .75rem 1rem; border-radius: 16px 16px 4px 16px; font-weight: 500;
}
.bubble-a {
  align-self: stretch; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 1.1rem 1.2rem;
}
.a-status { color: var(--muted); font-size: .8rem; margin-bottom: .5rem; }
.a-status.busy::before {
  content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--accent2); margin-right: .4rem; animation: pulse 1.3s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } }
.a-body { line-height: 1.65; white-space: pre-wrap; }
.a-body .cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem; margin: 0 .15rem;
  border-radius: 4px; background: rgba(124,92,255,.25); color: #d7c9ff;
  font-size: .7rem; font-weight: 700; text-decoration: none; vertical-align: super;
}
.sources { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.sources h4 { margin: 0 0 .5rem; font-size: .85rem; color: #cbbdff; }
.src {
  display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; margin-bottom: .35rem;
  border-radius: 10px; border: 1px solid var(--line); background: #101018; color: var(--text);
}
.src:hover { border-color: var(--accent); }
.src .n { color: var(--accent); font-weight: 700; font-size: .8rem; }
.src .t { font-size: .86rem; }
.follow-box {
  display: flex; gap: .5rem; margin-top: 1rem; position: sticky; bottom: .75rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .4rem .4rem 1rem;
}
.follow-box input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit;
}
@media (max-width: 860px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-105%); transition: .2s; }
  .sidebar.open { transform: none; }
  .burger { display: inline-block; }
  .modes { overflow: auto; flex-wrap: nowrap; }
}
