﻿/* Oval Advance design language â€” dark, accent #f97d14, glass panels */
:root {
  --bg: #0c0d0f;
  --panel: rgba(18, 20, 23, 0.9);
  --card: #17181b;
  --muted: #252729;
  --muted-fg: #a1a5ab;
  --border: rgba(255, 255, 255, 0.10);
  --fg: #f5f5f5;
  --accent: #f97d14;
  --accent-fg: #fffbf7;
  --radius: 12px;
  --topbar-h: 96px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 14px/1.5 ui-sans-serif, system-ui, "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#map { position: absolute; inset: 0; z-index: 0; background: var(--bg); }
body.base-off #map { background: #ffffff; }

/* ---------- é¡¶éƒ¨:å“ç‰Œ + å…³é”®æ•°æ® + æœç´¢ ---------- */
.topbar {
  position: absolute; z-index: 1000; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 16px 12px 18px;
  background: linear-gradient(180deg, rgba(10, 11, 13, 0.96) 0%, rgba(10, 11, 13, 0.88) 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.bico {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.bico svg { width: 18px; height: 18px; }
.btxt { line-height: 1.2; }
.bname { font-size: 18px; font-weight: 700; line-height: 1.12; letter-spacing: -.01em; }
.bsub { font-size: 10.5px; color: var(--muted-fg); margin-top: 3px; }
.bpoint { font-size: 11.5px; color: var(--fg); opacity: .85; margin-top: 2px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* å…³é”®æ•°æ®(å¤§å·) */
.stats { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 34px; overflow-x: auto; padding-bottom: 2px; }
.stats::-webkit-scrollbar { height: 0; }
.stat-empty { font-size: 12.5px; color: var(--muted-fg); padding: 14px 0; }
.stat-mode { display: flex; flex-direction: column; gap: 2px; flex: none; }
.stat-mode .mhead { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: rgba(245,245,245,.85); }
.stat-mode .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.stat-row { display: flex; align-items: flex-end; gap: 26px; }
.stat { display: flex; flex-direction: column; }
.snum {
  font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05;
  font-variant-numeric: tabular-nums; color: #fff;
}
.sunit { font-size: 13px; font-weight: 500; color: var(--muted-fg); margin-left: 5px; }
.sexact { font-size: 12px; color: var(--muted-fg); margin-top: 2px; font-variant-numeric: tabular-nums; }
.slab { font-size: 12.5px; color: var(--muted-fg); font-variant-numeric: tabular-nums; margin-top: 3px; }
.stat-meta { flex: none; font-size: 11px; color: var(--muted-fg); padding-bottom: 4px; }

/* æœç´¢ */
.searchbox {
  flex: none; display: flex; align-items: center; gap: 8px; width: 268px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
}
.searchbox .ico { width: 15px; height: 15px; color: var(--muted-fg); flex: none; }
.searchbox input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--fg); font-size: 13px; font-family: inherit; }
.searchbox input::placeholder { color: var(--muted-fg); }
.sqbtn { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border: 0; border-radius: 7px; background: var(--accent); color: var(--accent-fg); cursor: pointer; }
.sqbtn svg { width: 14px; height: 14px; }
.sqbtn:hover { opacity: .9; }

.langbtn {
  width: 38px; height: 38px; flex: none; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 10px;
  color: var(--fg); font: 600 12.5px/1.2 inherit; font-family: inherit; transition: color .15s, border-color .15s;
}
.langbtn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.ptbox {
  flex: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: rgba(255,255,255,.03); color: var(--muted-fg); font-size: 11.5px;
}
.iconbtn {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 10px;
  color: var(--fg); transition: color .15s;
}
.iconbtn:hover:not(:disabled) { color: var(--accent); }
.iconbtn:disabled { opacity: .4; cursor: not-allowed; }
.iconbtn svg { width: 17px; height: 17px; }

/* ---------- å·¦ä¾§æŽ§åˆ¶é¢æ¿ ---------- */
/* å·¦ä¸‹è§’:å›¾ä¾‹ + åˆ†æž/å›¾å±‚é¢æ¿(åŒå®½,å›¾ä¾‹é»˜è®¤æ”¶èµ·),ç½²ååœ¨æœ€åº•éƒ¨ */
.zoomhud { display: none; }        /* åªåœ¨æ‰‹æœºç«¯æ˜¾ç¤º,è§åª’ä½“æŸ¥è¯¢ */

.ver { display: none; }

.bottomleft {
  position: absolute; z-index: 1000; left: 16px; bottom: 44px; width: 320px;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.bottomleft > * { pointer-events: auto; }
.panel {
  width: 100%; max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - var(--topbar-h) - 190px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0,0,0,.5); backdrop-filter: blur(12px);
}
.panel.collapsed .pbody { display: none; }
.phead { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.pico { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 13px; }
.ptitles { flex: 1; min-width: 0; line-height: 1.2; }
.ptitles h1 { margin: 0; font-size: 13px; font-weight: 600; }
.ptitles p { margin: 1px 0 0; font-size: 10.5px; color: var(--muted-fg); }
.pbtn { width: 26px; height: 26px; flex: none; display: grid; place-items: center; cursor: pointer; background: transparent; border: 0; border-radius: 7px; color: var(--muted-fg); }
.pbtn:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.pbtn svg { width: 14px; height: 14px; }
.pbody { padding: 0 12px 12px; }
.sec { margin-top: 13px; }
.label { margin: 0 0 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-fg); }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--muted); border-radius: 10px; padding: 4px; }
.mode {
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  padding: 6px 2px; border: 0; border-radius: 7px; background: transparent;
  font-size: 10px; font-weight: 500; color: var(--muted-fg); font-family: inherit; transition: color .15s;
}
.mode:hover { color: var(--fg); }
.mode svg { width: 16px; height: 16px; }
.mode.on { color: #fff; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--muted); border-radius: 10px; padding: 4px; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
  padding: 6px 4px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  color: var(--muted-fg); font-size: 11.5px; font-weight: 500; font-family: inherit; transition: .15s;
}
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.bdot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .35; }
.seg button.on .bdot { opacity: 1; background: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: rgba(255,255,255,.03); color: var(--muted-fg);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; user-select: none;
  font-family: inherit; transition: .15s;
}
.chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--fg); }
.chip.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }

.toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tg {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: rgba(255,255,255,.03); color: var(--muted-fg); font-size: 11.5px;
}
.tg:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--fg); }
.tg input { accent-color: var(--accent); width: 13px; height: 13px; margin: 0; cursor: pointer; }
.tg input:disabled { cursor: not-allowed; opacity: .4; }
.tg:has(input:disabled) { opacity: .5; }
.tg:has(input:checked) { color: var(--fg); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.hint { font-size: 10px; line-height: 1.5; color: var(--muted-fg); flex: 1 1 100%; }

.runbtn {
  margin-top: 13px; width: 100%; padding: 9px; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
}
.runbtn:hover:not(:disabled) { opacity: .92; }
.runbtn:disabled { background: var(--muted); color: var(--muted-fg); cursor: not-allowed; }
.status { margin: 8px 0 0; font-size: 11.5px; color: var(--muted-fg); min-height: 16px; }
.status.err { color: #ff6568; }

.row2 { display: flex; gap: 6px; margin-top: 6px; }
.row2 input, .row2 select {
  flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255,255,255,.04); color: var(--fg); font-size: 11.5px; font-family: inherit;
}
.row2 input::placeholder { color: var(--muted-fg); }
.row2 input:focus, .row2 select:focus { outline: none; border-color: var(--accent); }
.row2 select { background: var(--muted); }
.btn2 {
  flex: 1; padding: 7px 10px; cursor: pointer; border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255,255,255,.03); color: var(--fg); font-size: 11.5px; font-weight: 500; font-family: inherit;
  white-space: nowrap; transition: .15s;
}
.btn2:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.btn2:disabled { opacity: .45; cursor: not-allowed; }
.btn2.primary2 { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn2.primary2:hover:not(:disabled) { opacity: .92; color: var(--accent-fg); }
.views { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.vrow { display: flex; gap: 4px; }
.vapply {
  flex: 1; min-width: 0; text-align: left; cursor: pointer; padding: 6px 9px; font-size: 11px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted-fg); font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vapply:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.vdel {
  width: 26px; flex: none; cursor: pointer; border: 1px solid var(--border); border-radius: 7px;
  background: rgba(255,255,255,.03); color: var(--muted-fg); font-size: 13px; line-height: 1; font-family: inherit;
}
.vdel:hover { color: #ff6568; border-color: rgba(255,101,104,.5); }
.note { margin-top: 13px; font-size: 10px; line-height: 1.6; color: var(--muted-fg); }

/* ---------- å³ä¸‹å›¾ä¾‹ / åº•éƒ¨ç½²å ---------- */
/* ç¼©æ”¾é”®æ”¾å³ä¸Š(é¡¶éƒ¨æ ä¸‹æ–¹) */
.maplibregl-ctrl-top-right { top: calc(var(--topbar-h) + 10px); right: 12px; }
.maplibregl-ctrl-group { border-radius: 10px; overflow: hidden; }

.legend {
  width: 100%; display: none; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0,0,0,.5); backdrop-filter: blur(12px);
}
.legend.show { display: block; }
.lghead { padding: 9px 12px 6px; color: var(--fg); font-weight: 600; font-size: 12.5px; }
.lgbody { display: block; padding: 2px 12px 11px; }
.lgrow { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(245,245,245,.9); }
.lgline { display: inline-block; height: 3px; width: 24px; border-radius: 999px; }
.lgheat { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.12); }
.lgheat .lgt { font-size: 10px; color: var(--muted-fg); margin-bottom: 4px; }
.lgheat .lgbar { height: 7px; border-radius: 3px; }
.lgheat .lgticks { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted-fg); margin-top: 3px; font-variant-numeric: tabular-nums; }

