/* Topic map (学科树交互图). Colours come from the site tokens so light/dark both work. */
.map-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.map-view-switch{display:inline-flex;padding:3px;border:1px solid var(--line);border-radius:9px;background:var(--surface)}
.map-view-switch a{padding:7px 16px;border-radius:7px;font-size:14px;color:var(--sub)}
.map-view-switch [aria-current]{background:var(--brand);color:var(--on)}
.topic-map[hidden],.tree-layout[hidden]{display:none!important}

.map-tools{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.map-tools form{flex:1 1 320px;display:flex;gap:6px;min-width:0}
.map-tools input{flex:1;min-width:0;padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink);font:inherit;font-size:14px}
.map-tools form button{padding:0 16px;border-radius:9px;background:var(--brand);color:var(--on);font-size:14px;cursor:pointer;white-space:nowrap}
.map-domains{display:inline-flex;gap:2px;padding:3px;border:1px solid var(--line);border-radius:9px;background:var(--surface);flex-wrap:wrap}
.map-domains button{padding:7px 13px;border-radius:7px;font-size:14px;color:var(--sub);cursor:pointer}
.map-domains button[aria-pressed="true"]{background:var(--soft);color:var(--brand);font-weight:600}
.map-search-results{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px;font-size:13px;color:var(--sub)}
.map-search-results:empty{display:none}

.map-layout{display:grid;grid-template-columns:minmax(0,1fr) 340px;margin:14px 0 10px;border:1px solid var(--line);border-radius:14px;overflow:hidden;background:var(--surface)}
.map-canvas{position:relative;min-width:0;background:radial-gradient(circle,var(--line) 1px,transparent 1.2px) 0 0/20px 20px}
.map-canvas svg{display:block;width:100%;height:640px;touch-action:none;cursor:grab}
.map-canvas svg:active{cursor:grabbing}
.map-overlay{position:absolute;z-index:2}
.map-legend{left:12px;top:12px;display:flex;gap:14px;padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);font-size:12px;color:var(--sub)}
.map-legend label{display:flex;gap:5px;align-items:center;cursor:pointer}
.map-legend input{accent-color:var(--brand);margin:0}
.map-actions{right:12px;top:12px;display:flex;flex-direction:column;border:1px solid var(--line);border-radius:8px;background:var(--surface);overflow:hidden}
.map-actions button{width:34px;height:32px;font-size:16px;color:var(--ink);cursor:pointer}
.map-actions button+button{border-top:1px solid var(--line)}
.map-actions button:hover{background:var(--soft);color:var(--brand)}
.map-hint{left:12px;bottom:10px;margin:0;font-size:11px;color:var(--sub);pointer-events:none}

.map-node{cursor:pointer;outline:none}
.map-node rect{fill:var(--surface);stroke:var(--line);stroke-width:1.5}
.map-node text{fill:var(--ink);font-family:inherit;font-size:15px;font-weight:600;pointer-events:none}
.map-node .map-count{fill:var(--sub);font-size:12px;font-weight:400}
.map-node.is-empty text{fill:var(--sub);font-weight:400}
.map-node.is-empty rect{stroke-dasharray:4 3}
.map-node:hover rect,.map-node:focus rect{stroke:var(--brand);stroke-width:2}
.map-node[aria-pressed="true"] rect{fill:var(--soft);stroke:var(--brand);stroke-width:2.5}
.map-node[aria-pressed="true"] text{fill:var(--brand)}
.map-expand{cursor:pointer}
.map-expand circle{fill:var(--soft)}
.map-expand text{fill:var(--brand);font-size:18px;font-weight:600}
.map-expand:focus{outline:none}
.map-expand:focus circle{stroke:var(--brand);stroke-width:2}
.map-edge{fill:none;stroke:var(--line);stroke-width:1.8}
.map-edge-prerequisite{stroke:#ad722b;stroke-dasharray:7 4}
.map-edge-related{stroke:#7477b6;stroke-dasharray:2 5}

.map-detail{padding:22px 20px;border-left:1px solid var(--line);min-width:0;max-height:640px;overflow-y:auto}
.map-crumb{font-size:12px;color:var(--sub);margin:0 0 4px}
.map-crumb button{color:var(--sub);cursor:pointer;padding:0;font-size:12px}
.map-crumb button:hover{color:var(--brand)}
.map-detail h2{font-size:22px;line-height:1.35;margin:0}
.map-desc{font-size:13px!important;line-height:1.75;color:var(--sub);margin:8px 0 0}
.map-stat{display:flex;align-items:baseline;gap:6px;margin:14px 0 4px;padding:12px 14px;border-radius:10px;background:var(--soft)}
.map-stat strong{font-size:24px;color:var(--brand);line-height:1}
.map-stat span{font-size:13px;color:var(--sub)}
.map-stat a{margin-left:auto;font-size:13px;color:var(--brand)}
.map-detail h3{font-size:13px;font-weight:600;color:var(--sub);margin:20px 0 8px}
.map-chips{display:flex;flex-wrap:wrap;gap:6px}
.map-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--ink);font-size:13px;cursor:pointer}
.map-chip span{font-size:11px;color:var(--sub)}
.map-chip:hover{border-color:var(--brand);color:var(--brand)}
.map-chip.is-empty{color:var(--sub);border-style:dashed}
.map-empty{font-size:13px!important;color:var(--sub)}
.map-resources{list-style:none;padding:0!important;margin:0;display:grid;gap:4px}
.map-resources a{display:flex;gap:11px;align-items:center;padding:8px;margin:0 -8px;border-radius:9px;color:var(--ink)}
.map-resources a:hover{background:var(--soft)}
.map-thumb{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:8px;display:grid;place-items:center;overflow:hidden;background:#153c46;color:#f6f5e9}
.map-thumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#fff;padding:3px;opacity:0}
.map-thumb.has-image img{opacity:1}
.map-thumb b{font-size:10px;font-weight:700;letter-spacing:-.2px;text-align:center;line-height:1.1;padding:0 2px;overflow-wrap:anywhere}
.map-res-text{display:grid;gap:2px;min-width:0}
.map-res-title{font-size:13px;font-weight:600;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.map-res-meta{font-size:11px;color:var(--sub);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.map-more{display:block;margin-top:12px;padding:9px;border:1px solid var(--line);border-radius:9px;text-align:center;font-size:13px;color:var(--brand)}
.map-more:hover{background:var(--soft)}
.map-foot{font-size:12px;color:var(--sub);margin:0}
.map-foot a{text-decoration:underline;color:var(--sub)}
.map-view-switch a:focus-visible,.map-actions button:focus-visible,.map-detail button:focus-visible,.map-domains button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}

@media(max-width:1100px){.map-layout{grid-template-columns:minmax(0,1fr)}.map-detail{border-left:0;border-top:1px solid var(--line);max-height:none}.map-canvas svg{height:520px}}
@media(max-width:610px){.map-canvas svg{height:420px}.map-tools input{font-size:16px}.map-domains{width:100%;flex-wrap:nowrap}.map-domains button{flex:1;white-space:nowrap;padding:7px 4px;font-size:13px}.map-hint{display:none}.map-legend{gap:10px}.map-detail{padding:16px}.map-actions button{width:38px;height:36px}}
