* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top bar */
#top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #16213e, #1a1a2e);
  border-bottom: 1px solid #2a2a4a;
  flex-shrink: 0;
}

#loc-info { flex-shrink: 0; }

#top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto; /* 极窄窗口时单行滚动，不折行 */
}

#top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

#location-name {
  font-size: 16px;
  font-weight: 600;
}

#date-weather {
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}

#link-3d {
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(30, 40, 70, 0.9);
  border: 1px solid #3a3a5a;
  color: #e0e0e0;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

#link-3d:hover {
  border-color: #ffa940;
  background: rgba(50, 65, 110, 0.9);
}

#btn-stats {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-stats:hover {
  border-color: #ffd27d;
}

#btn-search {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-cams {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-cams:hover {
  border-color: #ffa940;
}

#btn-search:hover {
  border-color: #ffa940;
}

#stats-box {
  background: #1a2440;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12px;
}

.stats-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.stats-head #link-api {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #3a3a5a;
  color: #e0e0e0;
  font-size: 12px;
  text-decoration: none;
  background: rgba(30, 40, 70, 0.9);
}

.stats-head #link-api:hover { border-color: #ffa940; }

.stat-total { color: #aaa; margin-bottom: 4px; }
.stat-total b { color: #ffa940; }
.stat-section { color: #888; margin: 6px 0 4px; font-size: 11px; }
.stat-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.stat-name { width: 130px; color: #ccc; font-size: 11px; white-space: nowrap; overflow: hidden; }
.stat-bar-bg { flex: 1; background: #23233a; border-radius: 3px; height: 10px; overflow: hidden; }
.stat-bar { height: 100%; background: linear-gradient(90deg, #ffa940, #ffd27d); border-radius: 3px; }
.stat-num { width: 40px; text-align: right; color: #ddd; font-size: 11px; }

#link-api {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

#link-api:hover {
  border-color: #ffa940;
}

/* Map */
/* Main area: map left, cards right */
#main-area {
  display: flex;
  flex: 1;
  min-height: 0;
}

#map {
  flex: 1;
  min-width: 0;
  background: #1a1a2e;
}

/* Peak cards */
#cards-container {
  width: 360px;
  overflow-y: auto;
  padding: 12px;
  background: #16213e;
  border-left: 1px solid #2a2a4a;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  #main-area {
    flex-direction: column;
  }
  #cards-container {
    width: 100%;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid #2a2a4a;
  }
}

#cards-loading {
  text-align: center;
  padding: 24px;
  color: #888;
}

.peak-card {
  background: #1e2a4a;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid #4a9eff;
  transition: border-color 0.3s;
}

.peak-card.golden {
  border-left-color: #ffa940;
}

.peak-card.highlighted {
  border-left-color: #ff6b6b;
  box-shadow: 0 0 0 2px #ff6b6b66;
  background: #24345a;
}

.search-badge {
  font-size: 12px;
  color: #ff6b6b;
  margin-left: 6px;
}

.card-3d-link {
  margin-left: auto;
  color: #8ab4ff;
  text-decoration: none;
  font-size: 12px;
}

.card-3d-link:hover {
  text-decoration: underline;
}

/* 收藏按钮（卡片右上角） */
.fav-btn {
  background: none;
  border: none;
  color: #ffd34d;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.fav-btn:hover {
  transform: scale(1.2);
}

/* 收藏区 */
.fav-section {
  margin-top: 16px;
  border-top: 1px solid #3a3a5a;
  padding-top: 12px;
}

.fav-section h4 {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-label {
  margin-left: auto;
  font-weight: normal;
  font-size: 12px;
}

#lead-select {
  background: #16213e;
  color: #e0e0e0;
  border: 1px solid #3a3a5a;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
}

.fav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(30, 40, 70, 0.6);
  border: 1px solid #3a3a5a;
  border-radius: 8px;
  color: #e0e0e0;
  padding: 8px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}

.fav-item:hover {
  border-color: #ffa940;
  background: rgba(50, 65, 110, 0.8);
}

.fav-time {
  float: right;
  color: #ffa940;
  font-size: 12px;
}

.fav-empty {
  color: #777;
  font-size: 12px;
}

