/* ============================================================
   地球自转与公转 · 地理教学实验室 —— 深空 HUD 科幻风样式
   无外部依赖、无网络请求；配合 file:// 双击运行
   最小适配 1280×720
   ============================================================ */

:root {
  --bg: #030814;
  --panel: rgba(8, 18, 38, 0.86);
  --panel-solid: #0a1428;
  --line: #1e3a6e;
  --cyan: #4fc3f7;
  --cyan-dim: rgba(79, 195, 247, 0.35);
  --amber: #ffd54f;
  --red: #ff5470;
  --green: #69f0ae;
  --text: #dfe8ff;
  --text-dim: rgba(223, 232, 255, 0.55);
  --font: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* , *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(79, 195, 247, 0.3); }

button { font-family: inherit; }

:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }

/* ---------- 通用面板 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), inset 0 0 24px rgba(79, 195, 247, 0.03);
}

/* 面板标题：青色左侧竖条 */
.panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #eaf3ff;
  white-space: nowrap;
}
.panel-title::before {
  content: "";
  width: 3px;
  height: 12px;
  flex: none;
  border-radius: 1px;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

/* ---------- HUD 按钮 ---------- */
.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
  background: rgba(12, 26, 52, 0.6);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.06s;
}
.hud-btn svg { flex: none; }
.hud-btn:hover {
  color: #ffffff;
  border-color: rgba(79, 195, 247, 0.7);
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.25);
}
.hud-btn:active { transform: translateY(1px); }

/* 教材同步面板（右侧滑出） */
#curriculum-panel {
  position: fixed;
  top: 86px;
  right: 300px;
  width: 330px;
  max-height: calc(100vh - 200px);
  overflow: auto;
  z-index: 620;
  display: none;
  flex-direction: column;
}
.curr-source { font-size: 10px; color: var(--text-dim); opacity: .7; margin: 2px 0 8px; }
.curr-card {
  border: 1px solid rgba(30, 58, 110, 0.8);
  border-radius: 6px;
  margin-bottom: 7px;
  overflow: hidden;
  background: rgba(6, 14, 30, 0.55);
  transition: border-color .15s, background .15s;
}
.curr-card:hover { border-color: rgba(79, 195, 247, 0.6); }
.curr-card.active { border-color: var(--cyan); background: rgba(79, 195, 247, 0.10); }
.curr-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  cursor: pointer;
}
.curr-title { font-size: 12px; color: var(--text); }
.curr-card.active .curr-title { color: var(--cyan); }
.curr-page { font-size: 10px; color: var(--text-dim); opacity: .7; font-family: var(--mono); }
.curr-text {
  padding: 0 10px 9px;
  font-size: 11px;
  line-height: 1.75;
  color: #b9cbe8;
  border-top: 1px dashed rgba(79, 195, 247, 0.25);
  padding-top: 7px;
}
.curr-tip { font-size: 10px; color: var(--text-dim); opacity: .6; margin-top: 4px; }
.curr-quote {
  border-left: 2px solid rgba(255, 213, 79, 0.55);
  padding-left: 8px;
  color: #e8dfc0;
}
.curr-note {
  margin-top: 6px;
  color: #7fc8f0;
  font-size: 10.5px;
}

/* 设置面板：配色多选竖排（横排 5 项会挤压换行） */
.form-row.stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.save-tip { font-size: 11px; color: var(--text-dim); opacity: .75; }

/* 滑杆行：− 滑杆 ＋ 步进布局 */
.slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slider-row .hud-range { flex: 1; min-width: 0; }
.step-btn {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  font-family: var(--mono);
}

/* 主要按钮 */
.hud-btn.accent {
  color: var(--cyan);
  border-color: rgba(79, 195, 247, 0.65);
  background: rgba(79, 195, 247, 0.10);
  text-shadow: 0 0 6px rgba(79, 195, 247, 0.5);
}
.hud-btn.accent:hover {
  color: #d7f1ff;
  border-color: var(--cyan);
  background: rgba(79, 195, 247, 0.18);
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.45);
}

/* 选中态（视图切换按钮） */
.hud-btn.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(79, 195, 247, 0.16);
  box-shadow: inset 0 -2px 0 rgba(79, 195, 247, 0.9), 0 0 10px rgba(79, 195, 247, 0.2);
}

