:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --ink-soft: #5c6570;
  --line: #dfe3e8;
  --accent: #1f6f5c;
  --accent-soft: #e6f2ee;
  --code-bg: #14181d;
  --code-ink: #dfe6ec;
  --code-dim: #7b8894;
  --warn: #9a5b12;
  --warn-bg: #fdf3e3;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --panel: #181c21;
    --ink: #e7ebef;
    --ink-soft: #98a3ae;
    --line: #2b3138;
    --accent: #5fbfa3;
    --accent-soft: #17302a;
    --code-bg: #0b0e11;
    --code-ink: #dfe6ec;
    --code-dim: #6f7c88;
    --warn: #e0a75c;
    --warn-bg: #2b2418;
  }
}

* { box-sizing: border-box; }

/* The hidden attribute has to beat any display rule further down. Without this
   a component that sets `display: flex` on itself quietly ignores being
   hidden — which is how the editing note stayed on screen after a reset, and
   how the command editor rendered on top of the block it replaces. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--accent-soft);
  color: inherit;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---------- header ---------- */

.site-header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--ink-soft);
  max-width: 52ch;
}

/* ---------- panels ---------- */

main { padding: 28px 20px 48px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel h3 {
  margin: 28px 0 10px;
  font-size: 1rem;
}

.panel > p:first-of-type { margin-top: 0; }

.step {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}

@media (prefers-color-scheme: dark) {
  .step { color: #0d1a16; }
}

/* ---------- form ---------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  appearance: none;
}

select:disabled { opacity: 0.5; }

input:focus-visible,
select:focus-visible,
button:focus-visible,
pre:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.picker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pseudo-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.picker-tools {
  display: flex;
  gap: 14px;
  flex: none;
}

.pick-scope {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* The tags are a hierarchy, so the picker is one. Opening a place is its own
   control, separate from the checkbox, so the tree can be read without being
   selected from. Scrolls rather than growing without limit once a few are open —
   expand all moves this list, not the page. */
.picker {
  /* Taller than a picker alone would need, because it is also how the scheme is
     read: 420px showed about fourteen rows, which is not many when a county has
     eight areas under it. Scales with the window rather than being a fixed
     number, with a floor so a short window still gets a usable list and a
     ceiling so a tall one does not turn the step into a wall of tags. */
  max-height: clamp(320px, 70vh, 720px);
  overflow-y: auto;
  /* And draggable past that, for anyone reading the whole tree. */
  resize: vertical;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pick-row {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  margin: 0;
  padding: 2px 4px;
  border-radius: 6px;
  font-weight: 400;
  color: var(--ink);
}

.pick-row:hover { background: var(--accent-soft); }

/* The label covers everything except the disclosure, so the whole row is a
   click target for ticking without swallowing the button next to it. */
.pick-main {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 4px 4px 4px 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
}

.pick-row input { flex: none; margin: 0; align-self: center; }

/* One glyph, rotated, rather than two: nothing to keep in sync. */
.pick-toggle {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.pick-toggle::before {
  content: "\25b8";
  display: block;
  transition: transform 0.12s ease;
}

.pick-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.pick-toggle:hover { color: var(--ink); }

/* Leaves get the same gap so their names line up with their siblings'. */
.pick-toggle.is-leaf { cursor: default; }
.pick-toggle.is-leaf::before { content: ""; }

/* The code is what actually goes on the air, so it leads the row rather than
   trailing it — it is the thing being looked up. */
.pick-code {
  flex: none;
  min-width: 3.4em;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.pick-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* One unit, so a row never shows a code with its name on the line beneath. */
.pick-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex: 0 1 auto;
  min-width: 0;
}

/* Clipped to one line so a row stays a row: the tree's shape is what makes the
   list scannable, and two-line entries destroy it. Full text is in the title.
   flex-basis 0, not auto: with auto the description asks for its full width and
   wins space from the name beside it, which pushed long names onto a second
   line and left the checkbox stranded between them. At 0 it simply takes
   whatever is left over. */
.pick-desc {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* Rows shrink with depth, so the level a row sits at is readable without
   counting indents. Classes are lvl-<depth>, not level names: the tree can be
   any number deep, and past the third the difference stops being useful. */
.pick-row.lvl-0 { font-weight: 600; font-size: 0.95rem; }
.pick-row.lvl-1 { font-size: 0.9rem; }
.pick-row.lvl-2 { font-size: 0.88rem; }
.pick-row.lvl-3, .pick-row.lvl-4, .pick-row.lvl-5,
.pick-row.lvl-6, .pick-row.lvl-7 { font-size: 0.86rem; }

/* One rule per level of nesting, which doubles as the separator between a
   parent and the things under it. */
.pick-children {
  margin: 2px 0 6px 12px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.pick-row input:checked ~ .pick-title .pick-name { font-weight: 600; color: var(--accent); }
.pick-row input:checked ~ .pick-title .pick-code { color: var(--accent); }

/* Narrow screens have no room to clip a description into: it drops to its own
   line instead, where density matters less because you are scrolling anyway. */
/* Narrow screens have no width to clip a description into, so it takes its own
   line. Grid rather than flex-wrap: wrapping picks lines by an item's
   max-content width, which puts the title on a line of its own the moment a name
   is long. Two explicit columns cannot do that. */
@media (max-width: 560px) {
  /* A phone row is two lines, so 70vh is most of the screen for eight regions
     and pushes the map out of sight. Lower ceiling here, and no drag handle —
     it is not a gesture touch offers. */
  .picker {
    max-height: clamp(300px, 55vh, 460px);
    resize: none;
  }

  .pick-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    column-gap: 9px;
    row-gap: 1px;
  }

  /* On the first line with the caret, not centred against a name that has
     wrapped to two — centred put the box between the two lines, reading as a
     stray control belonging to neither. */
  .pick-main input { grid-row: 1; align-self: start; margin-top: 3px; }
  .pick-title { grid-column: 2; }

  /* Two lines is enough to recognise a place by its towns. The seven-town
     lists run to four otherwise, which buries the tree. */
  .pick-desc {
    grid-column: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
  }

  .pick-name { white-space: normal; overflow: visible; }
}

.or {
  margin: 18px 0 14px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.or::before, .or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.field.checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
}

.hint {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.fw-row {
  padding: 12px 14px;
  margin-bottom: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fw-row select {
  background: var(--panel);
  max-width: 260px;
}

.field select:disabled + .hint,
.field input:disabled + .hint {
  opacity: 0.85;
}

/* ---------- search results ---------- */

.combo { position: relative; }

.results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.results li {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
}

.results li[aria-selected="true"],
.results li:hover {
  background: var(--accent-soft);
}

.results .r-name { font-weight: 600; }

.results .r-ctx {
  display: block;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.results .r-code {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.8rem;
}

.results .empty {
  color: var(--ink-soft);
  cursor: default;
}

.results .empty:hover { background: none; }

/* ---------- chain ---------- */

.chain-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.chain {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.chain li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chain li::after {
  content: "›";
  color: var(--ink-soft);
}

.chain li:last-child::after { content: ""; }

.chain .tok {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}

.chain li:last-child .tok {
  background: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .chain li:last-child .tok { color: #0d1a16; }
}

/* ---------- code block ---------- */

.code-block {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--line);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Two buttons now, so the title takes the slack rather than the gap between
   them. */
.code-title {
  margin-right: auto;
  color: var(--code-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.copy-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--code-ink);
  cursor: pointer;
}

.copy-btn:hover { background: rgba(255, 255, 255, 0.08); }
.copy-btn.done { border-color: var(--accent); color: var(--accent); }

.code-block pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--code-ink);
}

.code-block .c { color: var(--code-dim); }

/* Sits in the code block, so it wears the code block's clothes rather than the
   page's — swapping between the two should not move anything. */
#commands-edit {
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px;
  border: 0;
  resize: vertical;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.65;
}

#commands-edit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.edit-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--accent);
}

.edit-note.over { color: var(--warn); }

.link-btn {
  font: inherit;
  font-size: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.line-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.line-note.over {
  color: var(--warn);
  background: var(--warn-bg);
  padding: 8px 10px;
  border-radius: 6px;
}

/* ---------- explanations ---------- */

.advanced {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.advanced summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.advanced-body {
  padding: 4px 14px 16px;
  border-top: 1px solid var(--line);
}

.explain {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.explain dl { margin: 0; }

.explain dt {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 12px;
}

.explain dt:first-child { margin-top: 0; }

.explain dd {
  margin: 3px 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------- lists ---------- */

.scope-list, .notes {
  margin: 0;
  padding-left: 20px;
}

.scope-list li, .notes li { margin-bottom: 10px; }
.scope-list li:last-child, .notes li:last-child { margin-bottom: 0; }

.scope-list .s-code {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 2px 6px;
}

pre.tree {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ---------- push panel ---------- */

.step.alt { background: var(--warn); }

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 999px;
  padding: 3px 9px;
}

.warn-box {
  background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 16px 0;
  font-size: 0.9rem;
}

.warn-box strong { color: var(--warn); }

.action {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 9px 18px;
  margin: 0 8px 8px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.action:hover:not(:disabled) { border-color: var(--accent); }

.action:disabled { opacity: 0.45; cursor: not-allowed; }

.action.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .action.primary { color: #0d1a16; }
}

.action.quiet { color: var(--ink-soft); }

.push-actions { margin: 18px 0 4px; }

.detect {
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 8px;
}

.detect-line {
  margin: 0;
  font-size: 0.87rem;
  color: var(--ink);
}

.detect-line:empty { display: none; }

.detect-line + .detect-line { margin-top: 6px; }

.action.small {
  font-size: 0.84rem;
  padding: 6px 12px;
  margin: 10px 0 0;
  background: var(--panel);
}

.detect-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* The gap does the spacing here; .action's own margins would double it up. */
.detect-choices .action { margin: 0; }

.detect-choices .action.chosen {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.detect-choices + .detect-line { margin-top: 10px; }

.conn-status {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
}

.progress {
  list-style: none;
  margin: 18px 0 10px;
  padding: 0;
  counter-reset: cmd;
}

.progress .prog {
  position: relative;
  padding: 8px 0 8px 30px;
  border-top: 1px solid var(--line);
  counter-increment: cmd;
}

.progress .prog::before {
  content: counter(cmd);
  position: absolute;
  left: 0;
  top: 9px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  background: var(--line);
  color: var(--ink-soft);
}

.progress .ok::before {
  content: "✓";
  background: var(--accent);
  color: #fff;
}

.progress .fail::before {
  content: "!";
  background: var(--warn);
  color: #fff;
}

.progress .active::before {
  content: "…";
  background: var(--ink-soft);
  color: #fff;
}

.prog-cmd {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: none;
  padding: 0;
}

.progress .todo .prog-cmd { color: var(--ink-soft); }

.prog-reply {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--ink-soft);
}

.line-note.ok { color: var(--accent); font-weight: 600; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 36px;
}

.site-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- map ---------- */

/* The second question in the panel, after location. Set off a little so it does
   not read as a fourth dropdown in the region/county/area row. */


.map-figure {
  margin: 0 0 22px;
}

/* Positioning context for the tooltip, which is a plain div over the SVG. */
.map-host {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
}

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  /* Anything selectable sets its own cursor; the rest of the ocean is not. */
  cursor: default;
}

.map-svg.is-pointing { cursor: pointer; }

/* Only once there is somewhere to pan to. */
.map-svg.is-zoomed { cursor: grab; touch-action: none; }
.map-svg.is-dragging { cursor: grabbing; }

/* At full extent, a touch drag belongs to the page, not the map. */
.map-svg { touch-action: pan-y; }

.map-county {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: calc(var(--hair, 1) * 1);
  stroke-linejoin: round;
}

/* The selected region tints its whole set of counties, so the three levels of
   the scope chain each show up differently: region as a wash, county as a solid
   fill, area as a dot. */
.map-county.is-in-region { fill: var(--accent-soft); }

.map-county.is-hover {
  fill: color-mix(in srgb, var(--accent) 22%, var(--panel));
  stroke: var(--accent);
  stroke-width: calc(var(--hair, 1) * 1.5);
}

.map-county.is-on {
  fill: color-mix(in srgb, var(--accent) 38%, var(--panel));
  stroke: var(--accent);
  stroke-width: calc(var(--hair, 1) * 2);
}

.map-dot {
  r: var(--dot-r, 3);
  fill: var(--ink-soft);
  /* A ring in the surface colour keeps dots legible where they overlap, and
     against whatever fill the county underneath is wearing. */
  stroke: var(--panel);
  stroke-width: calc(var(--hair, 1) * 1);
}

.map-dot.is-hover {
  r: var(--dot-r-on, 5);
  fill: var(--accent);
}

.map-dot.is-on {
  r: var(--dot-r-on, 5);
  fill: var(--accent);
  stroke: var(--panel);
  stroke-width: calc(var(--hair, 1) * 2);
}

.map-label {
  fill: var(--ink-soft);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  /* Sized in viewBox units that work out to a constant size on screen — see
     resize() in map.js. */
  font-size: calc(var(--label-size, 20) * 1px);
  letter-spacing: 0.06em;
  text-anchor: middle;
  /* A halo in the surface colour, so a label stays readable where it crosses a
     county line or a cluster of dots. paint-order puts it behind the glyph. */
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: calc(var(--hair, 1) * 3.5);
  stroke-linejoin: round;
  /* Clickable — a region label is how you get a region-wide scope off the map.
     Only where painted, so it doesn't shadow the county around it. */
  pointer-events: painted;
  user-select: none;
}

.map-label.is-on,
.map-label.is-hover { fill: var(--accent); }

/* Where a connected repeater says it is. */
.map-mark-ring {
  r: calc(var(--dot-r, 3) * 3.2);
  fill: none;
  stroke: var(--warn);
  stroke-width: calc(var(--hair, 1) * 1.5);
  opacity: 0.9;
}

.map-mark-dot {
  r: calc(var(--dot-r, 3) * 0.9);
  fill: var(--warn);
}

.map-zoom {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 4;
}

.map-zoom button {
  width: 30px;
  height: 30px;
  padding: 0;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  /* The map shows through behind them. */
  opacity: 0.92;
}

.map-zoom button:hover:not(:disabled) { border-color: var(--accent); }
.map-zoom button:disabled { opacity: 0.4; cursor: default; }

.map-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 240px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.map-tip strong { display: block; font-weight: 700; }
.map-tip span { display: block; opacity: 0.75; font-size: 0.72rem; }

.map-caption {
  margin: 10px auto 0;
  max-width: 460px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
}

/* Dots are drawn at a fixed size in screen pixels, so a larger map spreads them
   further apart without making them bigger. That is exactly what a fingertip
   needs, so touch gets more room rather than less. */
@media (pointer: coarse) {
  .map-host { max-width: 480px; }
}
