:root {
  --bg: #05070f;
  --fg: #e8ecf8;
  --dim: #9aa3c0;
  --accent: #8fb4ff;
  --glass: rgba(13, 18, 38, 0.62);
  --border: rgba(143, 180, 255, 0.16);
  --radius: 14px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

#space { position: fixed; inset: 0; display: block; }

.hidden { display: none !important; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 落地页 ---------- */
#landing {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 42%, rgba(20, 30, 70, 0.35), rgba(4, 6, 14, 0.88) 70%);
  overflow-y: auto;
  transition: opacity .6s ease;
}
#landing.fade-out { opacity: 0; pointer-events: none; }
.landing-inner { text-align: center; padding: 40px 20px; max-width: 640px; }

.brand { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 24px rgba(120, 160, 255, .6)); }

#landing h1 {
  margin-top: 14px;
  font-size: 44px; letter-spacing: 14px; text-indent: 14px; font-weight: 600;
  background: linear-gradient(105deg, #cfe0ff 20%, #ffe9c4 45%, #9fb8ff 75%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin-top: 6px; letter-spacing: 6px; color: var(--dim); font-size: 13px; text-transform: uppercase; }
.desc { margin-top: 22px; color: var(--dim); line-height: 1.9; font-size: 15px; }

#launch-form { margin-top: 30px; }
.input-row { display: flex; gap: 10px; justify-content: center; }
#username {
  width: min(320px, 68vw); padding: 13px 18px; font-size: 16px;
  color: var(--fg); background: rgba(255,255,255,.05);
  border: 1px solid var(--border); border-radius: 999px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#username:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(143,180,255,.15); }
#go {
  padding: 13px 26px; font-size: 16px; border-radius: 999px; cursor: pointer;
  color: #06122e; font-weight: 600; border: none;
  background: linear-gradient(120deg, #b8ccff, #ffe3ae);
  transition: transform .15s, box-shadow .15s;
}
#go:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(160, 190, 255, .35); }

.examples { margin-top: 16px; color: var(--dim); font-size: 13px; }
.chip {
  margin: 0 3px; padding: 4px 12px; font-size: 13px; cursor: pointer;
  color: var(--accent); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
}
.chip:hover { background: rgba(143,180,255,.12); }

#token-box { margin-top: 22px; text-align: left; color: var(--dim); font-size: 13px; }
#token-box summary { cursor: pointer; text-align: center; color: #6f7a9c; }
#token-box[open] summary { margin-bottom: 10px; }
#token { width: 100%; padding: 10px 14px; font-size: 13px; color: var(--fg); background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 8px; outline: none; }
#token-box .hint { margin-top: 8px; line-height: 1.7; color: #6f7a9c; }

.foot { margin-top: 34px; font-size: 12px; color: #5c6685; }

/* ---------- 加载 / 错误 ---------- */
#loading, #error {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(4, 6, 14, .82); backdrop-filter: blur(4px);
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(143,180,255,.18); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: var(--dim); font-size: 14px; letter-spacing: 1px; }
#error-text { color: #ffb3a7; font-size: 15px; max-width: 80vw; text-align: center; line-height: 1.8; }
#error-back { padding: 8px 22px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.06); color: var(--fg); cursor: pointer; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }

#stats {
  position: absolute; top: 16px; left: 16px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.stat {
  min-width: 130px; padding: 10px 14px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px);
}
.stat .k { display: block; font-size: 11px; color: var(--dim); letter-spacing: 1px; }
.stat .v { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; }

#profile-card {
  position: absolute; top: 16px; right: 16px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(10px);
}
#p-avatar { width: 38px; height: 38px; border-radius: 50%; background: #101830; }
#p-name { font-size: 14px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#p-login { font-size: 12px; color: var(--dim); }

#actions {
  position: absolute; bottom: 22px; right: 16px;
  display: flex; gap: 8px;
}
#actions button {
  padding: 9px 16px; font-size: 13px; cursor: pointer;
  color: var(--fg); background: var(--glass);
  border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(10px); transition: background .15s;
}
#actions button:hover { background: rgba(143,180,255,.18); }

#hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: #6f7a9c; font-size: 12px; letter-spacing: 2px; white-space: nowrap;
}

#arms-card {
  position: absolute; left: 16px; bottom: 22px; max-width: 240px;
  padding: 12px 16px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px);
}
.arms-title { font-size: 11px; color: var(--dim); letter-spacing: 2px; margin-bottom: 8px; }
#arms { list-style: none; }
#arms li {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 3px 0; color: #cdd6ee;
}
#arms .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
#arms .n { margin-left: auto; color: var(--dim); font-size: 12px; }

/* ---------- 星点悬浮提示 ---------- */
#tooltip {
  position: fixed; z-index: 40; max-width: 300px; padding: 10px 13px;
  background: rgba(10, 14, 30, .92); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; line-height: 1.7; pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
