/* ============================================================
   赤峰 3D 沙盘 · 界面样式（桌面 + 移动）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: #33413c;
  background: #e9eee6;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color .55s ease;
}
#canvas-wrap { position: fixed; inset: 0; }
#canvas-wrap canvas { display: block; cursor: grab; touch-action: none; }
#canvas-wrap canvas:active { cursor: grabbing; }
#label-layer {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5;
}
.w-label {
  position: absolute; top: 0; left: 0;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: rgba(255,255,255,0.9);
  color: #3a4742;
  border: 1px solid rgba(60,80,72,0.12);
  box-shadow: 0 2px 8px rgba(53,74,66,0.1);
  transition: opacity .22s ease, box-shadow .2s ease, transform .2s ease;
  will-change: transform;
}
.w-label.clickable {
  pointer-events: auto;
  cursor: pointer;
}
.w-label.clickable:hover,
.w-label.clickable:focus-visible {
  box-shadow: 0 4px 14px rgba(53,74,66,0.18);
  outline: none;
}
.w-label.clickable:focus-visible {
  outline: 2px solid #3f9a86;
  outline-offset: 2px;
}
.w-label.selected {
  background: rgba(47,128,110,0.95);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}
.lbl-district { font-size: 13px; font-weight: 600; letter-spacing: 2px; }
.lbl-city-main { font-size: 12px; color: #8b3a2a; font-weight: 600; }
.lbl-peak { color: #455248; font-size: 10px; font-weight: 600; }
.lbl-river { color: #1f5f8f; background: rgba(228,240,250,0.92); font-weight: 600; }
.lbl-lake { color: #164f7c; font-weight: 600; }
.lbl-spot { color: #6e3218; background: rgba(255,248,235,0.96); font-weight: 600; }

#ui-root {
  position: fixed; inset: 0; pointer-events: none; z-index: 10;
}
#ui-root > * { pointer-events: auto; }
#ui-root.hidden { opacity: 0; pointer-events: none !important; }
#ui-root.hidden > * { pointer-events: none !important; }

.panel {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid rgba(70, 95, 85, 0.12);
  box-shadow: 0 10px 34px rgba(53, 74, 66, 0.12);
  border-radius: 18px;
  touch-action: pan-y;
}
#tab-districts, #tab-spots, #card {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* ---------------- 顶栏 ---------------- */
#title-bar {
  position: fixed; top: 18px; left: 18px;
  padding: 12px 18px;
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 7px; height: 7px; border-radius: 50%; background: #c9a227; }
.brand .eyebrow {
  font-size: 10px; letter-spacing: 3px; font-weight: 600; color: #7a5c20;
}
#title-bar h1 {
  font-size: 28px; font-weight: 600; letter-spacing: 8px;
  margin: 6px 0 2px; color: #2f4039;
  font-family: "Songti SC", "STSong", "SimSun", serif;
}
#title-bar .sub { font-size: 11px; letter-spacing: 2px; color: #5f6f67; }

/* ---------------- 面包屑 / 分级 ---------------- */
#level-bar {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 12px;
}
#level-bar button {
  border: none; background: transparent; color: #4e8c7d;
  font: inherit; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
#level-bar button:hover { background: rgba(63,154,134,.12); }
#level-bar button.active { color: #2f4039; font-weight: 600; }
#level-bar .sep { color: #b0bab3; }
#level-badge {
  margin-left: 4px; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(135deg, #3f9a86, #2f806e);
  color: #fff; font-size: 10px; letter-spacing: 1px;
}

