:root {
  --vermilion: #c83e2b;
  --vermilion-soft: #fdece9;
  --cyan-ink: #1b5e5a;
  --cyan-soft: #e6f3f2;
  --gilt: #b8862d;
  --gilt-bright: #e5b869;
  --dai-ink: #182220;
  --muted: #5e6b66;
  --xuan-paper: #f6efe2;
  --xuan-card: #fbf7ef;
  --xuan-line: #d9c8ae;
  --night-bg: #11171a;
  --night-card: rgba(20, 28, 32, 0.92);
  --night-border: rgba(229, 184, 105, 0.26);
  --serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--sans);
  background: #f4efe6;
  color: var(--dai-ink);
}

button {
  font-family: inherit;
}

/* =========================================================
   顶部四方案中枢切换栏
   ========================================================= */
.master-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 62px;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: #141c1f;
  color: #f7f1e5;
  border-bottom: 1px solid rgba(229, 184, 105, 0.28);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.seal-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--vermilion);
  border: 1.5px solid #f7d7c4;
  color: #fff;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  display: grid;
  place-items: center;
  text-align: center;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16.5px;
  color: #fff8ec;
  white-space: nowrap;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11px;
  color: #b5a995;
  white-space: nowrap;
}

/* 四大方案切换器 */
.scheme-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(229, 184, 105, 0.25);
  border-radius: 12px;
}

.scheme-tab {
  border: 0;
  background: transparent;
  color: #d2c7b6;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.scheme-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.scheme-tab .badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.scheme-tab.active {
  background: linear-gradient(135deg, var(--vermilion), #9f2919);
  color: #fff;
  box-shadow: 0 3px 12px rgba(200, 62, 43, 0.45);
}

.scheme-tab.active .badge {
  background: rgba(0, 0, 0, 0.28);
  color: #fde68a;
}

/* 右侧全局控制（单日切换与体力弹性段开关） */
.global-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.day-pill-group {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.07);
  padding: 3px;
  border-radius: 8px;
}

.day-btn {
  border: 0;
  background: transparent;
  color: #d6cbb9;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.day-btn.active {
  background: var(--gilt-bright);
  color: #17120b;
}

.flex-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(229, 184, 105, 0.14);
  border: 1px dashed var(--gilt-bright);
  color: var(--gilt-bright);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.flex-toggle-label input {
  margin: 0;
  accent-color: var(--vermilion);
}

/* =========================================================
   主视口与四大方案面板容器
   ========================================================= */
.stage-viewport {
  position: relative;
  width: 100vw;
  height: calc(100vh - 62px);
  margin-top: 62px;
  overflow: hidden;
}

.scheme-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.scheme-panel.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
}

/* =========================================================
   方案 C（最直观推荐）：双日同屏左右双地图对照 + 地铁图式线性路轨
   ========================================================= */
.split-compare-layout {
  display: flex;
  flex-direction: column;
  background: #f5f1e8;
}

.split-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 14px 8px;
}

.day-pane {
  display: flex;
  flex-direction: column;
  background: #fffdf9;
  border: 2px solid #dcd0bc;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(30, 24, 16, 0.06);
}

.day-pane.day1-pane {
  border-top: 4px solid var(--vermilion);
}

.day-pane.day2-pane {
  border-top: 4px solid var(--cyan-ink);
}

.pane-head {
  padding: 10px 14px 8px;
  background: #fbf8f1;
  border-bottom: 1px solid #e6dcc8;
}

.pane-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pane-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--vermilion);
  color: #fff;
}

.day2-pane .pane-badge {
  background: var(--cyan-ink);
}

.pane-direction {
  font-size: 11.5px;
  font-weight: 700;
  color: #7c5832;
}

.pane-head h2 {
  margin: 4px 0 3px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--dai-ink);
}

.pane-desc {
  margin: 0;
  font-size: 11.5px;
  color: #57524a;
  line-height: 1.45;
}

/* 地铁图式横向站点路轨条 */
.metro-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  background: #f4ede0;
  border-bottom: 1px solid #e5dac5;
  overflow-x: auto;
  scrollbar-width: none;
}

.metro-strip::-webkit-scrollbar {
  display: none;
}

