:root {
  /* The default design (Star chart, themes.js), so the first paint matches. */
  --bg: #04060f;
  --ph: #f3e6c0;         /* the design's bright text colour */
  --ph-dim: rgba(196, 208, 240, 0.72);
  --ph-faint: rgba(196, 208, 240, 0.45);
  --ph-rgb: 243, 230, 192;
  --panel-rgb: 6, 9, 24;
  --shadow-rgb: 4, 6, 15;
  --accent: #9cc2ff;
  --shadow: 0 0 3px rgb(var(--shadow-rgb)), 0 0 6px rgb(var(--shadow-rgb)), 0 0 10px rgba(var(--shadow-rgb), 0.9);
  --mono: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif; /* the design's font */
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ph-dim); font: 12px/1.35 var(--mono); }
html { transition: background-color 300ms; }
body { position: fixed; inset: 0; overflow: hidden; }

#map { position: absolute; inset: 0; touch-action: none; cursor: grab; outline: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#map.dragging { cursor: grabbing; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; contain: strict; }

/* Callouts are the only HTML labels; everything else is GPU text. */
.callout { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; width: max-content;
  padding: 4px 7px; background: rgba(var(--panel-rgb), 0.78); border: 1px solid rgba(var(--ph-rgb), 0.28);
  border-radius: 3px; color: var(--ph); text-shadow: 0 0 6px rgba(var(--ph-rgb), 0.35); will-change: transform;
  transition: opacity 1.1s ease; }
.callout.gone { opacity: 0; }
.callout.al-l { translate: 0 -50%; }
.callout.al-r { translate: -100% -50%; text-align: right; }
.callout .cap { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ph-dim); }
.callout .ip { font-size: 13px; }
.callout .meta { font-size: 10.5px; color: var(--ph-dim); }
.callout.sel { border-color: var(--accent); }

/* Visitor count and what this is: fixed on the zoomed-out page, left of or above the square (main.js layout). */
#hud { position: absolute; left: 0; top: 0; pointer-events: none; text-shadow: var(--shadow); will-change: transform; }
#count b { display: block; color: var(--ph); font-weight: 600; font-size: 28px; letter-spacing: 0.02em; line-height: 1.1;
  text-shadow: 0 0 10px rgba(var(--ph-rgb), 0.45), var(--shadow); }
#count span { color: var(--ph-dim); }
#hud.above #count b { display: inline; font-size: 20px; }
#hud.above #count span { margin-left: 4px; }
#note { margin-top: 4px; color: var(--ph-faint); font-size: 11px; }
#about { margin: 10px 0 0; color: var(--ph-faint); font-size: 11px; line-height: 1.45;
  text-wrap: pretty; pointer-events: auto; }
#privacy { margin: 10px 0 0; color: var(--ph-faint); font-size: 11px; line-height: 1.45; pointer-events: auto; }
#privacy h2 { margin: 0 0 2px; color: var(--ph-dim); font-size: 11px; font-weight: 600; }
#privacy p { margin: 0; text-wrap: pretty; }
/* A border, not text-decoration: Safari misplaces underlines under stacked text-shadows. */
#settings label { display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ph-dim); white-space: nowrap; }
#hud-opts { display: flex; gap: 8px; align-items: center; width: max-content; margin-top: 12px; cursor: pointer;
  color: var(--ph-dim); font-size: 11px; pointer-events: auto; }
#hud-opts:hover { color: var(--ph); }
#credit { margin: 12px 0 0; color: var(--ph-faint); font-size: 11px; pointer-events: auto; }
#about a { color: var(--ph-dim); text-decoration: none; white-space: nowrap; border-bottom: 1px solid rgba(var(--ph-rgb), 0.35); }
#credit a { color: var(--ph-dim); text-decoration: none; border-bottom: 1px solid rgba(var(--ph-rgb), 0.35); }
#about a:hover, #about a:focus-visible, #credit a:hover, #credit a:focus-visible { color: var(--ph); border-bottom-color: currentColor; }

#buttons { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; }
#buttons button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
  color: var(--ph-dim); background: rgba(var(--panel-rgb), 0.8); border: 1px solid rgba(var(--ph-rgb), 0.22); border-radius: 50%;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#buttons button:hover, #buttons button:focus-visible, #cog[aria-expanded="true"] { color: var(--ph); border-color: rgba(var(--ph-rgb), 0.5); }
