/* ============================================================
 * layout.css —— 顶栏 / 地图区 / 侧栏面板 / 详情抽屉 / 页脚
 * 视觉基调参考百度·高德「足迹」页：深色、玻璃质感、大数字。
 * ============================================================ */

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  background-image: var(--bg-glow);
  transition: background 0.35s ease;
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-mark {
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #04121a;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
}

.brand-text {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* 面包屑 */

.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.crumbs::-webkit-scrollbar {
  display: none;
}

.crumb {
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 13px;
  transition: background 0.18s, color 0.18s;
}

.crumb:hover {
  background: var(--line-soft);
  color: var(--text);
}

.crumb.is-current {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.crumb-sep {
  color: var(--text-faint);
  font-size: 11px;
}

/* 顶栏右侧控件 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.seg button {
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: all 0.18s;
}

.seg button.is-active {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-weight: 600;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 34%, transparent);
}

.theme-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.theme-dot {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s, border-color 0.18s;
}

.theme-dot:hover {
  transform: scale(1.14);
}

.theme-dot.is-active {
  border-color: var(--text);
}

.theme-dot[data-theme-id='paper'] {
  background: linear-gradient(135deg, #f7f4ef 45%, #d4622f 45%);
}

.theme-dot[data-theme-id='night'] {
  background: linear-gradient(135deg, #0a1119 45%, #3fd8c8 45%);
}

.theme-dot[data-theme-id='jade'] {
  background: linear-gradient(135deg, #f2f6f3 45%, #2f8f6f 45%);
}

.theme-dot[data-theme-id='danxia'] {
  background: linear-gradient(135deg, #fbf5f0 45%, #b8452f 45%);
}

/* ---------------- 主工作区 ---------------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 342px;
  gap: 14px;
  padding: 14px 20px;
  min-height: 0;
}

/* 地图舞台 */

.stage {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 380px;
  /* 把内部所有层级关在舞台里，别和页面其它层互相干扰 */
  isolation: isolate;
}

#map,
#tmap {
  position: absolute;
  inset: 0;
  /* 各自成为一个独立图层（z-index 非 auto 才会创建 stacking context）。
   * 腾讯地图内部有自己的控件层，z-index 高达 100 上下——如果不在这里
   * 把 #tmap 关成一个图层，那些内部元素会直接盖到「返回上一级」「缩放」
   * 这些浮层上面，表现就是：实景模式下按钮看得见却点不动。
   * （浮层本身 z-index 4~9，见下方各条规则） */
  z-index: 0;
}

#map {
  cursor: grab;
  /* 没放大时单指上下滑还是让页面滚，别把整屏滚动手势吃掉；
     放大之后（.is-zoomed）才独占手势，否则拖不动 */
  touch-action: pan-y;
}

#map.is-zoomed {
  touch-action: none;
}

#map.is-grabbing {
  cursor: grabbing;
}

/* 实景底图本来就该独占手势 */
#tmap {
  touch-action: none;
}

/* 实景模式里腾讯地图自建的容器 */
#tmap > div {
  width: 100%;
  height: 100%;
}

#map svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 行政区图元 */

.region {
  fill: var(--c-plain);
  stroke: var(--c-stroke);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.18s ease, filter 0.18s ease;
}

.region.is-visited {
  fill: var(--c-visited);
  /* 微微的发光，深色下更像「点亮」 */
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c-visited) 34%, transparent));
}

.region.is-hover {
  fill: var(--c-plain-hi);
}

.region.is-visited.is-hover {
  fill: var(--c-visited-hi);
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--c-visited) 55%, transparent));
}

.region.is-selected {
  stroke: var(--text);
  stroke-width: 1.6;
}

/* 相邻行政区（点一下直接跳过去） */

.ctx-region {
  fill: var(--ctx-fill);
  stroke: var(--ctx-line);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.18s ease;
}

.ctx-region.is-visited {
  fill: color-mix(in srgb, var(--c-visited) 16%, transparent);
}

.ctx-region.is-hover {
  fill: var(--ctx-hover);
}

.ctx-region.is-visited.is-hover {
  fill: color-mix(in srgb, var(--c-visited) 30%, transparent);
}

/* 板块名称：直接印在色块上——不描边、不发光，名字就是地图的一部分，不浮在上面。
 * 字号由 JS 按「屏幕像素」反算（见 config.js 的 LABEL_PX）：
 * 容器变宽、地图放大，字都不会跟着膨胀。
 * 装不进板块的名字直接不显示，宁可不标，也不让名字压到隔壁省份头上。 */

.region-label {
  fill: var(--c-label);
  font-size: 10px;
  text-anchor: middle;
  pointer-events: none;
  font-weight: 400;
  letter-spacing: 0;
}

/* 去过的板块底色偏亮，名称换成深色（浅色主题下是白字），跟着地块走 */
.region-label.is-on-visited {
  fill: var(--c-label-on);
  font-weight: 500;
}

