/* 校园地图 · 3D 模型 */
:root {
  --geo-base: #0d0f13;
  --geo-campus: #15181d;
  --geo-green: #17261e;
  --geo-sport: #1d3226;
  --geo-water: #173a5c;
  --geo-road: #2c313a;
  --geo-local: #23272e;
  --geo-walk: rgb(255 255 255 / 14%);
  --roof: #515a6a;
  --wall-a: #454d5b;
  --wall-b: #363c48;
  --wall-c: #2a2f39;
  --roof-hi: #7a869c;
  --edge: rgb(255 255 255 / 12%);
  --slab: rgb(190 205 235 / 20%);
  --slab-wall: rgb(150 170 210 / 16%);
}
:root[data-theme="light"] {
  --geo-base: #e6e9ed;
  --geo-campus: #f2f3f5;
  --geo-green: #dbe8dc;
  --geo-sport: #cfe3d2;
  --geo-water: #c3dcf4;
  --geo-road: #ffffff;
  --geo-local: #ffffff;
  --geo-walk: rgb(20 30 50 / 16%);
  --roof: #ffffff;
  --wall-a: #e3e7ed;
  --wall-b: #cfd5de;
  --wall-c: #bcc3ce;
  --roof-hi: #ffffff;
  --edge: rgb(20 30 50 / 14%);
  --slab: rgb(40 80 160 / 14%);
  --slab-wall: rgb(40 80 160 / 12%);
}

