:root {
  --bg: #0b0e14;
  --panel: rgba(20, 22, 28, 0.92);
  --panel-card: rgba(28, 31, 38, 0.88);
  --panel-recessed: rgba(12, 14, 18, 0.78);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f5f8;
  --muted: #8a93a6;
  --accent: #4da3ff;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--text);
}

#cesiumContainer {
  position: absolute;
  inset: 0;
}

.cesium-viewer-bottom,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-toolbar {
  display: none !important;
}

.hidden {
  display: none !important;
}

/* =========================================================
   Fullscreen toggle (top-right, aligned with the panel title)
   ========================================================= */
.fs-btn {
  position: absolute;
  top: 22px;
  right: 16px;
  z-index: 8;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--panel-border-strong);
  background: var(--panel);
  backdrop-filter: blur(16px);
  color: #e8eefb;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.fs-btn:hover {
  background: rgba(38, 46, 60, 0.96);
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}
.fs-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}
.fs-icon {
  width: 20px;
  height: 20px;
  display: block;
}
.fs-icon--exit { display: none; }
.fs-btn.is-fullscreen .fs-icon--enter { display: none; }
.fs-btn.is-fullscreen .fs-icon--exit { display: block; }

.btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.25); }
.btn.primary {
  background: linear-gradient(135deg, #2f7de0, #1f5fb8);
  border-color: transparent;
  width: 100%;
  justify-content: center;
  margin-top: 9px;
  padding: 9px 10px;
  font-weight: 600;
}
.btn.ghost { backdrop-filter: blur(12px); }

/* =========================================================
   Minimalist Left Sidebar Panel
   ========================================================= */
.panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(352px, calc(100vw - 28px));
  z-index: 6;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  border-radius: 20px;
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 92px);
  overflow-y: auto;
}
.panel::-webkit-scrollbar {
  width: 5px;
}
.panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

.explorer-header {
  margin-bottom: 14px;
}
.explorer-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.passport-section {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.passport-label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 7px;
}
.select-wrap {
  position: relative;
}
.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}
.passport-section select {
  width: 100%;
  appearance: none;
  background: var(--panel-card);
  color: #ffffff;
  border: 1px solid var(--panel-border-strong);
  border-radius: 12px;
  padding: 11px 32px 11px 13px;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.passport-section select:focus {
  border-color: rgba(255, 255, 255, 0.3);
}

/* Section Head: 入境方式 / 选择地图显示的分类 */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 14px 2px 10px;
}
.section-head.compact {
  margin: 10px 2px 8px;
}
.section-title {
  font-size: 13.5px;
  font-weight: 650;
  color: #e5e9f0;
}

