/* Doxt — 新时代 AI 搜索 UI v3
   顶部来源横条（无内嵌纵向滚动）+ 对话线程（流式回答）+ 追问条 + 分步进度 */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e7e8ec;
  --border-strong: #d9dbe2;
  --text: #1a1b1e;
  --muted: #6f7280;
  --faint: #a1a4ae;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --link: #3b5bdb;
  --hl: #d64545;
  --ok: #16a34a;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(20, 21, 26, .04), 0 4px 16px rgba(20, 21, 26, .06);
  --shadow-lift: 0 2px 6px rgba(20, 21, 26, .06), 0 10px 28px rgba(20, 21, 26, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7;
}
button { font-family: inherit; }
.ic { width: 16px; height: 16px; flex: none; }

/* ---------- 字母四色 logo ---------- */
.l-d { color: #2563eb; }
.l-o { color: #16a34a; }
.l-x { color: #8b5cf6; }
.l-t { color: #f59e0b; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.nav-search {
  flex: 1; max-width: 620px; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 8px 12px; color: var(--faint);
  transition: border-color .15s, box-shadow .15s;
}
.nav-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.14); }
.nav-search input { flex: 1; border: 0; outline: 0; background: none; font-size: 14px; color: var(--text); min-width: 0; }
.nav-search kbd {
  font-family: inherit; font-size: 11px; color: var(--faint);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 5px;
}
.seg-group { display: flex; background: #ececf1; border-radius: 10px; padding: 3px; }
.seg {
  border: 0; background: transparent; padding: 5px 15px; border-radius: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; transition: all .15s;
}
.seg.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(20,21,26,.1); }
.ghost {
  border: 1px solid var(--border-strong); background: var(--card); color: var(--muted);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 首页 Hero ---------- */
.hero { min-height: calc(100vh - 52px); display: flex; flex-direction: column; }
.hero-inner {
  flex: 1; width: 92%; max-width: 660px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 40px 0;
}
.hero-logo { font-size: 58px; font-weight: 800; letter-spacing: -2px; line-height: 1.1; }
.hero-logo span { transition: transform .15s; }
.hero-logo span:hover { transform: translateY(-3px); }
.logo-legend { color: var(--faint); font-size: 12.5px; margin: 10px 0 4px; }
.logo-legend b { font-weight: 700; }
.hero-tag { color: var(--muted); margin: 2px 0 32px; font-size: 15px; }
.tbd { color: var(--faint); font-size: 13px; }
.hero-seg { margin-bottom: 16px; }
.hero-search {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 15px 18px; color: var(--faint); box-shadow: var(--shadow);
  transition: box-shadow .2s, border-color .2s;
}
.hero-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99,102,241,.12), var(--shadow-lift); }
.hero-search input { flex: 1; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); min-width: 0; }
.go-btn {
  border: 0; cursor: pointer; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s, filter .15s;
}
.go-btn:hover { transform: translateX(2px); filter: brightness(1.06); }
.go-btn svg { width: 17px; height: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.chip {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 7px 15px; font-size: 13px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.hero-foot { text-align: center; color: var(--faint); font-size: 12px; padding: 18px; }

/* ---------- 结果布局：左对话 · 右来源（右栏自然排布，无内嵌滚动条） ---------- */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 22px 20px 70px;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px;
  align-items: start;
}
.answer-col { display: flex; flex-direction: column; min-height: calc(100vh - 140px); }

.sources-col {
  position: sticky; top: 72px; align-self: start;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 14px 6px;
}
.sources-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--text);
  padding: 2px 2px 10px; border-bottom: 1px solid var(--border);
}
.sources-head::before {
  content: ""; width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.src-count {
  font-weight: 500; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 0 8px; font-size: 12px;
}
.sources-list { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 8px; }
.src-card {
  border: 1px solid var(--border); border-radius: 12px; background: #fcfcfd;
  padding: 11px 13px; transition: all .15s;
}
.src-card:hover { border-color: #c7cbfa; box-shadow: var(--shadow); background: #fff; }
.src-card.active { border-color: var(--accent); background: var(--accent-soft); }
.src-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.fav {
  width: 18px; height: 18px; border-radius: 5px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #fff;
}
.src-site { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-date { font-size: 11px; color: var(--faint); margin-left: auto; flex: none; }
.src-title {
  font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 3px;
}
.src-title a { color: inherit; }
.src-title a:hover { color: var(--link); }
.src-snip {
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hl { color: var(--hl); font-style: normal; font-weight: 600; }
.skeleton {
  height: 70px; border-radius: 12px;
  background: linear-gradient(90deg, #f0f1f4 25%, #e8e9ee 50%, #f0f1f4 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sources-col { position: static; }
}

/* ---------- 对话线程 ---------- */
.turn { margin-bottom: 26px; }
.q-bubble {
  margin: 0 auto 14px; max-width: 78%; width: fit-content;
  background: var(--accent-soft); color: var(--text);
  border: 1px solid #dfe3ff; border-radius: 16px 16px 4px 16px;
  padding: 9px 16px; font-size: 14.5px; font-weight: 500;
  margin-left: auto;
}
.turn-user-label { text-align: right; font-size: 11.5px; color: var(--faint); margin: -8px auto 14px; max-width: 78%; }

.ai-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 22px 12px; min-height: 60px;
}
.ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 11px; border-radius: 999px; letter-spacing: .2px;
}
.spark { font-size: 11px; }
.ai-status { color: var(--faint); font-size: 12.5px; }
.ai-status.done { color: var(--ok); }
.mock-badge {
  background: #fff7ed; color: #c2410c; font-size: 11px;
  border: 1px solid #fed7aa; border-radius: 999px; padding: 2px 9px;
}
.cache-badge {
  background: #f0fdf4; color: #15803d; font-size: 11px;
  border: 1px solid #bbf7d0; border-radius: 999px; padding: 2px 9px;
}
.legal-note {
  background: #fefce8; border: 1px solid #fef08a; color: #854d0e;
  font-size: 12.5px; border-radius: var(--radius-s); padding: 7px 12px; margin-bottom: 12px;
}
.ai-body { font-size: 15px; }
.ai-body p { margin: 8px 0; }
.ai-body ul { margin: 8px 0 8px 4px; list-style: none; }
.ai-body li { padding-left: 18px; position: relative; margin: 5px 0; }
.ai-body li::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 6px; height: 6px; border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.ai-body code { background: #f1f2f6; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.ai-body blockquote {
  border-left: 3px solid #c9cdf5; background: #f8f8ff;
  margin: 10px 0; padding: 8px 14px; border-radius: 0 10px 10px 0; color: var(--muted);
}
.ai-body .md-h { font-size: 16px; display: inline-block; margin-top: 14px; }
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 17px; padding: 0 4px; margin: 0 2px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 600; cursor: pointer; transition: all .12s;
}
.cite:hover { background: var(--accent); color: #fff; }
.ai-foot {
  margin-top: 14px; border-top: 1px dashed var(--border);
  color: var(--faint); font-size: 12px; padding-top: 9px;
}
.cursor {
  display: inline-block; width: 7px; height: 15px; margin-left: 2px;
  border-radius: 2px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  vertical-align: -2px; animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 分步进度 ---------- */
.steps { display: flex; flex-direction: column; gap: 7px; padding: 4px 0 8px; }
.step {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--faint);
}
.step .dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: transparent; transition: all .2s;
}
.step.active { color: var(--text); font-weight: 500; }
.step.active .dot { border-color: var(--accent); }
.step.active .dot::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); animation: pulse 1s infinite;
}
.step.done { color: var(--muted); }
.step.done .dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.step.done .dot::after { content: "✓"; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- 追问条 ---------- */
.followup {
  position: sticky; bottom: 14px; z-index: 15;
  display: flex; align-items: center; gap: 10px;
  max-width: 720px; margin: 6px auto 0;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 10px 14px; color: var(--faint); box-shadow: var(--shadow-lift);
  transition: border-color .15s, box-shadow .15s;
}
.followup:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99,102,241,.12), var(--shadow-lift); }
.followup input { flex: 1; border: 0; outline: 0; background: none; font-size: 15px; color: var(--text); min-width: 0; }
.followup .go-btn { width: 32px; height: 32px; }
