/* ============================================================================
   智慧家谱平台 · 主样式 (style.css)
   深色科技感 / 浅色宣纸风 双主题
   ============================================================================ */

/* ====== CSS 变量（双主题） ====== */
:root,
[data-theme="dark"] {
  --bg: #0a0e17;
  --bg2: #111827;
  --bg3: #1a2235;
  --surface: rgba(255,255,255,.04);
  --surface-hover: rgba(255,255,255,.08);
  --border: rgba(255,255,255,.08);
  --text: #e8eaed;
  --text2: #9aa0b4;
  --muted: #606878;
  --accent: #c0392b;
  --accent-soft: rgba(192,57,43,.15);
  --accent-glow: rgba(192,57,43,.35);
  --gold: #d4a017;
  --gold-soft: rgba(212,160,23,.55);
  --green: #27ae60;
  --green-soft: rgba(39,174,96,.15);
  --blue: #2f80ed;
  --blue-soft: rgba(47,128,237,.15);
  --glass-bg: rgba(255,255,255,.035);
  --glass-border: rgba(255,255,255,.1);
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --border-strong: rgba(255,255,255,.18);
  --cinnabar: #c0392b;
  --jade-soft: #56d364;
  --text-soft: #b9c0cc;
  --surface-2: rgba(255,255,255,.06);
  --surface-solid: #111827;
}

[data-theme="light"] {
  --bg: #f5f0e8;
  --bg2: #ede7db;
  --bg3: #e8dfd0;
  --surface: rgba(43,32,15,.045);
  --surface-hover: rgba(43,32,15,.075);
  --border: rgba(67,52,29,.18);
  --text: #2c2418;
  --text2: #5a4e3a;
  --muted: #71644f;
  --accent: #8a1f1f;
  --accent-soft: rgba(138,31,31,.1);
  --accent-glow: rgba(138,31,31,.25);
  --gold: #77560d;
  --gold-soft: #70520d;
  --green: #1a6e33;
  --green-soft: rgba(26,110,51,.1);
  --blue: #1a56b5;
  --blue-soft: rgba(26,86,181,.1);
  --glass-bg: rgba(255,253,249,.78);
  --glass-border: rgba(67,52,29,.16);
  --shadow: 0 4px 20px rgba(0,0,0,.1);
  --sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --border-strong: rgba(67,52,29,.32);
  --cinnabar: #a01b1b;
  --jade-soft: #1a6e33;
  --text-soft: #6b5f49;
  --surface-2: rgba(67,52,29,.07);
  --surface-solid: #fffdf9;
}

/* ====== Reset & Base ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
a { color: var(--accent); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .85; }
img { max-width: 100%; display: block; }
input, select, button, textarea {
  font-family: inherit; font-size: inherit;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; outline: none; transition: border .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option, select optgroup {
  background: var(--surface-solid);
  color: var(--text);
}

/* ====== 布局 ====== */
main { padding-top: 64px; } /* topbar height offset */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .35s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }

/* ====== 顶栏 Topbar ====== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  height: 60px; background: rgba(10,14,23,.85); backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .topbar { background: rgba(245,240,232,.88); }
.brand {
  display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700;
  font-size: 16px; white-space: nowrap; flex-shrink: 0;
}
.brand small { font-size: 10px; color: var(--muted); margin-left: 4px; letter-spacing: 1px; font-weight: 400; }
.seal {
  width: 32px; height: 32px; line-height: 32px; text-align: center;
  background: linear-gradient(135deg, var(--accent), #e74c3c);
  color: #fff; border-radius: 8px; font-size: 18px; font-weight: 900; flex-shrink: 0;
}
.brand-seal-image {
  display: block; width: 32px; height: 32px; object-fit: cover; border-radius: 8px;
  flex-shrink: 0; box-shadow: 0 4px 14px rgba(192,57,43,.28);
}
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--text2); font-size: 14px; padding: 6px 12px; border-radius: var(--radius-sm);
  white-space: nowrap; transition: all .2s; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-hover); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.spacer { flex: 1; }
.theme-switch { display: flex; gap: 2px; flex-shrink: 0; }
.theme-switch button {
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px; font-size: 16px;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.theme-switch button:hover { background: var(--surface-hover); }
.theme-switch button.active { background: var(--accent-soft); border-color: var(--accent); }

/* ====== Hero 首页 ====== */
.hero {
  position: relative; min-height: 560px; display: flex; align-items: center;
  overflow: hidden; padding: 72px 0 64px; isolation: isolate; background: var(--bg);
}
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.hero::after {
  z-index: 1;
  background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 90%, transparent) 38%, color-mix(in srgb, var(--bg) 30%, transparent) 68%, transparent 100%);
}
.hero-art {
  position: absolute; z-index: 0; inset: 0 0 0 auto; width: min(58%, 820px); overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 28%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 28%);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: right center; }
