* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #eee4da;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#globe {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

[hidden] {
  display: none !important;
}

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  background: #000;
  padding: 16px;
}

#loading-text {
  margin: 0;
  max-width: 36em;
  white-space: pre-line;
}

#loading .bar {
  height: 4px;
  width: min(320px, 80vw);
  margin: 0 auto;
  background: #2a2320;
  border-radius: 2px;
  overflow: hidden;
}

#loading-bar {
  height: 100%;
  width: 0;
  background: #d9824a;
  transition: width 0.1s;
}

#panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 300px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(20, 14, 12, 0.78);
  border: 1px solid rgba(255, 200, 160, 0.15);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

#panel h1 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#panel label {
  font-size: 12px;
  color: #bfae9f;
}

.level-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.level-row input[type="number"] {
  width: 78px;
  padding: 3px 5px;
  color: inherit;
  background: #1d1714;
  border: 1px solid #4a3c34;
  border-radius: 4px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.unit {
  color: #bfae9f;
}

input[type="range"] {
  accent-color: #4fa3d9;
}

#exag {
  accent-color: #d9824a;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-block: 1px solid rgba(255, 200, 160, 0.12);
}

.stat strong {
  font-size: 20px;
  color: #7cc2ee;
  font-variant-numeric: tabular-nums;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.presets button {
  padding: 3px 8px;
  color: inherit;
  background: #2a211d;
  border: 1px solid #4a3c34;
  border-radius: 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.presets button:hover:not(:disabled) {
  background: #3a2d27;
}

.presets button:disabled {
  opacity: 0.5;
  cursor: default;
}

#panel label.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: inherit;
}

output {
  color: #eee4da;
}

.credit {
  margin: 4px 0 0;
  font-size: 11px;
  color: #8a7b70;
}

#hover {
  position: fixed;
  z-index: 2;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 6px 12px;
  background: rgba(20, 14, 12, 0.78);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* --- Layers ------------------------------------------------------------- */

#panel {
  z-index: 2;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

#panel h2 {
  margin: 6px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 200, 160, 0.12);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bfae9f;
}

#panel select {
  padding: 4px 6px;
  color: inherit;
  background: #1d1714;
  border: 1px solid #4a3c34;
  border-radius: 4px;
  font: inherit;
}

#opacity {
  accent-color: #9cc93c;
}

#legend {
  display: flex;
  flex-direction: column;
  max-height: 30vh;
  overflow-y: auto;
  margin: 0 -4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.legend-item:hover {
  background: #2a211d;
}

.legend-item.active {
  background: #3a2d27;
  font-weight: 600;
}

.legend-item i,
.chip i {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.hint {
  margin: 2px 0 0;
  font-size: 12px;
  color: #bfae9f;
}

/* --- Landmarks ---------------------------------------------------------- */

#labels {
  position: fixed !important;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.marker {
  position: relative;
  width: 9px;
  height: 9px;
  padding: 0;
  border: 1.5px solid #2a1a12;
  border-radius: 50%;
  background: #ffcf9a;
  cursor: pointer;
  pointer-events: auto;
}

.marker.group-vm {
  background: #6fe0d0;
}

.marker.group-southern {
  background: #d8e37a;
}

.marker.group-ocean {
  background: #9fd3f5;
}

.marker .label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #fbeee2;
  font: 12px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 1px #000;
}

.marker.minor .label {
  display: none;
}

#labels.zoomed .marker.minor .label,
.marker:hover .label,
.marker.selected .label {
  display: block;
}

.marker:hover,
.marker.selected {
  z-index: 1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 163, 217, 0.6);
}

.marker:hover .label,
.marker.selected .label {
  font-weight: 600;
  color: #fff;
}

/* --- Info panel --------------------------------------------------------- */

#info {
  position: fixed;
  z-index: 2;
  top: 16px;
  right: 16px;
  width: 360px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 14px 16px 16px;
  background: rgba(20, 14, 12, 0.86);
  border: 1px solid rgba(255, 200, 160, 0.15);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

#info-close {
  position: sticky;
  top: 0;
  float: right;
  width: 28px;
  height: 28px;
  margin: -6px -8px 0 8px;
  color: #bfae9f;
  background: #2a211d;
  border: 1px solid #4a3c34;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#info-close:hover {
  color: #fff;
}

#info h2 {
  margin: 0 0 2px;
  font-size: 19px;
  font-weight: 600;
}

#info h3 {
  margin: 14px 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #d9a67a;
}

#info p {
  margin: 4px 0;
}

#info .kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a7b70;
}

#info .coords {
  color: #bfae9f;
  font-variant-numeric: tabular-nums;
}

#info .object-notes {
  font-style: italic;
  color: #d9c7b6;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 5px;
  background: #2a211d;
  border: 1px solid #4a3c34;
  border-radius: 12px;
  font-size: 12px;
}

.weather {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0;
}

.weather dt {
  color: #bfae9f;
}

.weather dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.weather small {
  display: block;
  font-size: 11px;
  color: #8a7b70;
}

.notes {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #d9c7b6;
}

.notes li + li {
  margin-top: 2px;
}

#loading {
  z-index: 10;
}

@media (max-width: 640px) {
  #panel {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: 40vh;
  }

  #info {
    left: 16px;
    right: 16px;
    width: auto;
    max-height: calc(60vh - 48px);
  }

  #hover {
    display: none;
  }
}
