/* 行政区划代码地图 · 专题皮肤
   基于 _shared/thematic/thematic.css，本文件只做覆盖与新增。 */

:root {
  --accent: #38bdf8;
  --accent-light: #7dd3fc;
  --accent-dark: #0284c7;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --panel-solid: rgba(8, 15, 26, 0.95);
}
html, body, #map { background: #060d18; }

.intro h1 b {
  background: linear-gradient(96deg, #bae6fd 0%, #38bdf8 46%, #0284c7 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.note {
  margin: 8px 0 0; padding: 8px 10px;
  font-size: 11px; line-height: 1.68; color: var(--muted);
  background: rgba(255, 255, 255, .035);
  border-left: 2px solid var(--accent); border-radius: 0 7px 7px 0;
}
.note b { color: var(--accent-light); font-weight: 600; }

/* ── 搜索 ─────────────────────────────────────────────── */
.searchbox input {
  width: 100%; box-sizing: border-box;
  padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--text); font: inherit; font-size: 12.5px;
  outline: none;
}
.searchbox input:focus { border-color: var(--accent); }
.searchbox input::placeholder { color: var(--dim); }

.search-results { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.sr-row {
  display: grid; grid-template-columns: 64px 1fr auto;
  align-items: center; gap: 8px; width: 100%;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 7px;
  background: rgba(255, 255, 255, .025); cursor: pointer;
  font: inherit; text-align: left; color: var(--muted);
  transition: background .16s, border-color .16s, color .16s;
}
.sr-row:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.sr-row .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--accent-light); font-variant-numeric: tabular-nums;
}
.sr-row .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-row .lv {
  font-size: 9.5px; padding: 1px 6px; border-radius: 99px;
  background: rgba(255,255,255,.06); color: var(--dim); white-space: nowrap;
}
.sr-more { font-size: 11px; color: var(--dim); padding: 3px 8px; line-height: 1.6; }

/* 目录里的省级分组标题：可点，点开就是该省的详情卡 */
.unit-prov {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-top: 6px; padding: 5px 8px;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; cursor: pointer;
  font: inherit; font-size: 10.5px; letter-spacing: .1em; color: var(--dim);
  text-align: left;
  transition: color .16s, background .16s, border-color .16s;
}
.unit-prov:hover { color: var(--accent-light); background: var(--accent-soft); border-color: var(--line); }
.unit-prov.active { color: var(--accent-light); background: var(--accent-soft); border-color: var(--accent); }
.unit-prov.active i { opacity: .85; }
.unit-prov i { font-style: normal; opacity: .6; }