.credit { position: absolute; z-index: 1000; bottom: 14px; left: 16px; pointer-events: none; }
.credit p {
  margin: 0; padding: 4px 12px; border-radius: 999px; font-size: 10px; color: var(--muted-fg);
  background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(6px);
}
.credit b { color: rgba(245,245,245,.92); font-weight: 600; }
.credit .dim { opacity: .6; }

.maplibregl-popup-content { font: 12px/1.5 system-ui, "Microsoft YaHei", sans-serif; border-radius: 8px; padding: 8px 11px; }
.maplibregl-ctrl-attrib { font-size: 10px; }

@media (max-width: 1100px) {
  .stats { gap: 22px; }
  .snum { font-size: 28px; }
  .searchbox { width: 200px; }
}
/* ================= æ‰‹æœºç«¯å¸ƒå±€(åªä½œç”¨äºŽè§¦å±è®¾å¤‡,ç½‘é¡µç‰ˆä¸å—å½±å“) =================
   åœ°å›¾å§‹ç»ˆå…¨å±;æ•°æ®æµ®å±‚åœ¨ä¸‹;è®¾ç½®æ”¶ç¼©æˆæœ€åº•éƒ¨ä¸€æ¡(ä¸Žæ•°æ®æ åŒæ¬¾æ ·å¼) */
@media (max-width: 900px) {
  .legend, .credit, .note { display: none !important; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; gap: 8px; padding: 9px 10px; }
  .brand .bsub, .bpoint { display: none; }
  .bname { font-size: 15px; line-height: 1.1; }
  .bico { width: 30px; height: 30px; }
  .searchbox { flex: 1; width: auto; }

  /* æ•°æ®æ ä¸Žè®¾ç½®æ¡:åŒä¸€å¥—å¤–è§‚ */
  .stats, .panel {
    background: rgba(18,20,23,.94);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 26px rgba(0,0,0,.45);
  }
  .stats { padding: 10px 12px; gap: 16px; overflow: auto; align-items: flex-start; flex-wrap: wrap; }
  .stat-row { flex-wrap: wrap; gap: 14px 22px; }
  .snum { font-size: 24px; }
  .sunit { font-size: 11px; }
  .slab, .sexact { font-size: 10.5px; }
  .stat-mode .mhead { font-size: 11.5px; }

  /* è®¾ç½®æ¡:å æ»¡æ•´å®½ */
  .bottomleft { width: auto !important; left: 6px; right: 6px; }
  .panel.collapsed .phead { justify-content: center; padding: 11px 12px; }
  .panel.collapsed .pico { display: none; }
  .panel.collapsed .ptitles { flex: none; text-align: center; }
  .panel.collapsed .ptitles p { display: none; }

  /* ç‰ˆæƒ:æ‰‹æœºä¸Šé¢ä¸æ”¾åœ¨åº•éƒ¨,æ”¶æˆå³ä¸Šè§’ä¸€ä¸ªå°åœ†ç‚¹ */
  .maplibregl-ctrl-attrib {
    display: block !important; position: fixed !important;
    top: 58px; right: 8px; bottom: auto !important; left: auto !important; z-index: 1000;
  }
  .maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(18,20,23,.9); border-radius: 999px; }
}

