/* 李约瑟问题 · 图谱视图 */
.tools {
	position: relative; z-index: 15; display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
	padding: 8px var(--side); border-bottom: 1px solid var(--line); background: rgba(11, 10, 8, .72);
}
.filter-box { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.fgroup { display: flex; align-items: center; gap: 8px; }
.thread-pick { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.thread-pick select { max-width: 200px; }
.find { display: block; width: 150px; }
.chip-zh .l-long { display: none; }
.only-compact { display: none !important; }
@media (max-width: 1320px) {
	.only-compact { display: inline-flex !important; }
	.filter-box { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 30; padding: 12px var(--side) 14px; flex-direction: column; align-items: flex-start; background: rgba(14, 12, 10, .98); border-bottom: 1px solid var(--line-2); box-shadow: 0 20px 40px -20px #000; }
	.filter-box.open { display: flex; }
	.fgroup { flex-wrap: wrap; }
	.fgroup .flabel { min-width: 30px; }
	.chip-zh .l-long { display: inline; }
	.chip-zh .l-short { display: none; }
}

.map-wrap { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 384px; }
.map { position: relative; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; cursor: grab; }
.map.dragging { cursor: grabbing; }
.map:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-cap, .map-scale { position: absolute; z-index: 3; margin: 0; font-size: 10px; letter-spacing: .14em; color: var(--on-ink-3); pointer-events: none; }
.map-cap { left: 252px; bottom: 13px; }
.map-cap span { color: var(--gold); margin-right: 6px; }
.map-scale { left: 252px; bottom: 28px; }

/* 泳道标签（随纵向平移移动，横向固定在左侧） */
.lanes-label { position: absolute; left: 0; top: 0; bottom: 0; width: 76px; z-index: 2; pointer-events: none;
	background: linear-gradient(to right, rgba(11, 10, 8, .97) 70%, rgba(11, 10, 8, 0)); }
.lane-l { position: absolute; left: 0; width: 76px; display: flex; flex-direction: column; justify-content: center; padding-left: 12px; pointer-events: auto; cursor: pointer; }
.lane-l b { font: 600 15px/1.2 var(--serif); letter-spacing: .12em; color: var(--paper); transition: color .2s, opacity .2s; }
.lane-l i { margin-top: 3px; font: normal 9.5px/1.4 var(--mono); letter-spacing: .16em; color: var(--gold); }
.lane-l i::before { content: ""; display: inline-block; width: 10px; height: 1px; margin-right: 5px; vertical-align: middle; background: var(--gold); opacity: .6; }
.lane-l.off b, .lane-l.off i { opacity: .3; }
.lane-l:hover b { color: var(--gold); }

/* SVG 元素 */
.ax-line { stroke: var(--line-2); stroke-width: 1; }
.ax-tick { stroke: var(--line-2); }
.ax-tick.minor { stroke: var(--line); }
.ax-lbl { fill: var(--on-ink-3); font: 10px var(--mono); letter-spacing: .06em; }
.ax-lbl.major { fill: var(--on-ink-2); }
.grid-v { stroke: rgba(237, 230, 216, .045); }
.grid-v.major { stroke: rgba(237, 230, 216, .075); }
.lane-bg { fill: transparent; }
.lane-bg.alt { fill: rgba(237, 230, 216, .018); }
.lane-bg.off { fill: url(#hatch); }
.lane-sep { stroke: var(--line); }

.lk { fill: none; stroke-width: 1.2; transition: opacity .25s; }
.lk.crit { stroke: var(--zhu); }
.lk.oppose { stroke: var(--zhu); stroke-dasharray: 5 4; }
.lk.agree { stroke: rgba(242, 235, 222, .72); }
.lk.take { stroke: rgba(242, 235, 222, .34); stroke-width: .9; }
.lk.note { stroke: #8d8476; stroke-dasharray: 1.5 3.5; stroke-linecap: round; }
.lk.dim { opacity: .07; }
.lk.hide { display: none; }
.lk.hot { stroke-width: 1.8; opacity: 1; }
.lk.hot.flow { animation: lkflow 1.1s linear infinite; stroke-dasharray: 22 3; }
.lk.hot.note.flow { stroke-dasharray: 1.5 3.5; }
.lk.hot.oppose.flow { stroke-dasharray: 5 4; animation-name: lkflowO; }
@keyframes lkflow { to { stroke-dashoffset: -25; } }
@keyframes lkflowO { to { stroke-dashoffset: -18; } }
.paused .lk.hot.flow, .paused .pulse, .hidden-tab .lk.hot.flow, .hidden-tab .pulse { animation-play-state: paused; }

.thr { fill: none; stroke: var(--gold); stroke-width: 1.4; stroke-dasharray: 2 4; stroke-linecap: round; opacity: .85; }
.ghost { fill: none; stroke: rgba(242, 235, 222, .26); stroke-width: 1; }
.ghost-ln { stroke: rgba(242, 235, 222, .28); stroke-dasharray: 1 3; }
.ghost.dim, .ghost-ln.dim { opacity: .15; }

.nd { cursor: pointer; outline: none; }
.nd .hit { fill: transparent; }
.nd .gl { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; transition: fill .2s; }
.nd .zhm { fill: var(--gold); }
.nd .lbl { fill: var(--on-ink-2); font: 12px var(--sans); paint-order: stroke; stroke: var(--ink); stroke-width: 3px; stroke-linejoin: round; transition: fill .2s; }
.nd .lbl tspan.yr { font: 10px var(--mono); fill: var(--on-ink-3); }
.nd .ring { fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: 0; }
.nd:hover .lbl, .nd:focus-visible .lbl { fill: var(--paper); }
.nd:hover .ring, .nd:focus-visible .ring { opacity: .7; }
.nd.dim { opacity: .14; }
.nd.fade { opacity: .34; }
.nd.inthr .gl { stroke: var(--gold); }
.nd.dim .lbl { display: none; }
.nd.nolbl .lbl { display: none; }
.nd.sel .gl { fill: var(--gold); }
.nd.sel .ring { opacity: 1; }
.nd.sel .lbl, .nd.near .lbl { fill: var(--paper); }
.nd.match .gl { fill: var(--gold); }
.pulse { fill: none; stroke: var(--gold); stroke-width: 1; animation: pulse 2.4s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(3.2); opacity: 0; } }

.cur-v { stroke: rgba(217, 179, 108, .26); stroke-dasharray: 1 3; pointer-events: none; }
.cur-t { fill: rgba(217, 179, 108, .75); font: 10px var(--mono); letter-spacing: .06em; pointer-events: none; }
.map.dragging .cur-v, .map.dragging .cur-t { display: none; }
.map.brk::before, .map.brk::after { z-index: 5; }
.hud-v, .hud-h { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 2 3; opacity: .45; }
.hud-yr rect { fill: var(--gold); }
.hud-yr text { fill: var(--ink); font: 600 10.5px var(--mono); }

/* 缩放与线索步进 */
.zoom { position: absolute; left: 86px; bottom: 12px; z-index: 4; display: flex; border: 1px solid var(--line-2); background: rgba(11, 10, 8, .82); }
.zoom button { min-width: 34px; height: 30px; padding: 0 9px; border: 0; background: transparent; font-size: 16px; line-height: 1; color: var(--on-ink); }
.zoom button + button { border-left: 1px solid var(--line); }
.zoom button.mono { font-size: 11px; letter-spacing: .08em; }
.zoom button:hover { background: rgba(237, 230, 216, .08); }
.stepper {
	position: absolute; left: 86px; bottom: 52px; z-index: 4; display: flex; align-items: stretch; max-width: calc(100% - 100px);
	border: 1px solid var(--gold); background: rgba(11, 10, 8, .9); box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .8);
}
.stepper button { width: 34px; border: 0; background: transparent; color: var(--gold); font-size: 20px; line-height: 1; }
.stepper button:hover { background: var(--gold-dim); }
.stepper .step-x { font-size: 16px; color: var(--on-ink-3); border-left: 1px solid var(--line); }
.step-t { margin: 0; padding: 5px 8px; display: flex; flex-direction: column; min-width: 0; }
.step-t span { font-size: 9.5px; color: var(--gold); letter-spacing: .12em; }
.step-t b { font: 600 13px/1.35 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 浮动提示 */
.tip {
	position: absolute; z-index: 6; max-width: 280px; padding: 8px 10px; pointer-events: none; opacity: 0; transition: opacity .15s;
	background: rgba(20, 17, 13, .96); border: 1px solid var(--line-2); box-shadow: 0 14px 34px -16px rgba(0, 0, 0, .9);
}
.tip.on { opacity: 1; }
.tip .t-y { font: 600 10px var(--mono); color: var(--gold); letter-spacing: .1em; }
.tip .t-t { margin-top: 2px; font: 600 13px/1.45 var(--serif); color: var(--paper); }
.tip .t-a { font-size: 12px; color: var(--on-ink-2); }

/* 详情栏（宽屏在右侧，窄屏为底部抽屉） */
.panel { position: relative; z-index: 10; min-height: 0; border-left: 1px solid var(--line); background: linear-gradient(to bottom, rgba(17, 15, 12, .94), rgba(11, 10, 8, .98)); display: flex; flex-direction: column; }
.panel::before { content: ""; position: absolute; left: -1px; top: 0; width: 1px; height: 64px; background: var(--gold); }
.panel-in { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px 72px; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
.panel-x { position: absolute; right: 12px; top: 10px; z-index: 2; width: 30px; height: 30px; border: 1px solid var(--line-2); background: rgba(11, 10, 8, .7); color: var(--on-ink-2); font-size: 17px; line-height: 1; display: none; }
.panel.has-sel .panel-x { display: block; }
.panel-x:hover { border-color: var(--gold); color: var(--paper); }
.sheet-grip { display: none; }

/* 开场：节点按年份依次浮现（只动透明度，不碰 transform） */
.boot .nd { animation: ndIn .7s var(--ease) both; }
.boot .lk, .boot .ghost, .boot .ghost-ln { animation: ndIn 1s 1.1s var(--ease) both; }
@keyframes ndIn { from { opacity: 0; } }

.p-k { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 10px var(--mono); letter-spacing: .14em; color: var(--on-ink-3); }
.p-k .tag { padding: 1px 6px; border: 1px solid var(--line-2); color: var(--on-ink-2); letter-spacing: .06em; }
.p-k .tag.main { border-color: var(--gold); color: var(--gold); }
.p-k .tag.zh { border-color: transparent; background: var(--gold); color: var(--ink); }
.p-yr { margin: 12px 0 0; font: 600 44px/1 var(--mono); letter-spacing: -.02em; color: var(--paper); }
.p-yr small { margin-left: 8px; font-size: 11px; letter-spacing: .12em; color: var(--on-ink-3); font-weight: 400; }
.p-au { margin: 10px 0 0; font: 600 16px/1.4 var(--serif); letter-spacing: .06em; color: var(--gold); }
.p-au span { margin-left: 8px; font: 12px var(--sans); color: var(--on-ink-3); letter-spacing: 0; }
.p-ti { margin: 8px 0 0; font: 600 18px/1.5 var(--serif); color: var(--paper); overflow-wrap: anywhere; }
.p-tr { margin: 4px 0 0; font-size: 13px; color: var(--on-ink-2); }
.p-tr em { font-style: normal; font: 10px var(--mono); color: var(--on-ink-3); margin-right: 6px; letter-spacing: .1em; }
.p-ve { margin: 8px 0 0; padding-left: 10px; border-left: 1px solid var(--line-2); font: 11.5px/1.6 var(--mono); color: var(--on-ink-3); letter-spacing: .01em; overflow-wrap: anywhere; }
.p-h { margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; font: 10px var(--mono); letter-spacing: .2em; color: var(--on-ink-3); text-transform: uppercase; }
.p-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.p-claim { margin: 0; font: 15px/1.9 var(--serif); color: var(--on-ink); text-align: justify; }
.p-q { margin: 14px 0 0; padding: 10px 12px; border-left: 2px solid var(--zhu); background: rgba(226, 70, 43, .06); }
.p-q p { margin: 0; font: italic 14px/1.7 var(--serif); color: var(--paper); }
.p-q p.zh { font-style: normal; }
.p-q .gl { margin-top: 6px; font: 13px/1.7 var(--serif); font-style: normal; color: var(--on-ink-2); }
.p-q cite { display: block; margin-top: 6px; font: normal 10.5px/1.5 var(--mono); color: var(--on-ink-3); }
.p-pg { margin: 14px 0 0; }
.p-pg a { display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--zhu); color: var(--paper); text-decoration: none; font: 14px/1.5 var(--serif); }
.p-pg a:hover { background: var(--zhu); }
.p-pg i { font-style: normal; font-family: var(--mono); font-size: 12px; }

.p-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.p-links li button { width: 100%; display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 7px 8px; border: 1px solid var(--line); background: transparent; text-align: left; transition: border-color .2s, background .2s; }
.p-links li button:hover { border-color: var(--line-2); background: rgba(237, 230, 216, .03); }
.p-links .rk { grid-row: span 2; align-self: start; padding-top: 1px; font: 600 10px/1.5 var(--mono); letter-spacing: .06em; }
.p-links .rk.crit, .p-links .rk.oppose { color: var(--zhu); }
.p-links .rk.agree { color: var(--paper); }
.p-links .rk.take { color: var(--on-ink-2); }
.p-links .rk.note { color: #a99f8f; }
.p-links .rw { font: 600 13px/1.4 var(--serif); color: var(--paper); }
.p-links .rw i { font-style: normal; font: 10.5px var(--mono); color: var(--on-ink-3); margin-left: 6px; }
.p-links .rn { font-size: 12px; line-height: 1.6; color: var(--on-ink-2); }

.p-chain { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; }
.p-chain::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px; background: var(--line-2); }
.p-chain li { position: relative; }
.p-chain li::before { content: ""; position: absolute; left: -13px; top: 10px; width: 7px; height: 7px; border: 1px solid var(--on-ink-3); background: var(--ink); }
.p-chain li.cur::before { background: var(--gold); border-color: var(--gold); }
.p-chain button { width: 100%; padding: 3px 4px; border: 0; background: transparent; text-align: left; font-size: 13px; color: var(--on-ink-2); }
.p-chain button b { font: 10.5px var(--mono); color: var(--on-ink-3); font-weight: 400; margin-right: 6px; }
.p-chain li.cur button { color: var(--paper); }
.p-chain button:hover { color: var(--gold); }
.p-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.p-cite { margin: 0; padding: 10px 12px; background: var(--ink-1); border: 1px solid var(--line); font: 12px/1.65 var(--mono); color: var(--on-ink-2); overflow-wrap: anywhere; }
.p-lead { margin: 0; font: 15px/1.9 var(--serif); color: var(--on-ink); }
.p-lead + .p-lead { margin-top: 10px; }
.p-qq { margin: 12px 0 0; padding: 10px 12px; border-left: 2px solid var(--gold); background: rgba(217, 179, 108, .05); }
.p-qq p { margin: 0; font: italic 13.5px/1.65 var(--serif); color: var(--paper); }
.p-qq p + p { margin-top: 6px; }
.p-qq .gl { font-style: normal; color: var(--on-ink-2); font-size: 13px; }
.p-qq cite { display: block; margin-top: 6px; font: normal 10.5px var(--mono); color: var(--on-ink-3); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 12.5px; color: var(--on-ink-2); }
.legend li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.6; }
.legend svg { flex-shrink: 0; margin-top: -1px; }
.legend .rel-swatch { flex-shrink: 0; margin-top: 10px; }
.thr-list { display: grid; gap: 6px; }
.thr-list button { padding: 7px 10px; border: 1px solid var(--line); background: transparent; text-align: left; transition: border-color .2s; }
.thr-list button:hover { border-color: var(--gold); }
.thr-list b { display: block; font: 600 13.5px/1.4 var(--serif); color: var(--paper); }
.thr-list span { font-size: 12px; color: var(--on-ink-3); }
.thr-list i { font-style: normal; font: 10px var(--mono); color: var(--gold); margin-right: 6px; }
.p-hist { margin: 16px 0 0; }
.p-hist svg { display: block; width: 100%; height: auto; }
.p-hist svg text { fill: var(--on-ink-3); font: 9px var(--mono); }
.p-hist figcaption { margin-top: 4px; font-size: 11px; color: var(--on-ink-3); }
.p-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 14px; }
.p-stats div { background: var(--ink); padding: 8px 10px; }
.p-stats b { display: block; font: 600 20px/1.2 var(--mono); color: var(--paper); }
.p-stats span { font-size: 11px; color: var(--on-ink-3); }

@media (max-width: 1100px) { .map-wrap { grid-template-columns: minmax(0, 1fr) 340px; } .find { width: 140px; } }
@media (max-width: 860px) {
	.tools { gap: 8px; padding: 6px var(--side); }
	.thread-pick { margin-left: 0; flex: 1; min-width: 0; }
	.thread-pick select { max-width: none; width: 100%; }
	.thread-pick .flabel { display: none; }
	.find { width: 108px; }
	.map-wrap { grid-template-columns: minmax(0, 1fr); }
	.lanes-label, .lane-l { width: 46px; }
	.lane-l { padding-left: 8px; }
	.lane-l b { font-size: 13px; letter-spacing: .04em; }
	.lane-l i { display: none; }
	.zoom, .stepper { left: 10px; transition: bottom .32s var(--ease); }
	.zoom { bottom: calc(var(--sheet-h, 0px) + 10px); }
	.stepper { bottom: calc(var(--sheet-h, 0px) + 54px); right: 10px; max-width: none; }
	.step-t { flex: 1; }
	.map-cap { display: none; }
	.map-scale { display: none; }
	.panel { position: absolute; left: 0; right: 0; bottom: 0; height: min(60%, 480px); border-left: 0; border-top: 1px solid var(--gold); transform: translateY(102%); transition: transform .32s var(--ease); box-shadow: 0 -24px 50px -20px rgba(0, 0, 0, .9); }
	.panel.open { transform: none; }
	.panel { background: #0f0d0a; }
	.panel::before { display: none; }
	.panel-x { display: block; right: 10px; top: 8px; }
	.p-k { padding-right: 40px; }
	.sheet-open .zoom { opacity: 0; pointer-events: none; }
	.sheet-open .stepper { bottom: var(--sheet-h, 0px); left: 0; right: 0; border-width: 1px 0 0; box-shadow: none; }
	.sheet-grip { display: block; height: 18px; flex-shrink: 0; touch-action: none; cursor: ns-resize; }
	.sheet-grip i { display: block; width: 40px; height: 3px; margin: 8px auto 0; background: var(--line-2); }
	.panel-in { padding: 14px var(--side) 80px; }
	.p-yr { font-size: 34px; margin-top: 8px; }
}

/* 一步步看（../assets/tour.js）：启动钮在左下角。宽屏把缩放钮、线索步进条和图注往右让；
   窄屏缩放钮放到右下角（单开时叠在「在展馆中查看」上面）。走的时候整个作品往上收，让出卡片的高度（--hwt-h 由 walk.js 量）。 */
/* 底下这一条只放控件：图谱很矮、泳道放不下时，节点和泳道名不画进来（往上拖就能看到下面的泳道） */
.map svg { clip-path: inset(0 0 var(--bot, 0px) 0); }
.lanes-label { bottom: var(--bot, 0px); overflow: hidden; }
.zoom, .stepper { left: 214px; }
.stepper { max-width: calc(100% - 228px); }
.map-cap, .map-scale { left: 340px; }
@media (max-width: 860px) {
	.zoom { left: auto; right: 10px; bottom: calc(var(--sheet-h, 0px) + 12px); }
	html:not(.in-frame) .zoom { bottom: calc(var(--sheet-h, 0px) + 60px); }
	.stepper { left: 10px; bottom: calc(var(--sheet-h, 0px) + 58px); max-width: none; }
	html:not(.in-frame) .stepper { bottom: calc(var(--sheet-h, 0px) + 100px); }
	html .map-wrap.sheet-open .stepper { bottom: var(--sheet-h, 0px); left: 0; right: 0; }
}
html.hwt-on .app { bottom: var(--hwt-h, 0px); height: auto; overflow: hidden; }
@media (max-width: 860px) {
	/* 窄屏走的时候：收起标题行，详情抽屉铺满图谱区，线索步进条让给卡片上的「下一步」 */
	html.hwt-on .top .brand { display: none; }
	html.hwt-on .panel { height: 100%; }
	html.hwt-on .stepper { display: none; }
}
html.hwt-on .toast { bottom: calc(var(--hwt-h, 0px) + 20px); }
html.hwt-on .map-cap, html.hwt-on .map-scale { display: none; }
html.hwt-on .wk-pill { visibility: hidden; }
