:root {
  --sidebar-width: 300px;
  --sticky-total: 0px;
}
/* Remove main padding on map page */
main { padding: 0; min-height: 100vh; }
/* 地图页铺满屏幕：base .container 默认 max-width:1200px，地图页改为全宽（仅本页生效） */
#main-content > .container {
  max-width: none;
  padding: 0;
}
/* 容器 padding 已为 0：抵消 .map-page 的负边距（否则横向溢出出滚动条） */
#main-content > .container .map-page {
  margin: 0;
}
/* 全屏地图不出现页面级滚动条（地图内部区域自行滚动） */
html, body {
  height: 100%;
  overflow: hidden;
}
/* Back link in header */
.map-back-link {
  font-size: 0.8rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 0.15rem;
  display: inline-block;
}
.map-back-link:hover {
  text-decoration: underline;
}
.map-back-link-sep {
  color: var(--text-secondary);
  margin: 0 0.25rem;
  font-size: 0.8rem;
}
.map-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 -1.5rem;
  height: calc(100vh - var(--sticky-total));
}
.map-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* 截图裸模式（?bare=1）：景点标签字体加大两号 */
.bare-mode .poi-label-marker .label-text { font-size: 16px; }
/* 截图裸模式（?bare=1）：底部引导水印放大两号 */
.bare-mode .map-site-badge { font-size: 20px; }
/* 截图裸模式（?bare=1）：地图顶部中央标题 */
.map-bare-title {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  max-width: 70%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 999px;
  padding: 0.45rem 1.4rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.map-bare-title h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-bare-title .map-bare-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 线路评分列（桌面宽屏左侧，利用空白） */
.map-score-column {
  width: 300px;
  min-width: 300px;
  display: none;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background: var(--card-bg);
  overflow-y: auto;
  padding: 0.6rem 0.7rem;
}
.map-score-column.open { display: flex; }
/* 全屏模式（?fs=1）：退出按钮 */
.map-fs-exit {
  position: fixed;
  top: 0.75rem;
  right: 1rem;
  z-index: 2000;
}
.map-sidebar.sidebar-hidden {
  display: none;
}
.map-fs-exit-link {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.map-fs-exit-link:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}
.map-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background: var(--card-bg);
  overflow: hidden;
}
.map-sidebar-header {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.map-sidebar-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.map-sidebar-header .map-stats {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.map-sidebar-filters {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.map-sidebar-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.map-sidebar-search input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-color);
  color: var(--text-primary);
}
.map-sidebar-search input:focus-visible {
  border-color: var(--primary-color);
  outline: none;
}
.map-sidebar-search button {
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
.map-sidebar-search button:hover {
  background: var(--primary-hover);
}
.district-filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0;
}
.district-filter-toggle .arrow {
  font-size: 0.65rem;
  transition: transform 0.2s;
}
.district-filter-toggle .arrow.open {
  transform: rotate(90deg);
}
.district-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.4rem;
}
.district-tag {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.district-tag:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.district-tag.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.map-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}
/* 侧栏 Tab：景点列表 / 旅游线路 */
.map-sidebar-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--card-bg);
}
.map-sidebar-tab {
  flex: 1;
  padding: 0.45rem 0.5rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.map-sidebar-tab:hover {
  color: var(--primary-color);
}
.map-sidebar-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}
.map-sidebar-panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.map-sidebar-panel.active {
  display: flex;
}
.map-sidebar-routes-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.route-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s;
}
.route-link:hover {
  background: #f0f4ff;
}
.cw-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.72rem;
  margin-right: 4px;
}
.route-link.selected {
  background: #e8f0fe;
  border-left: 3px solid var(--primary-color);
}
.route-link__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.route-link__meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.day-tag {
  display: inline-block; padding: 0 5px; border-radius: 3px;
  font-size: 0.65rem; font-weight: 600; margin-right: 2px;
}
.day-tag.multi { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.day-tag.single { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.cnt-tag {
  display: inline-block; padding: 0 6px; border-radius: 3px;
  background: #f5f5f5; color: #616161; border: 1px solid #e0e0e0;
  font-size: 0.68rem; font-weight: 600;
}
.route-link__id {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 0.25rem;
}
.route-link__score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.3rem;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.route-link__score.grade-a { background: #27ae60; }
.route-link__score.grade-b { background: #f39c12; }
.route-link__score.grade-c { background: #e74c3c; }
.route-link__score.grade-none { background: #bdbdbd; color: #fff; }
/* 线路切换箭头 */
.route-nav-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-secondary, #888);
  cursor: pointer;
  padding: 0 8px;
  align-self: center;
}
.route-nav-btn:hover { color: var(--primary-color, #1677ff); }
.route-nav-btn:disabled { opacity: 0.25; cursor: default; pointer-events: none; }
/* 线路详情 */
.route-detail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.route-detail-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.route-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  flex-wrap: wrap;
}
.route-detail-admin {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px dashed var(--primary-color);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary-color) 8%, transparent);
  flex-shrink: 0;
  box-sizing: border-box;
}
.route-detail-admin-label {
  font-size: 0.7rem;
  color: var(--primary-color);
  font-weight: 600;
  flex-shrink: 0;
}
.route-detail-share {
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
}
.route-detail-share:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.route-detail-shortest {
  display: flex; align-items: center; gap: 2px;
}
.route-detail-edit,
.route-detail-intro {
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}
.route-detail-edit:hover,
.route-detail-intro:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.route-detail-name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 700;
  overflow-wrap: break-word;
  word-break: break-all;
  line-height: 1.4;
  cursor: pointer;
}

.route-detail-sub {
  padding: 0.25rem 0.6rem 0.4rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.route-detail-points {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.route-point-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s;
}
.route-point-item:hover {
  background: #f0f4ff;
}
.route-point-item.no-map {
  cursor: default;
  opacity: 0.6;
}
.route-point-item.no-map:hover {
  background: transparent;
}
.route-point-item .rpn {
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.route-point-item .rpn-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.route-point-item .rpn-name.draft {
  color: var(--text-secondary);
}
.route-point-item .rpn-name .draft-tag {
  color: #fa8c16;
  margin-right: 0.2rem;
}
/* 天数分组头 */
.route-day-header {
  padding: 0.35rem 0.6rem; font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color);
}
.route-day-header.d0 { color: #1890ff; background: rgba(24,144,255,0.06); }
  .route-day-header.d1 { color: #fa8c16; background: rgba(250,140,22,0.06); }
.route-day-header.d2 { color: #52c41a; background: rgba(82,196,26,0.06); }
  .route-day-header.d3 { color: #722ed1; background: rgba(114,46,209,0.06); }
  .route-day-header.d4 { color: #eb2f96; background: rgba(235,47,150,0.06); }
.route-day-header.d5 { color: #13c2c2; background: rgba(19,194,194,0.06); }
  .route-day-header.d6 { color: #faad14; background: rgba(250,173,20,0.06); }
/* 途经目的地徽章行 */
.route-dest-row {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.dest-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.dest-badge:hover {
  background: #d0e8d3;
  border-color: #2e7d32;
}
.dest-badge.alt {
  background: #f0f0f0;
  color: #666;
  border-color: #ccc;
}
.dest-badge.alt:hover {
  background: #e0e0e0;
  border-color: #8c8c8c;
}
/* 跨目的地线路：目的地分组标签 */
.route-dest-group {
  padding: 0.3rem 0.6rem;
  margin: 6px 0 2px;
  background: rgba(46, 125, 50, 0.08);
  border-left: 3px solid #2e7d32;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2e7d32;
  cursor: pointer;
}
.route-dest-group:hover {
  background: rgba(46, 125, 50, 0.16);
}
/* 线路编号标记（覆盖在地图景点点之上） */
.route-num-marker {
  background: none;
  border: none;
}
.route-num-marker .num {
  width: 22px;
  height: 22px;
  line-height: 22px;
  background: #e74c3c;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
/* 城市落脚点：绿色标记 */
.route-num-marker.city .num { background: #2e7d32; }
.route-point-item .rpn.city { background: #2e7d32; }
/* 未匹配景点（无系统景点）：灰色虚线圆，与正常景点区分 */
.route-point-item .rpn-name .unmatched-tag { background: #ecf0f1; color: #7f8c8d; border: 1px dashed #95a5a6; }
.route-num-marker.unmatched .num {
  background: #ffffff;
  color: #7f8c8d;
  border: 2px dashed #95a5a6;
  box-shadow: none;
}
.route-point-item .rpn.unmatched {
  background: #ffffff;
  color: #7f8c8d;
  border: 1px dashed #95a5a6;
}
/* 备选景点：灰色编号圆（文字与正式景点同字体） */
.route-point-item .rpn.alt { background: #8c8c8c; }
.district-group h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.4rem 0.6rem 0.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.district-group h3 .count {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-secondary);
}
.attraction-list-item {
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.attraction-list-item:hover {
  background: #f0f4ff;
}
.attraction-list-item.active {
  background: #e8f0fe;
  border-left-color: var(--primary-color);
}
.attraction-list-item__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  display: inline;
}
.attraction-list-item__name:hover {
  text-decoration: underline;
}
.attraction-list-item__meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  line-height: 1.4;
}
.popularity-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  color: #d4380d;
  border: 1px solid #d4380d;
  border-radius: 2px;
  padding: 0 0.3rem;
  margin-left: 0.4rem;
  line-height: 1.4;
  vertical-align: middle;
}
.map-sidebar-empty {
  text-align: center;
  padding: 3rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
/* Map container */
.map-container-wrap {
  flex: 1;
  position: relative;
}
/* 地图底部中间：网址 + 地图编号（与 Leaflet attribution/scale 控件同款样式） */
.map-site-badge {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 0 5px;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background: rgba(255,255,255,0.8);
  white-space: nowrap;
  pointer-events: none;
}
#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}
.map-fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  color: #333;
}
.map-fullscreen-btn:hover {
  background: #f5f5f5;
}
/* 线路全景按钮（缩放控件 + 号右侧，选中线路时显示） */
.map-route-fit-btn,
.map-attractions-fit-btn {
  position: absolute;
  top: 10px;
  left: 42px;
  z-index: 1000;
  padding: 5px 12px;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  color: #333;
}
.map-route-fit-btn:hover,
.map-attractions-fit-btn:hover {
  background: #e8f5e9;
  border-color: #2e7d32;
  color: #2e7d32;
}
/* Mobile-only header bar (above map) */
.map-mobile-header {
  display: none;
}
/* Leaflet overrides */
.leaflet-popup-content {
  margin: 8px 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  min-width: 200px;
}
.leaflet-popup-content strong a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1rem;
}
.leaflet-popup-content strong a:hover {
  text-decoration: underline;
}
.leaflet-popup-content small {
  color: var(--text-secondary);
}
.leaflet-popup-content .popup-intro {
  font-size: 0.8rem;
  color: #555;
  margin-top: 4px;
}
  .popup-intro-toggle { display: none; }
  .popup-intro-short { display: none; }
  @media (max-width: 768px) {
    .popup-intro { display: none; }
    .popup-address { display: none; }
  }
  .leaflet-popup-content .popup-address {
  font-size: 0.78rem;
  color: #999;
  margin-top: 2px;
}
/* 地图标记 + 名称标签 通用样式（destination_map / route_map 共用） */
.poi-dot-marker { background: none; border: none; }
.poi-dot-marker .dot {
  width: 12px; height: 12px;
  background: #e74c3c; border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.2s;
}
.poi-dot-marker.highlight .dot {
  width: 18px; height: 18px;
  background: #1677ff;
  box-shadow: 0 0 0 3px rgba(22,119,255,0.3);
  z-index: 10000 !important;
}
.poi-dot-marker.muted .dot {
  opacity: 0.3;
}
.poi-label-marker { background: none; border: none; text-align: center; pointer-events: none; }
.poi-label-marker .label-text {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.15s;
}
.poi-label-marker .label-text:hover {
  background: #e8f0fe;
  border-color: #1677ff;
}
.poi-label-marker.highlight .label-text {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}
/* 目的地城市标签（绿色） */
.poi-label-marker.city-label .label-text {
  color: #2e7d32;
  border-color: #a5d6a7;
  background: rgba(232,245,233,0.95);
}
.poi-label-marker.city-label .label-text:hover {
  background: #e8f5e9;
  border-color: #2e7d32;
}
.poi-line { pointer-events: none; }

/* B站视频卡片（用于弹窗内） */
.popup-video-list {
  margin-top: 6px;
  border-top: 1px solid #eee;
  padding-top: 6px;
}
.popup-video-item {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  align-items: flex-start;
}
.popup-video-item:hover {
  opacity: 0.85;
}
 .popup-video-item img {
   width: 96px;
   height: 64px;
   object-fit: cover;
   border-radius: 3px;
   flex-shrink: 0;
   background: #eee;
 }
 .popup-video-item .popup-video-title {
   font-size: 0.78rem;
   line-height: 1.35;
   min-height: calc(0.78rem * 1.35 * 2);  /* 固定保留2行高度，行高对齐 */
   display: -webkit-box;
   -webkit-line-clamp: 2;
   -webkit-box-orient: vertical;
   overflow: hidden;
   color: #333;
 }
.popup-video-item .popup-video-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.popup-video-item .popup-video-meta {
  font-size: 0.7rem;
  color: #999;
}
.popup-video-item .popup-video-up {
  font-size: 0.7rem;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* B站播放器模态框 — 与景点详情页完全一致 */
.bilibili-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.bilibili-modal.active {
  display: flex;
}
.bilibili-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.bilibili-modal .modal-content {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.bilibili-modal .modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.bilibili-modal .modal-close:hover {
  background: rgba(0,0,0,0.8);
}
.bilibili-modal .modal-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.bilibili-modal .modal-player-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.player-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 1rem;
  z-index: 1;
}
.bilibili-modal .modal-related-videos {
  padding: 0.75rem 1rem 1rem;
  background: #1a1a1a;
  max-height: 320px;
  overflow-y: auto;
}
.bilibili-modal .modal-related-videos h3 {
  color: #aaa;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  padding: 0;
}
.bilibili-modal .modal-related-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.bilibili-modal .modal-related-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  background: #222;
}
.bilibili-modal .modal-related-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.2);
}
.bilibili-modal .modal-related-item.is-playing {
  border-color: #00a1d6;
  box-shadow: 0 0 0 1px #00a1d6, 0 4px 12px rgba(0,0,0,0.3);
}
.bilibili-modal .modal-related-item .modal-related-cover {
  position: relative;
  aspect-ratio: 16/9;
  background: #333;
  overflow: hidden;
}
.bilibili-modal .modal-related-item .modal-related-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bilibili-modal .modal-related-item .modal-related-cover .cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.bilibili-modal .modal-related-item .cover-overlay .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.bilibili-modal .modal-related-item:hover .cover-overlay .play-icon {
  opacity: 1;
}
.bilibili-modal .modal-related-item .cover-overlay .play-icon::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 9px solid white;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  margin-left: 2px;
}
.bilibili-modal .modal-related-item .cover-overlay .stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.95);
}
.bilibili-modal .modal-related-item .modal-related-info {
  padding: 0.25rem 0.4rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #ddd;
}
.bilibili-modal .modal-related-item .modal-related-info .video-title {
  font-weight: 600;
  margin: 0 0 0.2rem 0;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #eee;
  font-size: 0.78rem;
}
.bilibili-modal .modal-related-item .modal-related-info .video-up {
  font-size: 0.65rem;
  color: #999;
}
@media (max-width: 1200px) {
  .bilibili-modal .modal-related-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .bilibili-modal {
    padding: 0;
  }
  .bilibili-modal .modal-content {
    border-radius: 0;
    max-width: 100%;
  }
  .bilibili-modal .modal-related-videos {
    max-height: 280px;
    padding: 0.5rem 0.75rem 0.75rem;
  }
  .bilibili-modal .modal-related-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}


/* Fullscreen */
.map-page.is-fullscreen {
  height: 100vh;
  margin: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .map-page {
    height: auto;
  }
  .map-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
  }
  .map-mobile-header h1 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
  }
  .map-mobile-header .map-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
  }
  .map-body {
    flex-direction: column;
    min-height: 0;
    overflow: visible;
  }
  .map-container-wrap {
    order: -1;
    height: 40vh;
    min-height: 300px;
    flex-shrink: 0;
  }
  #map {
    height: 100%;
    min-height: 0;
  }
  .map-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    max-height: calc(60vh - 10px);
    border-right: none;
    border-bottom: none;
  }
  .map-sidebar-header {
    display: none;
  }
  .map-sidebar-header h1 {
    font-size: 1.1rem;
  }
  .map-sidebar-list {
    max-height: none;
    overflow-y: auto;
  }
  .map-fullscreen-btn {
    display: none;
  }
  .popup-video-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-top: 6px;
  }
  .popup-video-item {
    flex-shrink: 0;
    padding: 0;
    gap: 0;
  }
  .popup-video-item img {
    width: 64px;
    height: 42px;
    border-radius: 3px;
  }
  .popup-video-item .popup-video-title {
    display: none;
  }
  .popup-video-item .popup-video-body {
    display: none;  /* 移动端仅显示封面图 */
  }
}