/* ── 香山 · 八大处 徒步标注 ───────────────────────────── */

:root {
  --bg: #0b100e;
  --text: #edf1ea;
  --muted: #8d9d94;
  --ok: #58d9a0;
  --off: #f2b233;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 78% 6%, rgba(242, 178, 51, 0.11), transparent 62%),
    radial-gradient(760px 560px at 14% 96%, rgba(88, 217, 160, 0.09), transparent 60%),
    radial-gradient(1200px 900px at 50% 50%, rgba(23, 40, 32, 0.55), transparent 70%);
  z-index: 0;
}

/* ── 顶部 ─────────────────────────────────────────────── */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 38px 18px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  font-size: 11px;
  letter-spacing: 0.22em;
  padding: 6px 9px 6px 11px;
  border: 1px solid rgba(242, 178, 51, 0.45);
  border-radius: 6px;
  color: var(--off);
  white-space: nowrap;
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 27px;
  letter-spacing: 0.06em;
  line-height: 1;
}

.brand h1 i { font-style: normal; color: var(--muted); padding: 0 2px; }

.brand h1 em {
  font-family: var(--sans);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-left: 10px;
  vertical-align: 4px;
}

.topstats { display: flex; gap: 30px; }

.stat { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }

.stat b {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

.stat b sup { font-size: 12px; color: var(--muted); margin: 0 1px; }
.stat span { font-size: 10.5px; letter-spacing: 0.12em; color: var(--muted); }

/* ── 布局 ─────────────────────────────────────────────── */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 404px) minmax(0, 1fr);
  gap: 38px;
  padding: 24px 38px 30px;
  height: calc(100vh - 92px);
  max-width: 1280px;
  margin: 0 auto;
}

/* ── 左栏 ─────────────────────────────────────────────── */

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 99px; }

.side-head { flex: none; padding-bottom: 10px; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: var(--off);
}

.lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: #b9c6bd;
  max-width: 34em;
}

/* 高程剖面 */

.profile-box { margin: 18px 0 4px; }

