: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; }
#dev-mode { margin: 8px 0 0; font-size: 11px; pointer-events: auto; }
#dev-mode a { color: var(--ph-faint); }
/* Which map: IPv4 or IPv6. The current one is plain text, the other a link. */
#family { margin: 6px 0 0; color: var(--ph-faint); font-size: 11px; pointer-events: auto; }
#family a { color: var(--ph-dim); text-decoration: none; border-bottom: 1px solid rgba(var(--ph-rgb), 0.35); }
#family a:hover, #family a:focus-visible { color: var(--ph); border-bottom-color: currentColor; }
#family a[aria-current] { color: var(--ph); border-bottom-color: transparent; pointer-events: none; }
#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, #dev-mode a:hover { color: var(--ph); border-bottom-color: currentColor; }

/* Map controls, like a maps app: small rounded cards of icon buttons at the
   edge of the map, always on screen. Layers and designs top right, replay and
   locate bottom right. A toggle that is on lights up in the design's accent. */
/* #controls is fixed, so the settings panel is placed against it. */
#controls { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  display: flex; flex-direction: column; gap: 10px; }
#buttons { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
.ctl-group { display: flex; flex-direction: column; overflow: hidden; background: rgba(var(--panel-rgb), 0.82);
  border: 1px solid rgba(var(--ph-rgb), 0.2); border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.ctl { position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  color: var(--ph-dim); background: none; border: 0; transition: color 150ms, background-color 150ms; }
.ctl + .ctl { border-top: 1px solid rgba(var(--ph-rgb), 0.14); }
.ctl svg { width: 19px; height: 19px; }
/* Only real hover: on touch screens :hover sticks to the last button tapped. */
@media (hover: hover) { .ctl:hover { color: var(--ph); background: rgba(var(--ph-rgb), 0.07); } }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 8px; }
.ctl[aria-pressed="true"] { color: var(--accent); background: rgba(var(--ph-rgb), 0.12); }
.ctl[aria-pressed="true"] svg { filter: drop-shadow(0 0 4px rgba(var(--ph-rgb), 0.45)); }

#cog svg { transition: transform 300ms; }
#cog[aria-expanded="true"] { color: var(--ph); }
#cog[aria-expanded="true"] svg { transform: rotate(60deg); }

/* Settings: a small card left of the controls, opened by the cog. */
#settings { position: absolute; top: 0; right: calc(100% + 10px); min-width: 180px; padding: 8px;
  background: rgba(var(--panel-rgb), 0.92); border: 1px solid rgba(var(--ph-rgb), 0.2); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#designs { display: flex; flex-direction: column; gap: 2px; }
#designs span { padding: 0 6px 4px; color: var(--ph-faint); font-size: 11px; }
#designs .design { display: flex; align-items: center; gap: 10px; padding: 6px; font: inherit; color: var(--ph-dim);
  text-align: left; white-space: nowrap; cursor: pointer; background: none; border: 0; border-radius: 6px; }
#designs .design:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#designs .design[aria-checked="true"] { color: var(--ph); background: rgba(var(--ph-rgb), 0.12); }
/* Each design's background with its text colour as a dot. */
#designs .swatch { flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle, var(--sw-fg) 0 2.5px, transparent 3px), var(--sw-bg);
  box-shadow: 0 0 0 1px rgba(var(--ph-rgb), 0.3); }
#designs .design[aria-checked="true"] .swatch { box-shadow: 0 0 0 1.5px rgba(var(--panel-rgb), 1), 0 0 0 3px var(--accent); }
@media (hover: hover) { #designs .design:hover { color: var(--ph); background: rgba(var(--ph-rgb), 0.07); } }


/* 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); }

/* A connection notice in the default star-chart palette, with no canvas. */
.connection-notice { position: static; overflow: auto; height: auto; min-height: 100%;
  display: grid; place-items: center; padding: 24px; }
.connection-notice main { width: min(100%, 28rem); padding-block: 20px; border-top: 1px solid var(--accent);
  font-size: 16px; line-height: 1.5; }
.connection-notice header { color: var(--accent); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.connection-notice h1 { margin: 8px 0 12px; color: var(--ph); font-size: clamp(1.8rem, 6vw, 2.4rem); line-height: 1.1; }
.connection-notice p { margin: 0 0 20px; }
.connection-notice a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-underline-offset: 4px; }

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