/* 离我最近的门店 · 深色工具型版式
   左侧固定面板 + 全屏地图；移动端面板变底部抽屉。 */
:root {
  --bg: #070c16;
  --panel: rgba(10, 18, 33, 0.9);
  --panel-2: rgba(18, 30, 50, 0.78);
  --line: rgba(148, 180, 220, 0.16);
  --text: #e8f0fa;
  --muted: #8ea3bf;
  --accent: #4fd8f0;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }
button { cursor: pointer; }

#map { position: absolute; inset: 0; }
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }

.maplibregl-ctrl-bottom-right { right: 12px; bottom: 10px; }
.maplibregl-ctrl-attrib { background: rgba(8, 14, 25, 0.7) !important; color: #9fb2cc !important; }
.maplibregl-ctrl-attrib a { color: #b9cbe4 !important; }
.maplibregl-ctrl-group { background: rgba(10, 18, 33, 0.85) !important; border: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-scale { background: rgba(8, 14, 25, 0.6) !important; color: #cbd9eb !important; }

/* ── 顶部标题 ─────────────────────────────────── */
.topbar {
  position: absolute;
  top: 18px;
  left: 382px;
  z-index: 5;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
}
.tb-kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 7px;
}
.topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.tb-sub { margin: 8px 0 0; font-size: 12.5px; color: #c4d4e8; }

/* ── 左侧面板 ─────────────────────────────────── */
.side {
  position: absolute;
  left: 16px;
  top: 16px;
  bottom: 16px;
  width: 348px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  transition: transform 0.28s ease;
}
.drawer { display: none; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px 10px; }
.side-scroll::-webkit-scrollbar { width: 6px; }
.side-scroll::-webkit-scrollbar-thumb { background: rgba(120, 160, 200, 0.28); border-radius: 3px; }

.sec-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 10px;
}
.origin-box { padding-bottom: 10px; border-bottom: 1px solid var(--line); }

.search-wrap { position: relative; }
#cityInput {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(79, 216, 240, 0.38);
  background: rgba(6, 14, 27, 0.8);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#cityInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 216, 240, 0.12); }
#cityInput::placeholder { color: #6f86a3; }

.city-list {
  position: absolute;
  left: 0; right: 0; top: 46px;
  margin: 0; padding: 5px;
  list-style: none;
  background: rgba(9, 17, 31, 0.98);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
  max-height: 232px;
  overflow-y: auto;
  display: none;
}
.city-list.on { display: block; }
.city-list li {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.city-list li:hover, .city-list li.hl { background: rgba(79, 216, 240, 0.14); }
.city-list li span { color: var(--muted); font-size: 11.5px; }

.origin-btns { display: flex; gap: 8px; margin-top: 10px; }
.origin-btns button {
  flex: 1;
  height: 33px;
  font-size: 12px;
  color: #cfe0f3;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.origin-btns button:hover { border-color: rgba(79, 216, 240, 0.5); color: #fff; }
.origin-cur {
  margin-top: 11px;
  font-size: 12px;
  color: var(--accent);
  background: rgba(79, 216, 240, 0.08);
  border: 1px solid rgba(79, 216, 240, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
}

.stat-row { display: flex; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat-row > div { flex: 1; text-align: center; }
.stat-row b { display: block; font-size: 17px; font-weight: 800; color: #fff; letter-spacing: 0.01em; }
.stat-row span { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted); }

.result-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0 7px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
}
.rh-note { font-size: 10.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.group-title {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: #7f96b3;
  padding: 9px 2px 6px;
  border-top: 1px dashed rgba(148, 180, 220, 0.13);
}
.group-title:first-child { border-top: 0; }
.loading { padding: 26px 4px; text-align: center; font-size: 12px; color: var(--muted); }

.res-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  margin-bottom: 5px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.028);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.res-row:hover { background: rgba(79, 216, 240, 0.08); }
.res-row.on { background: rgba(79, 216, 240, 0.12); border-color: rgba(79, 216, 240, 0.4); }
.res-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 9px currentColor; }
.res-main { flex: 1; min-width: 0; }
.res-main b { display: block; font-size: 12.5px; font-weight: 650; }
.res-main small {
  display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-dist { flex: 0 0 auto; text-align: right; min-width: 58px; }
.res-dist b { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.res-dist small { font-size: 10px; color: var(--muted); margin-left: 2px; }
.res-tag {
  display: inline-block; font-size: 9px; padding: 1px 5px; margin-left: 5px;
  border: 1px solid var(--line); border-radius: 4px; color: #8fa6c2; vertical-align: 1px;
}

.side-foot { padding: 12px 16px 14px; border-top: 1px solid var(--line); background: rgba(6, 12, 23, 0.6); }
.share-btn {
  width: 100%; height: 38px; border: 0; border-radius: 9px;
  background: linear-gradient(100deg, #1ba7c4, #4fd8f0);
  color: #04121a; font-size: 13px; font-weight: 800; letter-spacing: 0.04em;
}
.share-btn:hover { filter: brightness(1.1); }
.ctrl-nav { display: flex; justify-content: center; gap: 18px; margin: 10px 0 7px; }
.ctrl-nav a { color: #9fb6d2; font-size: 11.5px; text-decoration: none; }
.ctrl-nav a:hover { color: var(--accent); }
.foot-note { margin: 0; font-size: 10px; line-height: 1.55; color: #6f86a3; text-align: center; }

.panel-open { display: none; }

/* ── 右上工具 ─────────────────────────────────── */
.top-right {
  position: absolute; right: 16px; top: 16px; z-index: 10;
  display: flex; gap: 8px; align-items: center;
}
.bm-seg {
  display: flex; padding: 3px; gap: 2px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.bm-seg button {
  border: 0; background: transparent; color: #9fb4cf;
  font-size: 11.5px; padding: 7px 10px; border-radius: 7px;
}
.bm-seg button.on { background: rgba(79, 216, 240, 0.18); color: #dffaff; font-weight: 700; }
.reset-btn {
  height: 34px; padding: 0 11px; font-size: 11.5px;
  color: #c8d9ec; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.reset-btn:hover { color: var(--accent); }

.map-hint {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 5; pointer-events: none;
  font-size: 11.5px; color: #c7d8ec;
  background: rgba(8, 15, 28, 0.72); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 20px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.toast {
  position: absolute; left: 50%; top: 76px; transform: translateX(-50%);
  z-index: 40; pointer-events: none; opacity: 0;
  padding: 9px 16px; border-radius: 9px; font-size: 12px;
  background: rgba(8, 16, 30, 0.95); border: 1px solid rgba(79, 216, 240, 0.4);
  color: #dffaff; transition: opacity 0.25s;
}
.toast.on { opacity: 1; }

/* ── 地图标签 ─────────────────────────────────── */
.lab {
  position: absolute; pointer-events: none;
  transform: translate(-50%, -145%);
  padding: 4px 9px; border-radius: 7px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  background: rgba(8, 15, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.lab small { font-weight: 500; color: #b6c9df; margin-left: 6px; }
.lab.origin { border-color: var(--accent); color: var(--accent); }

/* ── 地图弹卡 ─────────────────────────────────── */
.maplibregl-popup-content {
  background: rgba(9, 17, 31, 0.96) !important;
  border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow); padding: 13px 15px !important;
  color: var(--text) !important;
}
.maplibregl-popup-tip { border-top-color: rgba(9, 17, 31, 0.96) !important; border-bottom-color: rgba(9, 17, 31, 0.96) !important; }
.pop-title { font-size: 13.5px; font-weight: 750; margin-bottom: 7px; }
.pop-row { font-size: 11.5px; color: #a9bdd6; line-height: 1.7; }
.pop-row b { color: #e8f0fa; font-weight: 600; }

/* ── 分享卡弹层 ───────────────────────────────── */
.share-modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: rgba(2, 6, 14, 0.82); backdrop-filter: blur(6px);
}
.share-modal.on { display: flex; }
.share-inner { width: min(92vw, 900px); }
#shareCanvas {
  width: 100%; height: auto; display: block;
  border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.share-actions { display: flex; gap: 10px; margin-top: 12px; }
.share-actions .share-btn { flex: 1; }
.ghost-btn {
  width: 130px; height: 38px; border-radius: 9px; font-size: 12.5px;
  color: #c8d9ec; background: var(--panel-2); border: 1px solid var(--line);
}

/* ── 移动端 ───────────────────────────────────── */
@media (max-width: 860px) {
  .topbar { left: 16px; top: 12px; }
  .tb-kicker { font-size: 9.5px; margin-bottom: 4px; }
  .topbar h1 { font-size: 20px; }
  .tb-sub { font-size: 10.5px; max-width: 62vw; }
  .top-right { top: auto; bottom: calc(62vh + 14px); right: 10px; flex-direction: column; align-items: flex-end; }
  .bm-seg button { font-size: 10.5px; padding: 6px 7px; }

  .side {
    left: 8px; right: 8px; width: auto; top: auto; bottom: 8px;
    height: 62vh; border-radius: 14px;
  }
  .side.collapsed { transform: translateY(calc(100% - 42px)); }
  .drawer {
    display: block; position: absolute; right: 10px; top: 7px;
    width: 34px; height: 28px; border: 0; background: transparent; z-index: 2;
  }
  .drawer i { display: block; width: 18px; height: 2px; margin: 5px auto; background: #9fb4cf; border-radius: 2px; }
  .side-scroll { padding: 10px 12px 4px; }
  .stat-row { display: none; }
  .origin-box { padding-bottom: 8px; }
  .origin-btns { margin-top: 7px; }
  .origin-cur { margin-top: 7px; padding: 6px 9px; font-size: 11px; }
  .result-head { padding: 8px 0 5px; }
  .group-title { padding: 6px 2px 4px; }
  .res-row { padding: 6px 9px; margin-bottom: 4px; }
  .side-foot { padding: 8px 12px 9px; }
  .side-foot .share-btn { height: 32px; }
  .ctrl-nav { margin: 6px 0 3px; }
  .foot-note { display: none; }
  .panel-open {
    display: block; position: absolute; left: 12px; bottom: 12px; z-index: 9;
    padding: 9px 16px; border-radius: 20px; font-size: 12px; font-weight: 700;
    color: #04121a; background: var(--accent); border: 0;
  }
  .side:not(.collapsed) ~ .panel-open { display: none; }
  .map-hint { display: none; }
  .toast { top: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  .side, .toast { transition: none; }
}
