:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #d7deea;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #0891b2;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --bot: #eef2ff;
  --user: #e0f2fe;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #e8eef8 0%, var(--bg) 28%);
  color: var(--text);
}

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow);
}
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.status-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel);
}
.badge.ok { color: var(--success); border-color: rgba(34,197,94,.35); }
.badge.warn { color: var(--warn); border-color: rgba(245,158,11,.35); }
.badge.pending { color: #67e8f9; border-color: rgba(103,232,249,.35); }
.badge.loading { color: var(--muted); }

.main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px 1fr 360px;
  gap: 16px;
  padding: 16px 24px 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

.chat-panel, .detail-panel, .history-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}

.history-panel {
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
}
.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.history-top-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: none;
}
.new-chat-btn {
  flex: 1;
  max-width: 118px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  background: var(--panel-2);
}
.new-chat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #eef4ff;
}
.chat-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.chat-topbar .mode-tabs {
  flex: 1;
  padding-right: 0;
}
.new-chat-inline {
  margin: 12px 12px 0 0;
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.new-chat-inline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chat-empty-state {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 20px 48px;
  color: var(--muted);
}
.chat-empty-state.hidden { display: none !important; }
.chat-empty-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.chat-empty-sub {
  margin: 0;
  max-width: 420px;
  line-height: 1.55;
  font-size: 14px;
}
.messages.hidden { display: none !important; }
.history-search {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}
.history-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}
.history-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 12px 8px 6px;
  text-transform: none;
  letter-spacing: 0.02em;
}
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  width: 100%;
}
.history-item:hover {
  background: var(--panel-2);
}
.history-item.active {
  background: #eef4ff;
  border-color: rgba(37, 99, 235, 0.22);
}
.history-item-title {
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
}
.history-item:hover .history-item-actions,
.history-item:focus-within .history-item-actions,
.history-item.active .history-item-actions { opacity: 1; }
.history-icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 6px;
  line-height: 1;
}
.history-icon-btn:hover { background: #e2e8f0; color: var(--danger); }
.history-icon-btn.rename:hover { color: var(--accent); }
.history-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 20px 8px;
  text-align: center;
  line-height: 1.5;
}
.history-foot { margin: 0; padding-top: 4px; }
.history-toggle-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
}
.history-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 22, 0.35);
  z-index: 45;
}
.history-backdrop.hidden { display: none !important; }

.chat-panel { display: flex; flex-direction: column; height: 100%; }
.detail-panel { padding: 16px; overflow: auto; }

.mode-tabs {
  display: flex; gap: 8px; padding: 12px 12px 0; flex-wrap: wrap;
  flex-shrink: 0;
}
.mode-btn {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); padding: 8px 12px; border-radius: 999px;
  cursor: pointer; font-size: 13px;
}
.mode-btn.active {
  color: white; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.db-stats {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 8px;
  flex-shrink: 0;
}
.stat-chip {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.stat-chip.warn { color: var(--warn); border-color: rgba(245,158,11,.35); }

.gene-card {
  padding: 12px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--border); font-size: 12px; line-height: 1.55;
}
.gene-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.gene-title span { color: var(--muted); font-weight: 400; font-size: 12px; }
.gene-meta { color: var(--muted); margin-bottom: 8px; }
.gene-func { margin: 0 0 8px; }
.gene-section { margin-top: 6px; }
.gene-section pre { margin-top: 4px; font-size: 11px; }

.toolbox {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.toolbox h3 { margin: 0 0 10px; font-size: 14px; }
.tool-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tool-tab {
  font-size: 11px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); cursor: pointer;
}
.tool-tab.active { color: var(--text); border-color: var(--accent); background: rgba(59,130,246,.15); }
.tool-panel textarea, .tool-panel input[type=text], .tool-panel input[type=file] {
  width: 100%; margin-bottom: 8px; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 8px;
  user-select: text; -webkit-user-select: text;
}
#blastInput, #idBatchInput {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px; line-height: 1.45; min-height: 96px; resize: vertical;
}
#blastInput:focus, .tool-panel textarea:focus {
  outline: none; border-color: var(--accent);
}
.tool-secondary-btn {
  flex: 1; font-size: 11px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer;
}
.tool-secondary-btn:hover { border-color: var(--accent); }
.blast-actions { margin-bottom: 8px; }
.tool-hint { font-size: 11px; color: var(--muted); margin: 6px 0 0; }
.answer-sync-hint { color: #67e8f9 !important; font-weight: 500; }
.tool-row { display: flex; gap: 8px; margin-bottom: 8px; }
.tool-row input {
  flex: 1; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); padding: 8px 10px; font-size: 12px;
}
.tool-row button {
  border: none; border-radius: 8px; padding: 8px 12px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  font-size: 12px;
}
.tool-result { font-size: 11px; max-height: 280px; overflow: auto; margin-top: 8px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); }
.tool-result pre.enrich-summary { font-size: 11px; margin: 0 0 8px; white-space: pre-wrap; background: transparent; border: none; padding: 0; }
.tool-summary { margin: 0 0 8px; font-size: 12px; }
.tool-gene-summary .meta { color: var(--muted); font-size: 11px; margin: 4px 0 8px; }
.tool-gene-note { padding: 6px 8px; margin-bottom: 8px; border-radius: 6px; background: rgba(6,182,212,.1); font-size: 11px; }
.tool-json-details { margin-top: 8px; font-size: 10px; color: var(--muted); }
.tool-json-details pre { max-height: 120px; overflow: auto; font-size: 10px; margin-top: 4px; }
.tool-hint.warn { color: #fcd34d; }
.muted { color: var(--muted); font-size: 11px; }
.gene-go { font-size: 11px; line-height: 1.5; max-height: 120px; overflow: auto; }
.gene-expr-sum { font-size: 11px; color: var(--muted); margin: 4px 0 8px; }
.pub-table { width: 100%; border-collapse: collapse; font-size: 10px; margin: 6px 0; }
.pub-table th, .pub-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.pub-table th { background: var(--panel-2); position: sticky; top: 0; }
.pub-h4 { font-size: 11px; margin: 8px 0 4px; color: var(--muted); }
.export-tsv-btn {
  margin-top: 6px; font-size: 10px; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer;
}
/* 2026-10-31 用户要求：界面文字一律正体，不用斜体 */
.tool-loading { color: var(--muted); font-style: normal; }

.id-resolve-panel { margin-top: 8px; font-size: 12px; }
.id-ref-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
  background: rgba(6,182,212,.12); color: #67e8f9; font-size: 11px;
}
.id-chain {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 10px;
}
.id-chain-node {
  padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); font-size: 11px;
}
.id-chain-node strong { display: block; color: var(--muted); font-weight: 500; font-size: 10px; }
.id-chain-arrow { color: var(--muted); font-size: 14px; }
.id-canonical {
  padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); margin-bottom: 8px;
}
.id-canonical .name { font-size: 15px; font-weight: 700; }
.id-canonical .meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.id-disambig {
  padding: 8px 10px; border-radius: 8px; margin-bottom: 8px;
  background: rgba(245,158,11,.12); color: #fcd34d; font-size: 11px;
}
.id-unify-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.id-unify-orig {
  padding: 8px; border-radius: 8px;
  border: 1px dashed rgba(245,158,11,.45); background: rgba(245,158,11,.06);
}
.id-unify-std {
  padding: 8px; border-radius: 8px;
  border: 1px solid rgba(6,182,212,.35); background: rgba(6,182,212,.06);
}
.id-unify-orig label, .id-unify-std label { font-weight: 600; }
.id-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 8px; }
.id-block label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.id-block ul { margin: 0; padding-left: 16px; max-height: 100px; overflow: auto; font-size: 11px; }
.id-notes { margin: 8px 0 0; padding-left: 16px; color: var(--muted); font-size: 11px; }
.tissue-bars { display: flex; flex-direction: column; gap: 4px; max-height: 140px; overflow: auto; }
.tissue-bar-row { display: grid; grid-template-columns: 90px 1fr 36px; gap: 6px; align-items: center; font-size: 10px; }
.tissue-bar-track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.tissue-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }

