:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0b1220;
  --line: #243147;
  --text: #d7e3ee;
  --muted: #8aa0b5;
  --accent: #2ecc71;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 "Segoe UI", "Microsoft YaHei", sans-serif;
}
.atlas-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.atlas-heading { display: flex; align-items: center; gap: 22px; }
.back { color: var(--muted); text-decoration: none; white-space: nowrap; }
.back:hover { color: var(--accent); }
h1 { margin: 0; font-size: 19px; letter-spacing: 0.02em; }
h1 span { margin-left: 10px; font-size: 14px; font-weight: 400; color: var(--muted); }
.stats { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#search { display: flex; gap: 8px; margin-left: auto; }
input, button { font: inherit; color: var(--text); background: #111c2d; border: 1px solid var(--line); border-radius: 6px; }
input { width: 250px; min-width: 0; padding: 8px 10px; }
input::placeholder { color: var(--muted); }
button { padding: 7px 12px; cursor: pointer; white-space: nowrap; }
button:hover:enabled { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.45; cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input[aria-invalid="true"] { border-color: #e88181; }
#viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#view-mode { position: absolute; right: 16px; top: 12px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); font-size: 11px; pointer-events: none; }
#map { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#map.drag { cursor: grabbing; }
#world-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  padding: 10px 20px;
  border: 1px solid #60758e;
  border-radius: 8px;
  background: rgba(7, 11, 20, 0.94);
  color: #eef3fa;
  font: 600 24px/1.4 Consolas, monospace;
  pointer-events: none;
}
#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  color: var(--muted);
  background: var(--bg);
}
#loading[hidden] { display: none; }
.zoom-controls { position: absolute; right: 20px; bottom: 20px; display: flex; gap: 6px; }
.zoom-controls button { height: 38px; min-width: 38px; background: var(--panel); }
#tooltip {
  position: absolute;
  top: 16px;
  left: 16px;
  max-width: min(540px, calc(100% - 32px));
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 14, 26, 0.94);
  pointer-events: none;
  font-family: Consolas, "Microsoft YaHei", monospace;
  white-space: pre-line;
  line-height: 1.8;
  font-size: 12px;
}
#tooltip::first-line { color: #ffffff; font-weight: 600; font-size: 14px; }
.atlas-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 20px;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.legend { display: flex; align-items: center; gap: 8px; }
.legend i { width: 110px; height: 5px; border-radius: 4px; background: linear-gradient(90deg, #104e64, #2ecc71, #f1c40f, #e67e22, #e74c3c); }
.allocation-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; }
.allocation-legend span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: currentColor; border-radius: 2px; }
.apnic { color: #7cdfdc; } .arin { color: #91bbf5; } .ripe { color: #c2abed; }
.lacnic { color: #d6d188; } .afrinic { color: #efb08d; } .special { color: #8ee1b3; }
.multicast { color: #e9c181; } .reserved { color: #b3bdcf; }
.registry-note { width: 100%; font-size: 11px; color: var(--muted); }
.registry-note a { color: inherit; text-underline-offset: 3px; }
.registry-note a:hover { color: var(--text); }
@media (max-width: 700px) {
  .atlas-header { padding: 10px 14px; gap: 8px; }
  .atlas-heading { width: 100%; justify-content: space-between; gap: 10px; }
  h1 { font-size: 16px; }
  h1 span { font-size: 12px; margin-left: 6px; }
  .back { font-size: 12px; }
  #search { width: 100%; }
  #query { flex: 1; width: 0; }
  .atlas-footer { padding: 8px 14px; }
  #selection { width: 100%; }
  .note { font-size: 10px; }
  .legend i { width: 64px; }
  .zoom-controls { right: 14px; bottom: 14px; }
}