[data-theme="dark"] .hero-art img { filter: brightness(.62) saturate(.72); }
.hero-canvas {
  position: absolute; inset: 0; z-index: 1; opacity: .14; pointer-events: none;
}
.hero .container {
  position: absolute; z-index: 2; left: max(24px, calc((100% - 1160px) / 2));
  top: 50%; transform: translateY(-50%); width: min(570px, calc(100% - 48px));
  max-width: 1160px; margin: 0; text-align: left;
}
.eyebrow {
  display: inline-block; font-size: 13px; color: var(--gold); font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 16px;
}
.hero h1 { max-width: 660px; font-size: clamp(36px, 5.2vw, 60px); line-height: 1.18; font-weight: 800; margin-bottom: 20px; letter-spacing: .015em; }
.hero .accent { color: var(--accent); }
.hero .lead {
  font-size: 16px; color: var(--text2); max-width: 570px; margin-bottom: 28px; line-height: 1.8;
}
.hero-stats { display: flex; gap: 14px; margin-bottom: 36px; flex-wrap: wrap; }
.hstat {
  padding: 14px 20px; border-radius: var(--radius); backdrop-filter: blur(10px);
  background: var(--glass-bg); border: 1px solid var(--glass-border); min-width: 90px; text-align: center;
}
.hv { font-size: 28px; font-weight: 800; color: var(--accent); }
.hl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .eyebrow { padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--glass-bg); }
.hero .hstat { min-width: 104px; padding: 12px 18px; backdrop-filter: blur(12px); }
.hero .hv { font-variant-numeric: tabular-nums; }