.id-batch-details { margin: 8px 0; font-size: 12px; }
.id-batch-details textarea { width: 100%; margin: 6px 0; font-size: 12px; }
.id-candidates { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.id-candidates label { width: 100%; font-size: 11px; color: var(--warning, #fbbf24); }
.id-cand-btn, .gene-pick-btn {
  font-size: 11px; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer;
}
.id-cand-btn:hover, .gene-pick-btn:hover { border-color: var(--accent); }
.ext-link { color: #93c5fd; text-decoration: none; }
.ext-link:hover { text-decoration: underline; }
.gene-expr-chart { margin-top: 6px; }
.gene-expr-block { margin-bottom: 8px; }
.gene-refs { font-size: 12px; line-height: 1.5; }

.messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}

.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--panel-2); color: var(--muted); flex-shrink: 0;
}
.msg.bot .avatar { background: rgba(59,130,246,.2); color: #93c5fd; }
.msg.user .avatar { background: rgba(6,182,212,.2); color: #67e8f9; }

.bubble {
  max-width: 78%; padding: 12px 14px; border-radius: 14px;
  line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.msg.bot .bubble { background: var(--bot); border: 1px solid var(--border); }
.msg.user .bubble { background: var(--user); border: 1px solid rgba(59,130,246,.35); }

/* ===== Markdown 渲染（AI 回答气泡） ===== */
.bubble.md-body { white-space: normal; }
.bubble.md-body .md-h1, .bubble.md-body .md-h2,
.bubble.md-body .md-h3, .bubble.md-body .md-h4 {
  margin: 10px 0 6px; font-weight: 700; line-height: 1.4;
}
.bubble.md-body .md-h1 { font-size: 1.15em; }
.bubble.md-body .md-h2 { font-size: 1.08em; color: var(--accent); }
.bubble.md-body .md-h3 { font-size: 1.02em; }
.bubble.md-body .md-h4 { font-size: 0.98em; }
.bubble.md-body .md-p { margin: 6px 0; }
.bubble.md-body .md-list { margin: 6px 0; padding-left: 1.4em; }
.bubble.md-body .md-li { margin: 3px 0; }
.bubble.md-body code {
  background: rgba(127,127,127,.15); padding: 1px 5px;
  border-radius: 5px; font-size: 0.9em;
}
.bubble.md-body .md-code {
  background: rgba(0,0,0,.25); padding: 10px 12px; border-radius: 10px;
  overflow-x: auto; margin: 8px 0; white-space: pre-wrap;
}
.bubble.md-body .md-quote {
  border-left: 3px solid var(--accent); padding: 4px 10px;
  margin: 6px 0; color: var(--muted); background: rgba(127,127,127,.08);
  border-radius: 0 8px 8px 0;
}
.bubble.md-body .md-hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.bubble.md-body .md-table {
  border-collapse: collapse; margin: 8px 0; font-size: 0.92em; width: 100%;
}
.bubble.md-body .md-table th, .bubble.md-body .md-table td {
  border: 1px solid var(--border); padding: 5px 9px; text-align: left;
}
.bubble.md-body .md-table th { background: rgba(59,130,246,.12); }
.bubble.md-body .md-refs {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.bubble.md-body .md-refs .md-h3 {
  margin: 0 0 8px;
  font-size: 1.02em;
}
.bubble.md-body .md-ref-line {
  font-size: 13px;
  line-height: 1.5;
  margin: 4px 0;
  color: var(--text);
}
.bubble.md-body strong { font-weight: 700; color: inherit; }

.examples { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.example-btn {
  border: 1px dashed var(--border); background: transparent;
  color: var(--muted); padding: 6px 10px; border-radius: 999px;
  cursor: pointer; font-size: 12px;
}
.example-btn:hover { color: var(--text); border-color: var(--accent); }

.scope-intro {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.scope-intro b { color: var(--text); font-weight: 600; }

.scope-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--panel);
  position: sticky;
  bottom: 72px;
  z-index: 7;
}
.scope-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.scope-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  min-width: 56px;
}
.strategy-row .scope-label {
  color: var(--accent, #3b82f6);
  font-weight: 700;
}
.scope-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scope-chip, .depth-chip {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
}
.scope-chip:hover, .depth-chip:hover { color: var(--text); border-color: rgba(59,130,246,.45); }
.scope-chip.active, .depth-chip.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(59,130,246,.18);
  box-shadow: inset 0 0 0 1px rgba(59,130,246,.25);
}
.depth-chip.active {
  border-color: rgba(16,185,129,.75);
  background: rgba(16,185,129,.16);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,.28);
}

.input-area {
  display: flex; gap: 10px; padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 6;
  background: var(--panel);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.18);
}
.input-area textarea {
  flex: 1; resize: none; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); padding: 10px 12px;
  font: inherit;
}
.input-area textarea:focus { outline: none; border-color: var(--accent); }
#sendBtn {
  min-width: 88px; border: none; border-radius: 12px; cursor: pointer;
  color: white; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
#sendBtn:disabled { opacity: .6; cursor: not-allowed; }

.detail-panel h3 { margin: 0 0 12px; font-size: 15px; }
.detail-empty { color: var(--muted); font-size: 13px; line-height: 1.6; }
.detail-content.hidden, .detail-block.hidden, .hidden { display: none; }
.detail-block { margin-bottom: 14px; }
.detail-block label {
  display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px;
}
.tag {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: rgba(59,130,246,.15); color: #93c5fd; font-size: 12px;
}
pre {
  margin: 0; padding: 10px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.5;
}
.table-wrap { overflow: auto; max-height: 260px; border-radius: 10px; border: 1px solid var(--border); }
.retrieval-table-wrap { max-height: 220px; margin-top: 8px; }
.retrieval-table-wrap label { display: block; font-size: 11px; color: var(--muted); margin: 0 0 4px 6px; }
#retrievalCtxPrev { margin-top: 8px; max-height: 160px; overflow: auto; }
#toolRetrieval textarea { min-height: 56px; }
#retrievalMaxChars, #retrievalTopK { max-width: 88px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: var(--panel-2); position: sticky; top: 0; }

.typing { color: var(--muted); font-style: normal; }

@media (max-width: 1100px) {
  .main { grid-template-columns: 220px 1fr 300px; }
}
@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .history-toggle-btn { display: inline-grid; place-items: center; }
  .history-panel {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw);
    z-index: 50;
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .history-panel.open { transform: translateX(0); }
  .history-backdrop:not(.hidden) {
    display: block;
  }
  .detail-panel { min-height: 240px; }
  .bubble { max-width: 92%; }
}

.auth-gate {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(7, 12, 22, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-gate.hidden { display: none; }
.auth-gate-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.auth-gate-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.auth-gate-card input {
  width: 100%; margin: 16px 0 12px; padding: 12px 14px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
}
.auth-gate-card button {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 600; cursor: pointer;
}

.welcome-card .welcome-lead {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}
.welcome-actions {
  display: grid;
  gap: 10px;
}
.welcome-primary,
.welcome-secondary,
.welcome-link,
#welcomeSubmitBtn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.welcome-primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.welcome-secondary {
  border: 1px solid var(--border) !important;
  background: var(--panel-2) !important;
  color: var(--text) !important;
}
.welcome-link {
  margin-top: 8px;
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-weight: 500;
}
.welcome-form-panel.hidden,
.welcome-form-panel .hidden { display: none !important; }
.welcome-form-panel h3 {
  margin: 8px 0 0;
  font-size: 16px;
}
.welcome-form-panel input {
  width: 100%;
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
#welcomeFormHint.is-error { color: #b42318; }
.welcome-foot { margin-top: 14px; }
.user-chip {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  max-width: 160px;
}
.user-chip #userChipName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 88px;
}
body.dark .user-chip {
  background: rgba(14,36,40,.9);
}
.user-chip.hidden { display: none !important; }
.user-chip-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  flex-shrink: 0;
}
.user-chip-btn.hidden { display: none !important; }
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.header-right .status-bar {
  flex-shrink: 1;
  min-width: 0;
}
.tool-tab.hidden { display: none; }
.auto-tool-banner { border-left: 3px solid var(--accent-2); padding-left: 10px; margin-bottom: 12px; }
.tool-tab.auto-linked { box-shadow: 0 0 0 1px var(--accent-2); }
.auto-tool-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border, rgba(255,255,255,.08)); }
.auto-tool-section:first-of-type { margin-top: 8px; border-top: none; padding-top: 0; }
.auto-tool-title { font-size: 0.92rem; margin: 0 0 8px; color: var(--accent-2); font-weight: 600; }
.auto-tool-pre {
  margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--ink); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto;
  font-family: inherit;
}

.agent-trace { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agent-step {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 8px;
  padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border);
  font-size: 12px;
}
.agent-step.ok { border-color: rgba(34,197,94,.35); }
.agent-step.miss { border-color: rgba(143,163,199,.25); opacity: .85; }
.agent-step.err { border-color: rgba(239,68,68,.45); }
.agent-name { font-weight: 600; color: var(--accent-2); grid-column: 1 / -1; }
.agent-sum { color: var(--text); }
.agent-ms { color: var(--muted); font-size: 11px; }
.stat-chip.muted { opacity: .75; font-size: 11px; }

.workflow-box {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}
.workflow-box h3 { margin: 0 0 8px; font-size: 15px; }
.workflow-select {
  width: 100%; margin: 8px 0; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
}
.workflow-box textarea {
  width: 100%; margin-bottom: 8px; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  resize: vertical; font-family: inherit;
}
#workflowRunBtn {
  width: 100%; padding: 10px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 600; cursor: pointer;
}
#workflowRunBtn:disabled { opacity: .6; cursor: not-allowed; }
.workflow-output {
  margin-top: 10px; padding: 10px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 13px; line-height: 1.55; white-space: pre-wrap;
}
.workflow-steps { margin-top: 10px; }

/* ============ Hub 页面升级（A 视觉 + B 交互，纯追加不破坏） ============ */

/* A1 消息进入动画 + 气泡质感 */
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg { animation: msgIn .28s ease both; }
.msg.bot .bubble { box-shadow: 0 2px 14px rgba(0,0,0,.20); }
.msg.user .bubble { box-shadow: 0 2px 14px rgba(6,182,212,.10); }

/* 打字光标动画（AI 等待提示） */
.msg.typing .bubble::after {
  content: "▍"; margin-left: 2px; color: var(--accent-2);
  animation: caretBlink 1s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.msg.typing .avatar { animation: typingPulse 1.2s ease-in-out infinite; }
@keyframes typingPulse { 50% { box-shadow: 0 0 0 4px rgba(59,130,246,.16); } }

/* A2 统计 chips：图标间距 + hover 反馈 */
.stat-chip { display: inline-flex; align-items: center; gap: 4px; transition: transform .12s, color .12s, border-color .12s; }
.stat-chip:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }

