/* 中国空间站 3D 展示 —— 界面样式 */

:root {
  --ink: #e8f1ff;
  --ink-dim: #93a7c4;
  --line: rgba(120, 180, 255, 0.22);
  --panel: rgba(8, 16, 30, 0.62);
  --accent: #4fb8ff;
  --accent-soft: rgba(79, 184, 255, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #02040a;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#stage.is-grabbing { cursor: grabbing; }

/* ---------- 标题 ---------- */
.title {
  position: fixed;
  top: 24px;
  left: 28px;
  z-index: 5;
  pointer-events: none;
}
.title h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}
.title p {
  margin: 6px 0 0;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ---------- 控制面板 ---------- */
.panel {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 5;
  width: 176px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--ink-dim);
}
.panel + .panel { margin-top: 12px; }

.btn {
  display: block;
  width: 100%;
  margin-bottom: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.1s;
}
.btn:last-child { margin-bottom: 0; }
.btn:hover {
  background: rgba(79, 184, 255, 0.3);
  border-color: rgba(120, 200, 255, 0.55);
}
.btn:active { transform: translateY(1px); }
.btn.is-off {
  background: rgba(120, 140, 170, 0.1);
  color: var(--ink-dim);
}

.views { display: flex; gap: 6px; }
.views .btn { margin-bottom: 0; padding: 8px 4px; font-size: 12px; letter-spacing: 0; }

/* ---------- 图例 ---------- */
.legend {
  position: fixed;
  left: 28px;
  bottom: 76px;
  z-index: 5;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-dim);
  max-width: 300px;
}
.legend b { color: var(--ink); font-weight: 600; }

/* ---------- 提示与状态 ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 5;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: opacity 0.5s;
}
.hint kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}
.hint.is-hidden { opacity: 0; pointer-events: none; }

.fps {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 1px;
  pointer-events: none;
}

/* ---------- 加载 / 降级 ---------- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #02040a;
  transition: opacity 0.6s;
}
.loading.is-hidden { opacity: 0; pointer-events: none; }
.loading .ring {
  width: 46px;
  height: 46px;
  border: 2px solid rgba(120, 180, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading p { margin: 0; font-size: 13px; letter-spacing: 3px; color: var(--ink-dim); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 必须显式压过下面的 display:flex —— 作者样式会覆盖 [hidden] 的 UA 默认值 */
.fallback[hidden] { display: none; }

.fallback {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  line-height: 1.9;
  background: #02040a;
  color: var(--ink-dim);
  font-size: 14px;
}

/* ---------- 窄屏适配 ---------- */
@media (max-width: 720px) {
  .title { top: 16px; left: 16px; }
  .title h1 { font-size: 19px; letter-spacing: 2px; }
  .title p { font-size: 11px; letter-spacing: 2px; }

  .panel {
    right: 12px;
    top: 12px;
    width: 132px;
    padding: 10px;
  }
  .btn { font-size: 12px; padding: 7px 6px; }

  .legend { display: none; }
  .hint {
    bottom: 14px;
    font-size: 11px;
    padding: 7px 12px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
  }
  .fps { bottom: 14px; right: 12px; font-size: 11px; }
}
