/* 数字地球 · 均围线格网 —— 浅色主题 */
:root {
  --paper: #f5f3ee;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --ink: #2b2b2b;
  --ink-soft: #666;
  --line: #dcd8d0;
  --accent: #8c4a3c;
  --accent-soft: #f0e6e2;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
  --font-title: "Source Han Serif SC", "Noto Serif CJK SC", "思源宋体", "SimSun", serif;
  --font-body: "Microsoft YaHei Light", "Microsoft YaHei", "微软雅黑", sans-serif;
}

* { box-sizing: border-box; }

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

#cesiumContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 隐藏 Cesium 默认控件中不需要的部分 */
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-bottom,
.cesium-widget-credits,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-geocoderContainer,
.cesium-baseLayerPicker-dropdown { display: none !important; }

.cesium-widget, .cesium-widget canvas { outline: none; }

/* ---------- 顶部栏 ---------- */
#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  padding: 0 24px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
}

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

.brand-logo-link {
  display: block;
  line-height: 0;
  cursor: pointer;
  border-radius: 3px;
  transition: opacity 0.15s ease;
}
.brand-logo-link:hover { opacity: 0.82; }

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 3px;
}

.brand-text h1 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 1px;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 300;
}

.topbar-actions { display: flex; gap: 10px; }

.tool-btn {
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
}
.tool-btn:hover { background: var(--accent-soft); }

/* ---------- 通用面板 ---------- */
.panel {
  position: absolute;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 20;
}

#sidebar {
  top: 88px;
  left: 20px;
  width: 268px;
  max-height: calc(100% - 140px);
  overflow-y: auto;
  padding: 4px 18px 18px;
}

.panel-section { padding: 16px 0 4px; border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: none; }

.section-title {
  margin: 0 0 12px;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .5px;
}

/* 底图切换 */
.basemap-switch { display: flex; gap: 8px; margin-bottom: 12px; }

.switch-btn {
  flex: 1;
  padding: 8px 4px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 300;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.switch-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* 图层列表 */
.layer-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }

.layer-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.layer-item input { margin-top: 3px; accent-color: var(--accent); cursor: pointer; }
.layer-item .layer-text { flex: 1; }
.layer-item .layer-name { display: block; font-size: 13px; font-weight: 400; }
.layer-item .layer-legend { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-soft); font-weight: 300; }

/* ---------- 概念词典 ---------- */
.dict-panel {
  top: 88px;
  right: 20px;
  width: 320px;
  max-height: calc(100% - 140px);
  padding: 4px 18px 18px;
  display: flex;
  flex-direction: column;
}

.dict-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--line);
}
.dict-head .section-title { margin: 0; }

.close-btn {
  width: 26px;
  height: 26px;
  line-height: 22px;
  text-align: center;
  font-size: 20px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.close-btn:hover { background: var(--accent-soft); }

.dict-content { overflow-y: auto; padding-top: 12px; }
.dict-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.dict-item:last-child { border-bottom: none; }
.dict-term {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 15px;
  color: var(--accent);
}
.dict-en { margin-left: 8px; font-size: 11px; color: var(--ink-soft); font-weight: 300; }
.dict-def { margin: 8px 0 0; font-size: 12px; line-height: 1.7; font-weight: 300; }
.dict-map {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper);
  border-radius: 3px;
  font-weight: 300;
}

/* ---------- 信息弹窗 ---------- */
.info-popup {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 40px));
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 30;
  padding: 4px 20px 18px;
}

.popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--line);
}
.popup-head h3 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 17px;
}

.popup-body { padding-top: 12px; }
.popup-row { display: flex; gap: 14px; margin-bottom: 10px; font-size: 13px; line-height: 1.6; font-weight: 300; }
.popup-label { flex: 0 0 64px; color: var(--accent); font-weight: 400; }

/* ---------- 底部状态栏 ---------- */
#statusbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  padding: 0 24px;
  background: var(--panel-bg);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 300;
  color: var(--ink-soft);
  z-index: 20;
}
.status-hint { color: #999; }

/* ---------- 加载遮罩 ---------- */
.loading {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity .4s;
}
.loading-inner { text-align: center; }
.loading-mark {
  width: 64px; height: 64px; line-height: 64px;
  margin: 0 auto 16px;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 32px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
}
.loading-inner p { font-size: 14px; font-weight: 300; color: var(--ink-soft); }

.hidden { display: none !important; }

/* ---------- file:// 协议提示 ---------- */
.file-tip {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.file-tip-card {
  max-width: 520px;
  background: #fff;
  border: 1px solid #e5e0d8;
  border-radius: 8px;
  padding: 36px 40px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.file-tip-icon {
  width: 52px; height: 52px; line-height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}
.file-tip-card h2 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  margin: 0 0 18px;
}
.file-tip-card p {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.file-tip-card .file-tip-step {
  padding: 12px 16px;
  background: #f7f3ec;
  border-radius: 6px;
  color: var(--ink);
}
.file-tip-card .file-tip-alt { font-size: 13px; margin-bottom: 0; }
.file-tip-card code {
  font-family: Consolas, Monaco, monospace;
  background: #f0ece4;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 720px) {
  #topbar { height: 60px; padding: 0 14px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text p { display: none; }
  .brand-logo { width: 38px; height: 38px; }
  #sidebar { top: 68px; left: 10px; width: 210px; max-height: 50%; }
  .dict-panel { top: 68px; right: 10px; width: calc(100% - 20px); max-height: 60%; }
  .status-hint { display: none; }
  .info-popup { bottom: 44px; }
}

/* 竖屏：控制面板移至画面下半区，横向紧凑排布，让出地球视野 */
@media (max-width: 720px) and (orientation: portrait) {
  #sidebar {
    top: auto;
    bottom: 44px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 28%;
    padding: 0 14px 10px;
    display: flex;
    gap: 14px;
  }
  #sidebar .panel-section {
    padding: 10px 0 0;
    border-bottom: none;
  }
  #sidebar .panel-section:first-child { flex: 0 0 40%; }
  #sidebar .panel-section:last-child {
    flex: 1;
    padding-left: 14px;
    border-left: 1px solid var(--line);
  }
  #sidebar .section-title { margin-bottom: 8px; font-size: 13px; }
  #sidebar .basemap-switch { flex-direction: row; gap: 6px; margin-bottom: 0; }
  #sidebar .switch-btn { padding: 6px 2px; font-size: 11px; }
  #sidebar .layer-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    padding-bottom: 0;
  }
  #sidebar .layer-item { gap: 6px; }
  #sidebar .layer-item input { margin-top: 2px; }
  #sidebar .layer-item .layer-text { min-width: 0; }
  #sidebar .layer-item .layer-name { font-size: 12px; }
  #sidebar .layer-item .layer-legend { font-size: 10px; line-height: 1.4; }
}