/* ---------------- 主题 ---------------- */
#theme-switch {
  position: fixed; top: 18px; right: 18px;
  display: flex; gap: 2px; padding: 4px;
}
.theme-btn {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; color: #5a6b63;
  padding: 8px 12px; border-radius: 11px;
  transition: background-color .2s ease, color .2s ease, transform .15s ease;
  touch-action: manipulation;
}
.theme-btn .ti { margin-right: 4px; font-size: 13px; line-height: 1; }
.theme-btn .tl { letter-spacing: 0.5px; }
.theme-btn:hover { background: rgba(63,154,134,.1); color: #2f806e; }
.theme-btn:active { transform: scale(0.96); }
.theme-btn.active {
  background: linear-gradient(135deg, #3f9a86, #2f806e);
  color: #fff;
}
.theme-btn:focus-visible,
#toolbar button:focus-visible,
.chip:focus-visible,
.btn-primary:focus-visible,
.btn-ghost:focus-visible,
#enter-btn:focus-visible,
#level-bar button:focus-visible,
#zoom-ctrl button:focus-visible,
#card-close:focus-visible {
  outline: 2px solid #3f9a86; outline-offset: 2px;
}

/* ---------------- 侧栏 / 列表 ---------------- */
#sidebar {
  position: fixed; top: 108px; left: 18px; bottom: 92px;
  width: 280px; display: flex; flex-direction: column;
  overflow: hidden; transition: transform .3s ease, opacity .3s ease;
  overscroll-behavior: contain;
}
#sidebar.collapsed { transform: translateX(-112%); opacity: 0; pointer-events: none; }
.side-head {
  padding: 14px 16px 10px; display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid rgba(70, 95, 85, .09);
}
.side-head b { font-size: 14px; letter-spacing: 2px; }
.side-head .count { font-size: 11px; color: #6b7a72; }
.filter-row {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px;
  border-bottom: 1px solid rgba(70, 95, 85, .08);
}
.chip {
  border: 1px solid rgba(70,95,85,.14); background: rgba(255,255,255,.6);
  color: #5a6b63; font-size: 11px; padding: 5px 10px; border-radius: 999px;
  cursor: pointer; font-family: inherit;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease,
    transform .12s ease;
  touch-action: manipulation;
}
.chip:hover { border-color: rgba(47,128,110,.4); color: #2f806e; }
.chip:active { transform: scale(0.96); }
.chip.active {
  background: #2f806e; border-color: #2f806e; color: #fff;
}
#tab-districts { display: none; }
#tab-spots { display: none; flex: 1; overflow-y: auto; padding: 8px 10px 12px; }
#tab-districts.visible, #tab-spots.visible { display: block; }
#tab-districts.visible { flex: 1; overflow-y: auto; padding: 8px 10px 12px; }
#tab-districts, #tab-spots {
  scrollbar-width: thin;
  scrollbar-color: rgba(47,128,110,.35) transparent;
}
.sec-title {
  font-size: 10px; letter-spacing: 3px; color: #6f7d75;
  padding: 10px 8px 6px;
}
.empty-tip {
  padding: 24px 12px; text-align: center;
  font-size: 12px; color: #6b7a72;
}
.item {
  display: flex; gap: 10px; align-items: flex-start;
  width: 100%; text-align: left; border: none; background: transparent;
  padding: 10px 10px; border-radius: 12px; cursor: pointer;
  font-family: inherit; color: inherit;
  transition: background-color .15s ease, transform .15s ease;
  touch-action: manipulation;
}
.item:hover { background: rgba(63,154,134,.1); transform: translateX(2px); }
.item:active { transform: translateX(1px) scale(0.99); }
.item.active { background: rgba(63,154,134,.14); }
.item:focus-visible {
  outline: 2px solid #3f9a86; outline-offset: 1px;
}
.item .no {
  font-size: 10px; color: #7a8880; min-width: 18px; padding-top: 2px;
}
.item .name { font-size: 13px; font-weight: 600; color: #2f4039; }
.item .meta { font-size: 11px; color: #6b7a72; margin-top: 2px; }
.item .swatch {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
}
.side-foot {
  padding: 10px 14px; font-size: 10px; color: #6b7a72;
  border-top: 1px solid rgba(70,95,85,.08);
}

/* ---------------- 详情卡 ---------------- */
#card {
  position: fixed; top: 108px; right: 18px; width: 320px;
  padding: 0 0 16px; overflow: hidden;
  transition: transform .3s ease, opacity .3s ease;
  overscroll-behavior: contain;
}
#card.hidden {
  transform: translateX(120%); opacity: 0; pointer-events: none;
}
#card-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.85); cursor: pointer;
  font-size: 18px; color: #5a6b63;
  transition: background-color .15s ease, transform .12s ease;
  touch-action: manipulation;
}
#card-close:hover { background: #fff; color: #2f4039; }
#card-close:active { transform: scale(0.92); }
.card-hero {
  height: 120px; display: flex; align-items: flex-end; padding: 14px 16px;
  color: #fff; font-size: 11px; letter-spacing: 2px;
  background: linear-gradient(135deg, #3f8f7a, #2f806e);
}
.card-hero.geo { background: linear-gradient(135deg, #8a6a3a, #6a5030); }
.card-hero.history { background: linear-gradient(135deg, #a05a3a, #7a4028); }
.card-hero.grass { background: linear-gradient(135deg, #b08930, #8a6a20); }
.card-hero.leisure { background: linear-gradient(135deg, #4a7aaa, #2f5f8a); }
.card-hero.nature { background: linear-gradient(135deg, #3f8f7a, #2f806e); }
.card-no { padding: 14px 18px 0; font-size: 10px; letter-spacing: 2px; color: #6b7a72; }
#card h2 {
  padding: 4px 18px 0; font-size: 22px; letter-spacing: 2px; color: #2f4039;
  font-family: "Songti SC", "STSong", serif;
}
.card-en { padding: 4px 18px 0; font-size: 10px; letter-spacing: 1.5px; color: #6b7a72; }
.card-desc {
  padding: 12px 18px; font-size: 12.5px; line-height: 1.7; color: #3d4a44;
}
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 12px; }
.card-chips span,
.card-chips button {
  font-size: 11px; padding: 4px 8px; border-radius: 999px;
  background: rgba(63,154,134,.1); color: #2f806e;
  border: none; font-family: inherit;
}
.card-chips button {
  cursor: pointer; touch-action: manipulation;
  transition: background-color .15s ease, transform .12s ease;
}
.card-chips button:hover { background: rgba(63,154,134,.22); }
.card-chips button:active { transform: scale(0.96); }
.card-actions { display: flex; gap: 8px; padding: 4px 18px 8px; }
.btn-primary, .btn-ghost {
  flex: 1; border: none; cursor: pointer; font-family: inherit;
  padding: 11px 8px; border-radius: 12px; font-size: 13px;
  transition: transform .15s ease, box-shadow .2s ease, background-color .15s ease;
  touch-action: manipulation;
}
.btn-primary {
  background: linear-gradient(135deg, #3f9a86, #2f806e); color: #fff;
  box-shadow: 0 6px 16px rgba(47,128,110,.3);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(47,128,110,.4); }
.btn-primary:active, .btn-ghost:active { transform: scale(0.98); }
.btn-ghost {
  background: rgba(63,154,134,.1); color: #2f806e;
}
.btn-ghost:hover { background: rgba(63,154,134,.18); }
.card-meta {
  padding: 8px 18px 0; font-size: 10px; color: #7a8880;
}

/* district card variant */
#card.mode-district .card-hero { height: 84px; }

/* ---------------- 工具栏 ---------------- */
#toolbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 6px;
  z-index: 30;
}
#toolbar button {
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 12px; border-radius: 12px; color: #5a6b63; font-family: inherit;
  min-width: 52px;
  transition: background-color .15s ease, color .15s ease, transform .12s ease;
  touch-action: manipulation;
}
#toolbar button span { font-size: 16px; line-height: 1; }
#toolbar button i { font-style: normal; font-size: 10px; }
#toolbar button:hover, #toolbar button.active {
  background: rgba(63,154,134,.12); color: #2f806e;
}
#toolbar button:active { transform: scale(0.94); }

#hint {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  padding: 8px 14px; font-size: 11px; color: #5a6b63;
  border-radius: 999px; white-space: nowrap;
  transition: opacity .4s;
  pointer-events: none;
}
#hint b { color: #2f806e; }

#zoom-ctrl {
  position: fixed; right: 18px; bottom: 100px;
  display: flex; flex-direction: column; gap: 6px; padding: 6px;
}
#zoom-ctrl button {
  width: 40px; height: 40px; border-radius: 12px; border: none;
  background: transparent; font-size: 18px; color: #5a6b63; cursor: pointer;
  transition: background-color .15s ease, transform .12s ease;
  touch-action: manipulation;
}
#zoom-ctrl button:hover { background: rgba(63,154,134,.12); }
#zoom-ctrl button:active { transform: scale(0.94); }

#compass {
  position: fixed; right: 18px; top: 86px;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; font: inherit; color: inherit;
  transition: transform .2s ease, box-shadow .2s ease;
  touch-action: manipulation;
}
#compass:hover { transform: scale(1.06); }
#compass:active { transform: scale(0.96); }
#compass:focus-visible {
  outline: 2px solid #3f9a86; outline-offset: 2px;
}
#compass .needle {
  width: 3px; height: 18px;
  background: linear-gradient(to bottom, #c0392b 50%, #4a5750 50%);
  border-radius: 2px;
  transition: transform .35s ease;
}
#compass span {
  position: absolute; top: 4px; font-size: 9px; color: #8a6a2a; font-weight: 700;
}

#minimap-wrap {
  position: fixed; right: 18px; bottom: 18px;
  width: 168px; padding: 8px; display: none;
}
#minimap-wrap.visible { display: block; }
.mm-title { font-size: 10px; letter-spacing: 2px; color: #6b7a72; margin-bottom: 6px; }
#minimap { width: 100%; height: 110px; border-radius: 10px; background: rgba(233,238,230,.8); }

#footnote {
  position: fixed; left: 18px; bottom: 18px;
  padding: 8px 12px; font-size: 10px; color: #6b7a72; border-radius: 12px;
  max-width: 320px; text-wrap: pretty;
}

#toast {
  position: fixed; left: 50%; bottom: 118px; transform: translate(-50%, 8px);
  padding: 9px 16px; border-radius: 999px;
  background: rgba(32, 48, 42, 0.88); color: #fff;
  font-size: 12px; letter-spacing: 1px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 60;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 开场 ---------------- */
#intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, #f7f4ea 0%, #dfe8d8 55%, #c5d4c0 100%);
  transition: opacity .6s ease;
}
#intro.gone { opacity: 0; pointer-events: none; }
.intro-card {
  max-width: 520px; width: calc(100% - 40px);
  padding: 36px 32px;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(16px);
  border-radius: 24px;
  border: 1px solid rgba(70,95,85,.1);
  box-shadow: 0 20px 50px rgba(53,74,66,.15);
  text-align: center;
}
.intro-eyebrow {
  font-size: 10px; letter-spacing: 4px; color: #8a6a2a; font-weight: 600;
}
.intro-card h1 {
  font-family: "Songti SC", "STSong", serif;
  font-size: 42px; letter-spacing: 12px; margin: 12px 0 4px; color: #2f4039;
}
.intro-sub { letter-spacing: 4px; color: #5a8a7a; font-size: 14px; }
.intro-desc {
  margin: 18px 0 22px; font-size: 13px; line-height: 1.8; color: #4a5750; text-align: left;
}
#enter-btn {
  border: none; cursor: pointer; font-family: inherit;
  padding: 14px 36px; border-radius: 999px; font-size: 15px; letter-spacing: 3px;
  background: linear-gradient(135deg, #3f9a86, #2f806e);
  color: #fff; box-shadow: 0 10px 24px rgba(47,128,110,.35);
  transition: transform .2s ease, box-shadow .2s ease;
  touch-action: manipulation;
}
#enter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(47,128,110,.42);
}
#enter-btn:active { transform: translateY(0) scale(0.98); }
.intro-tip { margin-top: 14px; font-size: 11px; color: #6b7a72; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #intro { transition: none; }
  #sidebar, #card, #toast, #hint { transition: none; }
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 768px) {
  #title-bar {
    top: max(10px, env(safe-area-inset-top));
    left: 12px; padding: 8px 12px;
  }
  #title-bar h1 { font-size: 20px; letter-spacing: 4px; }
  #title-bar .sub { display: none; }
  .brand .eyebrow { font-size: 8px; letter-spacing: 2px; }

  #level-bar {
    top: auto; bottom: calc(72px + env(safe-area-inset-bottom));
    font-size: 11px; padding: 6px 10px;
  }

  #theme-switch {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
  }
  .theme-btn { padding: 7px 8px; font-size: 11px; }

  #sidebar {
    top: auto; left: 0; right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom));
    width: 100%; height: 46vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(120%);
    opacity: 0; pointer-events: none; z-index: 20;
  }
  #sidebar.mobile-open {
    transform: translateY(0) !important; opacity: 1 !important; pointer-events: auto !important;
  }
  #sidebar.collapsed:not(.mobile-open) {
    transform: translateY(120%); opacity: 0; pointer-events: none;
  }

  #card {
    top: calc(74px + env(safe-area-inset-top));
    right: 10px; left: 10px; bottom: auto;
    width: auto; max-height: 40vh;
    border-radius: 16px;
    transform: translateY(0);
    overflow-y: auto;
    z-index: 22;
    box-shadow: 0 12px 32px rgba(53,74,66,.18);
  }
  #card.hidden { transform: translateY(-120%); opacity: 0; }
  .card-hero { height: 56px; }
  .card-desc { font-size: 12px; line-height: 1.55; padding: 8px 14px; }
  #card h2 { font-size: 18px; }
  .card-actions { padding-bottom: 4px; }
  #card.compact .card-desc { display: none; }
  #card.compact .card-chips { display: none; }
  #card.compact { max-height: 22vh; }

  #toolbar {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 4px;
  }
  #toolbar button {
    min-width: 44px; min-height: 44px; padding: 6px 4px;
  }
  #toolbar button i { display: none; }

  #hint {
    bottom: auto; top: 64px; font-size: 10px; max-width: 90vw;
    white-space: normal; text-align: center;
  }

  #zoom-ctrl { display: none; }
  #compass { width: 42px; height: 42px; top: 64px; right: 12px; }
  #minimap-wrap { display: none !important; }
  #footnote { display: none; }

  .w-label { font-size: 10px; padding: 2px 6px; }
  .lbl-district { font-size: 11px; }

  .intro-card { padding: 28px 20px; }
  .intro-card h1 { font-size: 32px; letter-spacing: 8px; }
}

@media (max-width: 480px) {
  #theme-switch .theme-btn {
    padding: 7px 8px; font-size: 0;
    min-width: 38px; min-height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  #theme-switch .theme-btn .ti { font-size: 15px; margin-right: 0; }
  #theme-switch .theme-btn .tl { display: none; }
  #toast { bottom: 96px; font-size: 11px; }
}
