@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600&family=Noto+Sans+SC:wght@300;400;500&display=swap");

:root {
  --bg-0: #000000;
  --bg-1: #000000;
  --text: #e8edf5;
  --muted: #a9b3c4;
  --line: #4a5364;
  --accent: #e8edf5;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
}

#labelLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

#labelLines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#labelItems {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.planet-label {
  position: absolute;
  transform: translate(-9999px, -9999px);
  padding: 3px 10px 3px 12px;
  border-radius: 0;
  border: none;
  background: var(--label-bg, rgba(35, 59, 110, 0.62));
  color: #edf3ff;
  font-family: "Plus Jakarta Sans", "Noto Sans SC", "Avenir Next", "Helvetica Neue", sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  text-transform: none;
  clip-path: polygon(0 50%, 9px 0, 100% 0, 100% 100%, 9px 100%);
  pointer-events: auto;
  cursor: pointer;
  transition: filter 160ms ease, opacity 160ms ease;
}

.planet-label.satellite {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: none;
  color: rgba(232, 238, 255, 0.96);
  font-weight: 400;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.72);
}

.planet-label.near {
  padding: 0;
  clip-path: none;
  border: none;
  background: transparent;
  box-shadow: none;
  color: rgba(233, 242, 255, 0.96);
  font-weight: 300;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.planet-label:hover {
  filter: brightness(1.18);
  opacity: 0.97;
}

.planet-label-line {
  stroke: rgba(179, 199, 255, 0.78);
  stroke-width: 1;
  stroke-linecap: round;
}

.satellite-label-line {
  stroke-width: 1.15;
  stroke-linejoin: round;
}

.topbar {
  position: fixed;
  z-index: 8;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(33vw, 560px);
  min-width: 420px;
  display: block;
}

.timescale {
  display: grid;
  grid-template-columns: auto 1fr 52px 32px;
  align-items: center;
  gap: 9px;
}

.timescale-label {
  white-space: nowrap;
  font-size: 13px;
  color: rgba(231, 237, 247, 0.82);
  letter-spacing: 0.03em;
}

.timescale input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 16px;
  background: transparent;
  --progress: 0%;
}

.timescale input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(238, 243, 251, 0.9) 0 var(--progress),
    rgba(206, 214, 228, 0.25) var(--progress) 100%
  );
}

.timescale input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  border: none;
  background: rgba(248, 251, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(210, 220, 236, 0.14);
}

.timescale input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 999px;
  background: rgba(206, 214, 228, 0.25);
}

.timescale input[type="range"]::-moz-range-progress {
  height: 2px;
  border-radius: 999px;
  background: rgba(238, 243, 251, 0.9);
}

.timescale input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(248, 251, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(210, 220, 236, 0.14);
}

input[type="range"] {
  accent-color: var(--accent);
}

#timeScaleNumber {
  width: 52px;
  border: none;
  background: transparent;
  color: rgba(233, 239, 248, 0.9);
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
  outline: none;
}

#timeScaleNumber::-webkit-outer-spin-button,
#timeScaleNumber::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#timeScaleNumber[type="number"] {
  -moz-appearance: textfield;
}

.icon-btn,
.fit-btn {
  border: none;
  background: transparent;
  color: rgba(236, 241, 248, 0.9);
  cursor: pointer;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.icon-btn:hover,
.fit-btn:hover {
  color: rgba(255, 255, 255, 1);
  filter: brightness(1.08);
}

.fit-btn {
  position: fixed;
  z-index: 8;
  top: 14px;
  right: 14px;
  padding: 4px 6px;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.focus-panel {
  position: fixed;
  z-index: 7;
  top: 58px;
  left: 14px;
  width: min(290px, calc(100vw - 28px));
  padding: 7px 9px;
  border: none;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.focus-panel.visible {
  opacity: 1;
  transform: translateY(0);
}

#focusData {
  color: rgba(226, 233, 245, 0.9);
  line-height: 1.28;
  font-size: 13px;
  letter-spacing: 0.01em;
  white-space: pre-line;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.66);
}

@media (max-width: 860px) {
  .topbar {
    left: 50%;
    width: calc(100vw - 22px);
    min-width: 0;
    top: 10px;
  }

  .timescale {
    grid-template-columns: auto 1fr 48px 30px;
    gap: 7px;
  }

  .timescale-label {
    font-size: 12px;
  }

  .focus-panel {
    top: 53px;
    left: 10px;
    width: min(264px, calc(100vw - 20px));
  }

  .fit-btn {
    top: 10px;
    right: 10px;
  }
}