.metro-stop {
  border: 1px solid #d4c3a8;
  background: #fff;
  color: var(--dai-ink);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.metro-stop .idx {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--vermilion);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.day2-pane .metro-stop .idx {
  background: var(--cyan-ink);
}

.metro-stop.flexible {
  border-style: dashed;
  border-color: var(--gilt);
  background: #fffdf5;
}

.metro-stop.flexible .idx {
  background: var(--gilt);
}

.metro-stop.active {
  background: var(--vermilion);
  color: #fff;
  border-color: var(--vermilion);
}

.day2-pane .metro-stop.active {
  background: var(--cyan-ink);
  border-color: var(--cyan-ink);
}

.metro-stop.active .idx {
  background: #fff;
  color: var(--dai-ink);
}

.metro-arrow {
  color: #9c8c74;
  font-size: 11px;
  font-weight: 800;
}

.pane-map-wrap {
  flex: 1;
  position: relative;
  min-height: 220px;
}

.split-map {
  width: 100%;
  height: 100%;
  background: #e8e2d5;
}

.pane-fit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 600;
  border: 1px solid #cbb89d;
  background: rgba(255, 253, 248, 0.94);
  color: var(--dai-ink);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* 方案 C 底部当前选中站点详情通栏 */
.split-Inspector-bar {
  height: 92px;
  margin: 0 14px 10px;
  padding: 10px 18px;
  background: #fffdf9;
  border: 2px solid #d5c5ab;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 6px 18px rgba(30, 24, 16, 0.06);
}

.insp-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.insp-stamp {
  width: 54px;
  height: 54px;
  border: 2.5px solid var(--vermilion);
  border-radius: 8px;
  color: var(--vermilion);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--vermilion-soft);
  flex-shrink: 0;
}

.insp-main h3 {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--dai-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.insp-main p {
  margin: 0;
  font-size: 12.5px;
  color: #464038;
  line-height: 1.45;
}

.insp-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.insp-pill {
  padding: 6px 11px;
  border-radius: 8px;
  background: #f4ece0;
  border: 1px solid #d9c8ae;
  font-size: 11.5px;
  font-weight: 700;
  color: #5c4328;
}

/* =========================================================
   方案 D：实景地图挂载手绘风物徽章 + 底部宣纸手账抽屉
   ========================================================= */
.badge-map-layout {
  position: relative;
  display: flex;
  flex-direction: column;
}

#mapSchemeD {
  flex: 1;
  width: 100%;
  background: #e6dfd1;
}

.schemeD-banner {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 600;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.schemeD-title-card {
  pointer-events: auto;
  max-width: 580px;
  padding: 12px 16px;
  background: rgba(251, 247, 239, 0.95);
  border: 2px solid #cbb695;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(45, 33, 18, 0.14);
}

.schemeD-title-card h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--dai-ink);
}

.schemeD-title-card p {
  margin: 0;
  font-size: 12px;
  color: #574c3f;
  line-height: 1.5;
}

.schemeD-drawer {
  height: 158px;
  background: var(--xuan-card);
  border-top: 2px solid #cbb695;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.drawer-card {
  min-width: 245px;
  max-width: 265px;
  height: 132px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fffdf9;
  border: 1.5px solid #d8c7ad;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.drawer-card:hover {
  border-color: var(--vermilion);
}

.drawer-card.active {
  background: #fff7f5;
  border: 2px solid var(--vermilion);
  box-shadow: 0 6px 18px rgba(200, 62, 43, 0.16);
}

.drawer-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-card-head h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--dai-ink);
}

.drawer-card p {
  margin: 4px 0;
  font-size: 11.5px;
  color: #524a40;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.drawer-card-foot {
  font-size: 10.5px;
  font-weight: 700;
  color: #854d27;
}

/* =========================================================
   方案 B（彻底修复零抖动 + 50%真实地图同屏）：上半屏宣纸手绘长卷 + 下半屏100%实景互动地图
   ========================================================= */
.scroll-plus-map-layout {
  display: grid;
  grid-template-rows: 45% 55%;
  background: var(--xuan-paper);
}

.scroll-upper-pane {
  display: flex;
  flex-direction: column;
  border-bottom: 3px solid #bfa782;
  background: linear-gradient(180deg, #fdfaf3 0%, #f3e8d4 100%);
  padding: 8px 18px 6px;
  overflow: hidden;
}

.scroll-mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.scroll-mini-bar h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16.5px;
  color: var(--dai-ink);
}

.scroll-mini-bar span {
  font-size: 12px;
  color: #7c2d12;
  font-weight: 700;
}

