/* ============================================================
   星海图志 · 视觉层
   ============================================================ */
:root {
  --void: #05070d;
  --ink: #e9e6dc;
  --ink-2: #b9b8af;
  --dim: #7d8597;
  --dim-2: #565d6d;
  --amber: #d9a05b;
  --cyan: #7fb6bd;
  --line: rgba(233, 230, 220, 0.13);
  --line-2: rgba(233, 230, 220, 0.07);
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

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

html, body {
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; cursor: grab; }
#stage canvas.is-grabbing { cursor: grabbing; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }

/* ---------- 天体标签 ---------- */
.label {
  position: fixed;
  left: 0; top: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 5px;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  opacity: 1;
  transition: color 0.25s ease;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
  will-change: transform;
}
.label .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px rgba(217, 160, 91, 0.9);
  flex: none;
}
.label .en {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.label:hover { color: #fff; }
.label:hover .en { color: var(--amber); }
.label.is-active { color: var(--amber); }
.label.is-active .dot { background: #fff; box-shadow: 0 0 10px #fff; }

.label--moon { font-size: 10px; color: var(--ink-2); padding: 3px 6px; }
.label--moon .dot { width: 2px; height: 2px; background: var(--cyan); box-shadow: 0 0 5px rgba(127, 182, 189, 0.8); }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 5; pointer-events: none; }
.hud--tl { left: 40px; top: 34px; }
.hud--tr {
  right: 40px; top: 34px;
  text-align: right;
  pointer-events: auto;
  transition: right 0.62s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
body.panel-open .hud--tr { right: 470px; }

.brand { display: flex; align-items: baseline; gap: 12px; }
.brand__mark {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.3em;
  color: var(--ink);
}
.brand__sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--dim);
}
.brand__line {
  margin-top: 12px;
  font-size: 11px;
  line-height: 1.9;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.mono { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-2); }
.mono--dim { color: var(--dim-2); margin-top: 6px; }

.ghost {
  margin-top: 16px;
  padding: 7px 14px;
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.25s ease;
}
.ghost:hover { color: var(--ink); border-color: rgba(233, 230, 220, 0.34); }

.hint {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 4;
  color: var(--dim-2);
  font-size: 10px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.credit {
  position: fixed;
  left: 40px;
  bottom: 26px;
  z-index: 4;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim-2);
  pointer-events: none;
}

/* ---------- 底部索引 ---------- */
.chips {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: min(920px, 92vw);
}
.chip {
  padding: 7px 13px;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--dim);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.22s ease, border-color 0.22s ease;
}
.chip:hover { color: var(--ink-2); }
.chip.is-active { color: var(--amber); border-bottom-color: var(--amber); }

/* ---------- 档案面板 ---------- */
.panel {
  position: fixed;
  right: 0; top: 0;
  z-index: 8;
  width: min(430px, 92vw);
  height: 100%;
  padding: 46px 38px 60px;
  background: linear-gradient(180deg, rgba(6, 9, 16, 0.94), rgba(6, 9, 16, 0.97));
  backdrop-filter: blur(14px);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(101%);
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}
.panel.is-open { transform: translateX(0); }
.panel::-webkit-scrollbar { width: 2px; }
.panel::-webkit-scrollbar-thumb { background: var(--line); }

.panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.panel__kind {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--amber);
}
.panel__close {
  width: 26px; height: 26px;
  background: none; border: 0;
  color: var(--dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}
.panel__close:hover { color: var(--ink); }

.panel__title {
  font-family: var(--serif);
  font-size: 33px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.panel__title span {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
}

.rule { height: 1px; background: var(--line); margin: 20px 0; }
.rule-v {
  position: fixed;
  left: 0; right: 0;
  bottom: 66px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2) 18%, var(--line-2) 82%, transparent);
  z-index: 2;
  pointer-events: none;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.stat span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim-2);
  margin-bottom: 5px;
}
.stat b {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.panel__desc {
  margin-top: 22px;
  font-size: 13px;
  line-height: 2.1;
  color: var(--ink-2);
  letter-spacing: 0.03em;
  text-align: justify;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.panel__sub {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.missions { list-style: none; }
.missions li { padding: 15px 0; border-bottom: 1px solid var(--line-2); }
.missions li:last-child { border-bottom: 0; }
.m__head { display: flex; align-items: baseline; gap: 9px; }
.m__head b { font-family: var(--serif); font-size: 15px; font-weight: 400; letter-spacing: 0.06em; }
.m__head i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim-2);
}
.m__head em {
  margin-left: auto;
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  color: var(--amber);
}
.missions p { margin-top: 8px; font-size: 12px; line-height: 1.9; color: var(--ink-2); }
.m__agency {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--dim-2);
}

/* ---------- 氛围层 ---------- */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 42%, rgba(3, 5, 9, 0.55) 100%),
    radial-gradient(60% 50% at 50% 110%, rgba(217, 160, 91, 0.05), transparent 70%);
}

/* ---------- 加载层 ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--void);
  transition: opacity 0.9s ease 0.15s, visibility 0.9s ease 0.15s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__inner { text-align: center; }
.loader__title {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--ink);
}
.loader__note {
  display: block;
  margin-top: 18px;
  color: var(--dim-2);
  font-size: 9.5px;
  letter-spacing: 0.26em;
}
.loader__bar {
  width: 132px;
  height: 1px;
  margin: 22px auto 0;
  background: var(--line);
  overflow: hidden;
}
.loader__bar i {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--amber);
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(340%); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .hud--tl { left: 20px; top: 22px; }
  .hud--tr { right: 20px; top: 22px; }
  .brand__mark { font-size: 17px; letter-spacing: 0.22em; }
  .brand__line { display: none; }
  .panel { width: 100%; padding: 34px 24px 50px; }
  .panel__title { font-size: 27px; }
  .hint { display: none; }
  .credit { display: none; }
  body.panel-open .hud--tr { right: 20px; opacity: 0; }
  .hud--tr #readout, .hud--tr #distance { display: none; }
  .ghost { margin-top: 0; padding: 6px 10px; font-size: 10px; }
  .chips { bottom: 18px; gap: 0; }
  .chip { padding: 6px 9px; font-size: 10.5px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
}
