:root {
  --bg: #0b1320; --panel: rgba(13, 22, 38, 0.95); /* 不用 backdrop-filter：盖在 WebGL 地图上会让每帧都重新模糊，缩放卡顿 */ --line: rgba(148, 178, 222, 0.18);
  --text: #e8eef8; --muted: #9fb0c8; --accent: #f5b942;
  --estate: #36c2ff; --listing: #ff7a45; --ok: #3ddc97;
  --radius: 10px; --sidebar: 340px; --detail: 420px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; z-index: 99; background: var(--accent); color: #000; padding: 6px 10px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #0e1a2e, #0b1320); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: conic-gradient(var(--estate), var(--listing), var(--accent), var(--estate)); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .5px; }
.brand .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.stats { display: flex; gap: 22px; margin-left: auto; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { background: rgba(255,255,255,.1); }

.layout { flex: 1; display: grid; grid-template-columns: var(--sidebar) 1fr; position: relative; min-height: 0; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }
.filters { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.filters input, .filters select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0f1a2c; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 4px; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: rgba(245,185,66,.18); color: var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 2px solid #fff; }
.dot.estate { background: var(--estate); }
.dot.listing { background: var(--listing); border-radius: 2px; }

.list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.list li button { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 8px;
  padding: 9px 10px; cursor: pointer; display: grid; grid-template-columns: 16px 1fr; gap: 2px 8px; }
.list li button:hover, .list li button.active { background: rgba(255,255,255,.06); border-color: var(--line); }
.list li button.active { border-color: var(--accent); }
.list .t { font-size: 14px; line-height: 1.35; }
.list .m { grid-column: 2; font-size: 12px; color: var(--muted); }
.list .p { grid-column: 2; font-size: 12px; color: var(--accent); }
.list .dot { margin-top: 4px; }
.list .empty { color: var(--muted); padding: 20px; text-align: center; }

.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
.legend { position: absolute; left: 12px; bottom: 28px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.legend .ring { display: inline-block; width: 12px; height: 12px; border: 2px dashed #fff; border-radius: 50%; margin-right: 5px; vertical-align: -2px; }
.legend .poly { display: inline-block; width: 14px; height: 10px; border: 2px solid var(--estate); background: rgba(54,194,255,.2); margin-right: 5px; vertical-align: -1px; }

.detail { position: absolute; right: 0; top: 0; bottom: 0; width: var(--detail); max-width: 100%; overflow-y: auto;
  background: var(--panel); border-left: 1px solid var(--line); padding: 14px 18px 24px;
  box-shadow: -10px 0 30px rgba(0,0,0,.35); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.detail-head { display: flex; justify-content: space-between; align-items: center; }
.detail h2 { margin: 12px 0 4px; font-size: 20px; line-height: 1.35; }
.muted { color: var(--muted); margin: 0; font-size: 13px; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: rgba(54,194,255,.18); color: var(--estate); }
.badge.listing { background: rgba(255,122,69,.18); color: var(--listing); }
.price-box { margin: 14px 0 8px; padding: 12px; border-radius: var(--radius); background: rgba(245,185,66,.08); border: 1px solid rgba(245,185,66,.3); }
.price-box .v { font-size: 18px; color: var(--accent); line-height: 1.4; word-break: break-word; }
.price-box .n { font-size: 11px; color: var(--muted); margin-top: 6px; }
.price-box.none .v { color: var(--muted); font-size: 14px; }
.geo-note { font-size: 12px; color: var(--muted); padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); }
.geo-note.approx { border-left: 3px solid var(--accent); }
.group { margin-top: 16px; }
.group h3 { font-size: 13px; color: var(--accent); margin: 0 0 6px; letter-spacing: 1px; }
.group dl { margin: 0; display: grid; grid-template-columns: 112px 1fr; gap: 6px 10px; font-size: 13px; }
.group dt { color: var(--muted); }
.group dd { margin: 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.provenance { margin-top: 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }

.maplibregl-popup-content { background: #0f1a2c; color: var(--text); border: 1px solid var(--line); padding: 6px 10px; font-size: 13px; }
.maplibregl-popup-tip { border-top-color: #0f1a2c !important; border-bottom-color: #0f1a2c !important; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.cluster-label { pointer-events: none; font-size: 13px; font-weight: 700; color: #06101e; text-shadow: 0 0 2px #fff; }
.maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-right { transition: right .25s, bottom .25s; }
body.detail-open .maplibregl-ctrl-top-right, body.detail-open .maplibregl-ctrl-bottom-right { right: calc(var(--detail) + 8px); }
.group dd, .price-box .n, .geo-note { color: #c3cfe0; }
.price-box .n { font-size: 12px; }

/* 平板 */
@media (max-width: 1100px) { :root { --sidebar: 280px; --detail: 360px; } .stats .stat:nth-child(n+3) { display: none; } }
/* 手机：列表变成底部抽屉 */
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 8px 10px; } .brand h1 { font-size: 15px; } .brand .sub, .stats { display: none; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr 38vh; }
  .sidebar { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .detail { width: 100%; top: auto; height: 56vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; z-index: 5; }
  body.detail-open .maplibregl-ctrl-top-right { right: 0; }
  body.detail-open .maplibregl-ctrl-bottom-right { bottom: 56vh; }
  body.detail-open .legend { display: none; }
  .group dl { grid-template-columns: 1fr; gap: 2px; } .group dd { margin-bottom: 8px; }
  .legend { bottom: 6px; left: 6px; gap: 8px; font-size: 11px; }
}
/* 大屏 */
@media (min-width: 2400px) { :root { font-size: 18px; --sidebar: 460px; --detail: 560px; } .detail h2 { font-size: 28px; } .group dl { font-size: 16px; grid-template-columns: 150px 1fr; } }

.site-plan img { display: block; width: 100%; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.site-plan .n { font-size: 12px; color: var(--muted); margin: 6px 0; white-space: pre-wrap; }
.site-plan .dl { font-size: 13px; color: var(--accent); }
.site-plan .ov-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.site-plan .ov-ctl .btn[aria-pressed="true"] { background: rgba(124,252,154,.18); border-color: #7CFC9A; color: #7CFC9A; }
.site-plan .ov-op { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.site-plan .ov-op[hidden] { display: none; }
.legend .poly.plan { border: 2px dashed #7CFC9A; background: rgba(124,252,154,.15); }
/* 详情页签 */
.tabs { position: sticky; top: -14px; z-index: 2; display: flex; gap: 4px; margin: 12px -18px 0; padding: 8px 18px 0;
  background: #0d1626; border-bottom: 1px solid var(--line); }
.tabs [role=tab] { flex: 1; border: 0; background: none; padding: 8px 4px; font-size: 13px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs [role=tab]:hover { color: var(--text); }
.tabs [role=tab][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-pane > .price-box:first-child { margin-top: 14px; }
.tab-empty { margin-top: 16px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
@media (max-width: 720px) { .tabs { top: -14px; } .tabs [role=tab] { font-size: 12px; } }
/* 顶栏三段：左 贯通 logo / 中 标题 / 右 统计+按钮 */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; }
.logo { justify-self: start; display: flex; align-items: center; }
.logo img { display: block; height: 44px; width: auto; }
.topbar .brand { justify-self: center; }
.top-right { justify-self: end; display: flex; align-items: center; gap: 22px; min-width: 0; }
.top-right .stats { margin-left: 0; }
@media (max-width: 1100px) { .logo img { height: 34px; } .top-right { gap: 12px; } }
@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .logo img { height: 26px; } .topbar .brand { justify-self: center; } .brand-mark { display: none; }
}
/* 中央标题：宋体粗笔 + 金属渐变字 + 两侧金线 */
.topbar .brand { flex-direction: column; gap: 3px; text-align: center; padding: 2px 0; }
.brand h1 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  font-size: 27px; font-weight: 900; letter-spacing: 7px; margin-right: -7px; line-height: 1.15;
  background: linear-gradient(180deg, #fff6dc 0%, #f5d27a 45%, #c8912e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(245, 185, 66, .28));
}
.brand .sub { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 10.5px; color: #c9a66b; letter-spacing: 2.5px; white-space: nowrap; }
.brand .sub::before, .brand .sub::after { content: ""; width: 42px; height: 1px; }
.brand .sub::before { background: linear-gradient(90deg, transparent, #c9a66b); }
.brand .sub::after { background: linear-gradient(270deg, transparent, #c9a66b); }
.brand .sub .en { font-family: "Times New Roman", Georgia, serif; letter-spacing: 3px; }
.brand .sub .cn { color: var(--muted); letter-spacing: 2px; }
.brand .sub .en + .cn::before { content: "｜"; color: rgba(201,166,107,.5); margin-right: 8px; }
@media (max-width: 1100px) { .brand h1 { font-size: 22px; letter-spacing: 4px; margin-right: -4px; } .brand .sub .cn { display: none; } }
@media (max-width: 720px) { .brand h1 { font-size: 16px; letter-spacing: 2px; margin-right: -2px; } .brand .sub { display: none; } }
/* 标题加大；右侧统计与按钮不换行 */
.brand h1 { font-size: 31px; letter-spacing: 8px; margin-right: -8px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.6)) drop-shadow(0 2px 8px rgba(245,185,66,.25)); }
.brand .sub::before, .brand .sub::after { width: 56px; }
.stat span, .btn { white-space: nowrap; }
.top-right { flex-shrink: 0; }
@media (max-width: 1280px) { .brand h1 { font-size: 24px; letter-spacing: 5px; margin-right: -5px; } .stats .stat:nth-child(n+3) { display: none; } }
@media (max-width: 720px) { .brand h1 { font-size: 16px; letter-spacing: 2px; margin-right: -2px; } }

/* ---- 图层切换 + 基础设施 ---- */
.map-ctl { position: absolute; left: 12px; top: 12px; z-index: 3; display: grid; gap: 8px; width: 168px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.map-ctl .base-seg { grid-template-columns: 1fr 1fr; }
.map-ctl .base-seg button { padding: 6px 4px; white-space: nowrap; }
.infra-switch { margin: 0; padding: 4px 2px 0; border: 0; display: grid; gap: 4px; font-size: 13px; }
.infra-switch legend { font-size: 11px; color: var(--muted); padding: 0 0 2px; letter-spacing: 1px; }
.infra-switch label { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.infra-switch input { margin: 0; accent-color: var(--accent); }
.infra-switch i, .infra-ic { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font-style: normal; font-size: 11px; font-weight: 700; color: #0b1320; flex: none; }
.infra-ic.ln { border-radius: 4px; }
.infra-intro { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
.infra-group h3 { display: flex; align-items: center; gap: 6px; }
.infra-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.infra-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.infra-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: rgba(255,255,255,.03); }
.infra-head { display: flex; align-items: center; gap: 8px; }
.infra-t { flex: 1; min-width: 0; display: grid; }
.infra-t b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.infra-t span { font-size: 11px; color: var(--muted); }
.infra-km { font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.infra-params { margin: 6px 0 0 26px; display: grid; grid-template-columns: 76px 1fr; gap: 2px 8px; font-size: 12px; }
.infra-params dt { color: var(--muted); } .infra-params dd { margin: 0; color: #c3cfe0; overflow-wrap: anywhere; }
.group .infra-cap { margin: 6px 0 0; display: grid; grid-template-columns: 76px 1fr; gap: 0 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
.group .infra-cap + .infra-params { margin-top: 2px; }
.group .infra-cap b { font-size: 18px; font-weight: 700; color: #ffc61a; font-variant-numeric: tabular-nums; }
.infra-note { margin: 8px 0 0; font-size: 11px; line-height: 1.6; color: var(--muted); }
.infra-none { margin: 6px 0 0 26px; font-size: 12px; color: var(--muted); }
.infra-group > .infra-none { margin-left: 0; }
.infra-act { margin: 6px 0 0 26px; display: flex; gap: 14px; font-size: 12px; }
.infra-act a, .infra-act .link { color: var(--estate); background: none; border: 0; padding: 0; cursor: pointer; font-size: 12px; text-decoration: none; }
.infra-act a:hover, .infra-act .link:hover { text-decoration: underline; }
.infra-src { margin-top: 14px; font-size: 11px; line-height: 1.6; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
@media (max-width: 720px) {
  .map-ctl { top: 6px; left: 6px; width: auto; grid-template-columns: auto; padding: 6px; }
  .infra-switch { grid-auto-flow: column; gap: 8px; font-size: 12px; } .infra-switch legend { display: none; }
}
