:root {
  --gold: #ffd54a;
  --bar-bg: rgba(22, 26, 34, 0.94);
  --bar-fg: #e8eaed;
  --muted: #9aa2b1;
  --line: rgba(255, 255, 255, 0.12);
  --ink-capital: #b83428;
  --ink-prefecture: #701610;
  --ink-pass: #8f2317;
  --ink-county: #8f2317;
  --ink-modern: #5f6368;
  --dot: #b83428;
  --mention: #d9480f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #202124;
  background: #11151c;
}
button { font-family: inherit; }

/* ---------- 顶栏：标题 · 搜索 · 图层 · 帮助 ---------- */
#topbar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: #1b1f27;
  color: var(--bar-fg);
  border-bottom: 1px solid #000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 30;
}
#topbar .title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  white-space: nowrap;
}
.search-wrap {
  position: relative;
  flex: 0 1 520px;
  min-width: 200px;
  display: flex;
  align-items: center;
  background: #252a35;
  border: 1px solid #3a4250;
  border-radius: 8px;
  padding: 0 4px 0 6px;
}
.search-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 213, 74, 0.16); }
#omni-search {
  flex: 1 1 auto;
  min-width: 80px;
  background: transparent;
  border: none;
  color: var(--bar-fg);
  font-size: 13.5px;
  padding: 8px 6px;
  outline: none;
}
#omni-search::placeholder { color: #8892a2; }
.person-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 213, 74, 0.16);
  border: 1px solid rgba(255, 213, 74, 0.5);
  color: var(--gold);
  border-radius: 999px;
  padding: 2px 4px 2px 9px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.person-pill.hidden { display: none; }
.person-pill .pp-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.person-pill button {
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.person-pill button:hover { color: #fff; }

.quick-toggles {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.q-btn {
  background: #252a35;
  color: #cfd5df;
  border: 1px solid #3a4250;
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.q-btn:hover { border-color: #636d80; color: #fff; }
.q-btn[aria-pressed="true"] {
  background: rgba(255, 213, 74, 0.16);
  border-color: rgba(255, 213, 74, 0.65);
  color: var(--gold);
  font-weight: 600;
}
.q-btn:disabled { opacity: 0.38; cursor: default; }

.top-actions { display: flex; gap: 8px; }
.top-btn {
  background: #2a2f3a;
  color: var(--bar-fg);
  border: 1px solid #3a4250;
  border-radius: 7px;
  padding: 6px 13px;
  font-size: 13px;
  cursor: pointer;
}
.top-btn.icon { padding: 6px 11px; font-weight: 700; }
.top-btn:hover, .top-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }

/* 搜索下拉 */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 440px;
  overflow-y: auto;
  background: #1b2029;
  border: 1px solid rgba(255, 213, 74, 0.3);
  border-radius: 9px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6);
  padding: 6px;
  z-index: 60;
}
.search-dropdown.hidden { display: none; }
.sd-group-title { font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 8px 3px; }
.sd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #e8eaed;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.sd-item:hover, .sd-item:focus { background: rgba(255, 213, 74, 0.13); outline: none; }
.sd-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sd-name { font-weight: 600; color: #fff; display: flex; align-items: center; gap: 6px; }
.sd-name small { color: var(--muted); font-weight: 400; }
.sd-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.sd-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 213, 74, 0.13); color: var(--gold); white-space: nowrap; }

/* 弹出面板（图层 / 帮助 / 跳转） */
.popover {
  position: absolute;
  background: #1b2029;
  color: var(--bar-fg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
  padding: 8px 12px 10px;
  z-index: 70;
}
.popover.hidden { display: none; }
#layers-pop { top: calc(100% + 6px); right: 56px; width: 280px; }
#help-pop { top: calc(100% + 6px); right: 14px; width: 330px; }
.pop-title { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 1px; margin: 8px 0 4px; }
.pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 5px 0;
}
.pop-row select {
  background: #2a2f3a;
  color: var(--bar-fg);
  border: 1px solid #3a4250;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12.5px;
  max-width: 160px;
}
.pop-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pop-foot .hint { font-size: 11px; color: var(--muted); }
.link-btn { background: none; border: none; color: #8ec0ff; font-size: 12px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.help-list { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: #cfd5df; }
.help-list b { color: var(--gold); }

/* 开关 */
.sw {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: #3a4250;
  border: none;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s;
}
.sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #cfd5df;
  transition: transform 0.15s, background 0.15s;
}
.sw[aria-pressed="true"] { background: var(--gold); }
.sw[aria-pressed="true"]::after { transform: translateX(15px); background: #1b1f27; }

/* ---------- 舞台 ---------- */
#stage { flex: 1 1 auto; position: relative; min-height: 0; }
#map { width: 100%; height: 100%; position: relative; }

/* 左上角图例 / 悬停检视 */
#map-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 12;
  display: none;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
  max-width: min(70vw, 620px);
}
.hud-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: rgba(24, 28, 36, 0.82);
  color: #e8eaed;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12px;
}
.hud-line strong { color: var(--gold); }
.hud-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.lg-item { display: inline-flex; align-items: center; gap: 4px; }
.lg-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid rgba(255,255,255,.35); }
.lg-muted { color: var(--muted); }