/* ====== 按钮 ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 22px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: all .2s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #e74c3c); color: #fff;
  border-color: transparent; box-shadow: 0 2px 12px var(--accent-glow);
}
.btn.primary:hover { filter: brightness(1.1); transform: translateY(-2px); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }
.btn.warn {
  background: linear-gradient(135deg, #f2994a, #f2c94c); color: #3a2a00;
  border-color: transparent; font-weight: 600;
}
.btn.warn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.done { opacity: .65; cursor: default; }
.btn[disabled] { opacity: .55; cursor: default; }
.gr-rerun-status {
  display: inline-block; margin-left: 6px; font-size: 12px; color: var(--gold, #D4A017);
  max-width: 240px; vertical-align: middle;
}
.magnetic { transition: transform .25s cubic-bezier(.25,.46,.45,.94), box-shadow .25s; }

/* ====== Section 通用 ====== */
.section { padding: 50px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .kicker {
  font-size: 13px; color: var(--gold); font-weight: 600; letter-spacing: 2px; margin-bottom: 10px;
}
.section-head h2 { font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.section-head p { color: var(--text2); max-width: 560px; margin: 0 auto; font-size: 15px; }

/* ====== Glass 毛玻璃卡片 ====== */
.glass {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius); backdrop-filter: blur(12px) saturate(150%);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.glass:hover {
  border-color: rgba(255,255,255,.18); box-shadow: var(--shadow); transform: translateY(-2px);
}
[data-theme="light"] .glass:hover { border-color: rgba(0,0,0,.18); }

/* ====== Reveal 动画 ====== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ====== 族谱卡片网格 ====== */
.clan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.clan-card {
  padding: 24px; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
}
.clan-card .hall { font-size: 12px; color: var(--gold); font-weight: 600; }
.clan-card h3 { font-size: 19px; font-weight: 700; }
.clan-card .founder { font-size: 13px; color: var(--text2); }
.clan-card .stats { display: flex; gap: 20px; margin-top: 8px; }
.clan-card .stats .num { font-size: 24px; font-weight: 800; color: var(--accent); }
.clan-card .stats .lbl { font-size: 11px; color: var(--muted); }
.clan-card .go {
  margin-top: auto; padding-top: 12px; font-size: 13px; color: var(--accent);
  font-weight: 600; opacity: 0; transition: opacity .2s;
}
.clan-card:hover .go { opacity: 1; }

/* ====== 功能特性网格 ====== */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.feat { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.feat .ico { font-size: 32px; }
.feat h4 { font-size: 17px; font-weight: 700; }
.feat p { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* ====== 工具栏（探索页） ====== */
.toolbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 3px; border-radius: var(--radius-sm); }
.tabs button {
  background: transparent; border: none; padding: 6px 16px; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--text2); font-weight: 500; transition: all .2s;
}
.tabs button.active { background: var(--accent); color: #fff; }
.tabs button:hover:not(.active) { background: var(--surface-hover); }

.chip {
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
  padding: 5px 14px; border-radius: 20px; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: all .2s; font-weight: 500;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.search-box {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 12px; transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box .si { font-size: 15px; flex-shrink: 0; }
.search-box input {
  background: transparent; border: none; padding: 8px 4px; flex: 1; min-width: 0;
}
.search-box input::placeholder { color: var(--muted); }

.root-select-wrap { display: flex; align-items: center; gap: 8px; }
.rs-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.root-select { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.root-select option { background: var(--surface-solid); color: var(--text); }
.rs-count { font-size: 12px; color: var(--muted); }
.tree-tools { display: flex; gap: 8px; }
.tree-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
  padding: 5px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; transition: all .2s;
}
.tree-btn:hover { border-color: var(--accent); color: var(--accent); }
.export-excel-btn {
  background: linear-gradient(135deg, var(--accent), #e74c3c); color: #fff;
  border-color: transparent; font-weight: 600; box-shadow: 0 2px 10px var(--accent-glow);
}
.export-excel-btn:hover { filter: brightness(1.08); color: #fff; transform: translateY(-1px); border-color: transparent; }
.export-excel-btn:disabled { opacity: .6; cursor: progress; filter: none; transform: none; }

/* ====== 树状图区域 ====== */
/* .tree-wrap 是主页+编辑器共用的 class；#tree-wrap 仅主页，#editor-tree-wrap 仅编辑器 */
.tree-wrap { width: 100%; min-height: 500px; position: relative; }
#tree-wrap { min-height: 500px; }
#editor-tree-wrap { height: 72vh; min-height: 400px; overflow: hidden; position: relative; }
#tree-svg { width: 100%; height: 520px; display: block; cursor: grab; background: var(--surface); border-radius: var(--radius); }
#editor-tree-svg { width: 100%; height: 100%; display: block; cursor: grab; }
#tree-svg.grabbing { cursor: grabbing; }
#tree-banner {
  display: none; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; padding: 6px 14px; border-radius: var(--radius-sm); margin-bottom: 8px;
}
#tree-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
#tree-coverage { font-size: 12px; color: var(--gold-soft); margin-bottom: 8px; }

/* ====== 世系树节点（tree.js 运行时动态生成，此前缺失导致黑底黑字不可见） ====== */
#tree-svg .tnode, #editor-tree-svg .tnode { cursor: pointer; }
#tree-svg .tnode-rect, #editor-tree-svg .tnode-rect {
  fill: var(--bg3);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: fill .15s, stroke .15s;
}
#tree-svg .tnode:hover .tnode-rect, #editor-tree-svg .tnode:hover .tnode-rect {
  fill: var(--surface-hover);
  stroke: var(--accent);
}
#tree-svg .tnode.is-root .tnode-rect, #editor-tree-svg .tnode.is-root .tnode-rect {
  stroke: var(--gold);
  stroke-width: 2;
}
#tree-svg .tnode.selected .tnode-rect, #editor-tree-svg .tnode.selected .tnode-rect {
  stroke: var(--accent);
  stroke-width: 2.5;
  fill: var(--accent-soft);
}
#tree-svg .tnode-bar, #editor-tree-svg .tnode-bar { fill: var(--accent); }
#tree-svg .tnode.is-root .tnode-bar, #editor-tree-svg .tnode.is-root .tnode-bar { fill: var(--gold); }
#tree-svg .tnode-name, #editor-tree-svg .tnode-name {
  fill: var(--text);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  pointer-events: none;
}
#tree-svg .tnode-sub, #editor-tree-svg .tnode-sub {
  fill: var(--text2);
  font-size: 12px;
  font-family: var(--font);
  pointer-events: none;
}
#tree-svg .tnode-spouse, #editor-tree-svg .tnode-spouse {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  pointer-events: none;
}
#tree-svg .tnode-doubt, #editor-tree-svg .tnode-doubt {
  fill: #C0392B;
  font-size: 11px;
  font-weight: 700;
}
.doubt { color: #C0392B; font-weight: 700; font-size: 0.92em; }
#tree-svg .edge, #editor-tree-svg .edge {
  fill: none;
  stroke: var(--text2);
  stroke-width: 1.5;
  opacity: .6;
}
#tree-svg .edge.dashed, #editor-tree-svg .edge.dashed {
  stroke-dasharray: 5 4;
  stroke: var(--green);
  opacity: .85;
}
#tree-svg .edge-label, #editor-tree-svg .edge-label {
  fill: var(--green);
  font-size: 11px;
  font-family: var(--font);
}
#tree-svg .tnode-toggle, #editor-tree-svg .tnode-toggle { cursor: pointer; }
#tree-svg .toggle-circle, #editor-tree-svg .toggle-circle {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 1;
}
#tree-svg .tnode-toggle.collapsed .toggle-circle,
#editor-tree-svg .tnode-toggle.collapsed .toggle-circle { fill: var(--muted); }
#tree-svg .toggle-sign, #editor-tree-svg .toggle-sign {
  fill: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  pointer-events: none;
}