#buttons svg { width: 18px; height: 18px; transition: transform 300ms; }
#cog[aria-expanded="true"] svg { transform: rotate(60deg); }

#settings { position: fixed; right: calc(max(12px, env(safe-area-inset-right)) + 46px); bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; background: rgba(var(--panel-rgb), 0.9);
  border: 1px solid rgba(var(--ph-rgb), 0.22); border-radius: 6px; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
/* Checkboxes in the phosphor style: a thin outlined square that lights up. */
input.check { appearance: none; -webkit-appearance: none; flex: none; width: 14px; height: 14px; margin: 0;
  border: 1px solid rgba(var(--ph-rgb), 0.42); border-radius: 3px; background: rgba(var(--panel-rgb), 0.6) center / 10px 10px no-repeat;
  cursor: pointer; transition: background-color 150ms, border-color 150ms, box-shadow 150ms; }
input.check:checked { border-color: var(--ph); background-color: rgba(var(--ph-rgb), 0.14);
  box-shadow: 0 0 6px rgba(var(--ph-rgb), 0.35); }
label:hover input.check { border-color: var(--ph); }
input.check:checked::after { content: ""; display: block; width: 100%; height: 100%; background: var(--ph);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.6 7.2l2.2 2.2 4.6-4.8' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.6 7.2l2.2 2.2 4.6-4.8' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }
input.check:focus-visible { outline: 1px solid var(--ph); outline-offset: 2px; }
#settings button, #settings a { font: inherit; text-transform: inherit; color: var(--ph-dim); background: none; border: 0; padding: 0; text-align: left;
  cursor: pointer; text-decoration: none; }
#settings button:hover, #settings a:hover, #settings label:hover { color: var(--ph); }
#replay.on { color: var(--ph); }

/* Replay: the date, running totals and new addresses per week, top centre. */
#replay-hud { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); translate: -50% 0;
  width: min(360px, calc(100vw - 24px)); padding: 10px 14px 8px; text-align: center; background: rgba(var(--panel-rgb), 0.82);
  border: 1px solid rgba(var(--ph-rgb), 0.22); border-radius: 6px; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#rp-date { color: var(--ph); font-size: 22px; font-weight: 600; letter-spacing: 0.03em; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(var(--ph-rgb), 0.45); }
#rp-stats { margin-top: 2px; color: var(--ph-dim); font-variant-numeric: tabular-nums; }
#rp-stats b { color: var(--ph); font-weight: 600; }
#rp-new { display: block; color: var(--ph-faint); font-size: 11px; }
#rp-new.burst { color: var(--ph); }
#rp-hist { display: block; width: 100%; height: 34px; margin-top: 8px; cursor: ew-resize; touch-action: none; border-radius: 2px; }
#rp-hist:focus-visible { outline: 1px solid rgba(var(--ph-rgb), 0.6); outline-offset: 3px; }
#rp-stop { margin-top: 6px; font: inherit; font-size: 11px; color: var(--ph-faint); background: none; border: 0; padding: 2px 6px; cursor: pointer; }
#rp-stop:hover, #rp-stop:focus-visible { color: var(--ph); }

#error { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--ph-dim); }

/* Design switcher: one named row per design, with its key. */
#designs { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; margin-top: 2px;
  border-top: 1px solid rgba(var(--ph-rgb), 0.15); }
#designs span { margin-bottom: 2px; color: var(--ph-faint); }
#designs button { display: flex; align-items: center; gap: 8px; padding: 3px 6px 3px 2px; margin-left: -2px;
  border: 1px solid transparent; border-radius: 4px; white-space: nowrap; }
#designs kbd { width: 16px; font: inherit; font-size: 10px; text-align: center; color: var(--ph-faint); }
#designs button[aria-pressed="true"] { color: var(--ph); border-color: rgba(var(--ph-rgb), 0.45); background: rgba(var(--ph-rgb), 0.12); }

/* Designs with hand lettering in capitals (XKCD). */
#hud, #replay-hud, #settings, .callout { text-transform: var(--case, none); }