/* A3 全局细节：滚动条 / 选中 / 聚焦 / 按钮反馈 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(127,143,175,.35); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(127,143,175,.55); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(59,130,246,.35); }
textarea:focus, input:focus, select:focus, button:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.mode-btn:not(.active):hover, .tool-tab:not(.active):hover, .example-btn:hover, .tool-secondary-btn:hover { filter: brightness(1.12); }

/* B5 消息操作按钮（回答下方常显，避免浅色无气泡样式下悬停找不到） */
.msg-actions {
  display: inline-flex;
  gap: 6px;
  margin-top: 10px;
  opacity: 0.72;
  transition: opacity .15s;
}
.msg.bot:hover .msg-actions,
.msg.bot:focus-within .msg-actions { opacity: 1; }
.msg-action-btn {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 999px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.msg-action-btn:hover { color: var(--text); border-color: var(--accent); background: #fff; }

/* B6 右侧面板折叠 */
.panel-collapse-btn {
  float: right; margin: -4px 0 6px 8px;
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
  font-size: 13px; line-height: 1; text-align: center;
  transition: color .12s, border-color .12s;
}
.panel-collapse-btn:hover { color: var(--text); border-color: var(--accent); }
body.side-collapsed .detail-panel { display: none; }
body.side-collapsed .main { grid-template-columns: 248px 1fr; }
@media (max-width: 1100px) {
  body.side-collapsed .main { grid-template-columns: 220px 1fr; }
}
@media (max-width: 980px) {
  body.side-collapsed .main { grid-template-columns: 1fr; }
}

/* B7 窄屏：表格横向滚动（仅窄屏，不影响桌面） */
@media (max-width: 980px) {
  .bubble.md-body .md-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ============ 对标 DeepSeek 网页版（追加覆盖，可整体删除回退） ============ */

/* 1. 浅色主题覆盖（公网演示） */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #d7deea;
  --text: #1e293b;
  --muted: #64748b;
  --bot: #eef2ff;
  --user: #e0f2fe;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* 2. 浅色背景 */
html, body { background: var(--bg) !important; }

/* 3. 头部更简洁 */
.header { padding: 12px 20px; background: rgba(255, 255, 255, .94); }
.brand p { display: none; }
.logo { width: 40px; height: 40px; font-size: 20px; border-radius: 11px; }
.brand h1 { font-size: 18px; }

/* 4. 主区协调 */
.main { max-width: 1560px; gap: 14px; padding: 12px 18px 18px; }
.chat-panel, .detail-panel { border-radius: 18px; }
.history-panel { border-radius: 18px; }

/* 5. 模式页签：简洁胶囊（保留功能） */
.mode-tabs { padding: 14px 14px 0; }
.mode-btn { background: transparent; border-color: transparent; color: var(--muted); }
.mode-btn:hover { background: var(--panel-2); color: var(--text); }
.mode-btn.active {
  background: var(--panel-2); color: var(--text);
  border-color: var(--border); box-shadow: none;
}

/* 6. 统计 chips 弱化（保留数据） */
.db-stats { padding: 4px 14px 10px; }
.stat-chip { background: transparent; border-color: transparent; color: var(--muted); }

/* 7. 聊天区居中窄栏（DeepSeek 居中对话） */
.messages {
  max-width: 840px; width: 100%; margin: 0 auto;
  padding: 26px 14px;
}
.messages::-webkit-scrollbar { width: 6px; }

/* 8. 隐藏头像，消息更干净 */
.msg { gap: 0; }
.avatar { display: none !important; }

/* 9. AI 回答：通栏 markdown，无气泡背景 */
.msg.bot .bubble {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  max-width: none;
  padding: 2px 4px;
}
.bubble.md-body { white-space: normal; }
.bubble.md-body .md-h1, .bubble.md-body .md-h2 { color: var(--text); }

/* 10. 用户消息：右侧小气泡（DeepSeek 风格） */
.msg.user .bubble {
  max-width: 74%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-left: auto;
  box-shadow: none;
}

/* 11. 输入框：DeepSeek 风格——底部居中悬浮圆角卡片 */
.input-area {
  max-width: 840px; width: 100%; margin: 0 auto;
  padding: 10px 14px 16px;
  background: transparent;
  border-top: none;
  box-shadow: none;
}
.input-area textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px 18px;
  font-size: 14px;
  max-height: 160px;
  min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
.input-area textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
#sendBtn {
  min-width: 0; width: 44px; height: 44px; align-self: flex-end;
  border-radius: 50%; font-size: 20px; line-height: 1;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: opacity .15s, transform .1s;
}
#sendBtn:hover:not(:disabled) { transform: translateY(-1px); }
#sendBtn.busy { opacity: .7; }
#sendBtn:disabled { opacity: .4; cursor: not-allowed; }

/* 12. 回答详情/工具侧栏协调 */
.detail-panel h3 { font-size: 14px; }

/* 13. 示例按钮简化 */
.example-btn { border-color: var(--border); }

/* 14. 窄屏下输入框圆角自适应 */
@media (max-width: 980px) {
  .input-area { padding: 8px 10px 12px; }
  .input-area textarea { border-radius: 16px; }
}


/* ===== Phase C: reef shell / home / chat hero ===== */
:root {
  --bg: #eef6f5;
  --panel: #ffffff;
  --panel-2: #f3faf9;
  --border: #c9e0dd;
  --text: #0c2a2e;
  --muted: #5a7a7e;
  --accent: #0d7377;
  --accent-2: #1a9b8e;
  --bot: #e4f2f0;
  --user: #e8f4f2;
  --shadow: 0 12px 32px rgba(6, 42, 46, 0.08);
  --rail: #062a2e;
  --font-ui: "Figtree", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Syne", "Figtree", "PingFang SC", sans-serif;
}
body.theme-reef {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(13, 115, 119, 0.18), transparent 55%),
    radial-gradient(900px 420px at 90% 0%, rgba(26, 155, 142, 0.12), transparent 50%),
    linear-gradient(180deg, #dcefee 0%, var(--bg) 32%);
}
body.theme-reef.dark {
  --bg: #071618;
  --panel: #0e2428;
  --panel-2: #123036;
  --border: #1f454b;
  --text: #e6f2f1;
  --muted: #8fb0b4;
  --bot: #123036;
  --user: #2a221c;
  --rail: #041011;
  background: radial-gradient(900px 400px at 20% 0%, rgba(15,118,110,.25), transparent), #071618;
}
.site-header {
  gap: 16px;
  padding: 12px 18px;
  align-items: center;
  background: rgba(247, 251, 251, 0.86);
  border-bottom: 1px solid var(--border);
}
body.dark .site-header { background: rgba(14,36,40,.9); }
.brand-click { cursor: pointer; }
.brand h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.logo {
  background: linear-gradient(145deg, #0f766e, #155e75);
  color: #dff7f3;
  border-radius: 16px;
}
.top-nav {
  display: flex; flex-wrap: wrap; gap: 4px; flex: 1; justify-content: center;
}
.top-nav-link {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 8px 10px; border-radius: 999px;
}
.top-nav-link:hover, .top-nav-link.active {
  color: var(--text); background: rgba(15,118,110,.1);
}
.header-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
}
.shell {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
}
.side-rail {
  background: var(--rail); color: #d7efec;
  display: flex; flex-direction: column; gap: 6px; padding: 12px 8px;
  overflow: auto;
}
.rail-item {
  color: inherit; text-decoration: none; text-align: center;
  padding: 10px 4px; border-radius: 12px; font-size: 11px; opacity: .85;
}
.rail-item span { display: block; font-size: 16px; margin-bottom: 2px; }
.rail-item:hover, .rail-item.active { background: rgba(255,255,255,.1); opacity: 1; }
.shell-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-view { flex: 1; min-height: 0; overflow: auto; }
.app-view.hidden { display: none !important; }
#view-workspace, #view-chat { display: flex; flex-direction: column; overflow: hidden; }
#view-workspace > .main, #view-chat > .main { flex: 1; min-height: 0; }

.home-hero {
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 28px;
  padding: 28px 32px 8px; max-width: 1280px; margin: 0 auto;
}
.home-eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.home-hero-copy h2 {
  font-family: var(--font-display); font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15; margin: 0 0 12px; font-weight: 600;
}
.home-lead { color: var(--muted); font-size: 15px; max-width: 46ch; margin: 0 0 18px; }
.home-search {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 8px;
  box-shadow: var(--shadow);
}
.home-search input, .home-search select {
  border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px;
}
.home-search button {
  background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 0 18px; font-weight: 600; cursor: pointer;
}
.home-cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.home-cta {
  text-decoration: none; color: var(--text); border: 1px solid var(--border);
  background: var(--panel); padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
}
.home-cta.primary { background: var(--accent); color: #fff; border-color: transparent; }
.home-hero-visual { position: relative; min-height: 240px; }
.viz-orb {
  position: absolute; inset: 20px; border-radius: 28px;
  background: linear-gradient(160deg, rgba(15,118,110,.35), rgba(196,92,38,.2));
  box-shadow: var(--shadow);
}
.viz-card {
  position: absolute; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow);
}
.viz-a { left: 8%; top: 18%; animation: floaty 5s ease-in-out infinite; }
.viz-b { right: 6%; top: 42%; animation: floaty 6s ease-in-out infinite .4s; }
.viz-c { left: 22%; bottom: 14%; animation: floaty 5.5s ease-in-out infinite .8s; }
@keyframes floaty { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-8px);} }
@media (prefers-reduced-motion: reduce) { .viz-a,.viz-b,.viz-c { animation: none; } }