/* ====== 世系总览（Bands） ====== */
#bands-wrap { padding: 10px 0; }
.band { margin-bottom: 20px; }
.band-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.band-head .pai {
  font-size: 15px; font-weight: 700; color: var(--accent); min-width: 80px;
}
.band-head .cnt { font-size: 12px; color: var(--muted); }
.band-head .line { flex: 1; height: 1px; background: var(--border); }
.band-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 10px; font-size: 13px; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 4px;
}
.person-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.person-chip.founder { border-color: var(--gold); color: var(--gold); }
.person-chip.has-spouse::after { content: '♡'; font-size: 10px; color: var(--accent); margin-left: 2px; }
.pn { font-weight: 600; }
.pg { font-size: 11px; color: var(--muted); }

/* ====== 详情面板 ====== */
#detail-panel {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 20px; margin-top: 16px; backdrop-filter: blur(12px);
}
.d-name { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.d-pai { font-size: 13px; color: var(--gold-soft); margin-bottom: 14px; }
.d-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.d-row:last-of-type { border-bottom: none; }
.d-row .k { color: var(--muted); min-width: 70px; flex-shrink: 0; font-weight: 600; font-size: 13px; }
.d-row .v { color: var(--text); word-break: break-all; }
.d-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.d-sub { font-size: 12px; color: var(--muted); margin-top: 12px; }
.rel-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.rel-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; font-size: 14px;
}
.rel-item:hover { background: var(--surface-hover); }
.rel-item .tag { font-size: 11px; color: var(--muted); margin-left: auto; }
.rel-item .go { color: var(--accent); }
.muted { color: var(--muted); }