.profile-box figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.profile-title { font-size: 10.5px; letter-spacing: 0.2em; color: #cfdad3; }
.profile-note { font-size: 10px; letter-spacing: 0.06em; color: #6e7f77; font-family: var(--mono); }

.profile-holder { height: 86px; }
.profile-holder svg { display: block; width: 100%; height: 100%; }

.profile-holder .grid-line { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.profile-holder .axis-text { fill: #7b8c84; font-family: var(--mono); font-size: 22px; }
.profile-holder .area { fill: url(#profGrad); opacity: 0.55; }
.profile-holder .line { fill: none; stroke: #7de0b4; stroke-width: 3.4; stroke-linejoin: round; }
.profile-holder .wp-dot { fill: #0b100e; stroke: #58d9a0; stroke-width: 3.5; cursor: pointer; }
.profile-holder .wp-dot.is-off { stroke: var(--off); stroke-dasharray: 4 3; }
.profile-holder .wp-dot.is-active { fill: #fff; stroke-width: 4; }
.profile-holder .wp-dot:hover { stroke-width: 5; }

/* 列表 */

.list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  position: relative;
  flex: none;
}

.list::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 24px;
  bottom: 24px;
  width: 1px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04));
}

.item { position: relative; }

.item--ok { --pin: var(--ok); }
.item--off { --pin: var(--off); }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 10px 5px 40px;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease;
}

.row:hover { background: rgba(255, 255, 255, 0.045); }

.num {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--pin, var(--ok));
  background: var(--bg);
  color: var(--pin, var(--ok));
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  z-index: 1;
}

.item--off .num { border-style: dashed; }

.rowtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.name {
  font-size: 14px;
  letter-spacing: 0.02em;
  color: #e7ece5;
  transition: color 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.01em;
  color: #7c8d84;
  white-space: nowrap;
}

.tag {
  flex: none;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
}

.item.is-open .num {
  background: var(--pin);
  color: #0b100e;
  transform: translateY(-50%) scale(1.06);
  border-style: solid;
}

.item.is-open .name { color: #fff; }
.item.is-open .row { background: rgba(255, 255, 255, 0.05); }
.item.is-open .tag { color: #cfdad3; border-color: var(--line-strong); }

.note {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.note > div { overflow: hidden; }

.item.is-open .note { grid-template-rows: 1fr; }

.note p {
  margin: 2px 0 8px;
  padding: 0 10px 0 40px;
  font-size: 12.5px;
  line-height: 1.85;
  color: #a9b8ae;
}

/* 页脚控件 */

.side-foot { flex: none; padding: 12px 0 4px; margin-top: 6px; border-top: 1px solid var(--line); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 9px;
}

.legend span { display: inline-flex; align-items: center; gap: 7px; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--ok { background: var(--ok); }
.dot--off { background: var(--off); }

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.switch,
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: #d4ded6;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.switch { justify-content: flex-start; }
.controls .btn { justify-content: center; }

.switch:hover,
.btn:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.06); }

.switch-box {
  width: 22px;
  height: 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  transition: background 0.2s ease;
  flex: none;
}

.switch-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfd8d1;
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch[aria-pressed="true"] { border-color: rgba(88, 217, 160, 0.5); color: #eafff4; }
.switch[aria-pressed="true"] .switch-box { background: rgba(88, 217, 160, 0.55); }
.switch[aria-pressed="true"] .switch-box::after { transform: translateX(10px); background: #06231a; }

.switch--calib[aria-pressed="true"] { border-color: rgba(242, 178, 51, 0.55); }
.switch--calib[aria-pressed="true"] .switch-box { background: rgba(242, 178, 51, 0.6); }

.fineprint {
  margin: 14px 0 0;
  font-size: 10.5px;
  line-height: 1.8;
  color: #66766e;
}

.fineprint summary {
  cursor: pointer;
  color: #83938b;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fineprint summary::-webkit-details-marker { display: none; }

.fineprint summary::before {
  content: "＋";
  font-family: var(--mono);
  font-size: 10px;
  color: #6f8079;
}

.fineprint[open] summary::before { content: "－"; }

.fineprint p { margin: 8px 0 0; }

.fineprint a {
  color: #8fd9b4;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── 地图 ─────────────────────────────────────────────── */

.stage-wrap {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

.contours {
  position: absolute;
  inset: -6% -8%;
  width: 116%;
  height: 112%;
  opacity: 0.85;
  z-index: -1;
  pointer-events: none;
}

.frame {
  position: relative;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1080 / 2232;
  border-radius: 20px;
  overflow: hidden;
  background: #1b241f;
  box-shadow:
    0 50px 90px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 0 0 8px rgba(255, 255, 255, 0.015);
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.frame.is-grabbing { cursor: grabbing; }
.frame.is-calib { cursor: default; }

.canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 2232px;
  transform-origin: 0 0;
  will-change: transform;
  --k: 0.4;
}

.canvas.is-anim { transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1); }

.map {
  display: block;
  width: 100%;
  height: 100%;
  filter: brightness(0.88) saturate(0.92) contrast(1.03);
  pointer-events: none;
  -webkit-user-drag: none;
}

.frame-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 20px;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.35);
}

/* 虚线引线 */

.leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.leaders line {
  stroke: var(--off);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  opacity: 0.7;
  vector-effect: non-scaling-stroke;
}

/* 图钉 */

.pins { position: absolute; inset: 0; }

.pin {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transform: scale(calc(1 / var(--k)));
  transform-origin: 0 0;
  color: var(--pin, var(--ok));
  -webkit-tap-highlight-color: transparent;
}

.pin--ok { --pin: var(--ok); }
.pin--off { --pin: var(--off); }

.pin-dot {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(6, 10, 8, 0.65);
}

.pin-stem {
  position: absolute;
  left: -0.75px;
  top: -44px;
  width: 1.5px;
  height: 42px;
  background: linear-gradient(to bottom, var(--pin), rgba(255, 255, 255, 0.15));
  opacity: 0.75;
}

.pin-badge {
  position: absolute;
  left: -15px;
  top: -59px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--pin);
  background: rgba(9, 14, 11, 0.92);
  color: var(--pin);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.pin--off .pin-badge { border-style: dashed; }
.pin--off .pin-stem { opacity: 0.4; }

.pin-label {
  position: absolute;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: #e6ece5;
  background: rgba(8, 12, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.pin--off .pin-label { border-color: rgba(242, 178, 51, 0.35); }

.pin--right .pin-label { left: 21px; top: -51px; }
.pin--left .pin-label { right: 21px; top: -51px; }
.pin--top .pin-label { left: 0; top: -80px; transform: translateX(-50%); }
.pin--bottom .pin-label { left: 0; top: 12px; transform: translateX(-50%); }

.pin:hover .pin-badge { transform: scale(1.12); }

.pin.is-active .pin-badge {
  background: var(--pin);
  color: #08110c;
  transform: scale(1.1);
  border-style: solid;
}

.pin.is-active .pin-label {
  background: var(--pin);
  color: #08110c;
  border-color: transparent;
  font-weight: 600;
}

.pin.is-active::after {
  content: "";
  position: absolute;
  left: -21px;
  top: -65px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--pin);
  animation: ping 2.2s cubic-bezier(0.2, 0.7, 0.4, 1) infinite;
}

@keyframes ping {
  0% { transform: scale(0.72); opacity: 0.9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.frame.hide-labels .pin-label { opacity: 0; }
.frame.hide-labels .pin.is-active .pin-label,
.frame.hide-labels .pin:hover .pin-label { opacity: 1; }

/* 校准 */

.frame.is-calib .frame-tip { opacity: 0; }
.frame.is-calib .pin { cursor: grab; }
.frame.is-calib .pin.is-active::after { display: none; }
.frame.is-calib .pin.is-dragging { cursor: grabbing; }
.frame.is-calib .pin.is-dragging .pin-badge { transform: scale(1.18); }

/* 工具条 */

.toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}

.toolbar button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 12, 10, 0.72);
  color: #dfe8e1;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.toolbar button:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.28); }
.toolbar .fit { font-size: 13px; }

.frame-tip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(6, 10, 8, 0.5);
  padding: 5px 9px;
  border-radius: 7px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
}

.frame-tip.is-hidden { opacity: 0; }

.calib-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translate(-50%, 14px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 99px;
  border: 1px solid rgba(242, 178, 51, 0.4);
  background: rgba(12, 16, 13, 0.9);
  color: #f4e3c2;
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.frame.is-calib .calib-bar { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

.calib-bar .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--off);
  box-shadow: 0 0 0 0 rgba(242, 178, 51, 0.6);
  animation: blip 1.8s infinite;
}

@keyframes blip {
  0% { box-shadow: 0 0 0 0 rgba(242, 178, 51, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(242, 178, 51, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 178, 51, 0); }
}

.calib-bar button {
  border: 0;
  background: none;
  color: var(--off);
  font-family: inherit;
  font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 50;
  padding: 10px 18px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: rgba(14, 20, 16, 0.94);
  color: #e9f2ea;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── 响应式 ───────────────────────────────────────────── */

@media (max-width: 1080px) {
  .layout { gap: 24px; padding: 20px 24px 24px; grid-template-columns: minmax(280px, 348px) minmax(0, 1fr); }
  .topbar { padding: 20px 24px 14px; }
  .brand h1 { font-size: 23px; }
  .topstats { gap: 20px; }
  .stat b { font-size: 17px; }
}

@media (max-width: 860px) {
  body { overflow-x: hidden; overflow-y: auto; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px 18px 12px; }
  .brand h1 { font-size: 21px; }
  .brand h1 em { display: none; }
  .topstats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .stat { align-items: flex-start; min-width: 0; }
  .stat b { font-size: 13px; white-space: nowrap; }
  .stat span { font-size: 9px; letter-spacing: 0.06em; white-space: nowrap; }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 18px;
    padding: 16px 18px 40px;
  }

  .stage-wrap { order: -1; }

  .frame {
    height: 70vh;
    max-height: 620px;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
  }

  .side { overflow: visible; padding-right: 0; }
  .lede { font-size: 13px; }
  .frame-tip { display: none; }
  .calib-bar { font-size: 10.5px; padding: 7px 10px; }
  .profile-holder { height: 96px; }
}

@media (max-width: 620px) {
  .pin-badge { left: -13px; top: -52px; width: 26px; height: 26px; font-size: 11px; }
  .pin-stem { top: -38px; height: 36px; }
  .pin.is-active::after { left: -17px; top: -56px; width: 34px; height: 34px; }
  .pin--right .pin-label { left: 18px; top: -45px; }
  .pin--left .pin-label { right: 18px; top: -45px; }
}

@media (max-width: 420px) {
  .brand h1 { font-size: 19px; }
  .brand-mark { font-size: 10px; padding: 5px 7px 5px 9px; }
  .tag { display: none; }
  .item.is-open .tag { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