.home-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px;
  max-width: 1280px; margin: 18px auto; padding: 0 32px;
}
.home-stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow);
}
.home-stat strong { display: block; font-size: 26px; font-family: var(--font-display); }
.home-stat span { color: var(--muted); font-size: 12px; }
.home-section-title {
  max-width: 1280px; margin: 12px auto 8px; padding: 0 32px;
  font-family: var(--font-display); font-size: 22px;
}
.module-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
  max-width: 1280px; margin: 0 auto 40px; padding: 0 32px 32px;
}
.module-card {
  text-decoration: none; color: inherit; background: var(--panel);
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s;
}
.module-card:hover { transform: translateY(-3px); border-color: rgba(15,118,110,.45); }
.module-thumb { height: 88px; }
.module-card h4 { margin: 12px 14px 4px; font-size: 15px; }
.module-card p { margin: 0 14px 14px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.t-chat { background: linear-gradient(135deg,#0f766e,#134e4a); }
.t-gene { background: linear-gradient(135deg,#155e75,#0e7490); }
.t-blast { background: linear-gradient(135deg,#c45c26,#9a3412); }
.t-enrich { background: linear-gradient(135deg,#0f766e,#c45c26); }
.t-kegg { background: linear-gradient(135deg,#1d4e4a,#315c57); }
.t-id { background: linear-gradient(135deg,#0e7490,#155e75); }
.t-seq { background: linear-gradient(135deg,#134e4a,#0f766e); }
.t-ann { background: linear-gradient(135deg,#9a3412,#c45c26); }
.t-lit { background: linear-gradient(135deg,#164e63,#0f766e); }
.t-up { background: linear-gradient(135deg,#3f3f46,#57534e); }

.chat-empty-state { text-align: center; padding: 48px 20px 24px; }
.chat-hero-mark {
  width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 22px;
  display: grid; place-items: center;
  background: transparent;
  box-shadow: 0 10px 28px rgba(6, 42, 46, 0.12);
  overflow: visible;
}
.chat-hero-mark img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: inherit;
}
.chat-empty-title { font-family: var(--font-display); font-size: 28px; margin-bottom: 8px; }
.chat-quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.quick-prompt {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 8px 12px; font-size: 12px; cursor: pointer;
}
.quick-prompt:hover { border-color: var(--accent); color: var(--accent); }
.input-plus {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; align-self: flex-end;
}
#sendBtn {
  width: auto !important; min-width: 72px !important; height: 40px !important;
  border-radius: 12px !important; font-size: 14px !important; padding: 0 14px;
}
.res-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.res-chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(15,118,110,.1); color: var(--accent); text-decoration: none;
}
.md-a-local, .md-body .md-a-local { color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px dashed rgba(15,118,110,.45); }
/* 外链以前只有颜色、没有下划线，看起来跟普通文字一样，用户根本不知道能点。
   现在给虚线下划线 + hover 变实线，和站内深链保持同样的「可点」信号。
   注意要带 .md-body 前缀：chat-2026.css 里的 `.md-body a`（特异性 0,1,1）
   会把它压成 border-bottom: 1px solid transparent，虚线就看不见了。 */
.md-a-ext, .md-body .md-a-ext {
  color: var(--accent-2); text-decoration: none; font-weight: 500;
  border-bottom: 1px dashed rgba(29,111,184,.45);
  transition: border-color .12s, color .12s;
}
.md-a-ext:hover, .md-body .md-a-ext:hover { border-bottom-style: solid; border-bottom-color: var(--accent-2); }
.md-a-ext::after { content: "\2197"; font-size: .82em; margin-left: 2px; opacity: .75; vertical-align: super; }
.map-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.map-table th, .map-table td { border-bottom: 1px solid var(--border); padding: 6px 4px; text-align: left; }

@media (max-width: 1100px) {
  .top-nav { display: none; }
  .home-hero { grid-template-columns: 1fr; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .shell { grid-template-columns: 64px 1fr; }
}
@media (max-width: 720px) {
  .side-rail { display: none; }
  .shell { grid-template-columns: 1fr; }
  .home-search { grid-template-columns: 1fr; }
}

/* ===== 涓€鍔熻兘涓€鐣岄潰锛氱嫭绔嬪姛鑳介〉 ===== */
#view-chat .toolbox,
#toolBank { display: none !important; }
.main-chat-only {
  grid-template-columns: 248px minmax(0, 1fr);
}
/* 右侧「回答详情 / 工作流编排」不再展示；逻辑仍保留在 DOM 供内部同步 */
#view-chat .detail-panel,
.main-chat-only .detail-panel,
#view-chat .workflow-box,
.workflow-box {
  display: none !important;
}
.panel-collapse-btn { display: none !important; }
.feature-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}
.feature-head { margin-bottom: 22px; }
.feature-eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.feature-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 600;
}
.feature-lead {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
  font-size: 14px;
  line-height: 1.5;
}
.feature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: 280px;
}
.feature-form-card .tool-panel {
  display: block !important;
}
.feature-form-card .tool-panel.hidden {
  display: block !important;
}
.feature-mount .tool-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.feature-mount input[type="text"],
.feature-mount input[type="search"],
.feature-mount input[type="number"],
.feature-mount textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}
.feature-mount button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.feature-mount .tool-secondary-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.feature-out-title {
  margin: 0 0 12px;
  font-size: 15px;
}
.feature-result-mount {
  min-height: 120px;
}
.feature-result-mount .tool-result {
  display: block;
}
.feature-result-mount .tool-result.hidden {
  display: none;
}
@media (max-width: 900px) {
  .feature-layout { grid-template-columns: 1fr; }
  .main-chat-only { grid-template-columns: 1fr; }
}


.chat-tool-result-host { margin-top: 14px; }
.chat-tool-result-host .tool-result { display: block; }
.chat-tool-result-host .tool-result.hidden { display: none; }


/* ===== home live stats + wave gallery ===== */
.home-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.home-stats-note, .gallery-credit {
  max-width: 1280px; margin: 4px auto 0; padding: 0 32px;
  color: var(--muted); font-size: 12px;
}
.gallery-credit { margin: 0 auto 28px; }
.wave-orb {
  overflow: hidden; position: absolute; inset: 20px; border-radius: 28px;
}
.wave-strip, .wave-thumb {
  --wave-img-a: none;
  --wave-img-b: none;
  position: relative; overflow: hidden;
}
.wave-strip {
  position: absolute; inset: 0; border-radius: 28px;
}
.wave-thumb {
  height: 118px;
}
.wave-layer {
  position: absolute; inset: -12% -8%;
  background-image: var(--wave-img-a), linear-gradient(135deg, rgba(15,118,110,.55), rgba(196,92,38,.35));
  background-size: cover;
  background-position: 50% 40%;
  opacity: .92;
  animation: waveDrift 14s ease-in-out infinite alternate;
  filter: saturate(1.15) contrast(1.05);
}
.wave-layer.wave-delay {
  background-image: var(--wave-img-b), linear-gradient(160deg, rgba(13,148,136,.25), rgba(15,23,42,.35));
  opacity: .55;
  mix-blend-mode: soft-light;
  animation: waveDriftAlt 18s ease-in-out infinite alternate;
  animation-delay: -4s;
}
.wave-thumb::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6,24,28,.08), rgba(6,24,28,.55)),
    radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,.18), transparent 55%);
  pointer-events: none;
}
.wave-thumb::before {
  content: "";
  position: absolute; left: -10%; right: -10%; bottom: -35%; height: 70%;
  background: radial-gradient(ellipse at center, rgba(56,189,248,.35), transparent 70%);
  animation: waveBob 6s ease-in-out infinite;
  pointer-events: none; z-index: 2;
}
.module-card.wave-card {
  border: 1px solid rgba(15,118,110,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.96));
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.module-card.wave-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 18px 40px rgba(15,118,110,.18);
  border-color: rgba(15,118,110,.45);
}
.module-card.wave-card:hover .wave-layer { animation-duration: 7s; }
@keyframes waveDrift {
  0% { transform: translate3d(-2%, 2%, 0) scale(1.08) rotate(-.6deg); }
  50% { transform: translate3d(3%, -2%, 0) scale(1.14) rotate(.4deg); }
  100% { transform: translate3d(-1%, 3%, 0) scale(1.1) rotate(-.2deg); }
}
@keyframes waveDriftAlt {
  0% { transform: translate3d(4%, -3%, 0) scale(1.16) rotate(1deg); }
  100% { transform: translate3d(-5%, 2%, 0) scale(1.08) rotate(-1deg); }
}
@keyframes waveBob {
  0%,100% { transform: translateY(0) scaleX(1); opacity: .35; }
  50% { transform: translateY(-10px) scaleX(1.08); opacity: .55; }
}
@media (prefers-reduced-motion: reduce) {
  .wave-layer, .wave-thumb::before { animation: none !important; }
}
@media (max-width: 1100px) {
  .home-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
/* ===== Atelier premium shell (theme-atelier) ===== */
body.theme-atelier {
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(13,115,119,.22), transparent 58%),
    radial-gradient(900px 480px at 92% 4%, rgba(26,155,142,.14), transparent 52%),
    linear-gradient(165deg, #dcefee 0%, #eef6f5 38%, #f4f8f7 100%);
  color: var(--text);
}
body.theme-atelier.dark {
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(13,115,119,.35), transparent 55%),
    #041416;
}

body.theme-atelier .site-header {
  padding: 10px 22px;
  background: rgba(238, 246, 245, 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(201, 224, 221, 0.7);
}
body.theme-atelier.dark .site-header {
  background: rgba(4, 20, 22, 0.78);
}
body.theme-atelier .brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
body.theme-atelier .brand p {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
body.theme-atelier .logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: transparent;
  color: #e8fffb;
  box-shadow: 0 8px 20px rgba(13, 115, 119, 0.22);
  overflow: hidden;
  padding: 0;
}
body.theme-atelier .logo-mark {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
body.theme-atelier .top-nav-link {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: background .2s ease, color .2s ease;
}
body.theme-atelier .top-nav-link.active {
  background: rgba(13, 115, 119, 0.12);
  color: var(--text);
  font-weight: 600;
}
body.theme-atelier .side-rail {
  background: linear-gradient(180deg, #062a2e 0%, #041a1c 100%);
  padding: 14px 8px;
  gap: 4px;
}
body.theme-atelier .rail-item {
  border-radius: 12px;
  padding: 10px 4px 8px;
  opacity: 0.78;
  transition: background .2s ease, opacity .2s ease, transform .2s ease;
}
body.theme-atelier .rail-item:hover,
body.theme-atelier .rail-item.active {
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
  transform: translateY(-1px);
}
body.theme-atelier .rail-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto 4px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: rgba(232, 255, 251, 0.08);
  color: #c8efe9;
}

/* Full-bleed cinematic hero */
body.theme-atelier .home-stage {
  position: relative;
  min-height: min(78vh, 720px);
  margin: 0;
  overflow: hidden;
  display: grid;
  align-items: end;
  isolation: isolate;
}
body.theme-atelier .home-stage-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 0;
}
body.theme-atelier .home-stage-media .wave-strip {
  inset: 0;
  border-radius: 0;
}
body.theme-atelier .home-stage-caustic {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 30%, rgba(255,255,255,.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 70%, rgba(26,155,142,.18), transparent 50%);
  animation: causticShift 16s ease-in-out infinite alternate;
  mix-blend-mode: soft-light;
}
body.theme-atelier .home-stage-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(105deg, rgba(4, 26, 28, 0.82) 0%, rgba(4, 26, 28, 0.55) 42%, rgba(4, 26, 28, 0.22) 70%, rgba(4, 26, 28, 0.08) 100%),
    linear-gradient(0deg, rgba(4, 20, 22, 0.55) 0%, transparent 42%);
}
body.theme-atelier .home-stage-copy {
  position: relative;
  z-index: 2;
  max-width: 720px;
  padding: clamp(36px, 7vh, 72px) clamp(24px, 5vw, 56px) clamp(40px, 6vh, 64px);
  color: #f3fffc;
  animation: stageRise .9s cubic-bezier(.22, 1, .36, 1) both;
}
body.theme-atelier .home-brand-hero {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: #ffffff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}
body.theme-atelier .home-headline {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: rgba(243, 255, 252, 0.92);
  max-width: 22ch;
}
body.theme-atelier .home-stage-copy .home-lead {
  color: rgba(220, 245, 240, 0.78);
  font-size: 15px;
  max-width: 48ch;
  margin: 0 0 22px;
  line-height: 1.55;
}
body.theme-atelier .home-search {
  grid-template-columns: 108px 1fr auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
}
body.theme-atelier .home-search input,
body.theme-atelier .home-search select {
  color: var(--text);
}
body.theme-atelier .home-search button {
  background: #0d7377;
  border-radius: 12px;
  min-width: 88px;
}
body.theme-atelier .home-cta-row {
  margin-top: 18px;
  gap: 12px;
}
body.theme-atelier .home-cta {
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #f3fffc;
  backdrop-filter: blur(6px);
  transition: transform .2s ease, background .2s ease;
}
body.theme-atelier .home-cta:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.18);
}
body.theme-atelier .home-cta.primary {
  background: #e8fffb;
  color: #062a2e;
  border-color: transparent;
}
body.theme-atelier .home-cta.primary:hover {
  background: #ffffff;
}

/* Metrics strip */
body.theme-atelier .home-metrics {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 28px 8px;
}
body.theme-atelier .home-metrics-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
body.theme-atelier .home-metrics-head h3,
body.theme-atelier .home-atelier-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.03em;
}
body.theme-atelier .home-metrics-head .home-stats-note,
body.theme-atelier .home-atelier-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
  max-width: none;
}
body.theme-atelier .home-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  max-width: none;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
}
body.theme-atelier .home-stat {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 20px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
body.theme-atelier .home-stat:nth-child(4n) { border-right: 0; }
body.theme-atelier .home-stat:nth-child(n+5) { border-bottom: 0; }
body.theme-atelier .home-stat strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: -0.03em;
  color: #0a4549;
}
body.theme-atelier .home-stat span {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Module atelier */
body.theme-atelier .home-atelier {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}
body.theme-atelier .home-atelier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
body.theme-atelier .module-grid {
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
body.theme-atelier .module-card.wave-card {
  border-radius: 20px;
  border: 1px solid rgba(13, 115, 119, 0.14);
  background: rgba(255, 255, 255, 0.88);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(6, 42, 46, 0.06);
  transition: transform .28s cubic-bezier(.22,1,.36,1), border-color .28s ease;
}
body.theme-atelier .module-card.wave-card:hover {
  transform: translateY(-5px);
  border-color: rgba(13, 115, 119, 0.4);
  box-shadow: 0 18px 36px rgba(6, 42, 46, 0.12);
}
body.theme-atelier .wave-thumb {
  height: 140px;
}
body.theme-atelier .module-body {
  padding: 14px 16px 16px;
}
body.theme-atelier .module-card h4 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}
body.theme-atelier .module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
body.theme-atelier .gallery-credit {
  margin: 16px 0 0;
  padding: 0;
  max-width: none;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* Feature + chat polish */
body.theme-atelier .feature-page {
  max-width: none;
  padding: 0;
  margin: 0;
}
body.theme-atelier .feature-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}
body.theme-atelier .feature-card {
  border-radius: 20px;
  border: 1px solid rgba(13, 115, 119, 0.14);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 32px rgba(6, 42, 46, 0.06);
}
body.theme-atelier .chat-panel,
body.theme-atelier .detail-panel,
body.theme-atelier .history-panel {
  border-radius: 18px;
  border-color: rgba(13, 115, 119, 0.14);
  box-shadow: 0 10px 28px rgba(6, 42, 46, 0.05);
}
body.theme-atelier .chat-empty-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}
body.theme-atelier #sendBtn,
body.theme-atelier .welcome-primary,
body.theme-atelier .feature-mount button {
  background: #0d7377 !important;
  border-radius: 12px !important;
}

/* Welcome gate */
body.theme-atelier .atelier-gate {
  background:
    radial-gradient(800px 400px at 30% 20%, rgba(13,115,119,.35), transparent 60%),
    rgba(4, 20, 22, 0.72);
  backdrop-filter: blur(10px);
}
body.theme-atelier .atelier-welcome {
  max-width: 420px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 28px 26px;
}
body.theme-atelier .atelier-welcome-brand {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.04em;
  color: #0a4549;
}
body.theme-atelier .atelier-welcome h2 {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 12px;
}
body.theme-atelier .welcome-primary {
  border-radius: 12px;
  background: #0d7377 !important;
}
body.theme-atelier .welcome-secondary {
  border-radius: 12px;
}

@keyframes stageRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes causticShift {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: .7; }
  to { transform: translate3d(-2%, 3%, 0) scale(1.06); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-atelier .home-stage-copy,
  body.theme-atelier .home-stage-caustic { animation: none !important; }
}
@media (max-width: 900px) {
  body.theme-atelier .home-stage { min-height: 68vh; }
  body.theme-atelier .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.theme-atelier .home-stat:nth-child(2n) { border-right: 0; }
  body.theme-atelier .home-stat:nth-child(4n) { border-right: 0; }
  body.theme-atelier .home-stat:nth-child(n+5) { border-bottom: 1px solid var(--border); }
  body.theme-atelier .home-stat:nth-child(n+7) { border-bottom: 0; }
  body.theme-atelier .home-metrics-head,
  body.theme-atelier .home-atelier-head { flex-direction: column; align-items: flex-start; }
}


/* ===== live research imagery stream ===== */
body.theme-atelier .home-reef-stream {
  max-width: 1240px;
  margin: 8px auto 0;
  padding: 8px 28px 4px;
}
body.theme-atelier .reef-stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
body.theme-atelier .reef-stream-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.03em;
}
body.theme-atelier .reef-stream-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
body.theme-atelier .reef-mode-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
body.theme-atelier .reef-mode-btn.active,
body.theme-atelier .reef-mode-btn:hover {
  background: #0d7377;
  color: #e8fffb;
  border-color: transparent;
}
body.theme-atelier .reef-stream-viewport {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(13,115,119,.16);
  background: rgba(6,42,46,.04);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  min-height: 168px;
}
body.theme-atelier .reef-stream-track {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  width: max-content;
  max-width: 2800px;
  padding: 10px;
  animation: reefMarquee 90s linear infinite;
}
body.theme-atelier .reef-tile {
  width: 148px;
  height: 104px;
}
body.theme-atelier .reef-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
body.theme-atelier .reef-mosaic .reef-tile {
  width: 100%;
  height: 88px;
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(13,115,119,.12);
}
body.theme-atelier .reef-mosaic .reef-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
body.theme-atelier .reef-tile.is-broken { display: none !important; }
body.theme-atelier .reef-stream-viewport:hover .reef-stream-track {
  animation-play-state: paused;
}
body.theme-atelier .reef-tile {
  position: relative;
  flex: 0 0 auto;
  width: 148px;
  height: 104px;
  border-radius: 12px;
  overflow: hidden;
  display: block;
  box-shadow: 0 6px 16px rgba(6,42,46,.12);
}
body.theme-atelier .reef-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
body.theme-atelier .reef-tile:hover img { transform: scale(1.08); }
body.theme-atelier .reef-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(4,26,28,.72);
  color: #e8fffb;
  letter-spacing: .04em;
}
@keyframes reefMarquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-atelier .reef-stream-track { animation: none; }
}
@media (max-width: 720px) {
  body.theme-atelier .reef-tile { width: 108px; height: 76px; }
  body.theme-atelier .reef-stream-head { flex-direction: column; align-items: flex-start; }
}

/* ===== Feature atelier stages (per-route atmosphere) ===== */
#view-feature {
  position: relative;
  overflow: auto;
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(13,115,119,.12), transparent 55%),
    radial-gradient(700px 360px at 88% 8%, rgba(196,92,38,.08), transparent 50%),
    linear-gradient(180deg, rgba(220,239,238,.55) 0%, transparent 28%);
}
#view-feature[data-feature="gene"] {
  --feat-accent: #0d7377;
  --feat-accent-2: #155e75;
  --feat-wash: rgba(13,115,119,.16);
}
#view-feature[data-feature="blast"] {
  --feat-accent: #c45c26;
  --feat-accent-2: #9a3412;
  --feat-wash: rgba(196,92,38,.14);
}
#view-feature[data-feature="enrich"] {
  --feat-accent: #0f766e;
  --feat-accent-2: #b45309;
  --feat-wash: rgba(15,118,110,.14);
}
#view-feature[data-feature="kegg"] {
  --feat-accent: #1d4e4a;
  --feat-accent-2: #315c57;
  --feat-wash: rgba(29,78,74,.16);
}
#view-feature[data-feature="id"] {
  --feat-accent: #0e7490;
  --feat-accent-2: #155e75;
  --feat-wash: rgba(14,116,144,.15);
}
#view-feature[data-feature="sequence"] {
  --feat-accent: #134e4a;
  --feat-accent-2: #0f766e;
  --feat-wash: rgba(19,78,74,.15);
}
#view-feature[data-feature="annotate"] {
  --feat-accent: #9a3412;
  --feat-accent-2: #c45c26;
  --feat-wash: rgba(154,52,18,.12);
}
#view-feature[data-feature="literature"] {
  --feat-accent: #164e63;
  --feat-accent-2: #0f766e;
  --feat-wash: rgba(22,78,99,.15);
}
#view-feature[data-feature="upload"] {
  --feat-accent: #57534e;
  --feat-accent-2: #3f3f46;
  --feat-wash: rgba(63,63,70,.12);
}

