:root {
  --bg: #05070d;
  --panel: rgba(10, 14, 24, 0.78);
  --panel-solid: #0a0e18;
  --line: rgba(120, 160, 220, 0.16);
  --text: #d6e2f2;
  --dim: #7d8ea6;
  --dim2: #55637a;
  --accent: #6fb6ff;
  --warm: #ffbe6b;
  --rose: #ff8f7a;
  --jade: #5fd8b4;
  --violet: #a98cff;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
           "SimSun", Georgia, serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
          "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

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

#stage {
  position: fixed;
  inset: 0;
  display: block;
  cursor: grab;
  touch-action: none;
}
#stage.dragging { cursor: grabbing; }
#stage.picking { cursor: crosshair; }

/* ---------------------------------------------------- 顶栏 */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 14px 22px 10px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  pointer-events: none;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(5,7,13,0.92), rgba(5,7,13,0));
}

.brand {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: #e8f1ff;
  text-shadow: 0 0 24px rgba(111,182,255,0.35);
}
.brand .sub {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
}

.header-right {
  margin-left: auto;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  background: var(--panel);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 500; }
.chip.live::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--jade);
  margin-right: 6px;
  vertical-align: 1px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(95,216,180,0.6); }
  50% { opacity: 0.4; box-shadow: 0 0 0 5px rgba(95,216,180,0); }
}

/* ---------------------------------------------------- 左侧信息 */
#left {
  position: fixed;
  left: 22px;
  top: 92px;
  width: 264px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120,160,220,0.25) transparent;
}
#left::-webkit-scrollbar { width: 4px; }
#left::-webkit-scrollbar-thumb {
  background: rgba(120,160,220,0.25);
  border-radius: 2px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  backdrop-filter: blur(10px);
}
.card h3 {
  margin: 0 0 9px;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card h3 .tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--dim2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
}
.card h3 .tag.real { color: var(--jade); border-color: rgba(95,216,180,0.35); }
.card h3 .tag.calc { color: var(--violet); border-color: rgba(169,140,255,0.35); }

.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
}
.kv .k { color: var(--dim); flex-shrink: 0; }
.kv .v { font-family: var(--mono); color: var(--text); text-align: right; }
.kv .v.big { font-size: 15px; }

.dropcap {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.72;
  color: #b9c8dd;
}
.dropcap .lit { color: var(--warm); }

.phase-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 4px;
}
.phase-disc {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset -4px -2px 8px rgba(0,0,0,0.85), 0 0 12px rgba(255,240,210,0.18);
}

.mansion-name {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  color: #f0e6d2;
  letter-spacing: 0.05em;
}
.mansion-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 5px;
}
.mansion-sym {
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
}

/* ---------------------------------------------------- 右下控制 */
#controls {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

button {
  font-family: var(--mono);
  font-size: 11px;
  padding: 7px 11px;
  background: var(--panel);
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
button:hover { color: var(--text); border-color: rgba(120,160,220,0.34); }
button.on {
  color: #04101c;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
button.warn.on {
  background: var(--warm);
  border-color: var(--warm);
}

/* ---------------------------------------------------- 时间轴 */
#timeline {
  position: fixed;
  left: 22px;
  right: 22px;
  bottom: 22px;
  z-index: 18;
  max-width: calc(100vw - 380px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 16px 13px;
  backdrop-filter: blur(10px);
}
#timeline.hidden { display: none; }

.tl-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.tl-time {
  font-family: var(--mono);
  font-size: 15px;
  color: #e9f2ff;
  letter-spacing: 0.04em;
}
.tl-date { font-size: 11px; color: var(--dim); font-family: var(--mono); }
.tl-now {
  margin-left: auto;
  font-size: 10px;
  color: var(--dim2);
  font-family: var(--mono);
}

.tl-track {
  position: relative;
  height: 30px;
  cursor: pointer;
}
.tl-track svg { display: block; width: 100%; height: 100%; }

#tl-cursor {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  pointer-events: none;
}
#tl-handle {
  position: absolute;
  top: -5px;
  width: 11px; height: 11px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(111,182,255,0.9);
  pointer-events: none;
}

.tl-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim2);
  margin-top: 3px;
}