/* ====== 检索结果 ====== */
.result-empty {
  text-align: center; padding: 48px 20px; color: var(--muted); font-size: 15px;
}
.result-card {
  padding: 14px 18px; cursor: pointer; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.rc-top { display: flex; align-items: baseline; gap: 10px; }
.rc-name { font-size: 16px; font-weight: 700; }
.rc-clan { font-size: 12px; color: var(--muted); }
.rc-meta { font-size: 13px; color: var(--text2); white-space: nowrap; }

/* ====== 数据看板 ====== */
.dash-clans { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 28px; align-items: stretch; }
.stat-card { padding: 18px 22px; text-align: center; min-width: 120px; flex: 1 1 140px; }
.sv { font-size: 28px; font-weight: 800; color: var(--accent); }
.sl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-title { font-size: 16px; font-weight: 700; margin: 24px 0 16px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 280px; padding: 0 10px; flex-wrap: wrap; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 30px; }
.bar { width: 100%; max-width: 40px; border-radius: 6px 6px 2px 2px; background: linear-gradient(to top, var(--accent), var(--gold)); transition: height .5s ease; min-height: 4px; }
.bn { font-size: 11px; font-weight: 700; color: var(--text); }
.bp { font-size: 10px; color: var(--muted); text-align: center; }

/* ====== 百家姓浏览器 ====== */
.surname-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.surname-card {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; border-radius: var(--radius); transition: all .2s;
}
.surname-card:hover { transform: scale(1.06); }
.sc-char { font-size: 32px; font-weight: 900; }
.sc-py { font-size: 11px; color: var(--muted); }
.sc-meta { font-size: 10px; color: var(--muted); }
.sc-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; margin-top: 4px; }
.sc-badge.tree { background: var(--green-soft); color: var(--green); }
.sc-badge.source { background: var(--blue-soft); color: var(--blue); }
.sc-badge.pending { background: var(--surface); color: var(--muted); }
.bz-stats { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.bzstat { padding: 14px 20px; text-align: center; min-width: 100px; }
.bv { font-size: 24px; font-weight: 800; color: var(--accent); }
.bl { font-size: 11px; color: var(--muted); }

/* ====== Modal 弹窗 ====== */
#surname-modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 24px;
}
#surname-modal.show { display: flex; animation: modalIn .25s ease; }
@keyframes modalIn { from{opacity:0} to{opacity:1} }
.modal-content {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; max-width: 520px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.src-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.src-char { font-size: 48px; font-weight: 900; color: var(--accent); }
.src-name { font-size: 20px; font-weight: 700; }
.src-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.src-tip { font-size: 14px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
.src-tip.warn { color: var(--gold); }
.src-row { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.src-row .k { color: var(--muted); min-width: 72px; flex-shrink: 0; font-weight: 600; }
.src-row .v { color: var(--text); }
.src-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.contrib-steps { margin-top: 16px; padding: 16px; background: var(--surface); border-radius: var(--radius-sm); font-size: 14px; }
.cs-title { font-weight: 700; margin-bottom: 10px; color: var(--gold); }
.cs-option { padding: 12px; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg2); }
.cs-option b { color: var(--text); }
.cs-option p { margin: 6px 0 0; color: var(--text2); line-height: 1.7; }
.cs-option .btn { margin-top: 10px; }
.cs-note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ====== Toast 提示 ====== */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  padding: 10px 24px; border-radius: 99px; font-size: 14px; z-index: 999;
  opacity: 0; pointer-events: none; transition: all .3s; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ====== 顶栏增强 ====== */
.topbar {
  height: 64px;
  background: rgba(10,14,23,.82);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 2px 18px rgba(0,0,0,.35);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-soft) 22%, var(--gold) 50%, var(--gold-soft) 78%, transparent);
  opacity: .65; pointer-events: none;
}
[data-theme="light"] .topbar {
  background: rgba(245,240,232,.9);
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
}
.brand { gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.18; }
.brand-text small { letter-spacing: 1.5px; margin: 1px 0 0; }
.brand-tag {
  font-style: normal; font-size: 11px; color: var(--gold);
  font-weight: 600; letter-spacing: 1px; margin-top: 1px;
}
.seal {
  box-shadow: 0 4px 14px rgba(192,57,43,.45), inset 0 1px 0 rgba(255,255,255,.3);
}
.nav a { position: relative; }
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  background: var(--gold); border-radius: 2px; opacity: .9;
  transform: scaleX(0); transform-origin: center; transition: transform .25s ease;
}
.nav a:hover::after,
.nav a.active::after { transform: scaleX(1); }
.nav a.active { color: var(--gold); background: transparent; }
.nav-login-btn {
  background: linear-gradient(135deg, var(--accent), #e74c3c);
  color: #fff; border: none; padding: 8px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 2px 10px var(--accent-glow); transition: transform .15s, box-shadow .2s;
}
.nav-login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.nav-login-btn:active { transform: translateY(0); }

/* ====== Footer 增强 ====== */
.footer {
  position: relative; margin-top: 64px; padding: 0; border-top: none;
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text2); font-size: 13px;
}
.footer::before {
  content: ""; display: block; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-soft) 30%, var(--gold) 50%, var(--gold-soft) 70%, transparent);
  opacity: .7;
}
.footer-inner {
  max-width: 1160px; margin: 0 auto;
  display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 28px; align-items: start;
  padding: 38px 24px 26px;
}
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
.seal-sm {
  width: 42px; height: 42px; line-height: 42px; font-size: 22px; border-radius: 10px; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(192,57,43,.45), inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-seal-image.seal-sm { width: 42px; height: 42px; border-radius: 10px; }
.footer-brand-name { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: .5px; }
.footer-brand-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; max-width: 440px; line-height: 1.7; }
.footer-col-title {
  font-size: 12px; color: var(--muted); letter-spacing: 2px;
  text-transform: uppercase; margin-bottom: 12px; font-weight: 600;
}
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { color: var(--text2); font-size: 13px; transition: color .2s; }
.footer-links a:hover { color: var(--gold); }
.footer-support { text-align: right; }
.footer-support-label {
  display: block; font-size: 12px; color: var(--muted);
  letter-spacing: 2px; margin-bottom: 8px;
}
.footer-support-co {
  display: inline-block; font-size: 16px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(135deg, var(--gold), #f0c75e);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  transition: filter .2s;
}
.footer-support-co:hover { filter: brightness(1.12); }
.footer-bottom { border-top: 1px solid var(--border); background: rgba(0,0,0,.16); }
[data-theme="light"] .footer-bottom { background: rgba(0,0,0,.03); }
.footer-bottom-inner {
  max-width: 1160px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; font-size: 12.5px; color: var(--muted);
}
.footer-copy { color: var(--muted); }
@media (max-width: 820px) {
  .footer-inner { grid-template-columns: 1fr; gap: 22px; }
  .footer-support { text-align: left; }
  .footer-bottom-inner { flex-direction: column; gap: 4px; }
}

/* ====== 空状态 ====== */
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 15px; }

