/* 地图点位与详情抽屉：从 style.css 拆出，避免单文件无限变长。加载顺序在 style.css 之后。 */
/* ── 地图点位 ─────────────────────────────── */
.mp-marker { cursor: pointer; }

.mp-dot {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.09), 0 2px 7px rgba(2, 7, 18, 0.6);
  transition: transform 0.12s;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .mp-dot {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent),
      0 0 13px color-mix(in srgb, var(--c) 62%, transparent),
      0 2px 7px rgba(2, 7, 18, 0.55);
  }
}

.mp-marker:hover .mp-dot,
.mp-marker.is-hit .mp-dot {
  transform: scale(1.7);
  box-shadow: 0 0 0 2px #fff, 0 0 0 7px rgba(61, 139, 255, 0.28), 0 3px 12px rgba(2, 7, 18, 0.6);
}

.mp-dot.is-pending { opacity: 0.66; }
.mp-marker.is-dim { opacity: 0.5; }

.cl {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  cursor: pointer;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24), 0 0 0 6px rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(2, 7, 18, 0.5);
  transition: transform 0.12s, box-shadow 0.12s;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .cl {
    background:
      radial-gradient(circle at 34% 28%,
        color-mix(in srgb, var(--c) 74%, #ffffff) 0%,
        var(--c) 52%,
        color-mix(in srgb, var(--c) 76%, #04101f) 100%);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 55%, #ffffff),
      0 0 0 6px color-mix(in srgb, var(--c) 14%, transparent),
      0 10px 24px rgba(2, 7, 18, 0.5);
  }
}

/* 待检测格子：不做实心白块，改成「幽灵泡」，让国土底色透上来 */
.mp-marker.is-pending .cl {
  background: rgba(120, 152, 196, 0.18);
  color: #dbe8fb;
  box-shadow: 0 0 0 1px rgba(146, 190, 255, 0.42), 0 6px 16px rgba(2, 7, 18, 0.4);
  text-shadow: 0 1px 2px rgba(2, 8, 20, 0.7);
}

.mp-marker.is-pending .cl:hover {
  background: rgba(120, 152, 196, 0.3);
  box-shadow: 0 0 0 1px rgba(170, 208, 255, 0.7), 0 0 0 8px rgba(61, 139, 255, 0.16),
    0 8px 20px rgba(2, 7, 18, 0.5);
}

.cl:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.34), 0 0 0 9px rgba(61, 139, 255, 0.18),
    0 12px 28px rgba(2, 7, 18, 0.58);
}

.cl small { font-size: 9px; font-weight: 600; opacity: 0.88; }

/* 点位密集时收敛阴影与过渡，避免合成层过多拖拽掉帧 */
body.is-dense .cl { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); transition: none; }
body.is-dense .mp-dot { box-shadow: none; transition: none; }

/* ── 详情抽屉 ─────────────────────────────── */
.detail-panel {
  position: absolute;
  z-index: 30;
  top: 96px;
  left: 16px;
  width: 384px;
  /* 上留 96px 让开品牌卡与搜索栏，下留 42px 让开底部状态条 */
  max-height: calc(100% - 142px);
  /* 定高 flex 列：标题与底部按钮固定，中间 .dp-body 单独滚动 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 0 4px;
  /* 抽屉本身要给实色底：卡片是半透明玻璃，去掉模糊之后底下街名会透上来 */
  background: var(--hud-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgba(2, 8, 20, 0.6);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity 0.18s ease, transform 0.18s ease;
  scrollbar-width: thin;
}

.detail-panel.is-open { opacity: 1; transform: none; }

.dp-head { flex: 0 0 auto; }
.dp-actions { flex: 0 0 auto; }
.dp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 166, 235, 0.3) transparent;
}

/* 内容超出一屏时底部渐隐，提示还能往下滚 */
.detail-panel.has-more .dp-body {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), rgba(0, 0, 0, 0));
  mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), rgba(0, 0, 0, 0));
}

.dp-body::-webkit-scrollbar { width: 6px; }
.dp-body::-webkit-scrollbar-thumb { background: rgba(122, 166, 235, 0.22); border-radius: 3px; }

.dp-head { position: relative; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }

.dp-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.dp-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

.dp-kicker {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--dim);
  padding-right: 32px;
}

.dp-title {
  margin: 7px 0 10px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.36;
  padding-right: 30px;
}

.dp-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.dp-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}

.dp-block { padding: 12px 16px; border-bottom: 1px solid var(--line); }

.dp-block h3 {
  margin: 0 0 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--dim);
  text-transform: uppercase;
}

.dp-row { display: flex; gap: 10px; padding: 4px 0; font-size: 12.5px; line-height: 1.6; }

.dp-row .k {
  flex: 0 0 62px;
  color: var(--dim);
  white-space: nowrap;
}