.feature-atelier.feature-enter .feature-stage-copy,
.feature-atelier.feature-enter .feature-rise {
  animation: featureRise .75s cubic-bezier(.22,1,.36,1) both;
}
.feature-atelier.feature-enter .feature-rise-delay {
  animation-delay: .12s;
}
@keyframes featureRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.feature-stage {
  position: relative;
  min-height: clamp(200px, 28vh, 280px);
  overflow: hidden;
  isolation: isolate;
  display: grid;
  align-items: end;
}
.feature-stage-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.feature-wave-strip {
  position: absolute;
  inset: 0;
  border-radius: 0;
}
.feature-stage-caustic {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 18% 35%, rgba(255,255,255,.16), transparent 55%),
    radial-gradient(ellipse 55% 45% at 82% 65%, var(--feat-wash, rgba(13,115,119,.18)), transparent 52%);
  animation: causticShift 14s ease-in-out infinite alternate;
  mix-blend-mode: soft-light;
}
.feature-stage-veil {
  position: absolute;
  inset: 0;
  /* 更透，让各功能页独立影像子集更明显 */
  background:
    linear-gradient(105deg, rgba(4,26,28,.62) 0%, rgba(4,26,28,.32) 48%, rgba(4,26,28,.10) 74%, rgba(4,26,28,.02) 100%),
    linear-gradient(0deg, rgba(4,20,22,.28) 0%, transparent 58%);
}
.feature-stage-copy {
  position: relative;
  z-index: 2;
  max-width: 920px;
  padding: clamp(28px, 5vh, 44px) clamp(22px, 4vw, 48px) clamp(24px, 4vh, 36px);
  color: #f3fffc;
}
.feature-brand-line {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 3.2vw, 32px);
  letter-spacing: -0.04em;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 18px rgba(0,0,0,.22);
}
.feature-stage .feature-eyebrow {
  margin: 0 0 6px;
  color: rgba(200, 239, 233, .88);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.feature-stage #featureTitle,
.feature-stage h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #ffffff;
  max-width: 18ch;
}
.feature-stage .feature-lead {
  margin: 0 0 16px;
  color: rgba(220, 245, 240, .82);
  font-size: 14px;
  line-height: 1.55;
  max-width: 54ch;
}
.feature-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.feature-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  background: rgba(232, 255, 251, .16);
  border: 1px solid rgba(232, 255, 251, .28);
  color: #e8fffb;
  backdrop-filter: blur(6px);
}
.feature-pill.soft {
  background: rgba(255,255,255,.08);
  font-weight: 600;
  letter-spacing: .02em;
}

.feature-body {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px clamp(18px, 3vw, 36px) 48px;
}
.feature-atelier .feature-layout {
  gap: 18px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}