/* ç«–å±:ä¸Š 60% çº¯åœ°å›¾;æ•°æ®æµ®å±‚åœ¨è®¾ç½®æ¡ä¸Šæ–¹(è®¾ç½®å±•å¼€æ—¶ä¸€èµ·ä¸Šæµ®) */
@media (max-width: 900px) and (orientation: portrait) {
  :root { --topbar-h: 54px; --sheet-h: 48px; }
  #map { inset: 0; }
  .topbar { left: 0; right: 0; top: 0; }
  .stats {
    position: fixed; left: 6px; right: 6px; top: auto; bottom: calc(var(--sheet-h) + 10px);
    max-height: 34vh;
  }
  .bottomleft { position: fixed; left: 6px; right: 6px; top: auto; bottom: 6px; }
  .panel { max-height: 46vh; }
}

/* æ¨ªå±:å·¦åŠå±æ•´å—ç•™ç™½ç»™åœ°å›¾;æ•°æ®ä¸Žè®¾ç½®æ¡éƒ½åœ¨å³åŠå± */
@media (max-height: 560px) and (orientation: landscape) {
  :root { --topbar-h: 48px; }
  #map { inset: 0; }
  .topbar { left: 50%; right: 0; top: 0; flex-wrap: wrap; gap: 6px; padding: 7px 9px; }
  .brand { flex: 1 1 100%; }
  .bname { font-size: 14px; }
  .stats {
    position: fixed; left: calc(50% + 6px); right: 6px; top: 86px;
    bottom: calc(var(--sheet-h, 48px) + 10px); max-height: 48vh;
  }
  .snum { font-size: 22px; }
  .bottomleft { position: fixed; left: calc(50% + 6px); right: 6px; top: auto; bottom: 6px; }
  .panel { max-height: 44vh; }
}
/* 人口结构(性别 · 年龄)卡片内小块 */
.stat .sex { font-size: 11px; color: #b9bec6; margin-top: 4px; letter-spacing: .2px; white-space: nowrap; }
.stat .sex b { color: #e8ebef; font-weight: 600; }
.stat .abar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 3px; background: #2a2e34; }
.stat .abar i { display: block; height: 100%; }
.stat .aleg { font-size: 9.5px; color: #8f959d; margin-top: 3px; white-space: nowrap; }

/* 人口金字塔(男上 / 女下,按年龄段) */
.stat .pyr { margin-top: 4px; }
.stat .pyr svg { display: block; }

/* 人口金字塔 v2:铺满信息框宽度;列 ↔ 年龄标签/百分比一一对齐;中位年龄标在轴上 */
.stat { min-width: 180px; }
.stat .pyr { margin-top: 5px; }
.stat .pyr .pchart { position: relative; }
.stat .pyr .prow { display: flex; height: 40px; }
.stat .pyr .prow.up { align-items: flex-end; }
.stat .pyr .prow.dn { align-items: flex-start; }
.stat .pyr .pcol { flex: 1 1 0; height: 100%; display: flex; justify-content: center; }
.stat .pyr .prow.up .pcol { align-items: flex-end; }
.stat .pyr .prow.dn .pcol { align-items: flex-start; }
.stat .pyr .pcol i { display: block; width: 78%; background: #4a8fd4; border-radius: 1.5px 1.5px 0 0; }
.stat .pyr .prow.dn .pcol i { background: #e2705a; border-radius: 0 0 1.5px 1.5px; }
.stat .pyr .paxis { height: 1px; background: rgba(255,255,255,.28); }
.stat .pyr .plab, .stat .pyr .ppct { display: flex; margin-top: 3px; }
.stat .pyr .ppct { margin-top: 1px; }
.stat .pyr .plab span, .stat .pyr .ppct span { flex: 1 1 0; text-align: center; font-size: 9px; white-space: nowrap; }
.stat .pyr .plab span { color: #8f959d; }
.stat .pyr .ppct span { color: #cfd4da; font-variant-numeric: tabular-nums; }
.stat .pyr .pmed { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(255,255,255,.5); }
.stat .pyr .pmed b { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: rgba(12,14,17,.92); border: 1px solid rgba(255,255,255,.3); border-radius: 3px; padding: 1px 4px; font-size: 9.5px; font-weight: 500; color: #eef1f4; white-space: nowrap; }

/* 图例:每个出行方式下列出各时间档的颜色(分钟越大越淡) */
.legend .lgrow { flex-wrap: wrap; row-gap: 3px; }
.legend .lglab { font-size: 11.5px; color: rgba(245,245,245,.92); }
.legend .lgband { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted-fg); }
.legend .lgline.sm { width: 16px; height: 3px; }
