:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  background: #050813;
  color: #f4f7ff;
}

* { box-sizing: border-box; }

html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }

canvas { display: block; width: 100%; height: 100%; outline: none; }

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  width: min(306px, calc(100vw - 36px));
  padding: 16px;
  border: 1px solid rgba(159, 183, 239, 0.24);
  border-radius: 7px;
  background: rgba(10, 15, 29, 0.78);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  z-index: 3;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  transition: transform 180ms ease, opacity 180ms ease;
}

.hud__heading { padding-bottom: 13px; border-bottom: 1px solid rgba(173, 194, 237, 0.18); }
.hud__title-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.hud__eyebrow { display: block; color: #80a9d8; font-size: 11px; letter-spacing: 0; }
h1 { margin: 3px 0 0; font-size: 18px; font-weight: 650; letter-spacing: 0; }
.hud__time { display: flex; justify-content: space-between; gap: 8px; padding: 13px 0 12px; color: #aebbd0; font-size: 13px; }
.hud__time strong { color: #f7d88e; font-weight: 600; white-space: nowrap; }
.date-controls, .observation-tools { display: grid; gap: 6px; margin: 0 0 13px; }
.date-controls p, .observation-tools p { margin: 0; color: #8091aa; font-size: 10px; line-height: 1.35; }
.date-row, .tool-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
input[type="date"] { min-width: 0; height: 30px; border: 1px solid rgba(150,188,228,.35); border-radius: 5px; padding: 0 6px; background: #111c2d; color: #e9eef9; }
.control-label, .select-wrap span { color: #b9c6da; font-size: 12px; }
.panel-icon, .panel-command { min-height: 28px; border: 1px solid rgba(150, 188, 228, 0.36); border-radius: 4px; background: #172940; color: #dbeafe; cursor: pointer; }
.panel-icon { width: 28px; padding: 0; font-size: 15px; line-height: 1; }
.panel-command { padding: 0 8px; font-size: 11px; }
.panel-icon:hover, .panel-command:hover { background: #254568; }
.observation-controls { display: grid; gap: 6px; margin: 0 0 13px; }
.observation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px; }
.observation-row select { min-width: 0; }
.hud.is-collapsed { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.panel-reveal { position: fixed; top: 26px; left: 0; z-index: 4; min-height: 42px; border: 1px solid rgba(150, 188, 228, 0.45); border-left: 0; border-radius: 0 5px 5px 0; padding: 0 9px; background: rgba(17, 32, 52, 0.92); box-shadow: 4px 7px 18px rgba(0, 0, 0, 0.22); color: #dbeafe; cursor: pointer; font-size: 11px; writing-mode: vertical-rl; letter-spacing: 0; }
.panel-reveal:hover { background: #254568; }
.panel-reveal[hidden] { display: none; }
.display-controls { display: grid; gap: 7px; margin: 0 0 14px; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border: 1px solid rgba(150, 188, 228, 0.28); border-radius: 5px; background: rgba(0, 0, 0, 0.14); }
.segment { min-height: 29px; border: 0; border-radius: 3px; background: transparent; color: #9eacc1; cursor: pointer; font-size: 12px; }
.segment.is-selected { background: #294565; color: #eff8ff; }
.layer-toggles { display: flex; flex-wrap: wrap; gap: 9px; color: #aebbd0; font-size: 11px; }
.layer-toggles label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.layer-toggles input { margin: 0; accent-color: #8bc6ef; }
.enhance-settings { border-top: 1px solid rgba(173, 194, 237, 0.16); padding-top: 6px; color: #9fadbf; font-size: 11px; }
.enhance-settings summary { cursor: pointer; color: #c4d3e7; }
.enhance-settings[open] summary { margin-bottom: 8px; }
.enhance-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 9px; margin-top: 9px; }
.enhance-toggles label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.enhance-toggles input { margin: 0; accent-color: #8bc6ef; }
.trail-settings { border-top: 1px solid rgba(173, 194, 237, 0.16); padding-top: 6px; color: #9fadbf; font-size: 11px; }
.trail-settings summary { cursor: pointer; color: #c4d3e7; }
.trail-settings[open] summary { margin-bottom: 8px; }
.trail-length { display: grid; grid-template-columns: 28px 1fr 30px; align-items: center; gap: 7px; }
.trail-length output { font-size: 11px; }
.trail-body-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 9px; margin-top: 9px; }
.trail-body-list label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.trail-body-list input { margin: 0; accent-color: #8bc6ef; }
.range-row { display: grid; grid-template-columns: 1fr 70px; align-items: center; gap: 10px; margin-top: 7px; }
input[type="range"] { width: 100%; accent-color: #8bc6ef; }
output { color: #f7d88e; font-variant-numeric: tabular-nums; text-align: right; font-size: 13px; }
.rate-status { min-height: 18px; margin: 8px 0 13px; color: #8ea4c2; font-size: 12px; }
.rate-status.is-limited { color: #ffbf78; }
.halley-fast-forward { width: 100%; min-height: 29px; margin: -5px 0 10px; color: #d9ecff; }
.button-row { display: flex; align-items: stretch; gap: 9px; }
button, select { font: inherit; }
.icon-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 88px;
  border: 1px solid rgba(150, 188, 228, 0.45);
  border-radius: 5px;
  background: #18283e;
  color: #f1f6ff;
  cursor: pointer;
}
.icon-command:hover { background: #213955; }
.select-wrap { display: grid; gap: 4px; flex: 1; }
select { height: 31px; border: 1px solid rgba(150, 188, 228, 0.35); border-radius: 5px; padding: 0 6px; background: #111c2d; color: #e9eef9; }
.hud__hint { margin: 14px 0 0; color: #7787a2; font-size: 11px; line-height: 1.45; }
.demo-controls { display: grid; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(173, 194, 237, 0.16); }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.demo-grid button, .demo-camera-actions button, .demo-exit { min-height: 29px; border: 1px solid rgba(150, 188, 228, 0.36); border-radius: 4px; background: #172940; color: #dbeafe; cursor: pointer; font-size: 11px; }
.demo-grid button:hover, .demo-camera-actions button:hover, .demo-exit:hover { background: #254568; }
.demo-camera-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.demo-status { min-height: 30px; margin: 0; color: #a8bad4; font-size: 11px; line-height: 1.42; }
.demo-exit { background: #3c2c34; border-color: rgba(237, 177, 139, 0.48); color: #ffe8d8; }
.demo-controls-strip { display: grid; gap: 6px; padding-top: 4px; }
.demo-control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.demo-chip { min-height: 26px; border: 1px solid rgba(150, 188, 228, 0.32); border-radius: 4px; padding: 0 9px; background: #131f33; color: #b9cde6; cursor: pointer; font-size: 11px; }
.demo-chip:hover { background: #1d3350; color: #e8f3ff; }
.demo-chip.is-active { border-color: rgba(247, 216, 142, 0.72); background: #2a3f17; color: #ffe9ad; }
.demo-control-label { display: flex; align-items: center; gap: 6px; color: #93a6c2; font-size: 11px; }
.demo-control-label input[type="range"] { width: 120px; accent-color: #7db4e8; }
.demo-control-label output { min-width: 30px; color: #e4eefb; font-size: 11px; text-align: right; }
.demo-control-check { display: flex; align-items: center; gap: 5px; color: #93a6c2; font-size: 11px; cursor: pointer; }
.demo-control-check input { accent-color: #7db4e8; }
/* 弹弓遥测：两列布局，保证"2.507 AU/年"这类数值不被截断或压扁。 */
.slingshot-telemetry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.telemetry-cell { min-width: 0; border-left: 1px solid rgba(173, 194, 237, 0.28); padding: 5px 8px; background: rgba(5, 10, 23, 0.42); }
.telemetry-cell span { display: block; overflow: hidden; color: #8fa3c0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.telemetry-cell strong { display: block; overflow: hidden; margin-top: 2px; color: #d9ecff; font-family: Consolas, 'Cascadia Mono', monospace; font-size: 12px; font-weight: 600; white-space: nowrap; }
.slingshot-telemetry.is-complete .telemetry-cell strong { color: #8fd8bc; }
.energy-monitor { margin-top: 12px; border-top: 1px solid rgba(173,194,237,.16); padding-top: 7px; color: #c4d3e7; font-size: 11px; }
.energy-monitor summary { cursor: pointer; }
#energy-chart { display: block; width: 100%; height: 66px; margin-top: 7px; border: 1px solid rgba(150,188,228,.18); background: rgba(2,6,16,.42); }
.energy-monitor output { display: block; margin-top: 5px; text-align: left; color: #8fd8bc; font-size: 11px; }
.event-panel { display: grid; gap: 6px; }
#event-results { display: grid; gap: 4px; color: #8193ae; font-size: 10px; }
.event-result { overflow: hidden; border: 0; padding: 2px 0; background: transparent; color: #b9d9f6; cursor: pointer; font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.event-result:hover { color: #f7d88e; }
.comparison-view { position: fixed; left: 50%; bottom: 18px; z-index: 4; display: none; width: min(960px, calc(100vw - 24px)); transform: translateX(-50%); grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; pointer-events: none; }
.comparison-view.is-visible { display: grid; }
.comparison-card { min-width: 0; border-top: 1px solid rgba(173, 211, 248, 0.42); padding: 5px 3px 0; background: rgba(4, 8, 20, 0.52); color: #b9c8dc; font-size: 10px; line-height: 1.35; text-align: center; }
.comparison-card strong, .comparison-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comparison-card strong { color: #f7d88e; font-size: 11px; }
.loading { position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; background: #050813; color: #d7e8fb; font-size: 15px; transition: opacity 240ms ease; pointer-events: none; }
.loading.is-hidden { opacity: 0; }
.labels { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.body-label { position: absolute; border: 1px solid rgba(167, 211, 245, 0.44); border-radius: 3px; padding: 2px 6px; background: rgba(5, 10, 23, 0.72); color: #eef6ff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28); font-size: 11px; line-height: 1.35; white-space: nowrap; }
.labels.is-hidden, .body-label.is-hidden { display: none; }
.hover-tooltip { position: fixed; z-index: 5; padding: 3px 6px; border: 1px solid rgba(187, 223, 255, 0.56); border-radius: 3px; background: rgba(5, 10, 23, 0.86); color: #f3f8ff; font-size: 11px; pointer-events: none; transform: translate(12px, 12px); }
.info-card { position: fixed; right: 18px; bottom: 18px; z-index: 3; width: min(290px, calc(100vw - 36px)); border: 1px solid rgba(159, 183, 239, 0.30); border-radius: 7px; padding: 14px; background: rgba(10, 15, 29, 0.80); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28); backdrop-filter: blur(14px); }
.info-card__heading { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(173, 194, 237, 0.18); color: #aebbd0; font-size: 12px; }
.info-card__heading strong { color: #f7d88e; font-size: 16px; }
.info-card__intro { min-height: 42px; margin: 10px 0; color: #c7d3e4; font-size: 12px; line-height: 1.55; }
.info-card__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; margin: 0; }
.info-card__facts div { min-width: 0; }
.info-card__facts dt { color: #8193ae; font-size: 10px; }
.info-card__facts dd { margin: 2px 0 0; overflow: hidden; color: #edf5ff; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.info-card__follow { width: 100%; min-height: 30px; margin-top: 12px; border: 1px solid rgba(150, 188, 228, 0.38); border-radius: 4px; background: #1d3c5b; color: #ecf8ff; cursor: pointer; font-size: 12px; }
.info-card__follow:hover { background: #28547e; }
.demo-science { position: fixed; top: 18px; right: 18px; z-index: 4; width: min(330px, calc(100vw - 36px)); max-height: calc(100vh - 36px); overflow: auto; border: 1px solid rgba(159, 183, 239, 0.30); border-radius: 9px; background: rgba(8, 13, 26, 0.78); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.30); backdrop-filter: blur(14px); }
.demo-science::before { content: ''; display: block; height: 2px; border-radius: 2px 2px 0 0; background: linear-gradient(90deg, var(--science-accent, #7db4e8), transparent 72%); }
.demo-science__inner { padding: 12px 15px 14px; }
.demo-science__eyebrow { display: block; color: var(--science-accent, #7db4e8); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; }
.demo-science__title { display: block; margin-top: 3px; color: #f5f8ff; font-size: 16px; font-weight: 600; line-height: 1.3; }
.demo-science__body p { margin: 8px 0 0; color: #c3d0e2; font-size: 12.5px; line-height: 1.68; }
.demo-science__facts { margin: 10px 0 0; padding: 9px 0 0; border-top: 1px solid rgba(173, 194, 237, 0.16); list-style: none; }
.demo-science__facts li { position: relative; margin-top: 6px; padding-left: 14px; color: #aebbd0; font-size: 11.5px; line-height: 1.55; }
.demo-science__facts li::before { content: '▸'; position: absolute; left: 0; color: var(--science-accent, #7db4e8); }
.guide-overlay { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: 18px; background: rgba(2, 5, 14, 0.70); backdrop-filter: blur(8px); }
.guide-overlay__content { width: min(420px, 100%); border: 1px solid rgba(184, 217, 250, 0.35); border-radius: 7px; padding: 22px; background: #111c2d; box-shadow: 0 20px 52px rgba(0, 0, 0, 0.46); }
.guide-overlay h2 { margin: 4px 0 12px; color: #f5f8ff; font-size: 20px; }
.guide-overlay p { margin: 8px 0; color: #b7c7dc; font-size: 13px; line-height: 1.65; }
.guide-overlay button { min-height: 34px; margin-top: 12px; border: 1px solid rgba(190, 224, 255, 0.50); border-radius: 4px; padding: 0 12px; background: #24527a; color: #f1f8ff; cursor: pointer; }
.guide-overlay[hidden], .demo-camera-actions[hidden], .demo-exit[hidden], #demo-controls[hidden], #slingshot-telemetry[hidden], #demo-science[hidden] { display: none !important; }

@media (max-width: 600px) {
  .hud { top: 10px; left: 10px; width: min(288px, calc(100vw - 20px)); max-height: calc(100vh - 310px); padding: 13px; }
  .comparison-view { bottom: 8px; width: calc(100vw - 12px); grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .info-card { right: 10px; bottom: 10px; width: min(260px, calc(100vw - 20px)); }
  .demo-science { top: 10px; right: 10px; width: min(290px, calc(100vw - 20px)); max-height: calc(100vh - 180px); }
  .panel-reveal { top: 18px; }
}