/* ---------------------------------------------------- 卫星列表 */
#sats-panel {
  position: fixed;
  right: 22px;
  top: 92px;
  width: 296px;
  max-height: calc(100vh - 210px);
  z-index: 15;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#sats-panel.show { display: flex; }

.sats-head {
  padding: 12px 14px 9px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sats-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--text);
  font-weight: 500;
}
.sats-head .n { font-family: var(--mono); font-size: 11px; color: var(--jade); }

.sats-body {
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(120,160,220,0.25) transparent;
}
.sats-body::-webkit-scrollbar { width: 4px; }
.sats-body::-webkit-scrollbar-thumb { background: rgba(120,160,220,0.25); }

.sat {
  padding: 7px 14px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.12s;
}
.sat:hover { background: rgba(111,182,255,0.06); }
.sat.vis { border-left-color: var(--jade); }
.sat.dark { opacity: 0.45; }
.sat .nm {
  font-size: 12px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sat .nm .al { font-family: var(--mono); color: var(--jade); font-size: 11px; }
.sat .meta {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim2);
  margin-top: 2px;
}

.pass-item {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(120,160,220,0.07);
  cursor: pointer;
}
.pass-item:hover { background: rgba(111,182,255,0.06); }
.pass-item .t {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--warm);
}
.pass-item .d {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim2);
  margin-top: 2px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 11px;
}
.tabs button.on {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
  font-weight: 500;
}

/* ---------------------------------------------------- 详情浮层 */
#detail {
  position: fixed;
  z-index: 30;
  width: 292px;
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid rgba(120, 160, 220, 0.28);
  border-radius: 11px;
  padding: 14px 16px;
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  display: none;
}
#detail.show { display: block; }
#detail .d-title {
  font-family: var(--serif);
  font-size: 19px;
  color: #f2f7ff;
  margin-bottom: 2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
#detail .d-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim2);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}
#detail .d-body { font-size: 11.5px; line-height: 1.65; color: #b9c8dd; }
#detail .d-close {
  position: absolute;
  top: 10px; right: 12px;
  cursor: pointer;
  color: var(--dim2);
  font-size: 15px;
  line-height: 1;
  padding: 2px;
}
#detail .d-close:hover { color: var(--text); }
#detail .d-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--dim2);
  line-height: 1.6;
}

/* ---------------------------------------------------- 底部提示 */
#hint {
  position: fixed;
  left: 50%;
  bottom: 130px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim2);
  letter-spacing: 0.06em;
  pointer-events: none;
  z-index: 12;
  text-align: center;
  transition: opacity 0.6s;
}

/* ---------------------------------------------------- 加载层 */
#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  transition: opacity 0.7s;
}
#boot.gone { opacity: 0; pointer-events: none; }
.boot-title {
  font-family: var(--serif);
  font-size: 34px;
  letter-spacing: 0.4em;
  color: #dce8fa;
  text-indent: 0.4em;
}
.boot-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim2);
  letter-spacing: 0.12em;
  min-height: 16px;
}
.boot-bar {
  width: 190px;
  height: 1px;
  background: rgba(120,160,220,0.16);
  position: relative;
  overflow: hidden;
}
.boot-bar i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 30%;
  background: var(--accent);
  animation: slide 1.5s ease-in-out infinite;
}
@keyframes slide {
  0% { left: -35%; }
  100% { left: 105%; }
}

/* ---------------------------------------------------- 移动端 */
@media (max-width: 860px) {
  .brand h1 { font-size: 19px; letter-spacing: 0.15em; }
  .brand .sub { font-size: 9px; }
  #left {
    top: auto;
    bottom: 128px;
    left: 12px;
    width: calc(100% - 24px);
    max-height: 34vh;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
  }
  #left .card { min-width: 210px; flex-shrink: 0; }
  #timeline {
    left: 12px; right: 12px; bottom: 12px;
    max-width: none;
    padding: 9px 12px 10px;
  }
  #sats-panel {
    right: 12px; left: 12px; width: auto;
    top: auto; bottom: 150px;
    max-height: 46vh;
  }
  #controls { right: 12px; bottom: 100px; }
  #hint { display: none; }
  .tl-time { font-size: 13px; }
}