/* 日照金山提醒横幅 */
#golden-toast {
  display: none;
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: linear-gradient(135deg, #3a2a10, #5a3d14);
  border: 1px solid #ffa940;
  color: #ffd9a0;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.peak-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.peak-card .peak-name {
  font-size: 17px;
  font-weight: 700;
}

.peak-card .peak-elevation {
  font-size: 14px;
  color: #aaa;
}

.peak-card .peak-time {
  font-size: 14px;
  color: #ffa940;
  margin-bottom: 4px;
}

.peak-card .peak-time .label {
  color: #888;
  font-size: 12px;
}

.peak-time .strict-ok, .peak-time .strict-fail {
  font-size: 11px;
  font-weight: 600;
}
.peak-time .strict-ok { color: #8ee08a; }
.peak-time .strict-fail { color: #ff8a8a; }

.peak-card .peak-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #aaa;
}

.peak-card .visibility-优 { color: #52c41a; }
.peak-card .visibility-良 { color: #faad14; }
.peak-card .visibility-差 { color: #ff4d4f; }
.peak-card .visibility-不可用 { color: #888; }

/* Tab bar */
#tab-bar {
  display: flex;
  justify-content: space-around;
  padding: 8px 0 12px;
  background: #16213e;
  border-top: 1px solid #2a2a4a;
  flex-shrink: 0;
}

.tab {
  background: none;
  border: none;
  color: #888;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.tab.active {
  background: #2a3a5a;
  color: #fff;
}

/* Modal */
/* 雪山实况（24h 慢直播 + 每日快照） */
.cam-content { max-width: 780px; width: 94%; }
.cam-sub { font-size: 12px; color: #888; font-weight: normal; }
#cam-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cam-tab { padding: 6px 12px; border: 1px solid #ddd; border-radius: 16px; background: #fff; cursor: pointer; font-size: 13px; }
.cam-tab.active { background: #2b6cb0; color: #fff; border-color: #2b6cb0; }
.cam-stage { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
#cam-video { width: 100%; max-height: 420px; display: block; }
.cam-stage-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #eee; font-size: 14px; padding: 0 16px; text-align: center; background: rgba(0,0,0,.55); }
.cam-actions { margin: 12px 0 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cam-link { font-size: 13px; color: #2b6cb0; }
#cam-snap-status { font-size: 12px; color: #666; }
#cam-snaps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.cam-snap { position: relative; flex: 0 0 auto; }
.cam-snap img { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid #eee; }
.cam-snap-time { position: absolute; bottom: 2px; right: 4px; font-size: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 0 3px; border-radius: 3px; }
.cam-snap-empty { font-size: 12px; color: #999; padding: 8px 0; }

.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.hidden { display: none !important; }
.modal-content {
  background: #1e2a4a;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 360px;
}
.modal-content h3 { margin-bottom: 16px; }
.modal-content input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: #16213e;
  color: #e0e0e0;
  font-size: 14px;
}
.modal-content button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  cursor: pointer;
}
#search-btn { background: #4a9eff; color: #fff; margin-right: 8px; }
#search-close { background: #3a3a5a; color: #aaa; }

/* 影像增强：EOX 哨兵影像偏灰软，提升对比度/饱和度让山体更清晰 */
.leaflet-tile-pane .leaflet-tile {
  filter: contrast(1.2) saturate(1.18) brightness(1.02);
}

/* 观景点选择弹窗 */
.vp-option {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(30, 40, 70, 0.8);
  border: 1px solid #3a3a5a;
  border-radius: 8px;
  color: #e0e0e0;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
}

.vp-option:hover {
  border-color: #ffa940;
  background: rgba(50, 65, 110, 0.8);
}

.vp-desc {
  display: block;
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

#vp-cancel {
  background: #3a3a5a;
  color: #aaa;
}

.vp-golden {
  display: block;
  font-size: 13px;
  color: #ffa940;
  margin-top: 3px;
}

/* 长征路线按钮 */
#btn-longmarch {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-longmarch:hover {
  border-color: #e63946;
}

#btn-longmarch.active {
  border-color: #e63946;
  background: rgba(120, 30, 40, 0.7);
}

/* 长征简介（替换右侧卡片区） */
#march-content {
  padding: 4px 2px;
}

#march-content-title {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 4px solid #e63946;
}

#march-content-body {
  color: #c8c8d4;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* 长征节点列表 */
.march-intro {
  margin-bottom: 14px;
}

.march-stop {
  background: rgba(30, 40, 70, 0.5);
  border-left: 3px solid #e63946;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.march-stop-name {
  font-weight: 600;
  color: #ffd0d0;
  font-size: 13px;
  margin-bottom: 3px;
}

.march-stop-desc {
  color: #a8a8b8;
  font-size: 12px;
  line-height: 1.7;
}

/* 长征节点互动 */
.march-stop {
  cursor: pointer;
  transition: background 0.2s;
}

.march-stop:hover {
  background: rgba(60, 30, 40, 0.6);
}

.march-stop.active {
  background: rgba(120, 30, 40, 0.5);
  border-left-color: #ff6b6b;
}

.march-stop-hint {
  font-size: 11px;
  color: #888;
  font-weight: normal;
}

/* 徒步线沿途山峰（三角图标 + 面板 chips） */
.trek-peak-icon {
  display: block;
  font-size: 15px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.6);
}

.march-peaks {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed #3a3a5a;
}

.march-peaks-title {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}

.march-peak {
  display: inline-block;
  margin: 2px 6px 6px 0;
  padding: 3px 10px;
  background: rgba(30, 40, 70, 0.7);
  border: 1px solid #3a3a5a;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  color: #ccc;
  transition: background 0.2s;
}

.march-peak:hover {
  background: rgba(50, 65, 110, 0.8);
  border-color: #ffa940;
  color: #ffd9a0;
}

/* 多路线节点选择按钮 */
.march-route-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(30, 40, 70, 0.7);
  border: 1px solid #3a3a5a;
  border-left-width: 4px;
  border-radius: 6px;
  color: #e0e0e0;
  padding: 8px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}

.march-route-btn:hover {
  background: rgba(50, 65, 110, 0.8);
}

/* 转山按钮 */
#btn-kora {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-kora:hover { border-color: #ffd166; }

#btn-kora.active {
  border-color: #ffd166;
  background: rgba(120, 100, 30, 0.7);
}

/* 川藏线按钮 */
#btn-chuanzang {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-chuanzang:hover { border-color: #ff6b35; }

#btn-chuanzang.active {
  border-color: #ff6b35;
  background: rgba(120, 70, 30, 0.7);
}

/* EBC 珠峰徒步按钮 */
#btn-ebc {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-ebc:hover { border-color: #e63946; }

#btn-ebc.active {
  border-color: #e63946;
  background: rgba(120, 30, 40, 0.7);
}