/* ---------- HUD 滑杆（细轨道 + 发光滑块） ---------- */
.hud-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
/* WebKit */
.hud-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(30, 58, 110, 0.9);
  border: 1px solid rgba(30, 58, 110, 0.9);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.hud-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c8ecff, #4fc3f7 60%, #0d6e9e);
  border: 1px solid rgba(223, 232, 255, 0.7);
  box-shadow: 0 0 6px rgba(79, 195, 247, 0.9), 0 0 14px rgba(79, 195, 247, 0.4);
  transition: box-shadow 0.15s;
}
.hud-range:hover::-webkit-slider-thumb {
  box-shadow: 0 0 8px rgba(79, 195, 247, 1), 0 0 20px rgba(79, 195, 247, 0.6);
}
.hud-range:active::-webkit-slider-thumb { transform: scale(1.15); }
/* Firefox */
.hud-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(30, 58, 110, 0.9);
  border: 1px solid rgba(30, 58, 110, 0.9);
}
.hud-range::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(79, 195, 247, 0.55);
}
.hud-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4fc3f7;
  border: 1px solid rgba(223, 232, 255, 0.7);
  box-shadow: 0 0 6px rgba(79, 195, 247, 0.9), 0 0 14px rgba(79, 195, 247, 0.4);
}
.hud-range:focus-visible { outline: none; }
.hud-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.5), 0 0 10px rgba(79, 195, 247, 0.9);
}

/* ---------- HUD 下拉框 ---------- */
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 7px;
  font-size: 10px;
  color: var(--cyan);
  pointer-events: none;
}
.hud-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 3px 22px 3px 8px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  background: rgba(6, 14, 30, 0.9);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hud-select:hover { border-color: rgba(79, 195, 247, 0.7); }
.hud-select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 8px rgba(79, 195, 247, 0.3); }
.hud-select option { background: var(--panel-solid); color: var(--text); }

/* ---------- HUD 拨杆开关 ---------- */
.hud-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.hud-switch:hover { color: var(--text); }
.hud-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}
.sw-track {
  position: relative;
  flex: none;
  width: 30px;
  height: 14px;
  border-radius: 8px;
  border: 1px solid rgba(79, 195, 247, 0.45);
  background: rgba(6, 14, 30, 0.9);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.sw-track::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5a6f96;
  transition: left 0.15s, background 0.15s, box-shadow 0.15s;
}
.hud-switch input:checked + .sw-track {
  background: rgba(79, 195, 247, 0.18);
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.35), inset 0 0 4px rgba(79, 195, 247, 0.25);
}
.hud-switch input:checked + .sw-track::before {
  left: calc(100% - 11px);
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}
.hud-switch input:focus-visible + .sw-track { outline: 1px solid var(--cyan); outline-offset: 2px; }

/* ---------- HUD 单选 ---------- */
.hud-radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.hud-radio:hover { color: var(--text); }
.hud-radio input { accent-color: var(--cyan); width: 13px; height: 13px; margin: 0; cursor: pointer; }
.hud-radio:has(input:checked) { color: var(--cyan); }

/* ============================================================
   3D 画布挂载点
   ============================================================ */
#stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
#stage canvas { display: block; }

/* ============================================================
   加载遮罩 / 致命错误卡（与头部内联兜底样式同构，此处增强）
   ============================================================ */
#loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 50% 42%, #071228 0%, #030814 72%);
  transition: opacity 0.4s;
}
#loading .load-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(79, 195, 247, 0.18);
  border-top-color: var(--cyan);
  box-shadow: 0 0 14px rgba(79, 195, 247, 0.25);
  animation: hud-spin 1s linear infinite;
}
#loading .load-title {
  font-size: 18px;
  letter-spacing: 3px;
  color: #eaf3ff;
  text-shadow: 0 0 12px rgba(79, 195, 247, 0.4);
}
#loading .load-sub, #loading .loading-extra {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
#loading .loading-extra { color: var(--amber); }
@keyframes hud-spin { to { transform: rotate(360deg); } }

#fatal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 20, 0.94);
}
#fatal .card {
  max-width: 580px;
  margin: 20px;
  padding: 20px 24px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: #160a12;
  box-shadow: 0 0 30px rgba(255, 84, 112, 0.2);
}
#fatal .fatal-title {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--red);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 84, 112, 0.4);
}
#fatal-msg {
  margin: 0;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--mono);
  font-size: 12px;
  color: #ffb3c0;
}

