:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f8;
  --bg-elev: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-soft: #4b5563;
  --text-mute: #9ca3af;
  --text-muted: #6b7280;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --primary-grad: linear-gradient(90deg, #4f46e5 0%, #ec4899 50%, #f59e0b 100%);
  --user-bubble: #eef2ff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--text-soft); text-decoration: none; }
a:hover { color: var(--primary); }
.hidden { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary-grad);
}
.brand-name { font-weight: 600; letter-spacing: 0.2px; }
.brand-divider {
  width: 1px; height: 16px; background: var(--border-strong);
}
.brand-sub { color: var(--text-mute); font-size: 13px; }
.topnav { display: flex; gap: 10px; font-size: 13px; align-items: center; }
.topnav-divider { width: 1px; height: 16px; background: var(--border-strong); margin: 0 2px; }
.topnav-music-btn,
.topnav-radio-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-mute);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.topnav-music-btn:hover,
.topnav-radio-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.topnav-music-btn[aria-pressed="true"],
.topnav-radio-btn[aria-pressed="true"] {
  color: var(--primary); border-color: var(--primary); background: var(--primary-soft);
}

/* ---------- toppanel (dropdown) ---------- */
.toppanel {
  position: fixed; top: 53px; z-index: 200;
  display: flex; justify-content: flex-end;
  width: 100%; max-width: 880px;
  left: 50%; transform: translateX(-50%);
  pointer-events: none;
}
.toppanel[hidden] { display: none; }
.toppanel-inner {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  pointer-events: all;
  animation: toppanelIn .18s ease-out;
  position: relative;
  z-index: 1;
}
.toppanel::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.06);
  z-index: 0;
}
@keyframes toppanelIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 紧凑 2 行布局 */
.toppanel-compact {
  padding: 8px 10px 6px;
  min-width: 360px;
  max-width: 560px;
  width: 94vw;
}
.toppanel-compact-cols {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.toppanel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.toppanel-row-1 { flex-wrap: nowrap; }
.toppanel-row-2 { flex-wrap: nowrap; }

.toppanel-close-mini {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border: 1px solid var(--border); border-radius: 4px;
  background: transparent; color: var(--text-mute); cursor: pointer;
  flex-shrink: 0; transition: background .12s, color .12s;
}
.toppanel-close-mini:hover { background: var(--bg-soft); color: var(--text); }

.music-play-btn-m {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.radio-play-btn-m { background: var(--primary-soft); color: var(--primary); }

.toppanel-select {
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
  font-size: 12px; padding: 3px 6px; cursor: pointer; flex-shrink: 0;
  max-width: 110px;
}
.toppanel-track-name { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

.toppanel-time { font-size: 11px; color: var(--text-mute); white-space: nowrap; flex-shrink: 0; font-family: var(--mono); }
.toppanel-progress { flex: 1; min-width: 40px; height: 3px; accent-color: var(--primary); cursor: pointer; }
.toppanel-vol-icon { font-size: 12px; flex-shrink: 0; }
.toppanel-vol { width: 52px; height: 3px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.toppanel-persist-link {
  flex-shrink: 0;
  height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.toppanel-persist-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.toppanel-radio-title { font-size: 12px; color: var(--text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toppanel-icon-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: 26px; height: 24px; padding: 0 4px; border-radius: 4px;
  background: transparent; border: 1px solid var(--border); color: var(--text-mute);
  cursor: pointer; font-size: 12px; flex-shrink: 0;
  transition: background .12s, color .12s; text-decoration: none;
}
.toppanel-icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.toppanel-meta { font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

/* 手机 */

/* dots-anim for active thinking steps */
.dots-anim { display: inline-block; min-width: 20px; }

/* knowledge-article cards inline in thinking stream */
.knowledge-article-inline {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 0;
  border-left: 2px solid var(--border, #e5e7eb);
  margin: 2px 0 2px 10px;
  font-size: 12px;
  color: var(--text-mute);
}
.knowledge-article-inline .kb-badge {
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 0 4px;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 16px;
}
.knowledge-article-inline .kb-title {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
}
.knowledge-article-inline .kb-authors {
  font-size: 11px;
  color: var(--text-mute);
}


/* v7.4: thinking steps - transparent, two-side aligned (no background chrome) */
.think-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  padding: 2px 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  border-left: 0;
  line-height: 1.5;
  color: var(--text-soft);
}
.think-step .step-icon { flex-shrink: 0; font-size: 15px; line-height: 1.5; margin-top: 1px; }
.think-step .step-text { color: var(--text-soft); font-size: 13px; font-weight: 500; line-height: 1.5; }
.think-step.tool-call {
  background: transparent;
  border-left: 0;
  color: var(--text-soft);
}
.think-step.tool-call .step-icon { color: #16a34a; }
.think-step.tool-call .step-text { color: #14532d; }
.think-step.tool-call .step-result { color: #15803d; font-size: 12px; margin-left: 4px; font-weight: 600; }
.think-step.active { background: transparent; border-left: 0; }
.think-step.active .step-icon { color: var(--text-mute); }
.think-step.done { background: transparent; border-left: 0; opacity: 1; }
.think-step.done .step-icon { color: var(--text-mute); }

/* dots-anim for active thinking steps */
.dots-anim { display: inline-block; min-width: 24px; color: #1e40af; font-weight: 600; }

/* knowledge-article cards inline in thinking stream */
.knowledge-article-inline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 0;
  background: transparent;
  border-left: 0;
  border-radius: 0;
  margin: 2px 0 2px 12px;
  border-left: 2px solid #a855f7;
  font-size: 13px;
  color: #6b7280;
  background: #faf5ff;
  border-radius: 4px;
}
.knowledge-article-inline .kb-badge {
  background: #a855f7;
  color: white;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 18px;
}
.knowledge-article-inline .kb-title { color: #1e293b; font-size: 13px; line-height: 1.4; }
.knowledge-article-inline .kb-authors { font-size: 11px; color: #64748b; margin-top: 2px; }


/* v7.0: thinking steps - visible, colorful PRISMA-style */
.think-step { display:flex; align-items:flex-start; gap:8px; font-size:14px; padding:2px 0; margin:0; border-radius:0; background:transparent; border-left:0; line-height:1.5; color:var(--text-soft); }
.think-step .step-icon { flex-shrink:0; font-size:15px; line-height:1.6; }
.think-step .step-text { color:var(--text-soft); font-size:13px; font-weight:500; }
.think-step.tool-call { background:transparent; border-left:0; color:var(--text-soft); }
.think-step.tool-call .step-icon { color:#16a34a; }
.think-step.tool-call .step-text { color:#14532d; }
.think-step.tool-call .step-result { color:#15803d; font-size:12px; margin-left:4px; font-weight:600; }
.think-step.active { background:transparent; border-left:0; }
.think-step.active .step-icon { color:#ca8a04; }
.think-step.done { background:transparent; border-left:0; }
.think-step.done .step-icon { color:#16a34a; }
.dots-anim { display:inline-block; min-width:24px; color:#1d4ed8; font-weight:700; }
.knowledge-article-inline { display:flex; align-items:flex-start; gap:8px; padding:2px 0; border-left:0; background:transparent; border-radius:0; font-size:12px; margin:0; }
.knowledge-article-inline .kb-badge { background:#a855f7; color:white; font-size:10px; padding:1px 6px; border-radius:3px; flex-shrink:0; line-height:18px; }
.knowledge-article-inline .kb-title { color:#1e293b; font-size:12px; line-height:1.4; }
.knowledge-article-inline .kb-authors { font-size:11px; color:#64748b; }

@media (max-width: 600px) {
  .toppanel { top: 45px; justify-content: flex-start; padding: 0 10px; }
  .toppanel-compact { min-width: unset; width: 100%; padding: 8px; }
  .toppanel-select { max-width: 90px; font-size: 11px; }
  .toppanel-track-name { font-size: 11px; }
  .toppanel-progress { min-width: 30px; }
  .toppanel-vol { width: 40px; }
  .toppanel-meta { font-size: 10px; }
  .toppanel::before { background: rgba(0,0,0,0.04); }
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- main ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ---------- welcome ---------- */
.welcome {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: center;
  padding: 28px 0 40px;
}
.title {
  font-size: clamp(30px, 5.4vw, 50px);
  line-height: 1.18;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.title-grad {
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  color: var(--text-mute);
  font-size: 14px;
  margin: 0 0 24px;
}

.hero-stats {
  margin: 0 auto 22px;
  max-width: 640px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
.hero-stats .stat {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  border-right: 1px solid var(--border);
}
.hero-stats .stat:last-child { border-right: 0; }
.hero-stats .stat strong {
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
}
.hero-stats .stat span {
  color: var(--text-muted);
  font-size: 11px;
}

.capabilities-row {
  margin: 0 0 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cap {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: left;
  transition: border-color .15s, background-color .15s;
}
.cap:hover { border-color: var(--primary); background: var(--primary-soft); }
.cap h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.cap p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.55;
}

/* ---------- composer ---------- */
.composer {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 12px 10px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s;
}
.composer:focus-within {
  border-color: var(--primary);
}
/* 输入区：textarea + 右侧语音/发送 */
.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.composer textarea {
  flex: 1;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  padding: 6px 4px;
  max-height: 220px;
  font-family: inherit;
}
.composer textarea::placeholder { color: var(--text-mute); }

.composer-right-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.voice-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.voice-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.send-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.send-btn:hover { background: #4338ca; }
.send-btn:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
}
.clear-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}
.clear-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* 工具栏：附件 + 分隔 + 快捷chips */
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.toolbar-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}
.composer-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-mute);
  background: transparent;
  border: 1px solid var(--border);
  transition: all 0.15s;
  white-space: nowrap;
}
.composer-upload-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}
.quick-chip {
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  transition: all 0.15s;
}
.quick-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.quick-chip[data-discussion] {
  position: relative;
  cursor: help;
}
.quick-chip-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.5;
  white-space: normal;
  width: 260px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
}
.quick-chip-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}
.quick-chip:hover .quick-chip-tooltip {
  display: block;
}
.disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
}

/* ---------- mode toggle ---------- */
.mode-toggle {
  display: flex;
  gap: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  margin: 0 auto 22px;
  width: fit-content;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
  background: transparent;
  white-space: nowrap;
}
.mode-btn.active {
  background: var(--bg-elev);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.mode-btn:hover:not(.active) {
  color: var(--text-soft);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

/* ---------- qa / synthesis panels ---------- */
#qaPanel, #synthesisPanel { width: 100%; }

/* ---------- synthesis ---------- */
.synth-intro {
  margin-bottom: 20px;
  text-align: left;
}
.synth-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.synth-desc {
  margin: 8px 0 0;
  color: var(--text-mute);
  font-size: 13px;
}
.composer-synth { padding: 14px 14px 10px; }
.composer-synth textarea { min-height: 36px; max-height: 80px; }
.composer-synth-row { width: 100%; display: flex; align-items: flex-end; gap: 8px; }
.composer-synth-row textarea { flex: 1 1 auto; width: 100%; }
.composer-toolbar-synth { width: 100%; padding: 8px 4px 0; gap: 8px; flex-wrap: wrap; }
.composer-toolbar-synth .quick-chips-synth { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-toolbar-synth .quick-chip { padding: 6px 12px; font-size: 12px; border-radius: 999px; background: #eef2ff; color: #1e3a8a; border: 1px solid #c7d2fe; cursor: pointer; transition: all .15s; }
.composer-toolbar-synth .quick-chip:hover { background: #c7d2fe; color: #1e3a8a; }
#synthesisPanel .composer-synth { max-width: 100%; }

.synth-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.depth-selector, .lang-selector, .func-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}
.depth-label {
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
}
.depth-btns {
  display: flex;
  gap: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.depth-btn {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mute);
  background: transparent;
}
.depth-btn.active {
  background: var(--bg-elev);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.depth-btn:hover:not(.active) { color: var(--text-soft); }

.synth-submit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.synth-submit:hover { background: #4338ca; }
.synth-submit:disabled { background: var(--border-strong); cursor: not-allowed; }

/* ---------- synth-intro wrapper & + button ---------- */
.synth-intro-wrapper {
  position: relative;
  margin-bottom: 20px;
  text-align: left;
}

/* Make synth-intro inline with + button */
.synth-intro {
  margin-bottom: 0;
  display: inline-block;
  vertical-align: top;
}

/* + Button */
.synth-plus-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text-mute);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
  padding: 0;
}
.synth-plus-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: rotate(90deg);
}
.synth-plus-btn svg {
  flex-shrink: 0;
}

/* Popup menu */
.synth-plus-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  padding: 6px;
  min-width: 160px;
  animation: synthPopupIn 0.18s ease-out;
}
@keyframes synthPopupIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.synth-plus-popup[hidden] { display: none; }

.synth-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.synth-popup-item:hover {
  background: var(--bg-soft);
}
.synth-popup-item:active {
  background: var(--primary-soft);
}
.synth-popup-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.synth-popup-label {
  font-weight: 500;
}

/* ---------- synth mode panels ---------- */
.synth-mode-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  animation: synthPanelIn 0.2s ease-out;
}
@keyframes synthPanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.synth-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.synth-mode-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.synth-mode-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.synth-mode-close:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}
.synth-mode-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-mute);
}

/* Upload button */
.synth-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}
.synth-upload-summary {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.synth-upload-summary:hover {
  background: #dcfce7;
  border-color: #4ade80;
}
.synth-upload-disc {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}
.synth-upload-disc:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}
.synth-upload-polish {
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  color: #7c3aed;
}
.synth-upload-polish:hover {
  background: #f3e8ff;
  border-color: #c084fc;
}

/* File status */
.synth-file-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 12px;
}
#synthSummaryStatus {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
#synthDiscStatus {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}
#synthPolishStatus {
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  color: #7c3aed;
}
.synth-file-remove {
  padding: 2px 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.synth-file-remove:hover { opacity: 1; }

/* Polish presets */
.synth-polish-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.polish-preset-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.polish-preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.polish-preset-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* Mode panel textarea */
.synth-mode-panel textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}
.synth-mode-panel textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Responsive */
@media (max-width: 640px) {
  .synth-intro-wrapper { margin-bottom: 16px; }
  .synth-plus-btn { margin-left: 4px; }
  .synth-plus-popup {
    left: -8px;
    min-width: 140px;
  }
  .synth-mode-panel { padding: 14px; }
}



/* Synth inline view (replaces separate panels) */
.synth-view-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-mute);
  padding: 0 2px;
}
.synth-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
/* ---------- synthesis output ---------- */
.synth-output {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 28px;
}
.synth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  flex-wrap: wrap;
  gap: 8px;
}
.synth-badge-row { display: flex; align-items: center; gap: 10px; }
.synth-meta-info {
  font-size: 12px;
  color: var(--text-mute);
}
.synth-actions { display: flex; gap: 6px; }
.synth-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-elev);
}
.synth-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.download-btn:hover { color: var(--primary); }
.new-synth-btn:hover { color: var(--text-soft); }

.synth-article {
  padding: 20px 24px 28px;
  font-size: 15px;
  line-height: 1.75;
}
.synth-article h2:first-child { margin-top: 0; }

/* ---------- voice / upload ---------- */
.voice-btn.recording {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

.upload-zone {
  width: 100%;
  padding: 20px;
  margin-bottom: 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  background: var(--bg-soft);
}
.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.upload-zone-mini {
  padding: 10px 16px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.7;
}
.upload-icon-sm { font-size: 18px; }
.upload-text {
  font-size: 14px;
  color: var(--text-soft);
  margin: 0 0 4px;
}
.upload-text-sm {
  font-size: 13px;
  color: var(--text-muted);
}
.upload-link {
  color: var(--primary);
  text-decoration: underline;
}
.upload-hint {
  font-size: 12px;
  color: var(--text-mute);
  margin: 0;
}

.uploaded-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.uploaded-files-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}
.uploaded-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.uploaded-file-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.uploaded-file-item.ready {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.uploaded-file-item.error {
  border-color: #ef4444;
  background: #fef2f2;
}

.file-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.file-name {
  font-weight: 500;
  color: var(--text);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size {
  font-size: 11px;
  color: var(--text-mute);
}

.upload-progress {
  flex: 1;
  min-width: 60px;
  max-width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  width: 0;
  transition: width 0.15s ease;
}
.upload-status {
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
}
.upload-status.ready { color: #10b981; }
.upload-status.error { color: #ef4444; }

.file-remove {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-mute);
  font-size: 16px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-remove:hover {
  background: var(--border);
  color: var(--text);
}

.upload-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- conversation ---------- */
.conversation {
  padding-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: msgIn 0.25s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
  background: var(--user-bubble);
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  max-width: 80%;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.avatar-mini {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.4px;
}
.msg-body { flex: 1; min-width: 0; }

.thinking-stream {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  padding: 14px 16px;
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.thinking-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-mute);
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  transition: background 0.2s ease;
}
.thinking-step.active {
  background: rgba(59, 130, 246, 0.06);
}
.thinking-step.done .label { color: #94a3b8; }
.thinking-step .spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
  position: relative;
}
.thinking-step.done .spinner {
  border: 0;
  background: transparent;
  width: 14px; height: 14px;
  border-radius: 50%;
  position: relative;
}
.thinking-step.done .spinner::before {
  content: '✓';
  position: absolute;
  inset: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.thinking-step .label { font-weight: 500; color: var(--text-soft); letter-spacing: 0.1px; }
/* v6.2: step-text is what submitSynthSummary2 creates; mirror .label styles */
.thinking-step .step-text { font-weight: 500; color: var(--text-soft); letter-spacing: 0.1px; }
.thinking-step.done .step-text { color: #94a3b8; }
.thinking-step .step-detail { color: var(--text-mute); font-size: 11px; }

.thinking-step .detail { color: var(--text-mute); font-size: 12px; }
.thinking-placeholder {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-mute);
  font-size: 13px;
  padding: 4px 0;
}
.thinking-placeholder .spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.thinking-placeholder .ph-text { color: var(--text-soft); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.answer-stream {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.answer-stream h1, .answer-stream h2, .answer-stream h3 {
  margin: 18px 0 8px;
  font-weight: 600;
  line-height: 1.3;
}
.answer-stream h1 { font-size: 20px; }
.answer-stream h2 { font-size: 17px; }
.answer-stream h3 { font-size: 15px; color: var(--text-soft); }
.answer-stream p { margin: 0 0 12px; }
.answer-stream ul, .answer-stream ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.answer-stream li { margin: 4px 0; }
.answer-stream code {
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
}
.answer-stream pre {
  background: var(--bg-soft);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  margin: 0 0 12px;
}
.answer-stream blockquote {
  border-left: 3px solid var(--primary);
  margin: 8px 0;
  padding: 4px 12px;
  background: var(--primary-soft);
  color: var(--text-soft);
  border-radius: 0 6px 6px 0;
}
.answer-stream table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
  font-size: 13px;
}
.answer-stream th, .answer-stream td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.answer-stream th { background: var(--bg-soft); font-weight: 600; }
.answer-stream a {
  color: var(--primary);
  text-decoration: underline;
}
.cursor-blink::after {
  content: "▍";
  color: var(--primary);
  animation: blink 1s steps(2) infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.followup-chip {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
}
.followup-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.sources {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-mute);
}
.sources-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-soft);
}
.sources ul { padding-left: 18px; margin: 0; }
.sources li { margin: 3px 0; line-height: 1.5; }
.sources a { color: var(--text-soft); }
.sources a:hover { color: var(--primary); }

.meta-line {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-mute);
}

.bottom-composer {
  position: sticky;
  bottom: 0;
  padding: 12px 0 18px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.composer-mini {
  padding: 10px 14px;
  border-radius: 22px;
}

.error-banner {
  background: color-mix(in srgb, #ef4444 12%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}

/* ---------- feature strip (capability strip on welcome) ---------- */
.feature-strip {
  margin: 22px auto 0;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.strip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.strip-tag {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}
.strip-row p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}


/* ---------- contact ---------- */
.contact-details {
  max-width: 760px;
  margin: 24px auto 0;
}
.contact-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-mute);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color .15s;
}
.contact-summary:hover { color: var(--text); }
.contact-summary::-webkit-details-marker { display: none; }
.contact-summary::marker { display: none; }
.contact-details[open] .contact-summary { color: var(--text); }
.contact-details[open] .contact-summary svg { transform: rotate(180deg); }
.contact-summary svg { transition: transform .2s; flex-shrink: 0; }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 10px;
}
.contact-grid > div {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.contact-grid h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.contact-grid p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.7;
}
.contact-grid .contact-meta {
  margin-top: 10px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
}

/* ---------- footer ---------- */
.site-foot {
  padding: 14px 24px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.foot-shell {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-mute);
  font-size: 11px;
}
.foot-shell a { color: var(--text-mute); }
.foot-shell a:hover { color: var(--primary); }
.foot-spacer { flex: 1; }

@media (max-width: 720px) {
  .capabilities-row { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  main { padding: 0 14px 40px; }
  .topbar { padding: 10px 16px; }
  .topnav { gap: 10px; font-size: 12px; }
  .brand-sub { display: none; }
  .composer textarea { font-size: 15px; }
  .msg-user .bubble { max-width: 90%; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; }
  .capabilities-row { grid-template-columns: 1fr; }
  .synth-controls { flex-direction: column; align-items: stretch; }
  .synth-submit { margin-left: 0; }
  .strip-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .foot-spacer { display: none; }
}

/* ---------- cite / pubmed blocks ---------- */
.cite-link { color: #2563eb; text-decoration: none; font-weight: 500; cursor: pointer; }
.cite-link:hover { color: #1d4ed8; text-decoration: underline; }

.query-blocks-container { margin: 8px 0 4px 28px; display: flex; flex-direction: column; gap: 6px; }
.query-blocks-header {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.qbh-icon::before { content: 'F50D'; margin-right: 4px; }
.qbh-syntax-doc { color: var(--primary); text-decoration: none; font-size: 12px; }
.qbh-syntax-doc:hover { text-decoration: underline; }

.query-block {
  background: var(--surface-2, #f9fafb);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
  transition: border-color 0.18s;
}
.query-block:hover { border-color: var(--primary); }
.query-block.running { border-color: var(--primary); }
.query-block.done { border-color: #10b981; }
.query-block.done .qb-round { color: #10b981; }

.qb-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}
.qb-round {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  color: var(--primary);
  font-size: 12px;
  min-width: 56px;
}
.qb-count { color: var(--text-mute); font-size: 12px; flex: 1; }
.qb-count b { color: #1f2937; font-weight: 600; }
.qb-toggle { font-size: 12px; color: var(--primary); font-weight: 500; }

.qb-query {
  background: #1f2937;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 14px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: none;
}
.query-block.expanded .qb-query { display: block; }

.qb-pmids {
  padding: 8px 12px;
  max-height: 160px;
  overflow-y: auto;
}
.qb-pmid-list { display: flex; flex-wrap: wrap; gap: 6px; }
.qb-pmid-chip {
  display: inline-block;
  background: #eef2ff;
  color: #1d4ed8;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  text-decoration: none;
}
.qb-pmid-chip:hover { background: #ddd6fe; }

/* ============================================================
 * 通用 section 头
 * ============================================================ */
.section-head {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.section-head h2 {
  margin: 8px 0 4px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}
.section-head p {
  margin: 0;
  color: var(--text-mute);
  font-size: 13px;
}
.section-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}
.section-pill-dot {
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: tour-blink 1.4s ease-in-out infinite;
}
@keyframes tour-blink { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* music / radio sections removed – now in toppanel */

/* ============================================================
 * 背景音乐 · 与主站一致的卡片
 * ============================================================ */
.music-player {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.music-play-btn {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.music-play-btn:hover { background: #4338ca; }
.music-info { flex: 1; min-width: 0; }
.music-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.music-track-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.music-persist-link {
  color: var(--primary);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
}
.music-persist-link:hover { background: var(--primary-soft); }
.music-track-select {
  width: 100%;
  margin: 6px 0 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
}
.music-progress {
  width: 100%;
  margin: 8px 0 4px;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.music-progress::-webkit-slider-thumb {
  appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}
.music-progress::-moz-range-thumb {
  width: 12px; height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}
.music-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  text-align: right;
}
.music-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.music-mini-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.music-mini-btn:hover { color: var(--primary); border-color: var(--primary); }
.music-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--text-mute);
  font-size: 12px;
}
.music-volume input[type=range] {
  appearance: none;
  width: 110px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.music-volume input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}
.music-volume input[type=range]::-moz-range-thumb {
  width: 10px; height: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}
.music-status {
  margin: 6px 0 0;
  color: var(--text-mute);
  font-size: 11px;
}

/* ============================================================
 * AI 电台 · 与主站一致的卡片
 * ============================================================ */
.radio-widget {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.radio-play-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.radio-play-btn:hover { background: #4338ca; }
.radio-info { min-width: 0; }
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--primary);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.radio-dot {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: tour-blink 1.4s ease-in-out infinite;
}
.radio-title-row {
  margin-top: 4px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.radio-title {
  flex: 1;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.radio-loading { color: var(--text-mute); font-weight: 400; }
.radio-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.radio-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.radio-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.radio-btn:disabled { opacity: .5; cursor: not-allowed; }
.radio-meta {
  margin-top: 4px;
  color: var(--text-mute);
  font-size: 11px;
  font-family: var(--mono);
}
.radio-script-wrap {
  grid-column: 2;
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s;
}
.radio-script-wrap[data-show="true"] {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.radio-script-text {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.radio-progress-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 3px;
  background: transparent;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.radio-progress-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width .25s linear;
}
.radio-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.radio-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--primary);
  background: var(--bg);
  font-size: 12px;
  text-decoration: none;
}
.radio-secondary-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.radio-secondary-tip {
  font-size: 11px;
  color: var(--text-mute);
}

/* radio upload modal */
.radio-modal {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: 480px;
  width: 92%;
}
.radio-modal::backdrop { background: rgba(15,23,42,.45); }
.radio-upload-form {
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.radio-upload-form h3 { margin: 0; font-size: 16px; color: var(--text); }
.radio-upload-form p { margin: 0; color: var(--text-mute); font-size: 13px; line-height: 1.6; }
.radio-upload-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 18px 14px;
  text-align: center;
  background: var(--bg-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 13px;
}
.radio-upload-drop.dragging { border-color: var(--primary); background: var(--primary-soft); }
.radio-upload-drop-icon { font-size: 26px; }
.radio-upload-filename { font-size: 12px; color: var(--primary); }
.radio-upload-progress { font-size: 12px; color: var(--text-mute); }
.radio-upload-progress-label { margin: 0 0 4px; }
.radio-upload-bar { background: var(--border); border-radius: 999px; height: 4px; overflow: hidden; }
.radio-upload-bar > div {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  width: 0;
  transition: width .25s;
}
.radio-upload-error { color: #b91c1c; font-size: 12px; }
.radio-upload-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.ghost-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }

/* radio interpret dialog */
.radio-interpret-dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: 720px;
  width: 92%;
  background: var(--bg);
}
.radio-interpret-dialog::backdrop { background: rgba(15,23,42,.45); }
.radio-interpret-shell { display: flex; flex-direction: column; }
.radio-interpret-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.radio-interpret-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
}
.radio-interpret-title { margin: 4px 0 4px; font-size: 18px; font-weight: 700; color: var(--text); }
.radio-interpret-subtitle { color: var(--text-mute); font-size: 12px; font-family: var(--mono); }
.radio-interpret-close {
  width: 28px; height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-mute);
  font-size: 14px;
  cursor: pointer;
}
.radio-interpret-close:hover { color: var(--text); border-color: var(--text-soft); }
.radio-interpret-body {
  padding: 18px 22px 22px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  max-height: 60vh;
  overflow-y: auto;
}
.ri-meta {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.ri-meta-item b { color: var(--text-mute); font-weight: 600; margin-right: 6px; }
.ri-text { margin: 0 0 12px; white-space: pre-wrap; }
.ri-authors { color: var(--text-soft); font-size: 12px; margin-bottom: 12px; }
.ri-authors b { color: var(--text-mute); margin-right: 6px; }
.ri-footer { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
 * 寻宝地图抽屉
 * ============================================================ */
.open-treasure-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.open-treasure-pill:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }

.treasure-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 90;
}
.treasure-backdrop[hidden] { display: none !important; }
.treasure-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(960px, 100%);
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(15,23,42,.18);
  animation: treasure-slide .22s ease-out;
}
.treasure-panel[hidden] { display: none !important; }
@keyframes treasure-slide { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.treasure-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.treasure-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
}
.treasure-panel-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text);
}
.treasure-panel-icon {
  font-size: 22px;
  line-height: 1;
}
.treasure-panel-title strong { font-size: 17px; }
.treasure-panel-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-mute);
  font-size: 12px;
}
.treasure-close-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-mute);
  font-size: 14px;
  cursor: pointer;
}
.treasure-close-btn:hover { color: var(--text); border-color: var(--text-soft); }

.treasure-grid {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 24px;
}
.treasure-group + .treasure-group { margin-top: 22px; }
.treasure-group-head {
  margin: 0 0 10px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.treasure-group-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.treasure-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, border-color .15s, background-color .15s;
}
.treasure-item:hover {
  transform: translateY(-1px);
  border-color: var(--ti-color, var(--primary));
  background: var(--ti-bg, var(--primary-soft));
}
.ti-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 18px;
  background: var(--ti-bg, var(--primary-soft));
  color: var(--ti-color, var(--primary));
}
.ti-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ti-text strong { font-size: 13px; color: var(--text); }
.ti-text small { color: var(--text-mute); font-size: 11px; }
.treasure-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}
.treasure-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 11px;
}
.treasure-panel-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* ============================================================
 * 巡游 box
 * ============================================================ */
#prime-tour-overlay[hidden],
#prime-tour-box[hidden] { display: none !important; }

@media (max-width: 720px) {
  .capabilities-row { grid-template-columns: repeat(2, 1fr); }
  .music-player { flex-direction: column; align-items: stretch; }
  .music-play-btn { align-self: flex-start; }
  .radio-widget { grid-template-columns: 48px 1fr; }
  .radio-play-btn { width: 48px; height: 48px; }
  .treasure-group-grid { grid-template-columns: repeat(2, 1fr); }
  .topnav .open-treasure-pill span:last-child,
  .brand-sub { display: none; }
}

@media (max-width: 640px) {
  main { padding: 0 14px 40px; }
  .topbar { padding: 10px 16px; }
  .topnav { gap: 8px; font-size: 12px; }
  .topnav-divider { height: 12px; }
  .toppanel { top: 45px; justify-content: flex-start; padding: 0 12px; }
  .toppanel-compact { min-width: unset; width: 100%; max-width: 100%; gap: 6px; padding: 8px; }
  .toppanel::before { background: rgba(0,0,0,0.04); }
  .contact-grid { grid-template-columns: 1fr; }
  .composer textarea { font-size: 15px; }
  .msg-user .bubble { max-width: 90%; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; }
  .capabilities-row { grid-template-columns: 1fr; }
  .synth-controls { flex-direction: column; align-items: stretch; }
  .synth-submit { margin-left: 0; }
  .strip-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .foot-spacer { display: none; }
  .treasure-group-grid { grid-template-columns: 1fr 1fr; }
  .treasure-panel { width: 100%; }
  .music-controls-row { flex-wrap: wrap; }
  .music-volume input[type=range] { width: 80px; }
  .radio-controls { width: 100%; }
}
/* ===== 图标横排样式 ===== */
.synth-intro-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.synth-icon-row {
  display: flex;
  gap: 8px;
}

.synth-icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  color: var(--text);
}

.synth-icon-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.synth-icon-emoji {
  font-size: 14px;
}

.synth-icon-label {
  font-weight: 500;
}


.quick-mode-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.2s;
}

.quick-mode-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.quick-mode-btn span {
  font-size: 14px;
}

/* ===== 论文助手浮层 ===== */
.synth-modal-overlay[hidden] { display: none; }
.synth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: synthOverlayIn 0.2s ease-out;
}
@keyframes synthOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.synth-modal-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  animation: synthBoxIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes synthBoxIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.synth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.synth-modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.synth-modal-icon {
  font-size: 20px;
}
.synth-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.synth-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}
.synth-modal-close:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}
.synth-modal-body {
  padding: 20px 18px;
}
.synth-panel {
  display: none;
}
.synth-panel.active {
  display: block;
}
.synth-panel-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.5;
}
.voice-btn-sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
}
.synth-panel .composer-input-row { width: 100%; box-sizing: border-box; flex-wrap: nowrap; }
.synth-panel .composer-input-row textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 64px;
  max-height: 160px;
  resize: vertical;
  padding: 8px 10px;
  background: var(--bg-soft, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.synth-panel .composer-input-row textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: #2563eb;
  background: #fff;
}
.synth-panel .composer-right-btns { padding-bottom: 0; align-items: flex-end; }
.synth-panel .synth-submit {
  padding: 8px 16px;
  height: auto;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}
.synth-submit-green {
  background: #16a34a;
  color: #fff;
}
.synth-submit-green:hover {
  background: #15803d;
}
.synth-submit-blue {
  background: #2563eb;
  color: #fff;
}
.synth-submit-blue:hover {
  background: #1d4ed8;
}
.synth-submit-purple {
  background: #7c3aed;
  color: #fff;
}
.synth-submit-purple:hover {
  background: #6d28d9;
}
@media (max-width: 480px) {
  .synth-modal-box { border-radius: 16px 16px 0 0; }
  .synth-modal-overlay { align-items: flex-end; padding: 0; }
  .synth-modal-box { max-width: 100%; }
}

/* === expert-clone injected 2026-07-23 === */
.expert-mode-bar {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 12px;
  padding: 0 16px;
}
.expert-mode-bar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.expert-mode-label {
  font-weight: 600;
  color: #475569;
  margin-right: 4px;
}
.expert-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: #475569;
  transition: all .15s;
}
.expert-mode-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}
.expert-mode-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.expert-mode-hint {
  margin-left: auto;
  color: #94a3b8;
  font-size: 12px;
}
.expert-history-item {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background .15s;
}
.expert-history-item:hover {
  background: #f8fafc;
}
.expert-history-q {
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
  margin-bottom: 2px;
}
.expert-history-a {
  color: #64748b;
  font-size: 11px;
}
.expert-sources-extra {
  margin-top: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #2563eb;
}
.cite-link {
  background: linear-gradient(transparent 60%, #dbeafe 60%);
  padding: 0 2px;
  border-radius: 3px;
}

/* === 2026-07-23: 回答完成样式 === */
.thinking-placeholder.done {
  color: var(--primary, #2563eb);
  font-weight: 500;
}
.thinking-placeholder.done .spinner {
  border: 0;
  background: var(--primary, #2563eb);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
  animation: none;
}
.thinking-placeholder.done .spinner::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 9px;
  font-weight: bold;
}
.thinking-placeholder.done .ph-text {
  color: var(--primary, #2563eb);
  font-weight: 500;
}

/* === 2026-07-23: composer-toolbar 模式按钮 === */
.composer-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: linear-gradient(135deg, #eff6ff, #f1f5f9);
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  color: #1e40af;
  transition: all .15s;
  font-weight: 500;
}
.composer-mode-btn:hover {
  border-color: #2563eb;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
}
.composer-mode-btn .mode-label {
  font-weight: 600;
}

.expert-mode-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  min-width: 140px;
}
.expert-mode-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  text-align: left;
}
.expert-mode-menu-item:hover {
  background: #f1f5f9;
}
.expert-mode-menu-item.active {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: #1e40af;
  font-weight: 600;
}

/* === 2026-07-23 v5: 主站 expert 的 4 阶段等待面板 CSS === */
.expert-wait-panel {
    margin: 6px 0 10px 0;
    padding: 12px 14px;
    background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.06);
}
.expert-wait-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #4338ca;
}
.expert-wait-header .brain-emoji {
    display: inline-block;
    font-size: 16px;
    animation: brainWiggle 1.6s ease-in-out infinite;
}
@keyframes brainWiggle { 0%,100%{transform:rotate(0deg);} 25%{transform:rotate(-8deg);} 75%{transform:rotate(8deg);} }
.expert-wait-elapsed {
    margin-left: auto;
    font-size: 11px;
    color: #6366f1;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.expert-wait-bar-wrap {
    width: 100%;
    height: 6px;
    background: rgba(199, 210, 254, 0.4);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.expert-wait-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    border-radius: 3px;
    transition: width 0.6s ease;
    background-size: 200% 100%;
    animation: barShimmer 2s linear infinite;
}
@keyframes barShimmer { 0%{background-position:0% 50%;} 100%{background-position:200% 50%;} }
.expert-wait-stages {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.expert-wait-stage {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    transition: color 0.3s;
}
.expert-wait-stage .stage-dot {
    width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
    background: #e5e7eb; border: 2px solid #d1d5db;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; color: #fff; font-weight: 700;
    transition: all 0.3s;
}
.expert-wait-stage.done { color: #16a34a; }
.expert-wait-stage.done .stage-dot {
    background: #16a34a; border-color: #16a34a;
}
.expert-wait-stage.done .stage-dot::after { content: '✓'; }
.expert-wait-stage.active { color: #4338ca; font-weight: 600; }
.expert-wait-stage.active .stage-dot {
    background: #fff; border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.expert-wait-stage.active .stage-dot::after {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #6366f1;
    animation: dotPulse 1s ease-in-out infinite;
}
@keyframes dotPulse { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.4);opacity:0.6;} }
.expert-wait-stage .stage-detail {
    font-size: 11px; color: #94a3b8; margin-left: 4px; font-weight: 400;
}
.expert-wait-hint {
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed #c7d2fe;
    font-size: 11px; color: #6366f1; line-height: 1.5;
}
.expert-wait-hint .hint-icon { margin-right: 3px; }

/* === 2026-07-23 v5: 禁用拖拽上传视觉提示 === */
.composer.no-drag-upload,
.composer-mini.no-drag-upload,
.composer-synth.no-drag-upload {
    cursor: default;
}
.composer.no-drag-upload.dragover,
.composer-mini.no-drag-upload.dragover,
.composer-synth.no-drag-upload.dragover {
    border-color: inherit !important;
    background: inherit !important;
}

/* v6 Phase1: Tool call visualization */
.thinking-step.tool-step-active {
  background: transparent;
  border-left: 0;
  padding-left: 0;
}
.thinking-step.tool-step-active .step-icon {
  color: #3b82f6;
}
.intent-reasoning-card {
  margin: 0 0 10px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-family: system-ui, -apple-system, sans-serif;
  animation: intentCardIn 0.3s ease-out;
}
.intent-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.intent-icon { font-size: 14px; }
.intent-title { font-size: 13px; font-weight: 600; color: #1f2937; }
.intent-conf {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  margin-left: 4px;
}
.intent-engine {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 8px;
  background: #ede9fe;
  color: #7c3aed;
  margin-left: auto;
}
.intent-latency { font-size: 11px; color: #9ca3af; margin-left: 4px; }
.intent-card-intent {
  font-size: 15px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 8px;
}
.intent-card-rationale {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  line-height: 1.5;
  padding: 0;
  background: transparent;
  border-left: 0;
  border-radius: 0;
}
.intent-card-bars { margin-bottom: 0; }
.intent-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}
.intent-bar-label {
  width: 72px;
  flex-shrink: 0;
  color: #374151;
}
.intent-bar-track {
  flex: 1;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.intent-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.intent-bar-score {
  width: 36px;
  text-align: right;
  color: #6b7280;
  flex-shrink: 0;
}

.thinking-step.synthesizing {
  background: transparent;
  border-left: 0;
  padding-left: 0;
}
.dot-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #93c5fd;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: synth-spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes intentCardIn {
  0% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes synth-spin { {
  to { transform: rotate(360deg); }
}
.dots-anim {
  display: inline-block;
  color: #22c55e;
}

.thinking-step .step-icon {
  display: inline-block;
  width: 18px;
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
}

/* v6 Phase3: Polish refs display */
.polish-refs-container { margin-top: 16px; }
.polish-refs-title {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  padding-bottom: 8px;
  border-bottom: 1px solid #fde68a;
  margin-bottom: 12px;
}
.polish-refs-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.6;
  color: #374151;
}
.polish-ref-item {
  margin-bottom: 10px;
  padding: 6px 10px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
}
.polish-ref-text {
  font-size: 12px;
  line-height: 1.5;
}
.polish-ref-link {
  color: #92400e;
  text-decoration: none;
  font-weight: 500;
}
.polish-ref-link:hover {
  text-decoration: underline;
  color: #b45309;
}
.polish-ref-meta {
  font-size: 11px;
  color: #78716c;
  margin-top: 4px;
}