.main:has(#view-map.active) { padding: 0; }
.view-map.active { animation: none; }
.map-stage { position: relative; height: 100dvh; overflow: hidden; background: var(--geo-base); }
.map-viewport { position: absolute; inset: 0; cursor: grab; touch-action: none; user-select: none; }
.map-viewport.dragging { cursor: grabbing; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.geo-campus path { fill: var(--geo-campus); }
.geo-green path { fill: var(--geo-green); }
.geo-water path { fill: var(--geo-water); }
.geo-sport path { fill: var(--geo-sport); }
.geo-road path, .geo-local path, .geo-walk path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.geo-road path { stroke: var(--geo-road); stroke-width: 11; }
.geo-local path { stroke: var(--geo-local); stroke-width: 5.5; }
.geo-walk path { stroke: var(--geo-walk); stroke-width: 1.4; stroke-dasharray: 3 4; }

/* 平面地物 */
.flat { fill: transparent; stroke: transparent; cursor: pointer; transition: fill .3s, opacity .3s; }
.flat.kind-water { fill: var(--geo-water); }
.flat.kind-sport { fill: var(--geo-sport); }
.flat.kind-parking { fill: var(--geo-local); }
.map-stage[data-zone="P"] .flat.kind-parking { fill: color-mix(in srgb, var(--blue) 30%, transparent); stroke: var(--blue); stroke-width: 1.2; }
.flat.kind-area { fill: color-mix(in srgb, var(--ink) 3%, transparent); stroke: var(--hairline-2); stroke-width: 1; stroke-dasharray: 4 5; }
.flat.kind-park { fill: color-mix(in srgb, var(--green) 7%, transparent); stroke: color-mix(in srgb, var(--green) 40%, transparent); stroke-width: 1.2; stroke-dasharray: 5 4; }
.flat.kind-place { fill: var(--roof-hi); }
.flat.muted { opacity: .25; }
.flat.kind-park.muted { opacity: 0; pointer-events: none; }
.flat.kind-parking.muted { opacity: 1; }
.flat.selected { fill: color-mix(in srgb, var(--blue) 45%, transparent); stroke: var(--blue); stroke-width: 2; }

/* 楼体 */
.bld { cursor: pointer; transition: opacity .35s; }
.bld polygon { stroke: var(--edge); stroke-width: calc(.7px * var(--u, 1)); stroke-linejoin: round; transition: fill .25s; }
.bld .roof { fill: var(--roof); }
.bld .wa { fill: var(--wall-a); }
.bld .wb { fill: var(--wall-b); }
.bld .wc { fill: var(--wall-c); }
.bld.frequent .roof { fill: var(--roof-hi); }
.bld:hover .roof { fill: color-mix(in srgb, var(--blue) 45%, var(--roof)); }
.bld.muted { opacity: .45; }
.bld.approximate .roof { stroke-dasharray: calc(3px * var(--u, 1)); }
.bld.selected:not(.exploded) .roof { fill: var(--blue); }
.bld.selected:not(.exploded) .wa { fill: color-mix(in srgb, var(--blue) 78%, black); }
.bld.selected:not(.exploded) .wb { fill: color-mix(in srgb, var(--blue) 62%, black); }
.bld.selected:not(.exploded) .wc { fill: color-mix(in srgb, var(--blue) 48%, black); }

/* 拆开的楼层 */
.slab polygon { stroke: color-mix(in srgb, var(--blue) 40%, transparent); }
.slab .roof { fill: var(--slab); }
.slab .wall { fill: var(--slab-wall); }
.slab:hover .roof { fill: color-mix(in srgb, var(--blue) 40%, transparent); }
.slab.on .roof { fill: var(--blue); }
.slab.on .wa { fill: color-mix(in srgb, var(--blue) 80%, black); }
.slab.on .wb { fill: color-mix(in srgb, var(--blue) 64%, black); }
.slab.on .wc { fill: color-mix(in srgb, var(--blue) 50%, black); }
.slab.on polygon { stroke: color-mix(in srgb, var(--blue) 70%, white); }
.slab-label { fill: var(--ink-2); font-size: calc(11.5px * var(--u, 1)); font-weight: 650; font-variant-numeric: tabular-nums; pointer-events: none; }
.slab.on .slab-label { fill: var(--ink); font-size: calc(14px * var(--u, 1)); font-weight: 750; }

/* 路线 */
.route-under { fill: none; stroke: var(--geo-base); stroke-width: calc(8px * var(--u, 1)); stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.route-line { fill: none; stroke: var(--blue); stroke-width: calc(5px * var(--u, 1)); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.route-line.draw { animation: routeDraw 1.4s cubic-bezier(.4, .1, .2, 1) forwards; }
@keyframes routeDraw { to { stroke-dashoffset: 0; } }
.route-end { fill: var(--geo-base); stroke: var(--blue); stroke-width: calc(2.5px * var(--u, 1)); r: calc(5px * var(--u, 1)); }
.route-end.goal { fill: var(--blue); }

/* 标签 */
.map-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.map-label { position: absolute; left: 0; top: 0; display: none; align-items: center; white-space: nowrap; pointer-events: auto; will-change: transform; }
.map-label.shown { display: inline-flex; }
.map-label.numbered { color: var(--ink-3); font-size: 10.5px; font-weight: 650; font-variant-numeric: tabular-nums; text-shadow: 0 0 4px var(--geo-base), 0 0 2px var(--geo-base); }
.map-label.named { height: 24px; padding: 0 9px; border-radius: 8px; background: var(--float); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid var(--float-edge); color: var(--ink); font-size: 12px; font-weight: 620; box-shadow: 0 4px 14px rgb(0 0 0 / 22%); }
.map-label.named::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 5px; background: var(--hairline-2); }
.map-label.named:hover { background: var(--float-solid); }
.map-label.selected { display: none; }
.map-label.kind-water.named, .map-label.kind-sport.named, .map-label.kind-park.named { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; box-shadow: none; color: var(--ink-2); font-size: 11.5px; text-shadow: 0 0 5px var(--geo-base); }
.map-label.kind-water.named::after, .map-label.kind-sport.named::after, .map-label.kind-park.named::after { display: none; }

/* 浮层控件 */
.map-top { position: absolute; z-index: 5; top: 16px; left: 16px; bottom: 16px; width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.map-search { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; border-radius: 16px; color: var(--ink-3); flex: 0 0 auto; transition: border-color .2s; }
.map-search:focus-within { border-color: color-mix(in srgb, var(--blue) 60%, transparent); }
.map-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.map-search input::placeholder { color: var(--ink-3); }
.map-search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }
.bld-panel { position: relative; min-height: 0; padding: 14px; border-radius: 20px; overflow-y: auto; overscroll-behavior: contain; animation: panelIn .4s var(--spring); scrollbar-width: thin; }
.bld-panel.has-building { padding: 22px; }
@keyframes panelIn { from { opacity: 0; transform: translateY(-8px); } }
.zone-chips { position: absolute; z-index: 4; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 14px; }
.zone-chips button { height: 34px; padding: 0 14px; border-radius: 10px; color: var(--ink-2); font-size: 13px; font-weight: 620; white-space: nowrap; transition: background .2s, color .2s; }
.zone-chips button:hover { color: var(--ink); }
.zone-chips button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.map-ctrl { position: absolute; z-index: 4; right: 16px; bottom: 18px; display: grid; gap: 8px; justify-items: end; }
.map-btn, .map-btn-group { border-radius: 13px; color: var(--ink); }
.map-btn { display: grid; place-items: center; width: 42px; height: 42px; font-size: 12px; font-weight: 750; }
.map-btn-group { display: grid; overflow: hidden; }
.map-btn-group button { display: grid; place-items: center; width: 42px; height: 40px; color: var(--ink-2); transition: background .2s, color .2s; }
.map-btn-group button + button { border-top: 1px solid var(--hairline); }
.map-btn-group button:hover, .map-btn:hover { color: var(--ink); background-color: var(--surface-2); }
.map-btn-group .icon { width: 18px; height: 18px; }
.map-btn-group .flip .icon { transform: scaleX(-1); }
.compass { display: grid; place-items: center; width: 26px; height: 26px; color: var(--red); font-size: 12px; font-weight: 800; transition: transform .1s linear; }
.compass::before { content: ""; position: absolute; width: 0; height: 0; margin-top: -24px; border: 3px solid transparent; border-bottom-color: var(--red); }
.map-credit { position: absolute; z-index: 3; right: 70px; bottom: 20px; color: var(--ink-3); font-size: 10.5px; }
.map-credit a:hover { color: var(--ink-2); }

/* 面板内容 */
.panel-kicker { margin: 4px 8px 6px; color: var(--ink-3); font-size: 12px; font-weight: 650; }
.building-list { display: grid; }
.building-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 8px; border-radius: 12px; text-align: left; transition: background .15s; }
.building-row:hover, .building-row:focus-visible { background: var(--surface-2); }
.building-row b { display: block; font-size: 14.5px; font-weight: 620; line-height: 1.35; }
.building-row small { display: block; margin-top: 1px; color: var(--ink-3); font-size: 12.5px; line-height: 1.4; }
.bld-no { display: grid; place-items: center; min-width: 38px; height: 32px; padding: 0 6px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.bld-no.glyph { color: var(--ink); }
.bld-no .icon { width: 17px; height: 17px; }
.map-muted { margin: 10px 8px; color: var(--ink-3); font-size: 13.5px; line-height: 1.55; }
.map-disclosure { margin-top: 8px; border-top: 1px solid var(--hairline); }
.map-disclosure summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 8px; color: var(--ink-3); font-size: 12.5px; font-weight: 620; cursor: pointer; list-style: none; }
.map-disclosure summary::-webkit-details-marker { display: none; }
.map-disclosure summary:hover { color: var(--ink); }
.map-itinerary { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.map-itinerary button { height: 30px; padding: 0 11px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 620; }
.map-itinerary button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.building-detail { position: relative; }
.panel-close { position: absolute; top: -6px; right: -6px; }
.bld-kicker { display: flex; align-items: center; gap: 8px; padding-right: 40px; color: var(--ink-3); font-size: 13px; }
.bld-kicker b { padding: 2px 7px; border-radius: 6px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.bld-name { margin-top: 10px; font-size: 25px; line-height: 1.22; font-weight: 720; letter-spacing: -.035em; outline: 0; }
.bld-use { margin-top: 6px; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.route-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.route-row > .icon { width: 18px; height: 18px; color: var(--blue); }
.route-row b { font-weight: 680; }
.route-row > span { color: var(--ink-3); font-size: 12.5px; }
.route-from { display: flex; gap: 2px; margin-left: auto; padding: 2px; border-radius: 9px; background: var(--surface-2); }
.route-from button { height: 26px; padding: 0 9px; border-radius: 7px; color: var(--ink-3); font-size: 12px; font-weight: 620; }
.route-from button[aria-pressed="true"] { background: var(--seg-thumb); color: var(--ink); }
.link-row { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; font-weight: 620; text-align: left; }
.link-row .icon { width: 16px; height: 16px; color: var(--ink-3); }
.map-destination { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 22%, transparent); }
.map-destination b { font-size: 14px; font-weight: 680; }
.map-destination p { margin-top: 4px; color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.floor-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0 10px; }
.floor-tabs button { min-width: 38px; height: 32px; padding: 0 8px; border-radius: 9px; color: var(--ink-3); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; transition: background .15s, color .15s; }
.floor-tabs button.known { color: var(--ink); background: var(--surface-2); }
.floor-tabs button:hover { background: var(--surface-3); }
.floor-tabs button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.floor-rooms { display: grid; }
.floor-rooms li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 2px; font-size: 14px; line-height: 1.5; }
.floor-rooms li + li { border-top: 1px solid var(--hairline); }
.room-no { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.map-source-links { display: grid; gap: 2px; padding: 0 4px 6px; }
.map-source-links a, .map-source-links button { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 4px; color: var(--ink-2); font-size: 12.5px; text-align: left; }
.map-source-links a:hover, .map-source-links button:hover { color: var(--ink); }
.map-source-links .icon { width: 13px; height: 13px; color: var(--ink-3); }

/* 面板里的当天菜单 */
.campus-menu { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.campus-menu:empty { display: none; }
.menu-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.menu-heading h3 { font-size: 14px; font-weight: 680; }
.menu-heading time { color: var(--ink-3); font-size: 12px; }
.menu-meal { margin-top: 10px; }
.menu-meal h4 { color: var(--ink-3); font-size: 12px; font-weight: 620; }
.menu-meal ul { margin-top: 4px; }
.menu-meal li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; }
.menu-price { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.menu-source { margin-top: 8px; }
.menu-source a, .menu-source button { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-size: 13px; font-weight: 620; }
.menu-source .icon { width: 14px; height: 14px; }

@media (max-width: 860px) {
  .map-stage { height: 100dvh; }
  .map-top { top: 12px; left: 12px; right: 12px; bottom: auto; width: auto; max-height: calc(100dvh - 24px); }
  .bld-panel { max-height: 44dvh; }
  .bld-panel.has-building { position: fixed; left: 8px; right: 8px; bottom: calc(86px + env(safe-area-inset-bottom)); max-height: 46dvh; animation: sheetUp .5s var(--spring); }
  .zone-chips { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .map-stage:has(.bld-panel.has-building) .zone-chips, .map-stage:has(.bld-panel.has-building) .map-ctrl { display: none; }
  .map-ctrl { right: 12px; bottom: calc(140px + env(safe-area-inset-bottom)); }
  .map-credit { right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* v6 · campus switcher floating above the map search */
.map-top .campus-switch { align-self: flex-start; gap: 2px; margin: 0; padding: 3px; border: 1px solid var(--float-edge); border-radius: 11px; background: var(--float); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--float-shadow); flex: 0 0 auto; }
.map-top .campus-switch a { padding: 5px 13px; border-radius: 8px; font-size: 14px; }
.map-top .campus-switch a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.map-top .campus-switch a[aria-current="page"]::after { display: none; }
.map-search { border-radius: 13px; height: 48px; }
/* Device GPS stays on the device; show reported uncertainty instead of snapping to a building. */
.user-accuracy { fill:#3688ef26; stroke:#3688ef80; stroke-width:1; vector-effect:non-scaling-stroke; }
.user-position-halo { fill:#fff; }
.user-position { fill:#267ae9; stroke:#fff; stroke-width:1.5; vector-effect:non-scaling-stroke; }
.map-location-status { position:absolute; left:12px; bottom:31px; max-width:calc(100% - 95px); margin:0; padding:5px 8px; border-radius:7px; font-size:10px; color:var(--ink-2); background:var(--surface); pointer-events:none; }
.map-location-btn { color:#267ae9; }
.pond-details { pointer-events:none; }
.pond-details path { stroke:#e4e9e8; stroke-width:2; fill:none; }
.pond-details circle { fill:#e4e9e8; }
.pond-details ellipse { fill:none; stroke:#bbdce8; stroke-width:1; }