/* ====== 滚动条 ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ====== 响应式 ====== */
@media (max-width: 768px) {
  .nav { display: none; } /* 移动端简化：可后续加汉堡菜单 */
  .hero { min-height: 620px; padding: 52px 0 46px; align-items: flex-start; }
  .hero-art { inset: 0 0 0 auto; width: min(88%, 520px); height: auto; opacity: .9; }
  .hero-art img { object-position: right bottom; }
  .hero::after { background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 93%, transparent) 43%, color-mix(in srgb, var(--bg) 26%, transparent) 100%); }
  .hero-canvas { opacity: .1; }
  .hero .container { position: absolute; left: 16px; top: 36px; transform: none; width: calc(100% - 32px); margin: 0; }
  .hero h1 { font-size: clamp(34px, 8vw, 44px); }
  .clan-grid { grid-template-columns: 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 8px; }
  .hstat { padding: 10px 14px; min-width: 70px; }
  .hstat .hv { font-size: 20px; }
  .container { padding: 0 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }
  .editor-layout { grid-template-columns: 1fr; }
  .bars { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-canvas { display: none; }
}

/* ====== 上传平台：断点续传提示条 ====== */
.resume-hint {
  margin: 12px 0 6px;
  padding: 14px 16px;
  border: 2px solid #ff6b6b;
  border-left: 5px solid #ff6b6b;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.12);
  font-size: 14px;
  line-height: 1.7;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.15);
  color: var(--text);
}
.resume-hint .rh-title { font-weight: 800; color: #ff6b6b; margin-bottom: 6px; font-size: 15px; }
.resume-hint .rh-info { margin-bottom: 12px; color: var(--text); }
.resume-hint .rh-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.resume-hint .btn { font-size: 13px; padding: 7px 16px; }
.resume-hint[hidden] { display: none; }

/* ====== AI 家谱问答助手（悬浮对话窗 · 阶段4） ====== */
.gqa-fab {
  position: fixed; right: 22px; bottom: 84px; z-index: 900;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px; border: 1px solid var(--glass-border); border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #e74c3c); color: #fff;
  font-size: 14px; font-weight: 700; font-family: var(--font);
  cursor: pointer; box-shadow: var(--shadow); transition: transform .2s, filter .2s;
}
.gqa-fab:hover { transform: translateY(-2px); filter: brightness(1.08); }
.gqa-fab.open { background: var(--bg3); color: var(--text); }
.gqa-fab-ico { font-size: 15px; }

.gqa-panel {
  position: fixed; right: 22px; bottom: 140px; z-index: 901;
  width: 390px; max-width: calc(100vw - 32px);
  height: 500px; max-height: calc(100vh - 200px);
  display: none; flex-direction: column;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.gqa-panel.show { display: flex; }

.gqa-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.gqa-title { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.gqa-clan {
  flex: 1; min-width: 0; padding: 5px 8px; font-size: 12.5px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.gqa-close {
  width: 26px; height: 26px; flex: none; line-height: 1;
  background: transparent; color: var(--text2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 16px; cursor: pointer;
}
.gqa-close:hover { color: var(--accent); border-color: var(--accent); }

.gqa-msgs {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.gqa-tip {
  font-size: 12.5px; line-height: 1.75; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.gqa-msg {
  max-width: 86%; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.72; white-space: pre-wrap; word-break: break-word;
}
.gqa-msg.user {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-bottom-right-radius: 2px;
}
.gqa-msg.assistant {
  align-self: flex-start; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 2px;
}
.gqa-msg.err { border-color: var(--accent); color: var(--accent); }
.gqa-note { font-size: 12px; color: var(--muted); padding: 0 4px; }

.gqa-form {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px; border-top: 1px solid var(--border); background: var(--bg2);
}
.gqa-form textarea {
  flex: 1; resize: none; max-height: 96px; padding: 8px 10px;
  font-size: 13.5px; font-family: var(--font); line-height: 1.5;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.gqa-send {
  flex: none; padding: 8px 16px; font-size: 13.5px; font-weight: 700;
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: filter .2s;
}
.gqa-send:hover { filter: brightness(1.1); }
.gqa-send:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 768px) {
  .gqa-fab { right: 14px; bottom: 74px; padding: 9px 14px; }
  .gqa-fab-txt { display: none; }
  .gqa-panel {
    right: 8px; left: 8px; bottom: 130px; width: auto;
    height: calc(100vh - 220px); max-height: none;
  }
}