/* ── 目录列表 ─────────────────────────────────────────── */
.unit-list { display: flex; flex-direction: column; gap: 3px; }
.unit-row {
  display: grid; grid-template-columns: 62px 1fr auto;
  align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: 1px solid transparent; border-radius: 7px;
  background: rgba(255, 255, 255, .025); cursor: pointer;
  font: inherit; text-align: left; color: var(--muted);
  transition: background .16s, border-color .16s, color .16s;
}
.unit-row:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.unit-row.active { border-color: var(--accent); background: var(--accent-soft); color: #fff; }
.unit-row .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; font-variant-numeric: tabular-nums; color: var(--accent-light);
}
.unit-row .nm { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-row .cnt { font-size: 10px; color: var(--dim); white-space: nowrap; }
.unit-row.direct .code { color: #c4b5fd; }

/* ── 详情卡 ───────────────────────────────────────────── */
.detail {
  position: absolute; right: 18px; top: 18px; z-index: 20;
  width: 340px; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
  overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; backdrop-filter: blur(10px);
}
.detail::-webkit-scrollbar { width: 7px; }
.detail::-webkit-scrollbar-thumb { background: rgba(148, 178, 214, .28); border-radius: 4px; }
.detail[hidden] { display: none; }

.detail header { display: flex; align-items: center; justify-content: space-between; }
.detail header small {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-light);
}
.dt-actions button {
  background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--muted);
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 12px;
}
.dt-actions button:hover { color: #fff; border-color: var(--accent); }

.detail h2 { margin: 6px 0 2px; font-size: 19px; line-height: 1.25; color: #fff; }
.detail > p { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.prov-link {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--accent-light); border-bottom: 1px dashed rgba(125, 211, 252, .45);
}
.prov-link:hover { color: #fff; border-bottom-color: #fff; }

.dt-code {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  align-items: center; gap: 2px 10px;
  padding: 9px 11px; border-radius: 9px;
  background: rgba(56, 189, 248, .08); border: 1px solid rgba(56, 189, 248, .22);
}
.dt-code small { grid-column: 1 / -1; font-size: 10px; color: var(--dim); }
.dt-code b {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px; letter-spacing: .12em; color: var(--accent-light);
}
.dt-code button {
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--muted);
  border-radius: 7px; font-size: 11px; padding: 5px 10px; cursor: pointer;
}
.dt-code button:hover { color: #fff; border-color: var(--accent); }

.dt-desc { margin-top: 12px; }
.dt-desc > small { display: block; font-size: 10px; letter-spacing: .1em; color: var(--dim); margin-bottom: 6px; }
.county-list { display: flex; flex-direction: column; gap: 3px; max-height: 42vh; overflow-y: auto; }
.county-list::-webkit-scrollbar { width: 7px; }
.county-list::-webkit-scrollbar-thumb { background: rgba(148, 178, 214, .28); border-radius: 4px; }
.county-row {
  display: grid; grid-template-columns: 62px 1fr;
  align-items: center; gap: 8px; width: 100%;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 7px;
  background: rgba(255, 255, 255, .025); cursor: pointer;
  font: inherit; text-align: left; color: var(--muted);
}
.county-row:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.county-row .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--accent-light); font-variant-numeric: tabular-nums;
}
.county-row .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail footer {
  margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 10.5px; line-height: 1.6; color: var(--dim);
}

/* ── 齿轮面板 ─────────────────────────────────────────── */
.panel-gear {
  position: absolute; left: calc(var(--intro-w, 352px) + 32px); bottom: var(--dock-b, 24px); z-index: 12;
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
  background: var(--panel-solid); border: 1px solid var(--line);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, transform .15s;
}
.panel-gear:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.panel-gear:active { transform: translateY(0); }
.panel-gear svg { width: 20px; height: 20px; }
.panel-gear[hidden] { display: none; }

#panel {
  position: absolute; left: calc(var(--intro-w, 352px) + 32px); bottom: var(--dock-b, 24px); z-index: 12;
  width: 258px; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px);
  border-radius: 13px;
  background: var(--panel-solid); border: 1px solid var(--line);
  padding: 10px 12px 12px; backdrop-filter: blur(10px);
  color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .42);
}
#panel.closed { display: none; }
#panel .panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; letter-spacing: .12em; color: var(--dim); text-transform: uppercase;
}
.panel-close {
  width: 24px; height: 24px; border-radius: 6px; line-height: 1;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; font-size: 11px;
}
.panel-close:hover { color: #fff; border-color: var(--accent); }
#panel .panel-body { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#panel .row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; font-size: 12px; color: #cdd9e8; cursor: pointer;
}
#panel .row input { accent-color: var(--accent); margin: 0; }
#panel .row-sub { padding-left: 22px; padding-top: 1px; color: var(--muted); font-size: 11.5px; }
#panel .row.is-disabled { opacity: .42; cursor: default; }
#panel .divider { height: 1px; background: var(--line); margin: 7px 0; }
#panel .bm-title { font-size: 10px; letter-spacing: .1em; color: var(--dim); margin-bottom: 6px; }
#panel .bm-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
#panel .bm-opt { position: relative; }
#panel .bm-opt input { position: absolute; opacity: 0; pointer-events: none; }
#panel .bm-opt span {
  display: block; text-align: center; padding: 6px 0; border-radius: 7px;
  border: 1px solid var(--line); font-size: 11px; color: var(--muted); cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
#panel .bm-opt input:checked + span {
  background: var(--accent-soft); color: var(--accent-light); border-color: var(--accent); font-weight: 600;
}
#panel .panel-note {
  margin: 0; font-size: 10.5px; line-height: 1.62; color: var(--dim);
  border-top: 1px solid var(--line); padding-top: 8px;
}
#panel .panel-note b { color: #9fb4cd; font-weight: 600; }

@media (max-width: 900px) {
  .panel-gear { left: 10px; top: 10px; bottom: auto; }
  #panel {
    left: 10px; right: 10px; top: 10px; bottom: auto; width: auto;
    max-height: 70vh; max-height: 70dvh;
  }
  /* 卡片是底部抽屉：同时开着会和设置卡抢地方，详情一出来就收起设置卡（齿轮随之回来） */
  body.has-detail #panel { display: none; }
  /* 手机端底部抽屉收起后只剩 44px 的把手：卡片要落在把手上面，别压住它 */
  .detail {
    left: 10px; right: 10px; top: auto;
    bottom: calc(54px + env(safe-area-inset-bottom, 0px));
    width: auto; max-height: 56vh; max-height: 56dvh;
  }
}
