/* ============================================================
   宁波市电子地图平台 · 数字海图风格
   深海青蓝底 + 航标金强调色
   ============================================================ */
:root {
  --bg-deep: #0a1929;
  --panel: rgba(13, 32, 50, 0.9);
  --panel-2: rgba(20, 44, 66, 0.7);
  --border: rgba(126, 174, 204, 0.16);
  --border-strong: rgba(126, 174, 204, 0.3);
  --text: #e7eff6;
  --text-dim: #93adbf;
  --text-faint: #60788b;
  --gold: #f2b544;
  --gold-deep: #d99a2b;
  --gold-soft: rgba(242, 181, 68, 0.16);
  --teal: #3fb6a8;
  --danger: #e0684f;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "Consolas", "Courier New", monospace;
  --topbar-h: 66px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#map-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
}
#map-canvas canvas { display: block; }

/* ---------------- 加载遮罩 ---------------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, #0e2438 0%, #08141f 100%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-ring {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(242, 181, 68, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 15px; letter-spacing: 2px; color: var(--text); }
.loader-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 3px; color: var(--text-faint); }

/* ---------------- 顶部栏 ---------------- */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  background: linear-gradient(180deg, rgba(8, 22, 35, 0.96) 0%, rgba(8, 22, 35, 0.78) 82%, rgba(8, 22, 35, 0));
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; color: var(--gold); flex: none; }
.brand-text h1 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 2px;
  line-height: 1.2;
}
.brand-en {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 2.6px;
  color: var(--text-faint);
  margin-top: 2px;
}

.coord-readout {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.coord-item { display: flex; flex-direction: column; gap: 2px; }
.coord-item em { font-style: normal; font-size: 10px; color: var(--text-faint); letter-spacing: 1px; }
.coord-item b { font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--teal); }
.coord-sep { width: 1px; height: 26px; background: var(--border-strong); }

.top-actions { display: flex; gap: 8px; }
.tool-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tool-btn svg { width: 17px; height: 17px; }
.tool-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-2); }
.tool-btn.active { color: var(--gold); border-color: rgba(242, 181, 68, 0.5); background: var(--gold-soft); }
.platform-home { text-decoration: none; }

/* ---------------- 侧面板通用 ---------------- */
.side-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  bottom: 58px;
  z-index: 25;
  width: 282px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
}
#left-panel { left: 18px; }
#right-panel { right: 18px; width: 322px; }

.side-panel::-webkit-scrollbar { width: 5px; }
.side-panel::-webkit-scrollbar-thumb { background: rgba(126, 174, 204, 0.25); border-radius: 3px; }
.side-panel::-webkit-scrollbar-track { background: transparent; }

.panel-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  backdrop-filter: blur(6px);
}
.panel-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2.5px;
  color: var(--text-dim);
  padding-bottom: 11px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--gold);
  border-radius: 1px;
}

/* KPI */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.kpi-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 11px 10px;
}
.kpi-num {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}
.kpi-num small { font-size: 10px; color: var(--text-faint); font-weight: 400; margin-left: 2px; }
.kpi-label { font-size: 10.5px; color: var(--text-faint); margin-top: 5px; letter-spacing: 1px; }

/* 图例 */
.legend-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.18s ease;
}
.legend-item:hover { color: var(--text); background: var(--panel-2); }
.legend-dot { width: 13px; height: 13px; border-radius: 3px; flex: none; background: var(--gold); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.legend-item .lg-code { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
.legend-item.active { color: var(--gold); background: var(--gold-soft); }

/* 搜索 */
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-bottom: 12px;
}
.search-box svg { width: 16px; height: 16px; color: var(--text-faint); flex: none; }
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
}
.search-box input::placeholder { color: var(--text-faint); }

/* 区县列表 */
.region-list { list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 230px; overflow-y: auto; }
.region-list::-webkit-scrollbar { width: 4px; }
.region-list::-webkit-scrollbar-thumb { background: rgba(126, 174, 204, 0.25); }
.region-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.17s ease;
}
.region-item:hover { background: var(--panel-2); }
.region-item .ri-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--gold); }
.region-item .ri-name { font-size: 13.5px; color: var(--text-dim); }
.region-item .ri-type { margin-left: auto; font-size: 10px; color: var(--text-faint); }
.region-item.active { background: var(--gold-soft); border-color: rgba(242, 181, 68, 0.4); }
.region-item.active .ri-name { color: var(--gold); font-weight: 500; }
.region-empty { font-size: 12px; color: var(--text-faint); padding: 12px 4px; text-align: center; }