/* ============================================================
   左侧：图层与标注面板
   ============================================================ */
#layer-panel {
  position: fixed;
  left: 76px;
  top: 12px;
  bottom: 128px;
  width: 212px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
#layer-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}
/* 图层行：checkbox + 文字，hover 高亮（js/layers.js 生成） */
.layer-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}
.layer-row:hover {
  background: rgba(79, 195, 247, 0.10);
  color: var(--text);
}
/* 拨杆开关：直接在 checkbox 上自绘（开=青色滑块在右，关=灰色在左），状态一眼可辨 */
.layer-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  margin: 0 0 0 auto;
  order: 2;               /* DOM 里 input 在文字前，flex order 把开关排到行尾（文字左、开关右） */
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: rgba(10, 24, 48, 0.9);
  border: 1px solid rgba(90, 120, 170, 0.45);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.layer-row input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #7c92b5;
  transition: left 0.15s, background 0.15s, box-shadow 0.15s;
}
.layer-row input[type="checkbox"]:hover { border-color: rgba(79, 195, 247, 0.6); }
.layer-row input[type="checkbox"]:checked {
  background: rgba(21, 101, 192, 0.85);
  border-color: rgba(79, 195, 247, 0.85);
  box-shadow: 0 0 7px rgba(79, 195, 247, 0.35);
}
.layer-row input[type="checkbox"]:checked::after {
  left: 18px;
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(79, 195, 247, 0.9);
}
.layer-row .chk {
  flex: none;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(79, 195, 247, 0.5);
  border-radius: 3px;
  background: rgba(6, 14, 30, 0.8);
  position: relative;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.layer-row input:checked + .chk {
  background: rgba(79, 195, 247, 0.85);
  border-color: var(--cyan);
  box-shadow: 0 0 6px rgba(79, 195, 247, 0.5);
}
.layer-row input:checked + .chk::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid #04121f;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.layer-row input:focus-visible + .chk { outline: 1px solid var(--cyan); outline-offset: 2px; }
.layer-row .layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 小图例区 */
#legend-box {
  flex: none;
  border-top: 1px dashed rgba(30, 58, 110, 0.9);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.lg-row { display: flex; align-items: center; gap: 6px; }
.lg-line {
  width: 14px;
  border-top: 2px solid var(--cyan);
  box-shadow: 0 0 4px rgba(79, 195, 247, 0.8);
}
.lg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
  margin: 0 3px;
}

/* ============================================================
   顶部中央：视图切换
   ============================================================ */
#view-switcher {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
}
.view-btns { display: flex; gap: 8px; }
#view-opts {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

/* ============================================================
   右上：工具栏
   ============================================================ */
#toolbar {
  position: fixed;
  left: 10px;
  top: 12px;
  bottom: 138px;
  width: 58px;
  z-index: 31;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 8px 5px;
  overflow-y: auto;
  overflow-x: hidden;
}
#toolbar .hud-btn {
  flex-direction: column;
  gap: 3px;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text-dim);
}
#toolbar .hud-btn:hover { color: var(--cyan); }

/* ============================================================
   右上（工具栏下方）：观测点实时数据面板
   ============================================================ */
#data-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 232px;
  z-index: 29;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
}
#obs-name {
  padding: 3px 0 7px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(30, 58, 110, 0.7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(79, 195, 247, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}
.data-row .k { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.data-row .v {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 昼夜状态行：高亮 */
.data-row.hl {
  margin-top: 5px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 213, 79, 0.4);
  border-radius: 5px;
  background: rgba(255, 213, 79, 0.07);
}
.data-row.hl .k { color: var(--amber); }
.data-row.hl .v {
  color: var(--amber);
  font-weight: 600;
  text-shadow: 0 0 6px rgba(255, 213, 79, 0.4);
}
.data-sep {
  height: 0;
  margin: 7px 0;
  border: none;
  border-top: 1px dashed rgba(30, 58, 110, 0.9);
}

/* ============================================================
   右下：昼夜半球缩略图
   ============================================================ */
#obs-thumb-box {
  position: fixed;
  right: 12px;
  bottom: 136px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 10px;
}
#obs-thumb {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #020617;
}