.feature-atelier .feature-card {
  position: relative;
  min-height: 320px;
  padding: 20px 20px 22px;
  border-radius: 22px;
  border: 1px solid rgba(13, 115, 119, 0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,252,251,.92)),
    var(--panel);
  box-shadow:
    0 14px 36px rgba(6, 42, 46, 0.07),
    inset 0 1px 0 rgba(255,255,255,.7);
  overflow: hidden;
}
.feature-atelier .feature-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--feat-accent, #0d7377), var(--feat-accent-2, #1a9b8e));
  opacity: .9;
}
.feature-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.feature-card-title,
.feature-atelier .feature-out-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.feature-card-hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .02em;
}
.feature-atelier .feature-mount input[type="text"],
.feature-atelier .feature-mount input[type="search"],
.feature-atelier .feature-mount input[type="number"],
.feature-atelier .feature-mount textarea,
.feature-atelier .feature-mount input[type="file"] {
  border-radius: 14px;
  border-color: rgba(13,115,119,.18);
  background: rgba(243,250,249,.9);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.feature-atelier .feature-mount input:focus,
.feature-atelier .feature-mount textarea:focus {
  outline: none;
  border-color: var(--feat-accent, var(--accent));
  box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.18);
}
.feature-atelier .feature-mount button {
  background: var(--feat-accent, #0d7377) !important;
  border-radius: 12px !important;
  transition: transform .18s ease, filter .18s ease;
}
.feature-atelier .feature-mount button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.feature-atelier .feature-mount .tool-secondary-btn {
  background: rgba(243,250,249,.95) !important;
  color: var(--text) !important;
  border: 1px solid rgba(13,115,119,.18);
}
.feature-atelier .tool-hint {
  color: var(--muted);
  line-height: 1.45;
}

.feature-empty-state {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 36px 18px 28px;
  min-height: 180px;
  border-radius: 16px;
  border: 1px dashed rgba(13,115,119,.22);
  background:
    radial-gradient(120px 80px at 50% 30%, var(--feat-wash, rgba(13,115,119,.12)), transparent 70%),
    rgba(243,250,249,.55);
  overflow: hidden;
}
.feature-empty-state.hidden { display: none !important; }
.feature-empty-orb {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, var(--feat-accent, #0d7377), var(--feat-accent-2, #1a9b8e));
  box-shadow: 0 10px 24px rgba(13, 115, 119, 0.28);
  animation: emptyPulse 3.6s ease-in-out infinite;
}
.feature-empty-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.feature-empty-sub {
  margin: 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
@keyframes emptyPulse {
  0%,100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.06); opacity: 1; }
}
.feature-foot-note {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}
.feature-atelier .feature-result-mount .tool-result {
  border-radius: 14px;
  border: 1px solid rgba(13,115,119,.14);
  background: rgba(243,250,249,.65);
  padding: 12px;
  max-height: min(52vh, 560px);
}
.feature-atelier .tool-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--feat-accent, var(--accent));
  font-weight: 600;
}
.feature-atelier .tool-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(13, 115, 119, 0.25);
  border-top-color: var(--feat-accent, #0d7377);
  animation: featSpin .7s linear infinite;
}
@keyframes featSpin { to { transform: rotate(360deg); } }

/* Chat atmosphere — flowing zebrafish imagery */
#view-chat {
  position: relative;
  isolation: isolate;
}
.chat-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(160deg, #041416 0%, #0a2a2e 42%, #0c3a40 100%);
}
.chat-reef-flow {
  position: absolute;
  inset: -6%;
}
.chat-reef-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 1.4s ease;
  animation: chatReefDrift 22s ease-in-out infinite alternate;
  filter: saturate(1.25) contrast(1.08) brightness(0.92);
}
.chat-reef-layer.is-active {
  opacity: 1;
}
.chat-reef-veil {
  position: absolute;
  inset: 0;
  /* 更透：让流动影像可见，仅留可读性遮罩 */
  background:
    linear-gradient(180deg, rgba(6,28,30,.28) 0%, rgba(8,36,40,.34) 40%, rgba(4,22,24,.48) 100%),
    radial-gradient(ellipse 85% 55% at 50% 12%, rgba(13,115,119,.14), transparent 68%),
    linear-gradient(105deg, rgba(247,252,252,.18) 0%, rgba(247,251,251,.10) 55%, rgba(240,248,248,.22) 100%);
}
body.dark .chat-reef-veil {
  background:
    linear-gradient(180deg, rgba(4,18,20,.45) 0%, rgba(6,26,28,.55) 45%, rgba(4,16,18,.7) 100%),
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(26,155,142,.22), transparent 68%);
}
.chat-reef-caustic {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 42% 30% at 18% 28%, rgba(255,255,255,.22), transparent 58%),
    radial-gradient(ellipse 38% 26% at 78% 58%, rgba(13,115,119,.18), transparent 62%);
  mix-blend-mode: soft-light;
  animation: chatCaustic 10s ease-in-out infinite alternate;
  opacity: .85;
}
@keyframes chatReefDrift {
  from { transform: scale(1.08) translate3d(-1.8%, -0.8%, 0); }
  to { transform: scale(1.18) translate3d(2.2%, 1.4%, 0); }
}
@keyframes chatCaustic {
  from { opacity: .55; transform: translate3d(0,0,0); }
  to { opacity: .95; transform: translate3d(2%, -1.2%, 0); }
}
#view-chat > .main {
  position: relative;
  z-index: 1;
}
body.theme-atelier #view-chat .chat-panel,
body.theme-atelier #view-chat .history-panel {
  background: rgba(255,255,255,.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
body.dark.theme-atelier #view-chat .chat-panel,
body.dark.theme-atelier #view-chat .history-panel {
  background: rgba(10,28,32,.72);
}
body.theme-atelier .chat-empty-atelier {
  position: relative;
  padding: 56px 24px 32px;
}
.chat-empty-glow {
  position: absolute;
  left: 50%; top: 24px;
  width: 220px; height: 220px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,115,119,.18), transparent 68%);
  pointer-events: none;
  animation: emptyPulse 4.5s ease-in-out infinite;
}
body.theme-atelier .chat-empty-brand {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
body.theme-atelier .chat-empty-atelier .chat-empty-title {
  font-size: clamp(26px, 3.5vw, 34px);
}
body.theme-atelier .chat-empty-sub {
  max-width: 44ch;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.55;
}
body.theme-atelier .quick-prompt {
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
body.theme-atelier .quick-prompt:hover {
  transform: translateY(-2px);
  border-color: rgba(13,115,119,.4);
  box-shadow: 0 8px 18px rgba(6,42,46,.08);
}
body.theme-atelier .mode-btn.active {
  background: rgba(13,115,119,.1);
  border-color: rgba(13,115,119,.28);
  color: var(--text);
  font-weight: 600;
}
body.theme-atelier .input-area textarea {
  background: rgba(255,255,255,.92);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(6,42,46,.05);
}
body.theme-atelier.dark #view-feature {
  background:
    radial-gradient(800px 360px at 10% 0%, rgba(13,115,119,.28), transparent 55%),
    #041416;
}
body.theme-atelier.dark .feature-atelier .feature-card {
  background: linear-gradient(180deg, rgba(14,36,40,.96), rgba(18,48,54,.92));
}
body.theme-atelier.dark .feature-empty-state {
  background: rgba(18,48,54,.55);
  border-color: rgba(143,176,180,.25);
}

@media (prefers-reduced-motion: reduce) {
  .feature-atelier.feature-enter .feature-stage-copy,
  .feature-atelier.feature-enter .feature-rise,
  .feature-stage-caustic,
  .feature-empty-orb,
  .chat-atmo-orb,
  .chat-empty-glow,
  .feature-atelier .tool-loading::before { animation: none !important; }
}
@media (max-width: 900px) {
  .feature-stage { min-height: 180px; }
  .feature-atelier .feature-layout { grid-template-columns: 1fr; }
  .feature-atelier .feature-card { min-height: 0; }
}

/* ===== 功能界面图标统一为斑马鱼 AI 图标（Zebrafish Hub） ===== */

/* 1) 左侧模块快捷入口：保持原字母方块样式（不使用斑马鱼图标） */

/* 2) 各功能页空状态色块 → 斑马鱼图标 */
.feature-empty-state .feature-empty-orb {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background-color: transparent;
  background-image: url("/static/assets/brand/zf-agent-emblem.png?v=20261012a");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  box-shadow: 0 12px 28px rgba(13, 115, 119, .22);
}

/* 3) 首页功能模块卡片缩略图：保持原设计（卡片影像轮播），不使用斑马鱼图标 */

/* ===== 图标流光边框：颜色循环 + 环绕流转（斑马鱼 AI 图标容器） ===== */
@property --zf-spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.chat-hero-mark,
.feature-empty-state .feature-empty-orb {
  position: relative;
  isolation: isolate;
}

.chat-hero-mark::before,
.feature-empty-state .feature-empty-orb::before {
  content: "";
  position: absolute;
  inset: -4px;
  padding: 4px;
  border-radius: 26px;
  background: conic-gradient(from var(--zf-spin),
    #0d7377, #22d3ee, #6366f1, #a855f7, #f59e0b, #10b981, #0d7377);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: zfBorderSpin 5.5s linear infinite;
  pointer-events: none;
  z-index: 2;
}

/* 环绕光晕：随边框同步呼吸 */
.chat-hero-mark::after,
.feature-empty-state .feature-empty-orb::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 32px;
  background: conic-gradient(from var(--zf-spin),
    rgba(13, 115, 119, .30), rgba(34, 211, 238, .30), rgba(99, 102, 241, .28),
    rgba(168, 85, 247, .26), rgba(245, 158, 11, .24), rgba(16, 185, 129, .28), rgba(13, 115, 119, .30));
  filter: blur(9px);
  opacity: .55;
  animation: zfBorderSpin 5.5s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes zfBorderSpin {
  to { --zf-spin: 360deg; }
}

/* 悬停时加快流转并增强光晕 */
.chat-hero-mark:hover::before,
.chat-hero-mark:hover::after,
.feature-empty-state .feature-empty-orb:hover::before,
.feature-empty-state .feature-empty-orb:hover::after {
  animation-duration: 2.4s;
}
.chat-hero-mark:hover::after,
.feature-empty-state .feature-empty-orb:hover::after {
  opacity: .8;
}

@media (prefers-reduced-motion: reduce) {
  .chat-hero-mark::before,
  .chat-hero-mark::after,
  .feature-empty-state .feature-empty-orb::before,
  .feature-empty-state .feature-empty-orb::after {
    animation: none !important;
  }
}

/* ==========================================================================
   Zebrafish Hub · 视觉升级层 V2「Atelier Polished」
   层次 / 光感 / 材质 / 节奏 —— 仅样式增强，不改结构与交互
   ========================================================================== */

/* ── 1. 设计令牌 ─────────────────────────────────────────────────────────── */
:root {
  --zf-ink: #08272c;
  --zf-ink-soft: #33565b;
  --zf-teal-900: #06373b;
  --zf-teal-700: #0d7377;
  --zf-teal-500: #14a08f;
  --zf-cyan: #22d3ee;
  --zf-indigo: #6366f1;
  --zf-hair: rgba(13, 115, 119, .13);
  --zf-hair-strong: rgba(13, 115, 119, .26);
  --zf-elev-1: 0 1px 2px rgba(6, 42, 46, .04), 0 10px 26px rgba(6, 42, 46, .07);
  --zf-elev-2: 0 2px 6px rgba(6, 42, 46, .06), 0 20px 48px rgba(6, 42, 46, .10);
  --zf-elev-3: 0 6px 14px rgba(6, 42, 46, .08), 0 34px 76px rgba(6, 42, 46, .16);
  --zf-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ── 2. 画布氛围：极光渐变 + 细网格 + 顶部渐隐 ──────────────────────────── */
body.theme-atelier {
  background:
    radial-gradient(1200px 620px at 10% -10%, rgba(34, 211, 238, .18), transparent 62%),
    radial-gradient(960px 540px at 92% -4%, rgba(99, 102, 241, .13), transparent 64%),
    radial-gradient(1100px 720px at 52% 112%, rgba(13, 115, 119, .13), transparent 62%),
    linear-gradient(180deg, #f3f9f8 0%, #eef5f7 44%, #e9f1f5 100%);
  background-attachment: fixed;
}
body.theme-atelier::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(13, 115, 119, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 115, 119, .04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(130% 92% at 50% 0%, #000, transparent 74%);
  mask-image: radial-gradient(130% 92% at 50% 0%, #000, transparent 74%);
}
body.theme-atelier .app { position: relative; z-index: 1; }

/* ── 3. 顶栏：玻璃材质 + 导航胶囊 + 徽章 ────────────────────────────────── */
body.theme-atelier .site-header {
  padding: 13px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .90), rgba(255, 255, 255, .66));
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(13, 115, 119, .12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 12px 34px rgba(6, 42, 46, .06);
}
body.theme-atelier .brand h1 { letter-spacing: -.02em; }
body.theme-atelier .brand p {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #7d9aa0;
}
body.theme-atelier .logo {
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(13, 115, 119, .20), 0 0 0 1px rgba(255, 255, 255, .7) inset;
}
body.theme-atelier .logo-mark { border-radius: 13px; }

body.theme-atelier .top-nav { gap: 2px; }
body.theme-atelier .top-nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  color: #3d5c60;
  transition: background .28s var(--zf-ease), color .28s var(--zf-ease),
              transform .28s var(--zf-ease), box-shadow .28s var(--zf-ease);
}
body.theme-atelier .top-nav-link:hover {
  background: rgba(13, 115, 119, .09);
  color: var(--zf-teal-900);
  transform: translateY(-1px);
}
body.theme-atelier .top-nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--zf-teal-700), var(--zf-teal-500));
  box-shadow: 0 10px 22px rgba(13, 115, 119, .26);
}
body.theme-atelier .badge {
  font-weight: 600;
  letter-spacing: .01em;
  border: 1px solid var(--zf-hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(246, 251, 251, .86));
  box-shadow: 0 1px 2px rgba(6, 42, 46, .05);
}
body.theme-atelier .badge.ok {
  color: #0f766e;
  border-color: rgba(16, 185, 129, .32);
  background: linear-gradient(180deg, #f0fdf9, #e6fbf3);
}
body.theme-atelier .badge.warn {
  color: #b45309;
  border-color: rgba(245, 158, 11, .30);
  background: linear-gradient(180deg, #fffaf0, #fef4e2);
}
body.theme-atelier .badge.pending,
body.theme-atelier .badge.loading {
  color: #0e7490;
  border-color: rgba(34, 211, 238, .32);
  background: linear-gradient(180deg, #f0fbff, #e6f7fd);
}
body.theme-atelier .icon-btn,
body.theme-atelier .history-toggle-btn {
  border-radius: 12px;
  border: 1px solid var(--zf-hair);
  background: linear-gradient(180deg, #fff, #f5fbfb);
  transition: transform .25s var(--zf-ease), box-shadow .25s var(--zf-ease),
              border-color .25s var(--zf-ease);
}
body.theme-atelier .icon-btn:hover,
body.theme-atelier .history-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: var(--zf-hair-strong);
  box-shadow: 0 8px 20px rgba(6, 42, 46, .10);
}

/* ── 4. 侧栏：玻璃面板 + 激活指示条 + 字母方块质感 ──────────────────────── */
body.theme-atelier .side-rail {
  padding: 10px 8px;
  border: 1px solid var(--zf-hair);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .80), rgba(255, 255, 255, .58));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--zf-elev-1);
}
body.theme-atelier .rail-item {
  position: relative;
  border-radius: 14px;
  transition: background .25s var(--zf-ease), transform .25s var(--zf-ease);
}
body.theme-atelier .rail-item:hover {
  background: rgba(13, 115, 119, .08);
  transform: translateY(-2px);
}
body.theme-atelier .rail-item.active {
  background: linear-gradient(180deg, rgba(13, 115, 119, .10), rgba(13, 115, 119, .04));
}
body.theme-atelier .rail-item.active::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 3px;
  height: 58%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--zf-cyan), var(--zf-teal-700));
  box-shadow: 0 0 12px rgba(34, 211, 238, .65);
}
body.theme-atelier .rail-mark {
  border: 1px solid rgba(13, 115, 119, .16);
  background: linear-gradient(145deg, rgba(255, 255, 255, .95), rgba(226, 246, 244, .78));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 2px 6px rgba(6, 42, 46, .07);
  transition: transform .3s var(--zf-ease), box-shadow .3s var(--zf-ease),
              background .3s var(--zf-ease), color .3s var(--zf-ease);
}
body.theme-atelier .rail-item:hover .rail-mark { transform: translateY(-1px) scale(1.05); }
body.theme-atelier .rail-item.active .rail-mark {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, var(--zf-teal-700), var(--zf-teal-500));
  box-shadow: 0 10px 22px rgba(13, 115, 119, .34);
}
body.theme-atelier .rail-item small { letter-spacing: .01em; }