/* ACT 安纳普尔纳按钮 */
#btn-act {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #3a3a5a;
  background: rgba(30, 40, 70, 0.9);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#btn-act:hover { border-color: #ffa940; }

#btn-act.active {
  border-color: #ffa940;
  background: rgba(120, 80, 20, 0.7);
}

/* 顶栏单行紧凑：全部按钮压缩间距与内边距，配合 nowrap 保证一排 */
#top-actions, #top-right { gap: 6px; }
#btn-longmarch, #btn-kora, #btn-chuanzang, #btn-ebc, #btn-act,
#btn-search, #btn-stats, #btn-cams, #link-3d {
  padding: 5px 10px;
  font-size: 12.5px;
}

/* 窄窗口：顶栏分两层——第一行观景点/日期，第二行按钮组左右排 */
@media (max-width: 1180px) {
  #top-bar { flex-wrap: wrap; row-gap: 4px; }
  #loc-info {
    flex-basis: 100%;
    display: flex;
    align-items: baseline;
    gap: 14px;
  }
  #date-weather { margin-top: 0; }
  #top-actions { overflow-x: auto; flex: 1; min-width: 0; }
  #top-right { margin-left: 0; }
}

/* 更窄：右组也允许压缩，搜索/统计等次要按钮缩短 */
@media (max-width: 820px) {
  #link-3d, #btn-stats, #link-api, #btn-cams { font-size: 12px; padding: 5px 8px; }
  #top-actions { gap: 4px; }
}

/* 多因素提示 */
.peak-tip { margin-top: 6px; font-size: 12px; color: #b8c0d8; line-height: 1.5; }