/* 状态提示：只在加载/出错/提示时短暂出现 */
#status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  font-size: 12px;
  color: var(--gold);
  background: rgba(24, 28, 36, 0.92);
  border: 1px solid rgba(255, 213, 74, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#status.show { opacity: 1; }
#status.error { color: #ff8a80; border-color: rgba(255, 138, 128, 0.4); opacity: 1; }

/* ---------- 左下信息卡 ---------- */
#info-card {
  position: absolute;
  left: 12px;
  bottom: 70px;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--bar-bg);
  backdrop-filter: blur(8px);
  color: var(--bar-fg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 11px 13px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 14;
}
#info-card:empty { display: none; }
.ic-kicker { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.ic-title { font-size: 16px; font-weight: 700; color: var(--gold); margin: 2px 0 5px; }
.ic-sub { font-size: 13px; font-weight: 600; color: #fff; margin-bottom: 4px; }
.ic-text { font-size: 12.5px; line-height: 1.6; color: #cfd5df; }
.ic-section { margin-top: 9px; }
.ic-label { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.ic-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ic-link {
  background: none;
  border: none;
  color: #8ec0ff;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
}
.ic-link.sgz { color: #8fe3b8; }
.ic-link.shiji { color: #f6c177; }
.ic-link:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  background: #262c38;
  color: #e8eaed;
  border: 1px solid #3a4352;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { border-color: var(--gold); color: #fff; background: rgba(255, 213, 74, 0.12); }
.chip.more-chip { background: rgba(255, 213, 74, 0.1); border-style: dashed; color: var(--gold); font-size: 11.5px; padding: 3px 8px; }
.chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip em { font-style: normal; font-size: 10.5px; color: var(--gold); }

/* ---------- 右侧抽屉（默认关闭） ---------- */
#drawer {
  position: absolute;
  top: 10px;
  right: 12px;
  bottom: 70px;
  width: 380px;
  max-width: calc(100vw - 24px);
  background: var(--bar-bg);
  backdrop-filter: blur(10px);
  color: var(--bar-fg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 16;
  overflow: hidden;
}
#drawer.hidden { display: none; }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.drawer-title { font-size: 14px; font-weight: 700; color: var(--gold); }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.icon-btn:hover { color: #fff; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.dr-section-title { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.dr-meta { font-size: 12px; color: #cfd5df; }

.doc-tabs {
  display: flex;
  gap: 5px;
  background: #161a22;
  padding: 3px;
  border-radius: 7px;
  border: 1px solid #2b3240;
}
.doc-tab {
  flex: 1 1 0;
  background: transparent;
  border: none;
  color: #aeb7c6;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.doc-tab em { font-style: normal; font-size: 10.5px; opacity: 0.8; margin-left: 2px; }
.doc-tab:hover { color: #fff; }
.doc-tab.active { background: #2a3242; color: var(--gold); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }

.entry-card {
  background: #1e232d;
  border: 1px solid #2e3544;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #dce0e6;
}
.entry-card.sgz-card {
  border-left: 3px solid #48b884;
  background: #1c242b;
}
.entry-card.shiji-card {
  border-left: 3px solid #d99b43;
  background: #222129;
}
.entry-meta { font-size: 11px; color: var(--gold); font-weight: 600; margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.src-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.src-badge.zztj { background: rgba(255, 213, 74, 0.16); color: var(--gold); border: 1px solid rgba(255, 213, 74, 0.38); }
.src-badge.zz { background: rgba(235, 175, 90, 0.18); color: #ffd089; border: 1px solid rgba(235, 175, 90, 0.42); }
.src-badge.shiji { background: rgba(217, 155, 67, 0.2); color: #f6c177; border: 1px solid rgba(217, 155, 67, 0.45); }
.src-badge.sgz { background: rgba(72, 184, 132, 0.18); color: #8fe3b8; border: 1px solid rgba(72, 184, 132, 0.42); }
.src-badge.sgz-note { background: rgba(130, 180, 255, 0.16); color: #a5c9ff; border: 1px solid rgba(130, 180, 255, 0.38); }
.entry-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.entry-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #28303e;
  color: #b8c4d9;
  border: 1px solid #384254;
  cursor: pointer;
}
.entry-tag:hover { border-color: var(--gold); color: var(--gold); }
.entry-tag.person { background: rgba(46, 204, 113, 0.13); color: #7ee0b0; border-color: rgba(46, 204, 113, 0.35); }

.person-bio { font-size: 12.5px; line-height: 1.65; color: #cfd5df; }
.person-role { font-size: 12px; color: #8ec0ff; }
.stop-card {
  background: #1d222c;
  border: 1px solid #2d3442;
  border-left: 3px solid var(--traj-color, #2ecc71);
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
}
.stop-card:hover { background: #232936; }
.stop-card.is-active { background: rgba(255, 213, 74, 0.09); border-color: rgba(255, 213, 74, 0.5); border-left: 4px solid var(--gold); }
.sc-top { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.sc-step { font-weight: 700; color: var(--gold); }
.sc-place { font-weight: 600; color: #fff; }
.sc-title { font-size: 13px; font-weight: 600; color: #e8eaed; margin: 3px 0; }
.sc-detail { font-size: 12px; line-height: 1.55; color: #c2c8d4; }
.sc-quote { margin-top: 5px; padding: 5px 7px; background: rgba(0,0,0,.25); border-left: 2px solid rgba(255,213,74,.5); font-size: 11.5px; line-height: 1.5; color: #dfd3a9; }
.sc-ref { font-size: 10.5px; color: #8c95a4; margin-top: 3px; }

/* ---------- 底部时间条 ---------- */
#timebar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 50px;
  background: var(--bar-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  z-index: 18;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  color: var(--bar-fg);
}
.tb-group { display: flex; align-items: center; gap: 10px; width: 100%; }
.tb-group.hidden { display: none; }
.tb-arrow {
  background: #2a2f3a;
  color: var(--bar-fg);
  border: 1px solid #3a4250;
  border-radius: 7px;
  width: 34px;
  height: 32px;
  cursor: pointer;
  font-size: 12px;
}
.tb-arrow:hover { border-color: var(--gold); color: var(--gold); }
.tb-arrow:disabled { opacity: 0.35; cursor: default; }
.tb-label-wrap { position: relative; }
.tb-label {
  background: transparent;
  border: 1px solid transparent;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 220px;
  text-align: left;
}
.tb-label:hover, .tb-label[aria-expanded="true"] { border-color: rgba(255, 213, 74, 0.4); background: rgba(255, 213, 74, 0.07); }
.tb-label.static { cursor: default; border: none; background: none; min-width: 260px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.tb-label small { color: #cfd5df; font-weight: 500; margin-left: 6px; }
#jump-pop { bottom: calc(100% + 10px); left: 0; width: 260px; }
.jump-windows { display: flex; flex-direction: column; gap: 4px; }
.jump-windows button {
  text-align: left;
  background: #242a35;
  border: 1px solid #353d4b;
  color: #e8eaed;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12.5px;
  cursor: pointer;
}
.jump-windows button:hover { border-color: var(--gold); color: var(--gold); }
#year-input {
  width: 100%;
  background: #151922;
  color: var(--gold);
  border: 1px solid #353c49;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
#year-input:focus { outline: 1.5px solid var(--gold); }
.tb-slider { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 100px; }
.tb-slider input[type="range"] { flex: 1 1 auto; accent-color: var(--gold); cursor: pointer; }
.tb-end { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tb-play, .tb-toggle {
  background: #2a2f3a;
  color: var(--bar-fg);
  border: 1px solid #3a4250;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.tb-play:hover, .tb-toggle:hover { border-color: var(--gold); }
.tb-play.playing, .tb-toggle[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #161a22; font-weight: 600; }

/* ---------- 地名标注 ---------- */
.place-container { position: absolute; left: 0; top: 0; pointer-events: none; }
.place {
  --dot-size: 8px;
  --dot-half: 4px;
  position: absolute;
  display: flex;
  align-items: center;
  transform: translateY(-50%);
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}
.place .dot {
  flex: 0 0 auto;
  width: var(--dot-size);
  height: var(--dot-size);
  margin-left: calc(-1 * var(--dot-half));
  border-radius: 50%;
  background: var(--dot);
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, .45);
}
.place .label {
  margin-left: 5px;
  text-shadow: -1px -1px 0 rgba(255,255,255,.85), 1px -1px 0 rgba(255,255,255,.85), -1px 1px 0 rgba(255,255,255,.85), 1px 1px 0 rgba(255,255,255,.85), 0 0 4px rgba(255,255,255,.92);
}
.place .mention-pill {
  display: none;
  margin-left: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(27, 31, 39, 0.88);
  color: var(--gold);
}
.place:hover .mention-pill { display: inline-block; }
.place.flip { flex-direction: row-reverse; }
.place.flip .dot { margin-left: 0; margin-right: calc(-1 * var(--dot-half)); }
.place.flip .label { margin-left: 0; margin-right: 5px; }

.place.type-capital { --dot-size: 12px; --dot-half: 6px; }
.place.type-capital .label { font-size: 16px; font-weight: 700; color: var(--ink-capital); }
.place.type-capital .dot { background: #c62828; border-color: var(--gold); }
.place.type-prefecture .label { font-size: 14.5px; font-weight: 600; color: var(--ink-prefecture); }
.place.type-pass .label { font-size: 14px; font-weight: 500; color: var(--ink-pass); }
.place.type-county { --dot-size: 5.5px; --dot-half: 2.75px; }
.place.type-county .label { font-size: 13px; color: var(--ink-county); }

.place.regime-wei .dot { background: #2c5b94; }
.place.regime-wei.type-prefecture .label { color: #1b3d66; }
.place.regime-shu .dot { background: #246b4b; }
.place.regime-shu.type-prefecture .label { color: #164a32; }
.place.regime-wu .dot { background: #a83824; }
.place.regime-wu.type-prefecture .label { color: #782012; }

/* 本年《通鉴》要地 */
.place.is-year-mentioned { z-index: 12; --dot-size: 10px; --dot-half: 5px; }
.place.is-year-mentioned .dot {
  background: var(--mention);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 213, 74, 0.35), 0 1px 5px rgba(0, 0, 0, 0.6);
}
.place.is-year-mentioned .label { font-weight: 700; color: #5c1108; font-size: 14.5px; }
.place.is-year-background { opacity: 0.8; }

/* 人物模式背景：只留郡治，淡化 */
.place.is-person-backdrop { opacity: 0.5; }
.place.is-person-backdrop .label { font-size: 12.5px; font-weight: 500; }
.place.is-person-backdrop .dot { --dot-size: 6px; }
.place.is-person-backdrop:hover { opacity: 0.95; }

.place.is-highlighted { z-index: 11; opacity: 1; }
.place.is-highlighted .dot { border-color: var(--gold); box-shadow: 0 0 6px rgba(255, 213, 74, 0.9); }
.place.type-modern { --dot-size: 4px; --dot-half: 2px; cursor: default; }
.place.type-modern .dot { background: var(--ink-modern); border-color: #fff; }
.place.type-modern .label { font-size: 13px; color: var(--ink-modern); text-shadow: none; }
.place.hidden { display: none; }

/* ---------- 人物轨迹 ---------- */
.trajectory-container { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 15; }
.trajectory-svg { position: absolute; pointer-events: none; overflow: visible; }
.trajectory-stops { position: absolute; left: 0; top: 0; pointer-events: none; }
.traj-stop {
  --traj-color: #2ecc71;
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 16;
}
.traj-stop .traj-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--traj-color);
  color: #0e131a;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}
.traj-stop .traj-tag {
  display: none;
  background: rgba(20, 24, 32, 0.9);
  color: #f1f3f5;
  border: 1px solid var(--traj-color);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.traj-stop .traj-tag em { font-style: normal; color: var(--gold); margin-left: 4px; font-size: 10.5px; }
.traj-stop.show-tag .traj-tag, .traj-stop:hover .traj-tag { display: inline-flex; align-items: center; }
.traj-stop.is-future { opacity: 0.55; }
.traj-stop.is-future .traj-num { background: #2b313d; color: #cfd5df; border-color: var(--traj-color); }
.traj-stop.is-current { z-index: 22; }
.traj-stop.is-current .traj-num {
  width: 24px;
  height: 24px;
  font-size: 12px;
  background: var(--gold);
  color: #151922;
  box-shadow: 0 0 0 5px rgba(255, 213, 74, 0.35), 0 3px 10px rgba(0, 0, 0, 0.65);
}

/* ---------- 地图气泡 ---------- */
.place-info {
  background: #1f232a;
  color: #e8eaed;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 10px 14px;
  max-width: 330px;
  font-size: 13px;
  line-height: 1.6;
}
.place-info h3 { margin: 0 0 6px; font-size: 16px; color: var(--gold); }
.place-info .row { margin: 2px 0; }
.place-info .k { color: #9aa0a6; margin-right: 6px; }
.place-info .note { margin-top: 6px; color: #cfd3da; }
.place-info .badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #2a2f38; color: #b6bcc6; margin-right: 4px; }
.zztj-iw-box { margin-top: 8px; padding-top: 7px; border-top: 1px dashed rgba(255, 213, 74, 0.35); }
.zztj-iw-box.sgz-iw-box { border-top-color: rgba(72, 184, 132, 0.4); }
.zztj-iw-title { font-size: 11.5px; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.zztj-iw-title.sgz-iw-title { color: #8fe3b8; }
.zztj-iw-title.shiji-iw-title { color: #f6c177; }
.zztj-iw-quote { font-size: 12px; line-height: 1.55; color: #e2d9b8; margin-bottom: 5px; }
.zztj-iw-quote.sgz-iw-quote { color: #d5e6de; }
.zztj-cite { display: inline-block; font-size: 10.5px; color: #9ec5fe; margin-right: 5px; font-weight: 600; }
.zztj-cite.sgz-cite { color: #8fe3b8; }
.zztj-cite.shiji-cite { color: #f6c177; }
.gm-style .gm-style-iw-c { background: #1f232a; padding: 0; }
.gm-style .gm-style-iw-d { overflow: auto; }
.gm-style .gm-style-iw-tc::after { background: #1f232a; }
.gm-style .gm-ui-hover-effect { filter: invert(1); }

.map-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: #11151c;
  color: #e8eaed;
  font-size: 15px;
  line-height: 1.8;
}
.map-fallback .box { max-width: 460px; border: 1px solid #3a404b; border-left: 4px solid var(--gold); border-radius: 8px; padding: 20px 24px; background: #1f232a; }

@media (max-width: 760px) {
  #topbar { flex-wrap: wrap; gap: 8px; }
  #topbar .title { display: none; }
  .search-wrap { flex: 1 1 100%; }
  .quick-toggles { margin-left: 0; overflow-x: auto; }
  .top-actions { margin-left: auto; }
  #info-card { width: calc(100vw - 24px); bottom: 68px; }
  .tb-label { min-width: 0; font-size: 12.5px; }
  .tb-end, #btn-play { display: none; }
  #drawer { top: auto; height: 55vh; }
}

* { scrollbar-width: thin; scrollbar-color: #3a404b transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #3a404b; border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: var(--gold); }