/* ============================================================
   右下（底部栏上方）：数据图表区（可折叠）
   ============================================================ */
#charts-area {
  position: fixed;
  right: 248px;
  bottom: 136px;
  width: 360px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 10px;
}
.charts-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#btn-charts-toggle { padding: 2px 8px; font-size: 11px; }
.charts-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#charts-area.collapsed .charts-body { display: none; }

#chart-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid rgba(30, 58, 110, 0.8);
  overflow-x: auto;
}
.chart-tab {
  flex: none;
  padding: 4px 6px 3px;
  font-size: 11px;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.chart-tab:hover { color: var(--text); }
/* tab 选中态：青色下划线 */
.chart-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 6px rgba(79, 195, 247, 0.4);
}
#chart-canvas {
  display: block;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(2, 6, 23, 0.65);
}

/* ============================================================
   底部通栏：四区 grid
   ============================================================ */
#bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 124px;
  z-index: 40;
  display: grid;
  grid-template-columns: 344px 1fr 225px 185px;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(4, 10, 24, 0.82);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}
.bb-zone {
  display: flex;
  min-width: 0;
  align-items: center;
}

/* a) 时间控制区 */
.bb-time { gap: 10px; }
#btn-play {
  flex: none;
  width: 44px;
  height: 36px;
  font-size: 14px;
}
.slider-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.slider-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.slider-cap .mono {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(79, 195, 247, 0.35);
}
.mono { font-family: var(--mono); }

/* b) 节气时间轴区（最宽） */
.bb-timeline {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
/* 24 节气刻度条：仅竖线（js/ui.js 按百分比绝对定位）；分至文字放滑轨下方独立标签行
   必须 width:100%——父级 flex 居中会让无内容宽度的容器收缩，百分比定位全叠在一点 */
#term-marks {
  position: relative;
  width: 100%;
  height: 13px;
  padding: 0 6px;
}
#term-labels {
  position: relative;
  width: 100%;
  height: 17px;
  padding: 0 6px;
}
.term-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  line-height: 17px;
  color: var(--amber);
  cursor: pointer;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(255, 213, 79, 0.45);
}
.term-label:hover { color: #ffe89b; }
#timeline-date {
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 1px;
}

/* c) 地球参数区 */
.bb-params {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.grid-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.grid-row label { flex: none; white-space: nowrap; }
.grid-row .select-wrap { flex: 1; }

/* d) 快捷跳转区 */
.bb-jump {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  align-content: center;
  justify-items: stretch;
}
.bb-jump .hud-btn {
  padding: 4px 2px;
  font-size: 11px;
}

/* ============================================================
   标注模式工具条（默认隐藏，js 加 .open 显示）
   ============================================================ */
#annotate-bar {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;   /* 高于标注覆盖画布(500)，否则激活时按钮被全屏画布挡住无法点击 */
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
#annotate-bar.open { display: flex; }
.anno-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.anno-tip .pen {
  color: var(--red);
  font-size: 13px;
  text-shadow: 0 0 6px rgba(255, 84, 112, 0.6);
}

/* ============================================================
   居中模态（默认隐藏，js 加 .open 显示）
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal.open { display: flex; }
.modal-card {
  width: 400px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55), 0 0 20px rgba(79, 195, 247, 0.08);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close { padding: 2px 8px; font-size: 11px; }
.form-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 0;
  font-size: 12px;
}
.form-label { flex: none; width: 40px; color: var(--text-dim); }
.about-text {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-dim);
}

/* ============================================================
   自检浮层（快捷键呼出，默认隐藏）
   ============================================================ */
#selftest-overlay {
  position: fixed;
  top: 110px;
  right: 12px;
  z-index: 9999;
  display: none;
  max-width: 360px;
  max-height: 60vh;
  overflow: auto;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--green);
  background: rgba(3, 8, 20, 0.92);
  border: 1px solid rgba(105, 240, 174, 0.45);
  border-radius: 6px;
  box-shadow: 0 0 18px rgba(105, 240, 174, 0.12);
  white-space: pre-wrap;
}

/* ============================================================
   右下角 toast 容器
   ============================================================ */