/* 详情面板 */
.detail-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.detail-name { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.detail-tag {
  flex: none;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 3px;
  color: var(--teal);
  border: 1px solid rgba(63, 182, 168, 0.4);
  margin-top: 5px;
}
.detail-seat { font-size: 12px; color: var(--text-faint); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.detail-seat svg { width: 13px; height: 13px; }
.detail-intro { font-size: 13px; line-height: 1.75; color: var(--text-dim); margin-bottom: 15px; }

.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 15px; }
.data-cell { background: var(--panel-2); border-radius: 4px; padding: 10px; border: 1px solid var(--border); }
.data-cell .dc-val { font-family: var(--mono); font-size: 15.5px; font-weight: 600; color: var(--text); }
.data-cell .dc-val small { font-size: 9.5px; color: var(--text-faint); font-weight: 400; }
.data-cell .dc-key { font-size: 10px; color: var(--text-faint); margin-top: 4px; letter-spacing: 1px; }

.landmark-title { font-size: 11px; letter-spacing: 2px; color: var(--text-faint); margin-bottom: 9px; }
.landmark-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.lm-tag {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.locate-btn {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  border: none;
  border-radius: 5px;
  color: #1a1206;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: filter 0.2s ease;
}
.locate-btn:hover { filter: brightness(1.08); }
.locate-btn svg { width: 16px; height: 16px; }

/* 区域平台跳转按钮（描边次按钮） */
.platform-btn {
  width: 100%;
  height: 40px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gold-soft);
  border: 1px solid rgba(242, 181, 68, 0.55);
  border-radius: 5px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.platform-btn:hover { background: rgba(242, 181, 68, 0.28); border-color: var(--gold); }
.platform-btn svg { width: 16px; height: 16px; }

/* 列表/图例中的外链图标 */
.ext-link {
  flex: none;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.ext-link svg { width: 14px; height: 14px; }
.ext-link:hover { color: var(--gold); background: var(--gold-soft); }

/* 底部提示 */
#hint-bar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  background: rgba(10, 26, 41, 0.82);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.hint-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

/* 移动端浮动开关 */
.float-toggle {
  display: none;
  position: fixed;
  z-index: 40;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--gold);
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.float-toggle svg { width: 21px; height: 21px; }
#toggle-left { left: 14px; bottom: 70px; }
#toggle-right { right: 14px; bottom: 70px; }

/* ---------------- 海拔分层设色图例 ---------------- */
.sub-title {
  margin: 18px 0 8px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-faint);
  font-weight: 500;
}
.elev-legend {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin: 6px 0 4px;
}
.elev-bar {
  width: 16px;
  height: 170px;
  border-radius: 3px;
  border: 1px solid var(--border);
  flex: none;
}
.elev-ticks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}
.elev-ticks .tick {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  line-height: 1;
}
.sym-list {
  list-style: none;
  margin: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sym-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--text-dim);
}
.sym { width: 22px; height: 10px; flex: none; border-radius: 2px; }
.sym-river { background: #2985d9; }
.sym-border {
  background: transparent;
  height: 0;
  border-top: 2px solid rgba(209, 204, 184, 0.85);
}

/* ---------------- 生物多样性图层勾选 ---------------- */
.layer-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.layer-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease;
}
.layer-check:hover { background: var(--panel-2); color: var(--text); }
.layer-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid rgba(126, 174, 204, 0.55);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}
.layer-check input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.layer-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #1a1206;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.layer-marker { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.marker-animal { background: #f2b544; box-shadow: 0 0 6px rgba(242, 181, 68, 0.7); }
.marker-plant { background: #2fb56b; box-shadow: 0 0 6px rgba(47, 181, 107, 0.7); }
.marker-priority {
  width: 15px;
  height: 13px;
  border-radius: 3px;
  background: rgba(63, 150, 220, 0.45);
  border: 1px solid rgba(120, 190, 240, 0.8);
}
.marker-flyway {
  width: 16px;
  height: 0;
  border-top: 2.5px dashed #38a3e8;
  background: transparent;
  border-radius: 0;
}
.marker-place { background: #c07ad4; box-shadow: 0 0 6px rgba(192, 122, 212, 0.7); }

/* 物种详情图片与简介 */
.bio-photo-wrap {
  margin-top: 12px;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(126, 174, 204, 0.35);
  background: rgba(10, 26, 42, 0.6);
}
.bio-photo { display: block; width: 100%; height: auto; }
.bio-desc {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.75;
  color: #a9c0d0;
  letter-spacing: 0.2px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .coord-readout { display: none; }
  .top-actions { margin-left: auto; }
}
@media (max-width: 900px) {
  #topbar { padding: 0 14px; gap: 12px; }
  .brand-text h1 { font-size: 16px; letter-spacing: 1px; }
  .brand-en { display: none; }
  .tool-btn span { display: none; }
  .tool-btn { padding: 0 11px; }

  .side-panel {
    width: calc(100% - 28px);
    max-width: 340px;
    transition: transform 0.32s cubic-bezier(.4,0,.2,1);
  }
  #left-panel { transform: translateX(-115%); }
  #right-panel { transform: translateX(115%); }
  #left-panel.open { transform: translateX(0); }
  #right-panel.open { transform: translateX(0); }
  .float-toggle { display: flex; }
  #hint-bar { font-size: 10.5px; padding: 7px 13px; max-width: 92%; overflow: hidden; }
}

@media (max-width: 440px) {
  #topbar { padding: 0 12px; gap: 8px; }
  .brand-mark { display: none; }
  .brand-text h1 { font-size: 14px; letter-spacing: 0.5px; }
  .top-actions { gap: 4px; }
  .tool-btn { padding: 0 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-ring, .hint-dot { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
