* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #05070d;
  color: #e8edf5;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

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

#title {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(to bottom, rgba(2, 5, 12, 0.9), transparent);
  z-index: 20;
}

#title h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

#sat-count {
  font-size: 0.8rem;
  color: #8fa3bf;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

#sidebar-toggle {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

#sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(79, 168, 255, 0.5);
}

#sidebar-toggle:active {
  transform: scale(0.94);
}

#sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: #e8edf5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#sidebar-toggle[aria-expanded="false"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

#sidebar-toggle[aria-expanded="false"] span:nth-child(2) {
  opacity: 0;
}

#sidebar-toggle[aria-expanded="false"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

#sidebar {
  position: fixed;
  top: 4.4rem;
  left: 1rem;
  width: 250px;
  max-height: calc(100vh - 6.2rem);
  overflow-y: auto;
  background: linear-gradient(165deg, rgba(16, 21, 34, 0.85), rgba(9, 12, 20, 0.85));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 1rem;
  z-index: 10;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#sidebar.collapsed {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-16px) scale(0.98);
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

#search {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#search::placeholder {
  color: #6b7d97;
}

#search:focus {
  outline: none;
  border-color: #4fa8ff;
  background: rgba(79, 168, 255, 0.08);
}

#legend {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  padding: 0.4rem 0.45rem;
  border-radius: 7px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.legend-item:has(input:not(:checked)) {
  opacity: 0.45;
}

.legend-item input {
  accent-color: #4fa8ff;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

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

.legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-count {
  margin-left: auto;
  color: #8fa3bf;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.sidebar-section-title {
  margin: 0.85rem 0 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7d97;
}

.hint {
  margin: 0.85rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  line-height: 1.4;
  color: #6b7d97;
}

#info-panel {
  position: fixed;
  top: 4.4rem;
  right: 1rem;
  width: 270px;
  background: linear-gradient(165deg, rgba(16, 21, 34, 0.9), rgba(9, 12, 20, 0.9));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  z-index: 10;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#info-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
}

#info-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  padding-right: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#info-panel dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.6rem;
  font-size: 0.8rem;
}

#info-panel dt {
  color: #8fa3bf;
}

#info-panel dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#info-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 6px;
  color: #8fa3bf;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

#info-close:hover {
  background: rgba(255, 80, 80, 0.18);
  color: #fff;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  background: radial-gradient(circle at 50% 40%, #0b1220 0%, #05070d 70%);
  z-index: 30;
  font-size: 0.9rem;
  color: #8fa3bf;
  transition: opacity 0.35s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #4fa8ff;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  #sidebar {
    width: calc(100vw - 2rem);
    max-height: 45vh;
  }

  #info-panel {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}