#toast-box {
  position: fixed;
  right: 12px;
  bottom: 352px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 260px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  background: rgba(8, 18, 38, 0.94);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.18s ease-out;
}
.toast.ok { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--amber); }
.toast.err { border-left-color: var(--red); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   细滚动条
   ============================================================ */
#layer-list::-webkit-scrollbar,
#chart-tabs::-webkit-scrollbar,
#selftest-overlay::-webkit-scrollbar,
#fatal-msg::-webkit-scrollbar { width: 6px; height: 6px; }
#layer-list::-webkit-scrollbar-thumb,
#chart-tabs::-webkit-scrollbar-thumb,
#selftest-overlay::-webkit-scrollbar-thumb,
#fatal-msg::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(79, 195, 247, 0.35);
}
#layer-list::-webkit-scrollbar-track,
#selftest-overlay::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   小屏（720 高）微调：压缩留白避免拥挤
   ============================================================ */
@media (max-height: 740px) {
  #data-panel { top: 12px; padding: 8px 10px; }
  .data-row { padding: 1px 0; }
  #obs-thumb-box { bottom: 134px; }
  #charts-area { bottom: 134px; }
}


/* ===== 界面档位（完整 / 教材） ===== */
.mode-textbook .adv-only { display: none !important; }
#btn-mode.mode-on {
  color: var(--green);
  border-color: var(--green);
  background: rgba(105, 240, 174, 0.10);
}
.curr-group-title {
  padding: 7px 8px 3px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
  margin-top: 5px;
}
.mode-tip { font-size: 12px; line-height: 1.75; color: var(--text); margin: 6px 0; }


/* ===== 章节化教学流（阶段1） ===== */
#chapter-panel { width: 250px; }
.ch-head { padding: 10px 12px 2px; }
.ch-tabs { display: flex; gap: 6px; padding: 6px 12px; }
.ch-tab {
  flex: 1; padding: 6px 0; font-size: 12px; color: var(--text-dim);
  background: rgba(79, 195, 247, 0.06); border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; font-family: var(--font);
}
.ch-tab.active { color: var(--cyan); border-color: var(--cyan-dim); background: rgba(79, 195, 247, 0.12); }
.ch-steps { display: flex; gap: 10px; align-items: center; padding: 8px 14px 4px; }
.ch-dot {
  width: 27px; height: 27px; border-radius: 50%; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-dim); cursor: pointer; font-family: var(--mono);
  background: transparent;
}
.ch-dot.active { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 8px var(--cyan-dim); }
.ch-card { padding: 6px 14px 4px; }
.ch-no { font-size: 11px; color: var(--cyan); font-family: var(--mono); }
.ch-title { font-size: 15px; color: var(--text); margin: 3px 0 6px; }
.ch-guide { font-size: 12px; line-height: 1.7; color: var(--text-dim); }
.ch-chip {
  display: inline-block; margin-top: 8px; padding: 3px 8px;
  border: 1px solid var(--cyan-dim); border-radius: 4px;
  font-size: 11px; color: var(--cyan); background: rgba(79, 195, 247, 0.06);
}
.ch-sec { padding: 10px 14px 2px; font-size: 11px; color: var(--text-dim); }
.ch-sec-sub { margin-left: 6px; opacity: 0.7; }
#chapter-controls { padding: 2px 10px 4px; }
.ch-reset {
  display: block; margin: 8px 12px 12px; width: calc(100% - 24px);
  padding: 7px 0; font-size: 12px; color: var(--text-dim);
  background: transparent; border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.ch-reset:hover { color: var(--cyan); border-color: var(--cyan-dim); }


/* ===== 极点观测视角标注层（阶段2） ===== */
#polar-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
#polar-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#polar-banner {
  position: absolute; top: 76px; left: 50%; transform: translateX(-50%);
  padding: 8px 16px; text-align: center;
  background: var(--panel); border: 1px solid var(--cyan-dim); border-radius: 8px;
  box-shadow: 0 0 18px rgba(79, 195, 247, 0.15);
}
#polar-banner b { color: var(--text); font-size: 14px; }
#polar-banner span { color: var(--cyan); font-size: 14px; }
#polar-banner em { display: block; margin-top: 3px; font-style: normal; font-size: 11px; color: var(--text-dim); }


/* ===== 昼夜 2D 同步小窗（阶段3） ===== */
#daynight-panel { position: fixed; right: 12px; bottom: 350px; z-index: 28; width: 356px; padding: 8px 10px; }
#daynight-head { display: flex; justify-content: space-between; align-items: center; }
#daynight-map { display: block; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #020617; margin-top: 6px; }
#daynight-close { padding: 0 7px; font-size: 11px; }