.dp-row .v { flex: 1; min-width: 0; color: var(--text); word-break: break-all; }
.dp-row .v.is-empty { color: var(--dim); }
.dp-row .v a { color: #8fbaff; text-decoration: none; }
.dp-row .v a:hover { text-decoration: underline; }

/* 概览四项排成 2×2 数字格：原来四行带标签文字，占掉 160px，
   把下面的城市分布挤成只剩一行可见；改成格子后省出约 60px 给列表。 */
.dp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dp-cell {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.dp-cell .k {
  display: block;
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--dim);
}

.dp-cell .v {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dp-cell .s {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.dp-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.dp-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.dp-tag.is-external { background: rgba(61, 139, 255, 0.16); color: #9cc2ff; }

.dp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 16px 14px;
  border-top: 1px solid var(--line);
}

.dp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.dp-btn:hover { background: rgba(255, 255, 255, 0.12); }

.dp-btn.is-primary {
  background: linear-gradient(135deg, #4d97ff, #1857d8);
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(30, 92, 214, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  font-weight: 600;
}

.dp-btn.is-primary:hover { background: linear-gradient(135deg, #63a4ff, #2468ea); }
.dp-copy-flash { border-color: rgba(53, 208, 127, 0.7) !important; color: #35d07f !important; }

.dp-cluster-list { padding: 6px 10px; }

.cluster-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 6px;
  border-radius: 9px;
  cursor: pointer;
}

.cluster-item:hover { background: rgba(61, 139, 255, 0.14); }
.ci-main { min-width: 0; flex: 1; }

.ci-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ci-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 载入遮罩 ─────────────────────────────── */
.loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  gap: 16px;
  justify-items: center;
  background: radial-gradient(80% 60% at 50% 45%, #0a1526 0%, #060c18 100%);
  transition: opacity 0.32s;
}

.loading.is-done { opacity: 0; pointer-events: none; }
.loading p { margin: 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0.3px; }

.loading-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(61, 139, 255, 0.18);
  border-top-color: #4d97ff;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 高德自带控件 ─────────────────────────── */
/* 版权与 logo 抬到底部信息条上方，暗色底图上反相成浅灰 */
/* #map 没有 z-index，高德 logo 自带 160 会串到详情面板(30)之上；压到 12：盖过暗角(1)、低于所有卡片 */
.amap-logo, .amap-copyright { bottom: 58px !important; opacity: 0.5; z-index: 12 !important; }
.amap-copyright { font-size: 10.5px !important; }
.amap-logo img, .amap-copyright { filter: invert(1) brightness(1.5) grayscale(1); }

/* ── 中屏 ─────────────────────────────────── */
@media (max-width: 1100px) {
  .map-tools { right: 16px; }
  .hud-tl { width: 340px; }
  .hud-right { width: 268px; }
  .rank-card { display: none; }

  /* 窄屏把「AI 实测」做成独立抽屉：默认收起，工具条上的 AI 按钮唤出，再点收起 */
  #toggle-ai { display: block; font-size: 11px; letter-spacing: 0.02em; }
  body.is-ai .legend-card { display: none; }
  body.is-ai .rank-card {
    display: flex;
    flex-direction: column;
    max-height: 62vh;
    overflow: hidden;
    /* 地图点会从半透明卡片里透上来，抽屉必须是实底 */
    background: var(--hud-solid);
  }
  /* 工具条竖排正好压在抽屉右边缘的把数上，抽屉打开时让开 */
  body.is-ai .map-tools { display: none; }
  body.is-ai .drawer-close { display: grid; }
  body.is-ai .rank-card .rank,
  body.is-ai .rank-card .probe-list { overflow-y: auto; }
}

/* ── 手机 ─────────────────────────────────── */
@media (max-width: 860px) {
  .hud-tl { top: 10px; left: 10px; right: 10px; width: auto; }
  .panel { padding: 9px 10px 10px; border-radius: 13px; }
  .brand { padding: 0 2px 8px; gap: 9px; }
  .brand-mark { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .brand-text h1 { font-size: 13.5px; line-height: 1.2; }
  /* 窄屏放不下副标题与来源标记，收起后搜索框紧贴标题 */
  .brand-text p, .brand-src { display: none; }
  .filter-bar { gap: 4px; margin-top: 8px; }
  .fx-chip { padding: 5px 7px; font-size: 11px; }
  .search-box input { height: 38px; font-size: 13px; border-radius: 10px; }
  .search-results { max-height: 40vh; }

  .hud-right {
    top: auto;
    right: 10px;
    left: 10px;
    bottom: 46px;
    width: auto;
    max-height: none;
    flex-direction: column;
    gap: 0;
  }

  .kpi-card, .rank-card { display: none; }
  .legend-card { padding-bottom: 2px; }
  .card-head { padding: 9px 12px 0; }
  .card-head h2 { font-size: 10px; }
  .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    padding: 4px 12px 10px;
    margin: 0;
  }
  .legend-item { flex: 0 0 auto; padding: 2px 0; gap: 6px; }
  .legend-label { font-size: 11.5px; white-space: nowrap; }
  .legend-count { font-size: 11px; }
  .legend-bar { display: none; }
  .card-note { display: none; }

  /* 底部图例卡顶到 678，工具竖排整体再往上抬一点，别压在卡片上 */
  .map-tools { right: 10px; bottom: 182px; gap: 6px; }
  .map-tools button { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }

  .detail-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 46px;
    width: auto;
    max-height: 66vh;
    transform: translateY(16px);
  }

  .dp-row .k { flex: 0 0 66px; }
  /* 手机上底部图例卡是浮层，高德标识往上让到卡片外面，别被压住 */
  .amap-logo, .amap-copyright { bottom: 176px !important; }
  .hud-footer { height: 34px; padding: 0 12px; font-size: 10.5px; }
  .footer-credit { display: none; }
}

/* ── 卡片头部小工具 ───────────────────────── */
.card-head-tools { display: flex; align-items: center; gap: 8px; }

.chip-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}

.chip-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.chip-btn.is-on {
  background: rgba(255, 176, 32, 0.16);
  border-color: rgba(255, 176, 32, 0.55);
  color: #ffb020;
  font-weight: 600;
}

/* 搜索定位到的门店：常驻脉冲光环，避免小圆点淹没在底图里 */
.mp-marker.is-focus { z-index: 800 !important; }

.mp-marker.is-focus .mp-dot {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(61, 139, 255, 0.9), 0 6px 16px rgba(12, 30, 60, 0.4);
}

.mp-marker.is-focus::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  border: 2px solid rgba(61, 139, 255, 0.75);
  animation: focusPulse 1.9s cubic-bezier(0.3, 0, 0.4, 1) infinite;
  pointer-events: none;
}

@keyframes focusPulse {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(3.4); opacity: 0; }
  100% { transform: scale(3.4); opacity: 0; }
}

/* ── 右栏 Tab：省级 TOP 8 / AI 实测 ───────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn {
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.is-on {
  background: rgba(61, 139, 255, 0.22);
  color: #bcd8ff;
  box-shadow: inset 0 0 0 1px rgba(97, 157, 255, 0.4);
}

.probe-list {
  max-height: 236px;
  padding: 4px 8px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 166, 235, 0.3) transparent;
}

.probe-note {
  margin: 4px 4px 8px;
  font-size: 11px;
  line-height: 1.62;
  color: var(--muted);
}

.probe-note strong { color: var(--text); }

.probe-row {
  display: grid;
  grid-template-columns: 1fr 46px 34px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}

.probe-row:hover { background: rgba(61, 139, 255, 0.14); }

.pr-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.pr-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.pr-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #37d67a, #12b76a);
}

.pr-v {
  text-align: right;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ── AI 实测详情：逐条问答 ──────────────────── */
.dp-qlist { display: flex; flex-direction: column; gap: 9px; }

.dp-q {
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.dp-q-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.dp-tag.is-hit { background: rgba(18, 183, 106, 0.18); color: #4be08f; }
.dp-tag.is-missing { background: rgba(240, 68, 56, 0.16); color: #ff8b80; }
.dp-tag.is-warn { background: rgba(247, 144, 9, 0.18); color: #ffc46b; }
.dp-tag.is-idle { background: rgba(147, 163, 184, 0.16); color: #b9c6d8; }
.dp-eng { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; align-items: center; }
.dp-eng-k { font-size: 11.5px; color: var(--dim); }
.dp-q-engine { font-size: 10.5px; color: var(--dim); }
.dp-q-root { margin-left: auto; font-size: 10.5px; color: var(--dim); }
.dp-q-text { font-size: 12.5px; line-height: 1.6; color: var(--text); }
.dp-q-snip { margin-top: 5px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }

@media (max-width: 860px) {
  .probe-list { max-height: 190px; }
  /* 抽屉在手机上占满下半屏，列表能滚，别被 190px 截断 */
  body.is-ai .rank-card { max-height: 58vh; }
  body.is-ai .rank-card .probe-list { max-height: 38vh; }
  body.is-ai .rank-card .rank { max-height: 38vh; }
}

/* .drawer-close 默认 display:none（只有窄屏 AI 抽屉才显示），对比面板沿用同一个 class
   就必须单独放出来，否则右上角的 × 尺寸是 0×0，看着在、点不到 */
.compare-panel .drawer-close { display: grid; }

/* 按压反馈：点下去有 1px 下沉与轻微收缩，密集按钮才有「按到了」的手感 */
.fx-chip:active,
.chip-btn:active,
.dp-btn:active,
.map-tools button:active,
.sr-item:active,
.cmp-bar button:active { transform: translateY(1px) scale(0.985); }
