:root {
  --a: #3de0ff;
  --b: #ff5ad9;
  --ocean: #0e2a47;
  --land: #6f8f6a;
  --anti: #ffb238;
  --mirror: #25507a;
  --text: #e8eef6;
  --muted: #9fb0c3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #0b1a2e 0%, #03070d 70%);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#globe { position: fixed; inset: 0; cursor: grab; }
#globe:active { cursor: grabbing; }
#globe canvas { display: block; }

/* City labels */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.city {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-size: 11px;
  color: #f4f7fb;
  text-shadow: 0 0 3px #000, 0 0 2px #000, 0 1px 2px #000;
  will-change: transform;
  display: none;
}
.city::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  vertical-align: 1px;
}
.city.r1 { font-size: 12.5px; font-weight: 600; }
.city.r3 { font-size: 10.5px; color: #dfe6ee; }

/* Panels */
.card {
  position: fixed;
  background: rgba(8, 16, 28, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

#panel { top: 16px; left: 16px; width: 290px; }
#panel h1 { margin: 0 0 2px; font-size: 20px; letter-spacing: 0.2px; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 12px; }

.legend { list-style: none; margin: 0 0 10px; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.legend .mirror-row { display: none; }
body.mirror-on .legend .mirror-row { display: flex; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; border: 1px solid rgba(255, 255, 255, 0.2); }
.swatch.ocean { background: var(--ocean); }
.swatch.land { background: var(--land); }
.swatch.anti { background: var(--anti); }
.swatch.mirror { background: var(--mirror); }

.stats { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.stats b { color: var(--anti); }

.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--anti); }

#selection { right: 16px; bottom: 16px; width: 340px; }
#selection.hidden { display: none; }
.pt { padding: 4px 0 10px; }
.pt + .pt { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 10px; }
.pt-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.a { background: var(--a); box-shadow: 0 0 8px var(--a); }
.dot.b { background: var(--b); box-shadow: 0 0 8px var(--b); }
.coords { font-variant-numeric: tabular-nums; font-size: 15px; margin-top: 4px; }
.place { font-size: 14px; }
.place.land { color: #b8d8b2; }
.place.antiland { color: var(--anti); }
.place.ocean { color: #8fb7e0; }
.near { color: var(--muted); font-size: 12px; }

.buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
button {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, 0.16); }
button.ghost { background: transparent; }

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: rgba(3, 7, 13, 0.6);
  transition: opacity 0.4s;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading.error { color: #ff8a8a; }
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--anti);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  #panel { width: auto; right: 16px; padding: 10px 12px; }
  #panel .legend, #panel .stats { font-size: 12px; }
  #selection { left: 16px; width: auto; }
}