/* 南海诸岛角标（符合国家标准的右下角插图） */

.inset {
  position: absolute;
  right: 14px;
  bottom: 112px;
  width: 104px;
  height: 146px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  overflow: hidden;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.inset svg {
  display: block;
  width: 100%;
  height: 100%;
}

.inset .region {
  cursor: default;
}

/* 悬停信息卡 */

.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 7;
  min-width: 176px;
  max-width: 240px;
  padding: 11px 13px 10px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px) saturate(1.2);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translate(0, 0);
  transition: opacity 0.14s ease;
}

.tip.is-on {
  opacity: 1;
}

.tip.is-ctx {
  border-style: dashed;
}

.tip .tip-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 5px;
}

.tip .tip-head b {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tip .tip-tag {
  font-size: 10.5px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  flex-shrink: 0;
}

.tip .tip-state-line {
  margin-bottom: 8px;
}

.tip .tip-state {
  display: inline-block;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--text-dim);
}

.tip .tip-state.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tip .tip-state.is-ctx-state {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--text-faint);
}

.tip .tip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 0;
}

.tip .tip-k {
  color: var(--text-dim);
}

.tip .tip-v {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.tip .tip-v small {
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 2px;
}

.tip .tip-foot {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--text-faint);
}

/* 返回上一级（显眼，非全国层级才出现） */

.btn-back {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: #04121a;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 38%, transparent),
    var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.2s ease;
  animation: backIn 0.24s ease;
}

@keyframes backIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.btn-back:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 48%, transparent);
}

.btn-back:active {
  transform: scale(0.97);
}

.btn-back .bb-arrow {
  font-size: 19px;
  line-height: 1;
  margin-top: -2px;
}

.btn-back em {
  font-style: normal;
  opacity: 0.78;
  font-weight: 500;
  margin-left: 3px;
}

/* 图例 */

.legend {
  position: absolute;
  left: 14px;
  bottom: 104px;
  z-index: 5;
  display: flex;
  gap: 13px;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  font-size: 11.5px;
  color: var(--text-dim);
  backdrop-filter: blur(10px);
}

.legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 1px solid var(--line);
}

.legend .lg-plain {
  background: var(--c-plain);
}

.legend .lg-visited {
  background: var(--c-visited);
  border-color: var(--c-visited);
}

.legend .lg-ctx {
  background: transparent;
  border-style: dashed;
  border-color: var(--ctx-line);
}

/* 底部大数字数据条 */

.kpi {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  padding: 12px 16px 10px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px) saturate(1.25);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kpi-v {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.kpi.is-hi .kpi-v {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.kpi-v .kpi-s {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-faint);
  margin-left: 3px;
  -webkit-text-fill-color: var(--text-faint);
}

.kpi-k {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 1px;
}

.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--glass-line);
  font-size: 11.5px;
  color: var(--text-dim);
}

.kpi-foot .kpi-hint {
  color: var(--text-faint);
  white-space: nowrap;
}

/* 缩放控件 */

.zoomctl {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  user-select: none;
}

.zoomctl button {
  width: 30px;
  height: 27px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-dim);
  display: grid;
  place-items: center;
  transition: background 0.16s, color 0.16s, transform 0.1s;
}

.zoomctl button:hover {
  background: var(--line-soft);
  color: var(--text);
}

.zoomctl button:active {
  transform: scale(0.93);
}

.zoomctl button:disabled {
  opacity: 0.34;
  cursor: default;
  background: none;
}

.zoomctl .zoom-val {
  text-align: center;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  padding-top: 1px;
}

/* 首次进入的操作提示，自动淡出 */

.zoomhint {
  position: absolute;
  left: 50%;
  bottom: 116px;
  z-index: 4;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  animation: hintFade 6s ease forwards;
}

@keyframes hintFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 7px);
  }
  12%,
  74% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .zoomhint {
    animation: none;
    opacity: 0;
  }
}

/* 叠加态（加载 / 错误 / 提示） */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(3px);
  text-align: center;
  padding: 24px;
}

.overlay[hidden] {
  display: none;
}

.overlay .spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.overlay .ov-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.overlay .ov-desc {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 380px;
  margin: 0 auto;
}

.overlay .ov-desc code {
  background: var(--line-soft);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.banner {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 9;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  max-width: 92%;
  text-align: center;
}

.banner[hidden] {
  display: none;
}

/* ---------------- 右侧面板 ---------------- */

.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 15px 16px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-head h2 {
  font-size: 14px;
}

.card-head .hint {
  font-size: 11px;
  color: var(--text-faint);
}

/* 数据看板 */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 13px;
}

.stat {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
}

.stat .k {
  font-size: 11px;
  color: var(--text-dim);
}

.stat .v {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.18;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat .v small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  margin-left: 2px;
}

/* 占比条 */

.bar {
  margin-bottom: 9px;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.5s cubic-bezier(0.3, 0.9, 0.3, 1);
}

/* 年份分布 */