/* ── 5. 首页：标题渐层 / 搜索框 / 统计 / 卡片 ──────────────────────────── */
body.theme-atelier .home-headline {
  font-size: clamp(26px, 3.3vw, 40px);
  line-height: 1.08;
  letter-spacing: -.025em;
  background: linear-gradient(120deg, #08272c 0%, #0d7377 46%, #14a08f 72%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.theme-atelier .home-stage-copy .home-lead {
  color: #4a6b70;
  font-size: 14.5px;
  line-height: 1.75;
  max-width: 62ch;
}
body.theme-atelier .home-search {
  padding: 7px;
  border: 1px solid rgba(13, 115, 119, .16);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f7fbfb);
  box-shadow: 0 1px 0 #fff inset, 0 2px 6px rgba(6, 42, 46, .05), 0 16px 38px rgba(6, 42, 46, .08);
  transition: box-shadow .3s var(--zf-ease), border-color .3s var(--zf-ease), transform .3s var(--zf-ease);
}
body.theme-atelier .home-search:focus-within {
  border-color: rgba(20, 160, 143, .48);
  transform: translateY(-1px);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .16), 0 20px 46px rgba(6, 42, 46, .12);
}
body.theme-atelier .home-search input,
body.theme-atelier .home-search select { background: transparent; border: none; }
body.theme-atelier .home-search button {
  border-radius: 13px;
  background: linear-gradient(135deg, var(--zf-teal-700), var(--zf-teal-500));
  box-shadow: 0 10px 22px rgba(13, 115, 119, .26);
  transition: transform .25s var(--zf-ease), box-shadow .25s var(--zf-ease), filter .25s var(--zf-ease);
}
body.theme-atelier .home-search button:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
  box-shadow: 0 14px 30px rgba(13, 115, 119, .32);
}
body.theme-atelier .home-cta {
  border-radius: 13px;
  border: 1px solid var(--zf-hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(245, 251, 251, .88));
  font-weight: 600;
  transition: transform .28s var(--zf-ease), box-shadow .28s var(--zf-ease), border-color .28s var(--zf-ease);
}
body.theme-atelier .home-cta:hover {
  transform: translateY(-2px);
  border-color: var(--zf-hair-strong);
  box-shadow: 0 16px 34px rgba(6, 42, 46, .12);
}
body.theme-atelier .home-cta.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--zf-teal-700), var(--zf-teal-500) 70%, var(--zf-cyan));
  box-shadow: 0 14px 30px rgba(13, 115, 119, .28);
}
body.theme-atelier .home-cta.primary:hover { box-shadow: 0 20px 44px rgba(13, 115, 119, .34); }

