:root {
  --bg: #05070f;
  --glass: rgba(12, 18, 36, 0.62);
  --glass-border: rgba(140, 180, 255, 0.16);
  --text: #e8eefc;
  --muted: #8b9bb8;
  --accent: #6eb6ff;
  --accent-2: #c9a4ff;
  --warm: #ffb45c;
  --success: #5dffa8;
  --danger: #ff6b7a;
  --radius: 16px;
  --font: "Outfit", "Segoe UI", "PingFang SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

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

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

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

/* Top bar */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #fff6c8, #ffb020 45%, #ff6a00 70%, transparent 72%),
    radial-gradient(circle at 50% 50%, rgba(255, 160, 40, 0.5), transparent 70%);
  box-shadow: 0 0 24px rgba(255, 160, 40, 0.55);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: 0.95rem;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.top-stats {
  display: flex;
  gap: 1.5rem;
  pointer-events: auto;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.55);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 88px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.accent {
  color: var(--accent);
}

/* Panels */
.panel {
  position: absolute;
  z-index: 10;
  width: min(300px, calc(100vw - 1.5rem));
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem 1.15rem;
  max-height: calc(100vh - 8.5rem);
  overflow: auto;
}

.panel-left {
  top: 5.2rem;
  left: 1.1rem;
}

.panel-right {
  top: 5.2rem;
  right: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-title {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
  font-weight: 500;
}

.control-block {
  margin-bottom: 1.15rem;
}

.control-block:last-child {
  margin-bottom: 0;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

/* Range */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a2744, #3d6cff 40%, #c9a4ff);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(110, 182, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.4);
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 0 0 4px rgba(110, 182, 255, 0.25);
}

.speed-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.chip {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}

.chip:hover,
.chip.active {
  background: rgba(110, 182, 255, 0.18);
  border-color: rgba(110, 182, 255, 0.45);
  color: var(--accent);
}

/* Toggles */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  color: var(--text);
}

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid var(--glass-border);
}

.switch .slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #c5d0e6;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: rgba(110, 182, 255, 0.35);
  border-color: rgba(110, 182, 255, 0.5);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
  background: #fff;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn:hover {
  background: rgba(110, 182, 255, 0.15);
  border-color: rgba(110, 182, 255, 0.4);
}

.hint {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Body list */
.body-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 42vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.body-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
  width: 100%;
}

.body-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.body-item.active {
  background: rgba(110, 182, 255, 0.12);
  border-color: rgba(110, 182, 255, 0.28);
}

.body-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 10px currentColor;
}

.body-item-name {
  font-size: 0.88rem;
  font-weight: 500;
}

.body-item-type {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.body-detail {
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--glass-border);
}

.detail-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.detail-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0.75rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.detail-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}

.detail-cell .k {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.detail-cell .v {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
}

/* Bottom */
.bottombar {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted);
}

.legend {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.2rem;
}

.dot.sun {
  background: var(--warm);
  box-shadow: 0 0 8px var(--warm);
}

.dot.planet {
  background: var(--accent);
}

.dot.moon {
  background: #c0c8d8;
}

.footer-note {
  opacity: 0.85;
}

/* Labels */
.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.label {
  position: absolute;
  transform: translate(-50%, -120%);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(232, 238, 252, 0.88);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(6, 10, 22, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.label.visible {
  opacity: 1;
}

.label.sun-label {
  color: #ffe0a0;
}

/* Scrollbar */
.panel::-webkit-scrollbar,
.body-list::-webkit-scrollbar {
  width: 6px;
}

.panel::-webkit-scrollbar-thumb,
.body-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

@media (max-width: 900px) {
  .panel {
    width: min(260px, calc(100vw - 1rem));
  }

  .panel-right {
    display: none;
  }

  .bottombar {
    flex-direction: column;
    gap: 0.25rem;
    border-radius: 14px;
    white-space: normal;
    text-align: center;
    max-width: calc(100% - 2rem);
  }

  .top-stats {
    gap: 0.8rem;
  }
}

@media (max-width: 640px) {
  .panel-left {
    top: auto;
    bottom: 5.5rem;
    left: 0.6rem;
    right: 0.6rem;
    width: auto;
    max-height: 40vh;
  }

  .brand-sub {
    display: none;
  }
}
