/* Web 游客对话壳样式（docs/22 §7.5）。零构建，纯原生。
 * 配色沿用小程序 / 落地页的素雅基调，桌面优先、移动端自适应。 */

:root {
  --warn: #94650d;
  --warn-bg: #fbf3e3;
  --warn-line: #e6cfa5;
  --shadow: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; flex: 0 0 auto; }
.brand-text { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-name { font-weight: 700; color: var(--brand); font-size: 17px; }
.brand-sub { color: var(--ink-soft); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.quota-pill {
  font-size: 13px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.quota-pill.empty { color: var(--danger); background: #fdecec; }

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ── 免责声明（持续可见）── */
.disclaimer {
  flex: 0 0 auto;
  background: var(--brand-soft);
  color: var(--ink-soft);
  /* 13.5px：合规要求"持续可见"，12.5px 在手机上接近不可读的下限 */
  font-size: 13.5px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
}
.disclaimer b { color: var(--brand-ink); }

/* ── 空态：标题 + 一句自述 + 可点的示例问题 ──
   示例芯片只把问题填进输入框、不自动发送——给用户一次改写机会。 */
.empty-state {
  margin: auto;
  max-width: 420px;
  padding: 32px 20px;
  text-align: center;
}
.empty-title {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--ink);
}
.empty-sub {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.empty-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.empty-chip {
  min-height: 44px;               /* 触控区下限，与小程序同规 */
  padding: 10px 18px;
  font-size: 14px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.empty-chip:hover { border-color: var(--brand); }
.empty-chip:active { background: var(--brand-soft); filter: brightness(0.97); }

/* ── 三栏骨架（桌面）── */
.app-body {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 220px minmax(0, 1fr) auto;
}
.history-side, .citation-side {
  background: #faf7f0; border-right: 1px solid var(--line);
  padding: 14px 12px; overflow-y: auto;
}
.citation-side { width: 320px; border-right: 0; border-left: 1px solid var(--line); }
.side-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 10px;
}
.citation-body { font-size: 12px; line-height: 1.75; color: var(--ink-soft); }
.citation-body .src { font-weight: 600; color: var(--ink); }
.citation-body .quote {
  margin: 8px 0 0; padding: 9px 10px; background: var(--bg);
  border-left: 3px solid #a6402c; border-radius: 0 4px 4px 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
}
.citation-body .origin {
  display: inline-block; margin-top: 10px; padding: 5px 12px;
  border: 1px solid var(--brand-ink); border-radius: 999px;
  color: var(--brand-ink); text-decoration: none; font-size: 12.5px;
}
.citation-body .origin:hover { background: var(--brand-ink); color: var(--panel); }
/* 「读全文」是**实心**的那个：它回答的是"我还漏了多少没看"，
   而「在微博打开原文」是去核对现状。两个都是 pill，靠填充区分主次，
   不靠顺序——顺序在窄屏换行之后就看不出来了。 */
.citation-body .origin.read-full {
  background: var(--brand-ink); color: var(--panel); margin-right: 6px;
}
.citation-body .origin.read-full:hover { background: var(--brand); }
.citation-body .hint { color: var(--ink-faint); }
@media (max-width: 1023px) {
  .app-body { grid-template-columns: 1fr; }
  .history-side, .citation-side { display: none; }
  .citation-side.open {
    display: block; position: fixed; left: 0; right: 0; bottom: 0;
    width: auto; max-height: 60vh; z-index: 30;
    border-left: 0; border-top: 1px solid var(--line);
    background: var(--panel); box-shadow: 0 -8px 24px rgba(0,0,0,.12);
  }
}
@media (min-width: 1024px) {
  #historyBtn { display: none; }
}

/* ── 消息区 ── */
.messages { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }
.bubble {
  max-width: min(760px, 92%);
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow);
}
.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-right-radius: 4px;
}
.msg.assistant .bubble {
  background: var(--ai-bubble);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
/* 急症 / 拒答卡片：醒目的警示样式，整条消息只有这一个区块（docs/22 §7.5）。 */
.bubble.emergency {
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
}
.bubble.emergency .ai-badge { color: var(--warn); }

.ai-badge {
  display: inline-block;
  /* 《标识办法》要求的显式标识，11px 在手机上是"看得见读不清" */
  font-size: 12px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 1px 7px;
  margin-bottom: 6px;
}
.ai-badge.warn { color: var(--warn); background: var(--warn-bg); }

/* 正文角标：正文里的 [E1] 渲染成这个，点了在右侧引用检查器看原文。
 * 上标 + 朱红 + 细下划线，与小程序同一套观感（chat.wxss 的 .cite）。
 * 用 button 而不是 span：它要能被 Tab 到、被键盘激活，读屏要能念出
 * 「第 N 条引用」。回答可回溯是这一页唯一不可替代的东西，不能只支持点按。
 * 11px 起：手机上 10px 以下基本点不中，而它周围没有留白可用。
 * 不用 `E1` 做文案：正文写 [E1]、下方列表写 [1]，读者没有依据把两者连起来。 */
/* 角标 + 紧随的句末标点：整组不可分割。理由见 app.js 的 makeCiteGroup。
 * 单用 `.cite { display: inline }` 时，行满的情况下「…的①。」会被拆成
 * 「…的①」+「。」，一行只剩一个句号。 */
.cite-group { display: inline-block; }

.cite {
  display: inline-block;
  appearance: none;
  border: 0;
  background: none;
  /* 不留左右 margin/padding：它贴着句末的「。」，多占 2px 就可能把
     标点挤到下一行。呼吸感靠下面的 border-bottom 与字号差，不靠空白。 */
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  /* 不用 vertical-align: super —— 它在 inline-block 里会把整组撑高、
     把行距拉开。上标位置用相对位移给，不改变盒子的高度。 */
  vertical-align: baseline;
  position: relative;
  top: -0.45em;
  color: var(--vermilion);
  border-bottom: 1px solid var(--vermilion);
  border-radius: 2px;
  cursor: pointer;
}
.cite:hover { background: var(--brand-soft); }
.cite:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 1px; }

/* 中文正文禁止行首标点（`line-break: strict`）。
 * 加了角标之后这条从"可选"变成"必要"：角标是 inline 元素，浏览器默认允许
 * 在它前后任意断行，于是「…可以解决①。」会被拆成「…可以解决①」+「。」
 * —— 一行只有一个句号，读起来像排版坏了。这条同时改善整体的标点孤行。 */
.a-text { line-break: strict; }

/* ── 等待期占位（见 app.js makeBubble 的注释）──
 * 服务端是策略 A：检索 + 整段生成做完才发第一帧，所以点完发送要静默 6~10 秒。
 * 这里给的是"文案 + 两条骨架"，不是转圈 —— 转圈只说明"在忙"，说明不了"在做什么"。
 * 动效用横向扫光而不是脉冲闪烁：长等待里闪烁读起来是焦虑，扫光读起来是推进。
 * 动画只是辅助，文案始终在；prefers-reduced-motion 下停掉动画也不丢信息。 */
.a-text.pending { display: flex; flex-direction: column; gap: 8px; }
.a-hint { font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); }
.a-skel {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--brand-soft) 0%, var(--line) 50%, var(--brand-soft) 100%);
  background-size: 240% 100%;
  animation: a-skel-sweep 1.6s ease-in-out infinite;
}
.a-skel.short { width: 58%; }
@keyframes a-skel-sweep {
  from { background-position: 120% 0; }
  to { background-position: -80% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .a-skel { animation: none; }
}

.citations {
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.citations[hidden] { display: none; }
.citation {
  font-size: 12.5px;
  color: var(--ink-soft);
}
.citation { cursor: pointer; }
.citation:focus-visible, .history-list li:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.msg.error .bubble { border-color: var(--danger); color: var(--danger); background: #fdecec; }

/* ── 反馈条 ──
 * 刻意做得比引用更轻：反馈是"顺手说一句"，不是每轮都要做的事。
 * 但点击区不能小 —— 手机上 24px 高的按钮基本点不中，这里给到 28px。
 * 负反馈必须先选原因（服务端强制），所以原因 chip 就地展开，不弹窗：
 * 弹窗会打断阅读，而用户此刻正看着答案。 */
.feedback {
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}
.fb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.fb-hint { font-size: 12px; color: var(--ink-faint); }
.fb-btn,
.fb-chip,
.fb-cancel {
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 6px 10px;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.fb-btn:hover,
.fb-chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.fb-btn.on { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.fb-btn:disabled { opacity: .55; cursor: default; }
.fb-cancel { border-style: dashed; color: var(--ink-faint); }
.fb-btn:focus-visible,
.fb-chip:focus-visible,
.fb-cancel:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.fb-done { font-size: 12px; color: var(--ink-faint); }

/* 分享是可点击按钮，不是一行说明文字。带上边框和胶囊圆角，
   让「能点」这件事在视觉上成立；复制结果就地回显，不弹 toast。 */
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.share-btn {
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 6px 10px;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.share-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.share-btn:disabled { opacity: .55; cursor: default; }
.share-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.share-status { font-size: 12px; color: var(--ink-faint); }
/* 失败要说出来。静默失败会让用户以为已经记下了。 */
.fb-err {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── 历史抽屉 ── */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(340px, 86vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 24px rgba(0,0,0,.08);
  padding: 14px;
  overflow-y: auto;
  z-index: 20;
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; margin-bottom: 10px;
}
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history-list li {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.history-list li:hover { border-color: var(--brand); }
.history-list .h-title { font-weight: 500; }
.history-list .h-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.history-empty { color: var(--ink-soft); font-size: 13px; }

/* ── 建议问题条（docs/07 §3.2）──
   显隐由 JS 控制（首屏隐藏、有问答才出现），这里只管版式。
   它贴在输入区上沿：一条 1px 线 + composer 自己的线，把"选一个问题"
   和"自己输入"分成上下两件事，与设计稿的两条分隔线一致。 */
.suggest {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.suggest[hidden] { display: none; }
.suggest-label {
  display: flex; align-items: center; flex: none;
  font-size: 12px; color: var(--ink-faint); white-space: nowrap;
}
/* 设计稿画的是灯泡；这里用一个小圆点，不在产品代码里放 emoji。 */
.suggest-dot {
  width: 5px; height: 5px; margin-right: 6px;
  background: var(--brand); border-radius: 50%;
}
/* 横向滚动而不是换行：换行会把输入框顶上去，用户正在打字的窗口会跳。 */
.suggest-list {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.suggest-list::-webkit-scrollbar { display: none; }
.suggest-chip {
  flex: none;
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--brand-ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.suggest-chip:hover { border-color: var(--brand); }
.suggest-chip:active { background: var(--brand-soft); }
/* 流式回答期间整条建议禁用（app.js::setSuggestBusy）。
   只加 disabled 属性的话，chip 仍然长得像可点的——用户会以为页面卡了，
   而不是"现在不能点"。所以弱化 + 去掉 hover 反馈。 */
.suggest-chip:disabled,
.suggest.is-busy .suggest-chip {
  opacity: 0.45;
  cursor: default;
}
.suggest-chip:disabled:hover,
.suggest.is-busy .suggest-chip:hover { border-color: var(--line); }
.suggest-chip:disabled:active,
.suggest.is-busy .suggest-chip:active { background: var(--panel); }
.suggest.is-busy .suggest-label { opacity: 0.6; }
/* 关闭键与"被横滑裁掉一半的 chip"必须分开：不加竖线时，
   截图里会看成 chip 的一部分，用户不敢点。 */
.suggest-close {
  flex: none;
  padding: 0 0 0 10px;
  font-size: 18px; line-height: 1;
  color: var(--ink-faint);
  background: none; border: 0; border-left: 1px solid var(--line);
  cursor: pointer;
}

/* ── 输入区 ── */
.composer {
  flex: 0 0 auto;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.composer-row { display: flex; }
.composer-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  max-height: 180px;
  outline: none;
}
.composer-input:focus { border-color: var(--brand); }
.composer-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.char-count { font-size: 12px; color: var(--ink-soft); }
.composer-actions { display: flex; gap: 8px; }
.send-btn {
  border: none;
  background: var(--brand);
  color: #fff;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
}
.send-btn:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; }
.send-btn:not(:disabled):hover { background: var(--brand-ink); }

/* 用完态 / 服务满 横幅 */
.banner {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
}
.banner.full { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }

/* ── 法律文本入口 + 告知—同意门 ─────────────────────────────
 * 两条硬要求：
 *   1. 入口常驻可见（折叠进抽屉等于没有），但只能是次要层级，不能抢提问按钮；
 *   2. 同意门默认不勾选、未勾选时主按钮 disabled —— 预勾选是「默认同意」，
 *      在 PIPL 口径下不成立。
 */
.legal-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px 10px;
  font-size: 12px;
  color: var(--ink-faint);
  flex-wrap: wrap;
}
.legal-row a { color: var(--ink-soft); text-decoration: none; }
.legal-row a:hover { color: var(--brand-ink); text-decoration: underline; }
.linklike {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--ink-soft);
  cursor: pointer;
}
.linklike:hover { color: var(--brand-ink); text-decoration: underline; }

/* ── 小程序扫码弹层 ──────────────────────────────────────────
 * 入口是 .legal-row 里的一行文字（次要层级，与法律文本并列），码放弹层。
 * 反过来做「常驻小图」要在输入区上方永久占约 120px，而这一页的主要动作
 * 是打字提问——手机上一屏本来就紧。
 * 同 .gate / .source-sheet：一旦给 display，UA 的 [hidden]{display:none}
 * 就被覆盖，必须显式补 [hidden] 规则，否则关不掉。
 */
.qr-sheet {
  position: fixed;
  inset: 0;
  /* 与切换源 sheet 同层：两者不会同时打开，抢层没有意义；
     必须低于同意门(50)——未同意时不该出现任何与产品导流有关的交互。 */
  z-index: 40;
  background: rgba(42, 38, 34, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.qr-sheet[hidden] { display: none; }
.qr-card {
  width: 100%;
  max-width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: 0 12px 40px rgba(42, 38, 34, .18);
}
.qr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.qr-head h2 { margin: 0; font-size: 16px; color: var(--ink); }
.qr-hint { margin: 0 0 12px; font-size: 13px; color: var(--ink-faint); }
/* 码按实际像素比缩放：430 → 220 是 1.95 倍，扫码器仍能取到足够的模块数；
   再小（<180px）在低端机摄像头下开始识别困难。 */
.qr-img {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}
.qr-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(42, 38, 34, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px 18px;
  box-shadow: 0 12px 40px rgba(42, 38, 34, .18);
}
.gate-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--ink);
}
.gate-lede {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--ink-soft);
}
.gate-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 16px;
}
.gate-check input { margin-top: 3px; flex: 0 0 auto; }
.gate-check a { color: var(--brand-ink); }
.gate-btn { width: 100%; padding: 10px 0; }
.gate-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

/* ── 多源：顶栏 pill 与「要问谁」sheet（docs/23 §8 第三批） ──────
 * 两条纪律：
 *   1. 一旦给 .source-pill / .source-sheet 设了 display，UA 的
 *      `[hidden] { display: none }` 就会被作者样式覆盖。必须显式补
 *      `[hidden]` 规则，否则单源时 pill 会一直挂在顶栏上且点不动，
 *      sheet 更会整屏遮住页面。同文件 .gate / .citations 已有先例。
 *   2. pill 上的名字、sheet 里的选项、空态示例问题全部来自 /v1/sources；
 *      样式只负责排布，不提供任何兜底人名。
 */
/* 源 pill 独占一行（见 index.html 的同处注释）：单源时整行 hidden，
   多源时只有它自己占宽，长名字用 ellipsis 截断，不挤压顶栏三要素。 */
.source-row {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 6px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.source-row[hidden] { display: none; }

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  color: var(--brand-ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.source-pill[hidden] { display: none; }
.source-pill:hover { border-color: var(--brand); }
.source-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.source-pill-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-dot {
  flex: 0 0 auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.source-caret { flex: 0 0 auto; color: var(--ink-faint); font-size: 11px; }

/* 空态里「正在问：谁」。.empty-sub 自带 18px 下边距，这里收一点，
   让这行看起来像标题的从属信息，而不是第三段独立文案。 */
.empty-source {
  margin: -8px 0 18px;
  font-size: 13px;
  color: var(--brand-ink);
}

/* 多源时「正在问」行同时是切源入口：给手型与 hover 反馈，
   「切换 ›」后缀用淡色，是提示不是主文案。 */
.empty-source-link {
  cursor: pointer;
}
.empty-source-link:hover { color: var(--brand); }
.empty-source-hint {
  color: var(--ink-faint);
  font-size: 12px;
}

/* 「也可以问 另一位 ›」。位置紧贴「正在问」行下方（那一行有 -8px 的上边距，
   这里再收一点，两行读起来是同一组信息而不是两个段落）。 */
.empty-other {
  margin: -12px 0 18px;
  font-size: 13px;
  color: var(--ink-faint);
  cursor: pointer;
  /* 命中区：文字小，行高给足，避免手机上点不准 */
  padding: 4px 0;
}
.empty-other:hover { color: var(--brand); }

.source-sheet {
  position: fixed;
  inset: 0;
  /* 高于历史抽屉(20)/引用侧栏(30)，低于同意门(50)：同意未给出时
     不该出现任何与切源有关的交互。 */
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.source-sheet[hidden] { display: none; }
.source-sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(42, 38, 34, .38);
}
.source-sheet-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 18px 16px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(42, 38, 34, .18);
}
.source-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.source-sheet-head h2 { margin: 0; font-size: 17px; color: var(--ink); }
.source-sheet-hint { margin: 0 0 14px; font-size: 13px; color: var(--ink-faint); }
.source-sheet-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.source-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;              /* 触控区下限，与 .empty-chip 同规 */
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.source-option:hover { border-color: var(--brand); }
.source-option.active {
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-color: var(--brand);
}
.source-option:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.source-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-option-tick { flex: 0 0 auto; color: var(--brand); }

@media (max-width: 480px) {
  /* 手机上从底部升起，够得着；顶栏给 pill 让出空间。 */
  .brand-sub { display: none; }
  .source-pill { max-width: 42vw; }
  .source-sheet { align-items: flex-end; padding: 0; }
  .source-sheet-card {
    max-width: none;
    max-height: 72vh;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