.years {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 76px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.year-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
  min-width: 0;
}

.year-col .bar-v {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  opacity: 0.9;
  min-height: 3px;
  transition: height 0.5s cubic-bezier(0.3, 0.9, 0.3, 1);
}

.year-col .bar-l {
  font-size: 10px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* 同级快速切换 chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 168px;
  overflow-y: auto;
}

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--panel-soft);
  transition: all 0.16s;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text);
  border-color: var(--text-faint);
  transform: translateY(-1px);
}

.chip.is-visited {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}

.chip.is-visited::before {
  content: '●';
  font-size: 8px;
  margin-right: 4px;
  vertical-align: 1px;
  opacity: 0.8;
}

.chip.is-current {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #04121a;
  font-weight: 600;
}

/* 照片墙 */

.wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.wall-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  background-image: linear-gradient(135deg, var(--ph-a, #6b7f95), var(--ph-b, #2b3646));
  transition: transform 0.18s;
}

.wall-item:hover {
  transform: translateY(-2px);
}

.wall-item span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 6px 4px;
  font-size: 10px;
  color: #fff;
  text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wall-item .ph-icon {
  font-size: 18px;
  opacity: 0.5;
  color: #fff;
}

.wall-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 22px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.wall-empty .we-icon {
  font-size: 22px;
  color: var(--text-faint);
}

.wall-empty small {
  color: var(--text-faint);
  font-size: 11.5px;
}

/* 待办清单（未启用的功能透明化） */

.todo {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.todo li {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line-soft);
}

.todo li:last-child {
  border-bottom: none;
}

.todo .tk {
  flex-shrink: 0;
  width: 15px;
  color: var(--accent);
  font-weight: 700;
}

.todo li.done .tk {
  color: var(--text-faint);
}

/* ---------------- 详情抽屉 ---------------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 392px;
  max-width: 92vw;
  z-index: 40;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 40px rgba(0, 0, 0, 0.3);
  transform: translateX(101%);
  transition: transform 0.28s cubic-bezier(0.3, 0.9, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head .dh-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.drawer-head .dh-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.dh-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.dh-close:hover {
  background: var(--line-soft);
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 26px;
}

.dh-actions {
  display: flex;
  gap: 9px;
  margin-bottom: 18px;
}

.btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--line);
  color: var(--text-dim);
  transition: all 0.18s;
}

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

.btn.is-primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #04121a;
  font-weight: 600;
}

.btn.is-primary:hover {
  filter: brightness(1.07);
  color: #04121a;
}

.dh-sec {
  margin-bottom: 20px;
}

.dh-sec h3 {
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 9px;
}

.dh-note {
  padding: 12px 13px;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
}

.dh-note .note-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.dh-note .note-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 8px;
}

.dh-wall {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.dh-wall .wall-item span {
  font-size: 11px;
}

.dh-empty {
  padding: 22px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 39;
  /* 只留一层靠抽屉一侧的淡淡暗角：地图必须始终可点，
     否则「点地图空白 / 再点同一个地区」收起抽屉这条交互就不成立 */
  background: linear-gradient(
    to left,
    rgba(6, 10, 16, 0.34),
    rgba(6, 10, 16, 0.08) 42%,
    transparent 62%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}

.drawer-mask.is-on {
  opacity: 1;
}

/* ---------------- 页脚 ---------------- */

.footbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 9px 20px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-faint);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

.footbar a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-faint);
}

.footbar a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 940px) {
  /* 单列时不再锁死视口高度，改成整页自然滚动，否则右侧面板会被裁掉、滚不到 */
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  #app {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
    min-height: 0;
  }

  .stage {
    /* 手机端地图尽量占满但不至于一屏装不下 */
    min-height: min(66vh, 560px);
  }

  /* 触屏按钮放大到接近标准点按尺寸 */
  .zoomctl {
    right: 10px;
    top: 10px;
    padding: 5px;
    gap: 3px;
  }

  .zoomctl button {
    width: 36px;
    height: 34px;
    font-size: 16px;
  }

  .zoomctl .zoom-val {
    font-size: 10.5px;
  }

  .btn-back {
    left: 10px;
    top: 10px;
    padding: 8px 14px 8px 10px;
    font-size: 13px;
  }

  .kpi {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 12px 9px;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 10px;
  }

  .kpi-v {
    font-size: 21px;
  }

  .kpi-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .legend {
    left: 10px;
    bottom: 168px;
  }

  .inset {
    right: 10px;
    bottom: 168px;
    width: 92px;
    height: 130px;
  }

  .zoomhint {
    bottom: 172px;
  }

  .side {
    overflow: visible;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .crumbs {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }

  .brand-sub {
    display: none;
  }

  .drawer {
    width: 100%;
    max-width: none;
    top: auto;
    height: 84vh;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(101%);
  }

  .drawer.is-open {
    transform: translateY(0);
  }

  .footbar {
    padding: 9px 12px;
  }
}