#tooltip .t-repo { color: var(--accent); }
#tooltip .t-msg { color: #cdd6ee; word-break: break-all; }
#tooltip .t-date { color: #6f7a9c; }

/* ---------- 旋臂标签 / 年份环标签 ---------- */
.arm-label {
  position: fixed; z-index: 5; transform: translate(-50%, -50%);
  font-size: 12px; letter-spacing: 1px; color: #aab8dd; pointer-events: none;
  text-shadow: 0 0 12px rgba(0,0,0,.9), 0 0 4px rgba(0,0,0,.9);
  white-space: nowrap;
  transition: opacity .25s;
}
.arm-label .cnt { color: #5c6685; font-size: 11px; }

.ring-label {
  position: fixed; z-index: 4; transform: translate(-50%, -50%);
  font-size: 11px; letter-spacing: 1px; color: #56639b; pointer-events: none;
  text-shadow: 0 0 10px rgba(0,0,0,.9), 0 0 4px rgba(0,0,0,.9);
  white-space: nowrap;
}
.ring-label.now { color: #8fa3d4; font-size: 12px; }

/* ---------- 银河判词 ---------- */
#verdict {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  max-width: min(44vw, 560px); text-align: center;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); padding: 10px 18px;
}
#verdict-badge {
  display: inline-block; font-size: 14px; font-weight: 600; letter-spacing: 2px;
  color: #ffe3ae; background: rgba(255, 214, 110, 0.1);
  border: 1px solid rgba(255, 214, 110, 0.35); border-radius: 999px;
  padding: 3px 14px;
}
#verdict-line { margin-top: 7px; font-size: 12px; line-height: 1.7; color: #aab8dd; min-height: 20px; }

/* ---------- 时间旅行 ---------- */
#timeline {
  position: absolute; bottom: 106px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(10px);
}
.tl-icon { font-size: 14px; }
#tl-range {
  width: min(320px, 42vw); accent-color: #8fb4ff; cursor: ew-resize;
}
#tl-year {
  font-size: 12px; color: #ffe3ae; letter-spacing: 1px; min-width: 52px; text-align: center;
}

/* ---------- 生物钟卡片 ---------- */
#clock-card {
  position: absolute; left: 16px; top: 176px;
  padding: 12px 14px 10px;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); text-align: center;
}
#clock { display: block; width: 150px; height: 150px; }
.clock-title { margin-top: 6px; font-size: 11px; color: var(--dim); letter-spacing: 2px; }
.clock-meta { margin-top: 3px; font-size: 12px; color: #cdd6ee; }

/* ---------- 颜色模式切换 ---------- */
#mode-switch {
  position: absolute; bottom: 68px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(10px);
}
#mode-switch .mode-label { font-size: 11px; color: var(--dim); letter-spacing: 2px; padding: 0 4px; }
#mode-switch button {
  padding: 5px 12px; font-size: 12px; cursor: pointer; border: none;
  color: var(--dim); background: transparent; border-radius: 999px;
  transition: background .15s, color .15s;
}
#mode-switch button:hover { color: var(--fg); }
#mode-switch button.active { color: #06122e; font-weight: 600; background: linear-gradient(120deg, #b8ccff, #ffe3ae); }

/* 图例交互 */
#arms li { cursor: pointer; border-radius: 6px; padding: 3px 6px; transition: opacity .2s, background .15s; }
#arms li:hover { background: rgba(143,180,255,.12); }
#arms li.active { background: rgba(143,180,255,.18); }
#arms li.dimmed { opacity: 0.25; }
#arms .lang { color: #5c6685; font-size: 11px; }
.arms-title .click-tip { color: #5c6685; font-size: 10px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 50; left: 50%; top: 24px; transform: translateX(-50%);
  padding: 10px 22px; border-radius: 999px;
  background: rgba(20, 28, 56, .95); border: 1px solid var(--border);
  font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}

@media (max-width: 640px) {
  #landing h1 { font-size: 34px; letter-spacing: 8px; text-indent: 8px; }
  #stats { grid-template-columns: 1fr 1fr; }
  .stat { min-width: 120px; padding: 8px 10px; }
  #arms-card { display: none; }
  .arm-label { display: none !important; }
  .ring-label { display: none !important; }
  #clock-card { display: none; }
  #mode-switch { bottom: 58px; }
  #timeline { bottom: 100px; padding: 5px 10px; }
  #tl-range { width: 40vw; }
  #verdict { max-width: 92vw; top: auto; bottom: 158px; padding: 8px 12px; }
  #verdict-line { font-size: 11px; }
  #hint { display: none; }
  #actions { bottom: 16px; }
  #actions button { padding: 8px 12px; font-size: 12px; }
  #p-name { max-width: 90px; }
}
