/* 投资群山 · 知识图谱可视化 — 设计令牌复刻自 investment-terrain.html */

:root {
  --bg: #0a0a0c;
  --surface-from: #16161a;
  --text: #e8eaed;
  --text-strong: #f5f5f7;
  --text-muted: #6b6b73;
  --text-subtle: #52525b;
  --text-tertiary: #71717a;
  --text-body: #b4b4bd;
  --text-chip: #a1a1aa;
  --accent: #fbbf24;          /* 师承 · 金 */
  --collab: #94a3b8;          /* 合作 · 灰蓝 */
  --influence: #64748b;       /* 影响 · 深灰 */
  --line-08: #ffffff08;
  --line-14: #ffffff14;
  --line-1a: #ffffff1a;
  --line-44: #ffffff44;
  --serif: "Noto Serif SC", -apple-system, "Songti SC", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  font-family: var(--serif);
  color: var(--text);
}

/* ---- 背景网格 ---- */
#bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(#ffffff05 1px, transparent 1px),
    linear-gradient(90deg, #ffffff05 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ---- 顶部标题 ---- */
#title { position: fixed; top: 26px; left: 38px; z-index: 5; display: flex; align-items: center; gap: 13px; cursor: pointer; outline: none; }
#brand-logo { width: 46px; height: 46px; flex: none; opacity: .82; transition: opacity .2s ease, transform .2s ease; }
#title:hover #brand-logo, #title:focus-visible #brand-logo { opacity: 1; transform: scale(1.05); }
#title:focus-visible { outline: 1px solid var(--text-muted); outline-offset: 6px; border-radius: 6px; }
#title h1 { font-size: 23px; font-weight: 300; letter-spacing: 4px; color: var(--text-strong); }
#title p { font-size: 12px; font-weight: 200; letter-spacing: 2px; color: var(--text-muted); margin-top: 7px; }

/* ---- 底部提示 ---- */
#hint {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 5;
  font-size: 11px; font-weight: 200; letter-spacing: 2px; color: var(--text-subtle);
  transition: opacity .3s;
}

/* ---- 顶部控制区（视图切换 + 搜索） ---- */
#controls {
  position: fixed; top: 30px; right: 38px; z-index: 6;
  display: flex; align-items: center; gap: 14px;
}
.seg { display: flex; border: 1px solid var(--line-1a); border-radius: 2px; overflow: hidden; }
.seg button {
  background: var(--line-08); border: none; color: var(--text-subtle);
  font-family: inherit; font-size: 12px; font-weight: 200; letter-spacing: 2px;
  padding: 8px 15px; cursor: pointer; transition: .25s;
}
.seg button + button { border-left: 1px solid var(--line-1a); }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--line-14); color: var(--text-strong); }

#search input {
  background: var(--line-08); border: 1px solid var(--line-1a); border-radius: 2px;
  padding: 9px 16px; color: var(--text); font-size: 13px; font-family: inherit;
  width: 200px; outline: none; letter-spacing: 1px; transition: .3s;
}
#search input::placeholder { color: var(--text-subtle); }
#search input:focus { border-color: var(--line-44); width: 230px; }

/* ---- 地形图 ---- */
#map {
  width: 100vw; height: 100vh; display: block;
  background: radial-gradient(ellipse 80% 70% at 50% 42%, var(--surface-from) 0%, var(--bg) 70%);
}
.marker { transition: fill-opacity .3s; }
.nodes g { transition: opacity .35s; }
.nlabel {
  transition: opacity .35s; font-family: var(--serif); font-weight: 300; letter-spacing: 1px;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round;
}
.peaks text { font-family: var(--serif); }