/* 实时库规模 */
body.theme-atelier .home-metrics,
body.theme-atelier .home-atelier {
  border: 1px solid var(--zf-hair);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(250, 253, 253, .86));
  box-shadow: var(--zf-elev-1);
  overflow: hidden;
}
body.theme-atelier .home-metrics { position: relative; }
body.theme-atelier .home-metrics::after,
body.theme-atelier .home-atelier::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .55), transparent);
  pointer-events: none;
}
body.theme-atelier .home-stats { border-top: 1px solid rgba(13, 115, 119, .10); }
body.theme-atelier .home-stat {
  padding: 16px 14px;
  transition: background .3s var(--zf-ease), transform .3s var(--zf-ease);
}
body.theme-atelier .home-stat:hover {
  transform: translateY(-3px);
  background: radial-gradient(120px 60px at 50% 0%, rgba(34, 211, 238, .16), transparent 70%);
}
body.theme-atelier .home-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
  background: linear-gradient(120deg, var(--zf-teal-900), var(--zf-teal-500) 68%, var(--zf-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.theme-atelier .home-stat span {
  margin-top: 4px;
  display: block;
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7d9aa0;
}

/* 功能模块卡片 */
body.theme-atelier .module-card.wave-card {
  border: 1px solid rgba(13, 115, 119, .13);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(250, 253, 253, .98));
  box-shadow: var(--zf-elev-1);
  transition: transform .35s var(--zf-ease), box-shadow .35s var(--zf-ease),
              border-color .35s var(--zf-ease);
}
body.theme-atelier .module-card.wave-card:hover {
  transform: translateY(-7px) scale(1.012);
  border-color: rgba(13, 115, 119, .40);
  box-shadow: var(--zf-elev-3);
}
body.theme-atelier .module-thumb {
  transition: transform .5s var(--zf-ease), filter .5s var(--zf-ease);
}
body.theme-atelier .module-card.wave-card:hover .module-thumb {
  filter: saturate(1.12) contrast(1.04);
}
body.theme-atelier .module-body {
  border-top: 1px solid rgba(13, 115, 119, .08);
  background: linear-gradient(180deg, rgba(255, 255, 255, .6), transparent);
}
body.theme-atelier .module-card h4 { letter-spacing: -.015em; }
body.theme-atelier .gallery-credit { color: #86a3a8; }

/* ── 6. 影像流：圆角 + 悬停放大 + 徽章 ─────────────────────────────────── */
body.theme-atelier .reef-stream-viewport {
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 14px 36px rgba(6, 42, 46, .10);
}
body.theme-atelier .reef-tile {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(6, 42, 46, .10);
}
body.theme-atelier .reef-tile:hover {
  box-shadow: 0 12px 28px rgba(6, 42, 46, .20);
  z-index: 3;
}
body.theme-atelier .reef-badge {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .04em;
  backdrop-filter: blur(4px);
  background: rgba(6, 42, 46, .55);
  border: 1px solid rgba(255, 255, 255, .22);
}
body.theme-atelier .reef-mode-btn {
  border-radius: 999px;
  border: 1px solid var(--zf-hair);
  background: linear-gradient(180deg, #fff, #f5fbfb);
  transition: transform .25s var(--zf-ease), box-shadow .25s var(--zf-ease), color .25s var(--zf-ease);
}
body.theme-atelier .reef-mode-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(6, 42, 46, .10); }

/* ── 7. 问答区：面板 / 气泡 / 输入 / 快捷提示 ──────────────────────────── */
body.theme-atelier .chat-panel,
body.theme-atelier .detail-panel,
body.theme-atelier .history-panel {
  border: 1px solid var(--zf-hair);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(251, 254, 254, .86));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--zf-elev-1);
}
body.theme-atelier .avatar {
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(6, 42, 46, .12);
}
body.theme-atelier .msg.bot .avatar {
  color: #fff;
  background: linear-gradient(135deg, var(--zf-teal-700), var(--zf-teal-500));
}
body.theme-atelier .msg.user .avatar {
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #22d3ee);
}
body.theme-atelier .bubble {
  border-radius: 16px;
  line-height: 1.72;
}
body.theme-atelier .msg.bot .bubble {
  border: 1px solid rgba(13, 115, 119, .12);
  background: linear-gradient(180deg, #ffffff, #f8fcfc);
  box-shadow: 0 2px 6px rgba(6, 42, 46, .05), 0 14px 34px rgba(6, 42, 46, .07);
}
body.theme-atelier .msg.user .bubble {
  color: #fff;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--zf-teal-700), var(--zf-teal-500));
  box-shadow: 0 12px 26px rgba(13, 115, 119, .26);
}
body.theme-atelier .msg.user .bubble a,
body.theme-atelier .msg.user .bubble code { color: #eafffb; }
body.theme-atelier .input-area {
  border-top: 1px solid rgba(13, 115, 119, .10);
  background: linear-gradient(180deg, rgba(255, 255, 255, .8), rgba(248, 252, 252, .94));
}
body.theme-atelier .input-area textarea {
  border-radius: 16px;
  border: 1px solid var(--zf-hair);
  background: #fff;
  box-shadow: 0 1px 0 #fff inset, 0 6px 18px rgba(6, 42, 46, .05);
  transition: box-shadow .3s var(--zf-ease), border-color .3s var(--zf-ease);
}
body.theme-atelier .input-area textarea:focus {
  border-color: rgba(20, 160, 143, .48);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .15), 0 10px 26px rgba(6, 42, 46, .08);
}
body.theme-atelier #sendBtn,
body.theme-atelier .feature-mount button,
body.theme-atelier .welcome-primary {
  border: none;
  border-radius: 14px;
  color: #fff;
  font-weight: 650;
  background: linear-gradient(135deg, var(--zf-teal-700), var(--zf-teal-500) 72%, var(--zf-cyan));
  box-shadow: 0 12px 26px rgba(13, 115, 119, .26);
  transition: transform .25s var(--zf-ease), box-shadow .25s var(--zf-ease), filter .25s var(--zf-ease);
}
body.theme-atelier #sendBtn:hover,
body.theme-atelier .feature-mount button:hover,
body.theme-atelier .welcome-primary:hover {
  transform: translateY(-1px);
  filter: saturate(1.12);
  box-shadow: 0 18px 40px rgba(13, 115, 119, .32);
}
body.theme-atelier .quick-prompt {
  border-radius: 999px;
  border: 1px solid var(--zf-hair);
  background: linear-gradient(180deg, #fff, #f5fbfb);
  font-weight: 600;
  transition: transform .25s var(--zf-ease), box-shadow .25s var(--zf-ease),
              border-color .25s var(--zf-ease), color .25s var(--zf-ease);
}
body.theme-atelier .quick-prompt:hover {
  transform: translateY(-2px);
  color: var(--zf-teal-900);
  border-color: rgba(20, 160, 143, .42);
  box-shadow: 0 12px 26px rgba(6, 42, 46, .12);
}
body.theme-atelier .msg-actions button {
  border-radius: 10px;
  border: 1px solid var(--zf-hair);
  background: rgba(255, 255, 255, .9);
  transition: transform .2s var(--zf-ease), box-shadow .2s var(--zf-ease);
}
body.theme-atelier .msg-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(6, 42, 46, .12);
}

/* ── 8. 工具页 ─────────────────────────────────────────────────────────── */
body.theme-atelier .feature-card {
  border: 1px solid var(--zf-hair);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(250, 253, 253, .88));
  box-shadow: var(--zf-elev-1);
}
body.theme-atelier .feature-head h2 { letter-spacing: -.02em; }

/* ── 9. 细节：滚动条 / 焦点环 / 入场动画 ──────────────────────────────── */
body.theme-atelier ::-webkit-scrollbar { width: 10px; height: 10px; }
body.theme-atelier ::-webkit-scrollbar-track { background: transparent; }
body.theme-atelier ::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(13, 115, 119, .38), rgba(34, 211, 238, .34));
  background-clip: content-box;
}
body.theme-atelier ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(13, 115, 119, .62), rgba(34, 211, 238, .55));
  background-clip: content-box;
}
body.theme-atelier :focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .35);
  border-radius: 10px;
}

@keyframes zfRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
body.theme-atelier .home-stage-copy,
body.theme-atelier .home-metrics,
body.theme-atelier .home-atelier,
body.theme-atelier .home-reef-stream {
  animation: zfRise .72s var(--zf-ease) both;
}
body.theme-atelier .home-metrics { animation-delay: .08s; }
body.theme-atelier .home-atelier { animation-delay: .16s; }
body.theme-atelier .home-reef-stream { animation-delay: .24s; }

/* ── 10. 暗色主题适配 ─────────────────────────────────────────────────── */
body.theme-atelier.dark {
  background:
    radial-gradient(1100px 560px at 12% -8%, rgba(34, 211, 238, .13), transparent 60%),
    radial-gradient(900px 520px at 90% -6%, rgba(99, 102, 241, .16), transparent 62%),
    linear-gradient(180deg, #04161a 0%, #061c22 52%, #041418 100%);
}
body.theme-atelier.dark::before { opacity: .5; }
body.theme-atelier.dark .site-header {
  background: linear-gradient(180deg, rgba(9, 32, 38, .92), rgba(9, 32, 38, .70));
  border-bottom-color: rgba(143, 176, 180, .18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 34px rgba(0, 0, 0, .28);
}
body.theme-atelier.dark .brand p { color: #7fa0a6; }
body.theme-atelier.dark .top-nav-link { color: #9fc3c7; }
body.theme-atelier.dark .top-nav-link:hover { background: rgba(34, 211, 238, .10); color: #dcffff; }
body.theme-atelier.dark .side-rail,
body.theme-atelier.dark .chat-panel,
body.theme-atelier.dark .detail-panel,
body.theme-atelier.dark .history-panel,
body.theme-atelier.dark .home-metrics,
body.theme-atelier.dark .home-atelier,
body.theme-atelier.dark .feature-card {
  border-color: rgba(143, 176, 180, .18);
  background: linear-gradient(180deg, rgba(10, 34, 40, .94), rgba(8, 28, 34, .88));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .30), 0 24px 54px rgba(0, 0, 0, .34);
}
body.theme-atelier.dark .rail-mark { background: rgba(255, 255, 255, .06); border-color: rgba(143, 176, 180, .22); color: #cdeeed; }
body.theme-atelier.dark .home-headline {
  background: linear-gradient(120deg, #eafcff 0%, #7fe3dc 48%, #34d3f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.theme-atelier.dark .home-stat strong {
  background: linear-gradient(120deg, #dffcfb, #5fd6cb 70%, #34d3f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.theme-atelier.dark .home-stat span,
body.theme-atelier.dark .home-stage-copy .home-lead { color: #8fb0b6; }
body.theme-atelier.dark .home-search,
body.theme-atelier.dark .home-cta,
body.theme-atelier.dark .quick-prompt,
body.theme-atelier.dark .reef-mode-btn,
body.theme-atelier.dark .icon-btn,
body.theme-atelier.dark .history-toggle-btn {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(143, 176, 180, .22);
  color: #dbeeee;
}
body.theme-atelier.dark .module-card.wave-card {
  border-color: rgba(143, 176, 180, .16);
  background: linear-gradient(180deg, rgba(12, 38, 44, .96), rgba(9, 30, 36, .94));
}
body.theme-atelier.dark .module-body { border-top-color: rgba(143, 176, 180, .12); }
body.theme-atelier.dark .msg.bot .bubble {
  border-color: rgba(143, 176, 180, .20);
  background: linear-gradient(180deg, rgba(16, 44, 50, .96), rgba(12, 36, 42, .94));
  color: #e2f4f4;
}
body.theme-atelier.dark .input-area textarea {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(143, 176, 180, .22);
  color: #e6f6f6;
}
body.theme-atelier.dark .badge { background: rgba(255, 255, 255, .06); border-color: rgba(143, 176, 180, .22); }

@media (prefers-reduced-motion: reduce) {
  body.theme-atelier .home-stage-copy,
  body.theme-atelier .home-metrics,
  body.theme-atelier .home-atelier,
  body.theme-atelier .home-reef-stream { animation: none !important; }
}

/* ── 修正：画布背景需要 !important 才能覆盖基础规则
      （style.css 顶部有 `html, body { background: var(--bg) !important; }`，
        同 important 下按特异性决胜 → html body.theme-atelier 更高） ── */
html body.theme-atelier {
  background:
    radial-gradient(1200px 620px at 10% -10%, rgba(34, 211, 238, .20), transparent 62%),
    radial-gradient(960px 540px at 92% -4%, rgba(99, 102, 241, .14), transparent 64%),
    radial-gradient(1100px 720px at 52% 112%, rgba(13, 115, 119, .14), transparent 62%),
    linear-gradient(180deg, #f3f9f8 0%, #eef5f7 44%, #e9f1f5 100%) !important;
  background-attachment: fixed !important;
}
html body.theme-atelier.dark {
  background:
    radial-gradient(1100px 560px at 12% -8%, rgba(34, 211, 238, .14), transparent 60%),
    radial-gradient(900px 520px at 90% -6%, rgba(99, 102, 241, .18), transparent 62%),
    linear-gradient(180deg, #04161a 0%, #061c22 52%, #041418 100%) !important;
  background-attachment: fixed !important;
}