/* ===== 视角预设矩阵（阶段4） ===== */
#view-presets { display: flex; gap: 5px; align-items: center; padding: 6px 10px 2px; flex-wrap: wrap; }
.vp-label { font-size: 11px; color: var(--text-dim); margin-right: 2px; }
.hud-btn.vp { padding: 3px 8px; font-size: 11px; }


/* ===== 时间条读数（阶段4B） ===== */
.bb-meta { display: flex; gap: 14px; padding: 2px 4px 0; font-size: 11px; color: var(--text-dim); font-family: var(--mono); }

/* 帮助面板：居中弹层 */
#help-panel {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 48px));
  max-height: min(72vh, 640px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
}
#help-body { overflow-y: auto; }
#help-body .help-sec {
  margin: 10px 0 2px;
  color: #ffd54f;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 2px;
}
#help-body p { margin: 2px 0; line-height: 1.65; }

/* ===================== A1/A2/A3 UI 框架升级（2026-09-21 对标竞品） ===================== */
/* 章节面板：显式定位（原为文档流），让位左列 rail */
#chapter-panel {
  position: fixed;
  left: 76px;
  top: 12px;
  bottom: 138px;
  width: 250px;
  overflow-y: auto;
  z-index: 6;
}
/* A2 步进/倍速/收起/直射读数 */
.bb-speed-chips { display: flex; align-items: center; gap: 4px; padding: 2px 0 0; }
.bb-speed-chips .chip-cap { font-size: 10px; color: var(--text-dim); margin-right: 2px; }
.bb-speed-chips .hud-btn.chip {
  padding: 2px 8px; font-size: 11px; min-width: 30px; text-align: center;
}
.bb-speed-chips .hud-btn.chip.on {
  color: var(--amber); border-color: var(--amber); background: rgba(255, 213, 79, 0.10);
}
#bb-subsolar { color: var(--amber); }
#bb-toggle {
  position: absolute;
  top: -1px;
  right: 12px;
  width: 34px;
  height: 20px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  border-top: none;
  border-radius: 0 0 6px 6px;
}
#bottom-bar.bb-collapsed { transform: translateY(calc(100% - 24px)); }
#bottom-bar.bb-collapsed #bb-toggle { border-radius: 6px 6px 0 0; }   /* 把手留在 bar 顶部=露出区内；移底部会出屏 */
/* A3 牌匾 + 四角装饰 */
#app-plaque {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 32;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 26px 7px;
  background: linear-gradient(180deg, rgba(10, 22, 46, 0.92), rgba(6, 14, 32, 0.88));
  border: 1px solid rgba(255, 213, 79, 0.55);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 213, 79, 0.12), 0 4px 18px rgba(0, 0, 0, 0.45);
}
#app-plaque .plq-main {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 10px;
  text-indent: 10px;
  color: #ffe9a8;
  text-shadow: 0 0 12px rgba(255, 213, 79, 0.35);
}
#app-plaque .plq-sub {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
}
.frame-corner {
  position: fixed;
  width: 26px;
  height: 26px;
  z-index: 3;
  pointer-events: none;
  border-color: rgba(255, 213, 79, 0.4);
}
.fc-tl { left: 6px; top: 6px; border-left: 2px solid; border-top: 2px solid; }
.fc-tr { right: 6px; top: 6px; border-right: 2px solid; border-top: 2px solid; }
.fc-bl { left: 6px; bottom: 130px; border-left: 2px solid; border-bottom: 2px solid; }
.fc-br { right: 6px; bottom: 130px; border-right: 2px solid; border-bottom: 2px solid; }

/* ===================== 视角精简：更多视角下拉 ===================== */
#more-views { position: relative; }
#more-views summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
#more-views summary::-webkit-details-marker { display: none; }
#more-views summary.in-menu {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(255, 213, 79, 0.10);
}
#more-views .mv-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 132px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
#more-views .mv-menu .hud-btn {
  justify-content: flex-start;
  text-align: left;
  padding: 5px 10px;
}
#more-views .mv-sep { height: 1px; background: var(--line); margin: 4px 0; }
#mv-opts { display: flex; flex-direction: column; gap: 4px; }