/* 搜索/聚焦信标：金色脉冲环，让低权重的小节点也能被一眼定位 */
.beacon circle { fill: none; stroke: var(--accent); }
.beacon .beacon-dot { fill: var(--accent); stroke: none; }
.beacon .beacon-ring { stroke-width: 1.5; stroke-opacity: .9; }
.beacon .beacon-pulse {
  stroke-width: 2;
  transform-box: fill-box; transform-origin: center;
  animation: beacon-pulse 1.8s ease-out infinite;
}
@keyframes beacon-pulse {
  0% { transform: scale(.35); stroke-opacity: .95; }
  75% { transform: scale(1.6); stroke-opacity: 0; }
  100% { transform: scale(1.6); stroke-opacity: 0; }
}
.beacon text {
  fill: var(--accent); font-family: var(--serif); font-size: 16px; font-weight: 400;
  letter-spacing: 1px; text-anchor: middle;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round;
}

/* 聚类切换（地形图内左下） */
#cluster-toggle {
  position: fixed; bottom: 26px; left: 38px; z-index: 5;
}

/* ---- 详情面板 ---- */
#panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  height: 52vh; min-height: 430px;
  background: #07080a;
  padding: 34px 38px 30px; transform: translateY(110%);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
  border: 0; border-radius: 0;
  box-shadow: 0 0 60px #000000dd;
  max-height: 56vh; overflow-y: auto;
}
#panel.show { transform: translateY(0); }
#panel { display: flex; gap: 28px; }
/* 顶部金色细线，呼应大师雕版肖像的金调。 */
#panel::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; z-index: 3;
  background: linear-gradient(90deg, transparent, var(--accent) 18%, #fde68a 50%, var(--accent) 82%, transparent);
  opacity: .55; pointer-events: none;
}
/* 大师雕版肖像 + 金色星轨/光线/柱状图背景层（由 panel.js 按面板像素绘制）。 */
#p-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; border-radius: 0;
}
#p-body { flex: 1; min-width: 0; max-width: 760px; position: relative; z-index: 1; }
#p-graph {
  width: min(420px, 30vw); flex-shrink: 0; position: absolute; top: 92px; right: 8vw;
  z-index: 1; margin-right: 0;
}
#p-graph .side-title { margin-bottom: 10px; }
#p-graph-svg { width: 100%; height: 400px; overflow: visible; }
#p-graph .gc-center { fill: #f5f5f7; font-family: var(--serif); font-size: 16px; font-weight: 400; }
#p-graph .gi-label { fill: #dcdce4; font-family: var(--serif); font-size: 13.5px; font-weight: 300; }
#p-graph .gi-sub { fill: #71717a; font-family: var(--serif); font-size: 10.5px; font-weight: 200; }
.desc-cn {
  font-size: 14px; font-weight: 300; line-height: 1.85; color: #c8ccd4;
  margin: 6px 0 4px; max-width: 880px; letter-spacing: .3px;
  border-left: 2px solid var(--line-1a); padding-left: 12px;
}
.quote-cn {
  font-size: 13px; font-weight: 300; color: #d9b96a; line-height: 1.7;
  margin: 2px 0 14px; max-width: 880px; letter-spacing: .3px; padding-left: 17px;
}
#panel .close {
  position: absolute; top: 18px; right: 22px; cursor: pointer; z-index: 3;
  background: var(--line-08); border: 1px solid var(--line-1a); border-radius: 2px;
  color: var(--text-muted); font-size: 14px; line-height: 1; padding: 6px 10px; transition: .2s;
}
#panel .close:hover { color: var(--text); border-color: var(--line-44); }
#panel .wiki-link {
  font-size: 11px; font-weight: 300; letter-spacing: 2px; color: var(--accent);
  text-decoration: none; border: 1px solid var(--accent); border-radius: 2px;
  padding: 4px 12px; transition: .2s; opacity: .85;
}
#panel .wiki-link:hover { opacity: 1; background: #fbbf2418; }
#panel .wiki-link.yt { color: #f87171; border-color: #f87171; }
#panel .wiki-link.yt:hover { background: #f8717118; }
#panel .wiki-link.bili { color: #38bdf8; border-color: #38bdf8; }
#panel .wiki-link.bili:hover { background: #38bdf818; }
#panel .p-head { display: flex; align-items: flex-start; gap: 20px; }
#panel .p-head .row { flex: 1; min-width: 0; }
#panel .row { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
#panel h2 { font-size: 30px; font-weight: 400; letter-spacing: 2px; color: #fff; }
#panel .en { font-size: 13px; font-weight: 200; color: var(--text-tertiary); letter-spacing: 1px; }
#panel .tag {
  font-size: 11px; font-weight: 300; letter-spacing: 3px; color: var(--bg);
  background: var(--text); padding: 3px 12px; border-radius: 1px;
}
#panel .meta { display: inline-flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#panel .meta .wbadge {
  font-size: 12px; font-weight: 400; letter-spacing: 1px; font-style: normal;
  border: 1px solid; border-radius: 2px; padding: 2px 9px;
}
#panel .meta .meta-rest { font-size: 12px; font-weight: 200; letter-spacing: 1px; color: #9a9aa5; }
#panel .desc {
  font-size: 15px; font-weight: 300; line-height: 1.85; color: #dcdce4;
  margin: 16px 0 4px; max-width: 880px; letter-spacing: .3px;
}
#panel .quote {
  font-size: 14px; font-weight: 300; font-style: italic; color: var(--accent);
  line-height: 1.8; margin: 6px 0 16px; max-width: 880px; letter-spacing: .3px;
  border-left: 3px solid var(--accent); padding-left: 14px;
}