.svg-scroll-box {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
}

#handdrawnSvg {
  width: 100%;
  min-width: 1060px;
  height: 100%;
  display: block;
}

/* 关键修复：绝对禁止在带 SVG transform="translate(x,y)" 的 <g> 上使用 CSS transform！
   改为仅改变内部圆环描边粗细与滤镜阴影，彻底根除鼠标移入跳回 (0,0) 的闪烁抖动 */
.svg-stop-node {
  cursor: pointer;
}

.svg-stop-node .node-outer-ring {
  transition: stroke-width 0.16s ease, fill 0.16s ease;
}

.svg-stop-node:hover .node-outer-ring {
  stroke-width: 4.5px;
  fill: #fff3e6;
}

.scroll-lower-map-pane {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;
}

#mapSchemeB {
  width: 100%;
  height: 100%;
  background: #e5dec9;
}

.schemeB-side-journal {
  background: var(--xuan-card);
  border-left: 2px solid #cbb695;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* =========================================================
   方案 A（修复正北直观方向感）：正北全览黑金流光沙盘 + 右侧叙事舱 + 底部胶片轨
   ========================================================= */
.cinema-north-layout {
  position: relative;
  background: var(--night-bg);
}

#mapSchemeA {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #141b1f;
}

.cinema-top-hud {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cinema-btn {
  border: 1px solid var(--night-border);
  background: var(--night-card);
  color: #f5ede0;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cinema-btn.primary {
  background: var(--vermilion);
  border-color: #f59e8b;
  color: #fff;
}

.cinema-scrolly-panel {
  position: absolute;
  top: 14px;
  right: 16px;
  bottom: 118px;
  width: 375px;
  z-index: 600;
  background: var(--night-card);
  border: 1px solid var(--night-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f4ece0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.cinema-film-dock {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  height: 94px;
  z-index: 600;
  background: var(--night-card);
  border: 1px solid var(--night-border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}

/* =========================================================
   地图自定义无抖动气泡与手绘徽章标点 (Leaflet DivIcon)
   ========================================================= */
.clean-pin-icon {
  background: transparent;
  border: 0;
}

.pin-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  background: #fffdf9;
  border: 2px solid var(--vermilion);
  color: var(--dai-ink);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, -50%);
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.pin-pill.day2 {
  border-color: var(--cyan-ink);
}

.pin-pill.flexible {
  border-style: dashed;
  border-color: var(--gilt);
  background: #fffbeb;
}

.pin-pill .num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--vermilion);
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.pin-pill.day2 .num {
  background: var(--cyan-ink);
}

.pin-pill.flexible .num {
  background: var(--gilt);
}

.pin-pill.active {
  background: var(--vermilion);
  color: #fff;
  border-color: #fde047;
  box-shadow: 0 0 0 4px rgba(200, 62, 43, 0.32), 0 8px 20px rgba(0, 0, 0, 0.35);
  z-index: 900;
}

.pin-pill.day2.active {
  background: var(--cyan-ink);
  box-shadow: 0 0 0 4px rgba(27, 94, 90, 0.32), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.pin-pill.active .num {
  background: #fff;
  color: var(--dai-ink);
}

/* 方案 D 地图手绘插画圆章标点 */
.art-badge-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -58%);
}

.art-badge-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fffaf0;
  border: 2.5px solid var(--vermilion);
  box-shadow: 0 5px 15px rgba(45, 30, 15, 0.28);
  display: grid;
  place-items: center;
  position: relative;
}

.art-badge-marker.day2 .art-badge-circle {
  border-color: var(--cyan-ink);
}

.art-badge-marker.active .art-badge-circle {
  background: #fff3e0;
  border-width: 3.5px;
  box-shadow: 0 0 0 5px rgba(200, 62, 43, 0.28), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.art-badge-step {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--vermilion);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.art-badge-marker.day2 .art-badge-step {
  background: var(--cyan-ink);
}

.art-badge-label {
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(24, 34, 32, 0.9);
  color: #fff;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.art-badge-marker.active .art-badge-label {
  background: var(--vermilion);
}

@media (max-width: 1024px) {
  .master-topbar {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
  }
  .stage-viewport {
    height: calc(100vh - 105px);
    margin-top: 105px;
  }
  .split-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .scroll-lower-map-pane {
    grid-template-columns: 1fr;
  }
  .cinema-scrolly-panel {
    display: none;
  }
}