/* Category Cards List */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cat-card {
  background: var(--panel-card);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cat-card:hover {
  border-color: var(--panel-border-strong);
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  user-select: none;
}

/* Top-level rounded-square checkbox */
.cat-check {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.6px solid rgba(160, 170, 188, 0.42);
  background: transparent;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  transition: all 0.15s ease;
}

/* Single category cards (免签直走 & 特殊安排) and COLLAPSED 需要办签 card:
   Filled with their solid category color (#22c55e, #eab308, #14b8a6) */
.cat-card.on .cat-check,
.cat-card.partial .cat-check {
  background: var(--cat-color, #eab308);
  border-color: var(--cat-color, #eab308);
  color: #0b0e14;
}

/* EXPANDED 需要办签 card aggregate checkbox (#needVisaCard.expanded-mode):
   Matches User Image 1 (049771bc...png): Dark fill + light silver-white border + bold white checkmark ✓ */
#needVisaCard.expanded-mode.on .cat-check,
#needVisaCard.expanded-mode.partial .cat-check {
  background: #1c2029;
  border: 1.8px solid #d4dbe6;
  color: #ffffff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.cat-card:not(.on):not(.partial) .cat-title,
.cat-card:not(.on):not(.partial) .cat-count {
  color: var(--muted);
}

.cat-title {
  flex: 1;
  font-size: 15px;
  font-weight: 650;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.cat-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-count {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #d6dde8;
}

.cat-expand-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  padding: 2px 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s ease;
}
.cat-expand-btn:hover {
  color: #ffffff;
}

/* Recessed Sub-list inside 需要办签 */
.sub-recessed {
  margin-top: 11px;
  background: var(--panel-recessed);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 11px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
}

.sub-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 2px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
}
.sub-row + .sub-row {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Sub-item checkbox: when expanded & checked, displays its own category color (#ef4444, #3b82f6, #f59e0b, #a855f7) at the checkmark box! */
.sub-check {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  border-radius: 5.5px;
  border: 1.6px solid rgba(148, 163, 184, 0.36);
  background: rgba(255, 255, 255, 0.02);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  transition: all 0.15s ease;
}
.sub-row.on .sub-check {
  background: var(--sub-color, #3b82f6);
  border-color: var(--sub-color, #3b82f6);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38);
}

.sub-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 550;
  color: #f1f5f9;
  transition: color 0.15s ease;
}
.sub-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
  transition: color 0.15s ease;
}
.sub-row:not(.on) .sub-name,
.sub-row:not(.on) .sub-count {
  color: #687285;
}

/* Map Info Layers Section at bottom of Panel */
.map-layers-box {
  margin-top: 12px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.format-pill {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.format-pill:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}
.layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 2px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: #e2e8f0;
}
.layer-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.layer-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.6px solid rgba(148, 163, 184, 0.36);
  background: #1c2029;
  display: inline-grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  transition: all 0.15s ease;
}
.layer-row input:checked + .layer-check {
  border-color: #d4dbe6;
  background: #1c2029;
  color: #ffffff;
}
.layer-row input:not(:checked) ~ .layer-label {
  color: #687285;
}

/* =========================================================
   Floating Zoom Controls Dock (Right Side)
   ========================================================= */
.zoom-dock {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 8px 7px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  user-select: none;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel-card);
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}
.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-track-wrap {
  height: 108px;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#zoomSlider {
  width: 98px;
  height: 5px;
  transform: rotate(-90deg);
  accent-color: #e2e8f0;
  cursor: pointer;
}

.zoom-readout {
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
  padding: 2px 4px;
}

.zoom-reset-btn {
  width: 36px;
  padding: 5px 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.zoom-reset-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* =========================================================
   3D Globe Overlay: Adaptive Country Names & Landmarks
   ========================================================= */
.globe-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.g-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate3d(-9999px, -9999px, 0);
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  will-change: transform;
}

.g-country {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.g-country-name {
  color: #ffffff;
  font-weight: 750;
  font-size: 13px;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(0, 0, 0, 0.85),
    -1px -1px 0 rgba(8, 12, 20, 0.88),
    1px -1px 0 rgba(8, 12, 20, 0.88),
    -1px 1px 0 rgba(8, 12, 20, 0.88),
    1px 1px 0 rgba(8, 12, 20, 0.88);
  white-space: nowrap;
}
.g-country.tier-1 .g-country-name {
  font-size: 14.5px;
  letter-spacing: 0.04em;
}

.g-country.is-abbr .g-country-name {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(241, 245, 249, 0.92);
  background: rgba(10, 14, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 1px 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.g-country-trait {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 550;
  color: #fde68a;
  background: rgba(10, 14, 24, 0.72);
  border: 1px solid rgba(253, 230, 138, 0.28);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.g-landmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(12, 16, 26, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 2.5px 8px 2.5px 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.g-landmark:hover {
  border-color: rgba(253, 224, 71, 0.82);
  background: rgba(20, 26, 40, 0.95);
  z-index: 10;
}
.g-landmark::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}
.g-lm-icon {
  font-size: 12px;
  line-height: 1;
}
.g-lm-name {
  font-size: 11px;
  font-weight: 600;
  color: #f8fafc;
}
.g-lm-tag {
  font-size: 9.5px;
  color: #cbd5e1;
  padding-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

/* =========================================================
   Country Detail, Landmark Switcher & 5-Photo Open-Source Gallery Popup
   ========================================================= */
.popup {
  position: absolute;
  right: 68px;
  bottom: 14px;
  width: min(416px, calc(100vw - 88px));
  max-height: calc(100vh - 82px);
  overflow-y: auto;
  z-index: 7;
  background: var(--panel);
  border: 1px solid var(--panel-border-strong);
  backdrop-filter: blur(18px);
  border-radius: 16px;
  padding: 13px 15px;
  box-shadow: var(--shadow);
}
.popup-badges-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.popup::-webkit-scrollbar { width: 5px; }
.popup::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 99px; }
.popup.hidden { display: none; }
.popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}
.popup-flag-row { display: flex; gap: 10px; align-items: center; padding-right: 20px; }
.popup-flag {
  width: 40px;
  font-size: 30px;
  line-height: 1;
  text-align: center;
  flex: 0 0 auto;
}
.popup-title { font-size: 16px; font-weight: 650; }
.popup-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.popup-status {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, var(--status, #888) 22%, transparent);
  color: var(--text);
}
.swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--swatch, #888);
}

.popup-highlights {
  margin-top: 10px;
  background: var(--panel-recessed);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px 11px;
}
.popup-trait {
  font-size: 12px;
  font-weight: 650;
  color: #fde68a;
  margin-bottom: 4px;
}
.popup-lm-switch-hint {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.popup-landmark-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.popup-lm-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 4.5px 7.5px;
  font-size: 11px;
  font-weight: 550;
  color: #cbd5e1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.popup-lm-chip:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.popup-lm-chip.active {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(250, 204, 21, 0.72);
  color: #fef08a;
  font-weight: 650;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* 5-Photo Open-Source Gallery inside Popup */
.popup-gallery {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.gallery-lm-title {
  font-size: 12px;
  font-weight: 650;
  color: #f8fafc;
}

.gallery-stage {
  position: relative;
  width: 100%;
  height: 210px;
  border-radius: 10px;
  overflow: hidden;
  background: #0d111a;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.gallery-main-img {
  width: 100%;
  height: 100%;
  /* contain：竖构图/全景图不再被裁成一条，背景是深色不影响观感 */
  object-fit: contain;
  display: block;
}
.gallery-nav {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 14, 22, 0.72);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}
.gallery-nav:hover {
  background: rgba(20, 28, 44, 0.92);
  border-color: rgba(255, 255, 255, 0.5);
}
.gallery-nav.prev { left: 7px; }
.gallery-nav.next { right: 7px; }

.gallery-counter {
  position: absolute;
  top: 7px;
  right: 8px;
  background: rgba(10, 14, 22, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 1.5px 7px;
  font-size: 10px;
  font-weight: 650;
  color: #f1f5f9;
  z-index: 2;
}

/* 5 Thumbnails Strip */
.gallery-thumbs {
  margin-top: 6px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
}
/* 图片署名：极小字号，不抢版面，但保持可读与可选中 */
.gallery-credit {
  margin: 5px 0 0;
  font-size: 8px;
  line-height: 1.35;
  color: #7c8798;
  letter-spacing: 0.01em;
  opacity: 0.8;
  word-break: break-word;
}
.gallery-thumb-btn {
  position: relative;
  padding: 0;
  height: 42px;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: #141822;
  cursor: pointer;
  opacity: 0.72;
  transition: all 0.14s ease;
}
.gallery-thumb-btn:hover {
  opacity: 0.95;
  border-color: rgba(255, 255, 255, 0.35);
}
.gallery-thumb-btn.active {
  opacity: 1;
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.45);
}
.gallery-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-thumb-idx {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 9px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(8, 12, 20, 0.75);
  border-radius: 3px;
  padding: 0 3.5px;
  line-height: 1.3;
}

.popup-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 9px 0 0;
}
.popup-meta div {
  background: rgba(255,255,255,0.04);
  border-radius: 9px;
  padding: 6px 9px;
}
.popup-meta dt { font-size: 10px; color: var(--muted); }
.popup-meta dd { margin: 2px 0 0; font-size: 11.5px; }

.loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 12px;
  background: radial-gradient(ellipse at center, #12203a 0%, #05070d 70%);
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.loading.hide { opacity: 0; pointer-events: none; transition: opacity 0.4s; }
.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }



/* Embed mode — full-bleed canvas inside the htex page shell.
   只在桌面生效：这两条的特异性 (0,2,1) 高于移动端块里的 .panel (0,1,0)，
   不加媒体查询的话手机上会被顶回左上角（实测面板变成整屏 820px）。 */
@media (min-width: 721px) {
  html.embed .panel { top: 14px; }
  html.embed .zoom-dock { top: 50%; }
}

/* Landmark list heading (replaces the old tier/scale hint text) */
.popup-lm-heading {
  margin: 10px 0 6px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* Data-source language note (non-Chinese locales) */
.popup-source-note {
  margin: 10px 0 6px;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.22);
  font-size: 11px;
  line-height: 1.5;
  color: #e2c98f;
}
.popup-source-note.hidden { display: none; }

/* Load failure: keep it readable and localized */
.loading--error {
  display: grid;
  place-items: center;
  padding: 24px;
  color: #f87171;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

/* =========================================================
   移动端覆盖必须放最后：上面 html.embed .panel { top:14px } 优先级更高，
   放前面会被它顶回左上角（实测面板变成整屏 820px）。
   ========================================================= */
@media (max-width: 720px) {
  /* ---------- 手机端：地球占满屏幕，筛选收进底部抽屉 ---------- */
  .fs-btn { display: none; }

  .panel {
    left: 10px;
    right: 10px;
    width: auto;
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    max-height: 48vh;
    padding: 0 14px calc(12px + env(safe-area-inset-bottom));
    border-radius: 22px;
    background: rgba(14, 17, 24, 0.9);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    backdrop-filter: blur(22px) saturate(140%);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transition: max-height 0.24s ease;
  }

  .sheet-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    position: sticky;
    top: 0;
    z-index: 2;
    cursor: pointer;
    background: linear-gradient(
      180deg,
      rgba(14, 17, 24, 0.98) 0%,
      rgba(14, 17, 24, 0.92) 72%,
      rgba(14, 17, 24, 0) 100%
    );
  }
  .sheet-grip {
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.26);
  }

  /* 收起态：只留护照 + 分类，图层/子类藏起来 */
  .panel.is-collapsed {
    max-height: none;
    overflow: hidden;
  }
  .panel.is-collapsed .map-layers-box,
  .panel.is-collapsed .sub-recessed { display: none; }
  .panel.is-collapsed .cat-card.expanded-mode {
    flex-basis: auto;
    border-radius: 999px;
    padding-bottom: 0;
  }
  .panel.is-collapsed .cat-card.expanded-mode .cat-row { padding-bottom: 8px; }

  /* 抽屉展开时收起缩放条，避免压在地球上 */
  html.sheet-expanded .zoom-dock {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
  }

  .explorer-header { display: none; }

  .passport-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 9px;
    border-bottom: 0;
  }
  .passport-label {
    margin: 0;
    font-size: 10.5px;
    white-space: nowrap;
    color: var(--muted);
  }
  .select-wrap { flex: 1; min-width: 0; }
  .passport-section select {
    height: 38px;
    padding: 0 28px 0 11px;
    border-radius: 11px;
    font-size: 12.5px;
    background: rgba(255, 255, 255, 0.08);
  }

  .section-head { margin: 3px 2px 8px; }
  .section-head.compact { margin: 9px 2px 7px; }
  .section-title { font-size: 11px; }

  /* 分类卡片 → 胶囊按钮 */
  .category-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 7px;
  }
  .cat-card {
    flex: 0 0 auto;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
  }
  .cat-row { padding: 7px 10px; gap: 5px; }
  .cat-check { width: 14px; height: 14px; font-size: 9.5px; border-radius: 4px; }
  .cat-title { font-size: 11.5px; }
  .cat-count { font-size: 10px; min-width: 13px; }
  .cat-expand-btn { font-size: 9.5px; padding: 2px 3px; }

  /* 展开「需要办签」时整条占满一行 */
  .cat-card.expanded-mode {
    flex-basis: 100%;
    border-radius: 16px;
    padding-bottom: 4px;
  }
  .cat-card.expanded-mode .cat-row { padding-bottom: 2px; }
  .sub-recessed {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    padding: 4px 10px 8px;
    background: none;
    border: 0;
  }
  .sub-row {
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
  }
  .sub-row + .sub-row { border-top: 0; }
  .sub-check { width: 13px; height: 13px; font-size: 9px; border-radius: 4px; }
  .sub-name { flex: 0 1 auto; font-size: 10.5px; }
  .sub-count { font-size: 9.5px; }

  .map-layers-box {
    margin-top: 4px;
    padding-top: 8px;
  }
  .layer-toggles { flex-direction: row; flex-wrap: wrap; gap: 7px; }
  .layer-row {
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 10.5px;
  }
  .layer-check { width: 14px; height: 14px; font-size: 9.5px; border-radius: 4px; }
  .layer-label { font-size: 10.5px; }
  .format-pill { padding: 2px 6px; font-size: 9.5px; }

  /* 缩放条：只剩 + / − / 整球，贴在抽屉上方 */
  .zoom-dock {
    top: auto;
    bottom: calc(var(--sheet-h, 200px) + 26px + env(safe-area-inset-bottom));
    right: 10px;
    transform: none;
    padding: 6px;
    gap: 6px;
    border-radius: 14px;
  }
  .zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    font-size: 19px;
  }
  .zoom-track-wrap,
  .zoom-readout { display: none; }
  .zoom-reset-btn {
    width: 40px;
    padding: 4px 0;
    font-size: 11px;
  }

  /* 国家详情：整宽底部卡片 */
  .popup {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    max-height: 52vh;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    border-radius: 22px;
    z-index: 9;
  }
  .popup-title { font-size: 15.5px; }
  .popup-sub { font-size: 10.5px; }
  .popup-status { font-size: 11px; padding: 3px 9px; }
  .popup-trait { font-size: 11.5px; }
  .popup-meta dt { font-size: 9px; }
  .popup-meta dd { font-size: 10.5px; }
  .popup-lm-heading { font-size: 10.5px; }
  .popup-lm-chip { font-size: 11px; padding: 4px 8px; }
  .popup-close {
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
  }
  /* 主按钮吸底：手机上不用滚到底才看得到 */
  .popup .btn.primary {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: 10px;
    padding: 12px 10px;
    font-size: 13px;
    box-shadow: 0 -14px 22px rgba(14, 17, 24, 0.92);
  }

  /* 太空底图上的国名：跟着 App 的微字号走，宁小不大 */
  .g-country-name { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; }
  .g-country.tier-1 .g-country-name { font-size: 11px; letter-spacing: 0.03em; }
  .g-country.is-abbr .g-country-name {
    font-size: 8.5px;
    padding: 1px 3px;
  }
  .g-country-trait { display: none; }
  .g-landmark { padding: 1.5px 5px; gap: 3px; }
  .g-lm-icon { font-size: 10px; }
  .g-lm-name { font-size: 9px; font-weight: 600; }
  .g-lm-tag { display: none; }
}