@media (max-width: 1100px) {
  #panel { height: 56vh; min-height: 420px; padding: 30px 26px 28px; }
  #p-body { max-width: 68vw; }
  #p-graph { top: 86px; right: 4vw; width: 300px; opacity: .82; }
}

@media (max-width: 760px) {
  #panel { height: 62vh; min-height: 0; max-height: 62vh; padding: 48px 20px 28px; }
  #p-body { max-width: none; }
  #p-graph { display: none; }
}

/* 数据维度配色：每个区块一个主色（左色条 + 同色标题）。 */
.psec { --dim: #8a8a96; margin: 20px 0 0; padding-left: 16px; border-left: 2px solid var(--dim); }
.psec.sec-tags { --dim: #94a3b8; }
.psec.sec-principle { --dim: #fbbf24; }
.psec.sec-claim { --dim: #34d399; }
.psec.sec-resource { --dim: #38bdf8; }
.psec.sec-relation { --dim: #a78bfa; }
#panel .section-label {
  font-size: 12px; font-weight: 400; letter-spacing: 3px; color: var(--dim);
  margin: 0 0 10px;
}

.rel { display: flex; flex-wrap: wrap; gap: 7px; max-width: 900px; }
.chip {
  font-size: 12px; font-weight: 300; letter-spacing: 1px; color: #c8ccd4;
  border: 1px solid var(--line-1a); padding: 4px 11px; border-radius: 2px;
  background: var(--line-08);
}
.rchip {
  font-size: 12px; font-weight: 300; letter-spacing: 1px; color: #c8ccd4;
  border: 1px solid var(--dim, var(--line-1a)); padding: 4px 11px; border-radius: 2px;
  cursor: pointer; transition: .25s; background: var(--line-08);
}
.rchip:hover { background: #ffffff14; color: #fff; }
.plist { max-width: 920px; display: flex; flex-direction: column; gap: 11px; }
.pitem {
  font-size: 14px; font-weight: 300; line-height: 1.75; color: #d2d2da;
  letter-spacing: .3px; display: flex; gap: 10px; align-items: baseline;
}
.pitem .ptype {
  flex-shrink: 0; font-size: 10px; letter-spacing: 1px; color: var(--dim);
  border: 1px solid var(--dim); border-radius: 2px; padding: 1px 7px; opacity: .9;
}
.pitem .ptext { flex: 1; }
.reslist { display: flex; flex-wrap: wrap; gap: 8px; max-width: 920px; }
.reschip {
  font-size: 12px; font-weight: 300; letter-spacing: 1px; color: #c8ccd4;
  border: 1px solid var(--line-1a); padding: 5px 12px; border-radius: 2px;
  text-decoration: none; transition: .25s; background: var(--line-08);
}
.reschip:hover { border-color: var(--dim); color: var(--dim); }
.reschip .rt { color: var(--dim); font-size: 10px; letter-spacing: 1px; margin-left: 7px; opacity: .85; }

/* ---- 通用视图容器（看板 / 检索） ---- */
.view {
  position: fixed; inset: 0; z-index: 4; overflow-y: auto;
  padding: 96px 38px 60px; display: none;
}
.view.active { display: block; }
.view-inner { max-width: 1100px; margin: 0 auto; }
.view h2.view-title { font-size: 20px; font-weight: 300; letter-spacing: 3px; color: var(--text-strong); margin-bottom: 6px; }
.view p.view-sub { font-size: 12px; font-weight: 200; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 36px; }

/* ---- 看板 ---- */
.totals { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 40px; }
.stat {
  border: 1px solid var(--line-14); border-radius: 2px; padding: 18px 24px; min-width: 140px;
  background: var(--line-08);
}
.stat .num { font-size: 30px; font-weight: 300; letter-spacing: 1px; color: var(--text-strong); }
.stat .lbl { font-size: 11px; font-weight: 200; letter-spacing: 2px; color: var(--text-subtle); margin-top: 6px; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 32px; }
.chart-card { border: 1px solid var(--line-14); border-radius: 2px; padding: 22px 24px; background: var(--line-08); }
.chart-card h3 { font-size: 13px; font-weight: 300; letter-spacing: 2px; color: var(--text); margin-bottom: 18px; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.bar-row .bl { width: 116px; font-size: 11px; font-weight: 200; letter-spacing: 1px; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 14px; background: var(--line-08); border: 1px solid var(--line-14); border-radius: 1px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--line-44); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar-fill.accent { background: var(--accent); opacity: .65; }
.bar-row .bv { width: 42px; font-size: 11px; font-weight: 200; color: var(--text-subtle); flex-shrink: 0; }

/* ---- 检索列表 ---- */
.search-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; align-items: center; }
.search-bar input {
  background: var(--line-08); border: 1px solid var(--line-1a); border-radius: 2px;
  padding: 9px 16px; color: var(--text); font-size: 13px; font-family: inherit;
  width: 280px; outline: none; letter-spacing: 1px; transition: .3s;
}
.search-bar input:focus { border-color: var(--line-44); }
.search-bar input::placeholder { color: var(--text-subtle); }
.result-count { font-size: 11px; font-weight: 200; letter-spacing: 2px; color: var(--text-subtle); margin-left: auto; }
.cardlist { display: flex; flex-direction: column; gap: 12px; }
.rescard {
  border: 1px solid var(--line-14); border-radius: 2px; padding: 16px 20px; background: var(--line-08);
  cursor: pointer; transition: .25s;
}
.rescard:hover { border-color: var(--line-44); }
.rescard .head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.rescard .who { font-size: 14px; font-weight: 400; letter-spacing: 1px; color: var(--text-strong); }
.rescard .badge {
  font-size: 10px; font-weight: 200; letter-spacing: 2px; color: var(--text-subtle);
  border: 1px solid var(--line-14); padding: 2px 9px; border-radius: 1px;
}
.rescard .badge.ev-medium { color: var(--accent); border-color: var(--accent); opacity: .8; }
.rescard .txt { font-size: 13px; font-weight: 200; line-height: 1.8; color: var(--text-body); letter-spacing: .5px; }

/* ---- 概览左侧栏（山峰列表 + 大师榜） ---- */
#sidebar {
  position: fixed; top: 96px; left: 0; bottom: 0; width: 264px; z-index: 5;
  padding: 0 20px 30px 38px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 26px;
  mask: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 30px), transparent 100%);
}
#peak-bar, #peak-rank { display: none; }
.side-section { display: flex; flex-direction: column; gap: 10px; }
.side-title {
  font-size: 11px; font-weight: 300; letter-spacing: 3px; color: var(--text-subtle);
  text-transform: uppercase;
}
.wbar { height: 4px; background: var(--line-08); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.wfill { height: 100%; background: var(--line-44); }
.wfill.accent { background: var(--accent); opacity: .7; }

.peak-row { padding: 7px 0; cursor: pointer; border-bottom: 1px solid var(--line-08); transition: .2s; }
.peak-row:hover { padding-left: 4px; }
.peak-row-head { display: flex; justify-content: space-between; align-items: baseline; }
.peak-row .pn { font-size: 13px; font-weight: 300; letter-spacing: 1px; color: var(--text); display: inline-flex; align-items: center; }
.peak-row .pdot { width: 8px; height: 8px; border-radius: 50%; margin-right: 9px; flex-shrink: 0; }
.peak-row:hover .pn { color: var(--accent); }
.peak-row .pc { font-size: 10px; font-weight: 200; color: var(--text-subtle); letter-spacing: 1px; }
.peak-row.active { padding-left: 8px; border-left: 2px solid var(--accent); }
.peak-row.active .pn { color: var(--accent); }

#weight-legend { display: flex; flex-direction: column; gap: 6px; }
.legend-row { display: flex; align-items: center; font-size: 11px; font-weight: 200; letter-spacing: 1px; color: var(--text-muted); }
.legend-row .sw { width: 11px; height: 11px; border-radius: 2px; margin-right: 9px; flex-shrink: 0; }
.legend-row em { margin-left: auto; font-style: normal; color: var(--text-subtle); font-size: 10px; }

.lead-row {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: baseline; gap: 8px;
  padding: 5px 0; cursor: pointer; transition: .2s;
}
.lead-row .wbar { grid-column: 1 / -1; margin-top: 2px; }
.lead-row:hover { padding-left: 4px; }
.lead-row .rank { font-size: 11px; font-weight: 300; color: var(--text-subtle); }
.lead-row .ln { font-size: 12px; font-weight: 300; letter-spacing: 1px; color: var(--text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-row:hover .ln { color: var(--accent); }
.lead-row .lw { font-size: 11px; font-weight: 300; color: var(--text-subtle); }

/* ---- 单山视图：面包屑 + 右侧人物榜 ---- */
#peak-bar {
  position: fixed; top: 30px; left: 38px; z-index: 6; align-items: baseline; gap: 16px;
}
#peak-bar.show { display: flex; }
#peak-back {
  background: var(--line-08); border: 1px solid var(--line-1a); border-radius: 2px;
  color: var(--text); font-family: inherit; font-size: 12px; font-weight: 200; letter-spacing: 2px;
  padding: 7px 14px; cursor: pointer; transition: .25s;
}
#peak-back:hover { border-color: var(--line-44); }
#peak-bar .crumb { font-size: 14px; font-weight: 300; letter-spacing: 2px; color: var(--text-muted); }
#peak-bar .crumb b { color: var(--text-strong); font-weight: 400; }
#peak-bar .crumb-sub { font-size: 11px; font-weight: 200; letter-spacing: 1px; color: var(--text-subtle); }

#peak-rank {
  position: fixed; top: 96px; right: 0; bottom: 0; width: 320px; z-index: 5;
  padding: 0 38px 30px 22px; overflow-y: auto;
  flex-direction: column; gap: 10px;
  mask: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 30px), transparent 100%);
}
#peak-rank.show { display: flex; }
.rank-row {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start;
  padding: 9px 0; cursor: pointer; border-bottom: 1px solid var(--line-08); transition: .2s;
}
.rank-row:hover { padding-left: 4px; }
.rank-row .rk { font-size: 13px; font-weight: 300; color: var(--text-subtle); text-align: right; }
.rk-head { display: flex; justify-content: space-between; align-items: baseline; }
.rank-row .rkn { font-size: 13px; font-weight: 400; letter-spacing: 1px; color: var(--text); }
.rank-row:hover .rkn { color: var(--accent); }
.rank-row .rkw { font-size: 11px; font-weight: 300; color: var(--text-subtle); }
.rk-sub { font-size: 10px; font-weight: 200; letter-spacing: 1px; color: var(--text-subtle); margin-top: 5px; }

/* 滚动条极简化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-1a); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
