/*
  The look every page shares (docs/StyleGuide.md): the Monitor's pages, the upload page
  and the Memory tool, at home and in the cloud. Loaded before each page's own style.css, which
  keeps only what is the page's own. No page writes a colour of its own except for data.
*/

/* ── tokens ─────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --ground: #0f1316;
  --surface: #171c20;
  --raised: #1e252a;
  --ink: #e3e8eb;
  --muted: #8f9ba3;
  --line: #2a3238;
  --line-strong: #3b454c;
  --home: #2ec4b6;
  --home-soft: #12302e;
  --cloud: #a78bfa;
  --cloud-soft: #2a2140;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  /* What memory is made of, wherever it is told apart (docs/StyleGuide.md#memory): one
     lightness, oklch(0.72 …), so none of the three stands out from the others. */
  --memory-stays: #ca9d33;
  --memory-moves: #61bd67;
  --memory-random: #50b1dc;
  /* The heat's three curves (shared/curves.js), told apart on one chart: one lightness,
     oklch(0.75 …), as memory's are, and hues apart from the heat's palettes' warm middle. */
  --curve-opacity: #6cb4f0;
  --curve-glow: #e5a54c;
  --curve-width: #d488e0;
  /* How two services talk, on the overview's edges. The green leans yellow, away from --home. */
  --proto-http: #a3c94a;
  --proto-signalr: #4f8ff7;
  /* What a service offers: a page to open, or map tiles to draw from. */
  --page: #e6c14d;
  --page-soft: #3a3116;
  --tiles: #f0883e;
  --tiles-soft: #3d2515;
  --on-accent: #0f1316;
  /* Until /side.js has said where the page runs, or if it could not be loaded. */
  --accent: var(--home);
  --accent-soft: var(--home-soft);
  /* Hover and pressed shift lightness, never hue: over any surface, and over the accent. */
  --tint: rgb(255 255 255 / 6%);
  --tint-strong: rgb(255 255 255 / 11%);
  --accent-hover: color-mix(in oklab, var(--accent), white 14%);
  --accent-pressed: color-mix(in oklab, var(--accent), black 18%);
  --shadow: 0 6px 24px rgb(0 0 0 / 45%);
  /*
    Glass is for what floats over something: the header, menus, the toast, dialogs, the boxes and
    popups over a map. Cards and tables lie on the page and stay solid. Over the dark page, what is
    behind is only blurred. Over a map it is darkened too, and --muted is lighter there, so that
    over the land of a light map it still meets WCAG AA. That caps how much of the map shows: a
    thinner tint needs more darkening, and the reverse; the thinner tint lets more colour through.
  */
  --glass: rgb(30 37 42 / 56%);
  --glass-filter-page: blur(16px) saturate(160%) brightness(0.9);
  --glass-filter-map: blur(16px) saturate(160%) brightness(0.36);
  --glass-filter: var(--glass-filter-page);
  --glass-line: rgb(255 255 255 / 9%);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / 6%), var(--shadow);
  --radius: 8px;
  /* What sticks to the top of the window keeps clear of the header, which is this high. */
  --header-height: 3.5rem;
  /* Floating boxes keep this far from the map's edges, and as far from each other. */
  --float-gap: 10px;
  /* Bottom boxes stop above Leaflet's scale and attribution, which are never covered. */
  --float-bottom: 2.25rem;
  /* A box down the right of a map is this wide, unless the page says otherwise. */
  --side-width: 26rem;
  /* How long whatever opens, closes, folds or slides takes, and how it eases in and out. */
  --motion: 200ms;
  --motion-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --mono: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  color: var(--ink);
  background: var(--ground);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass: var(--raised);
  }
}

/* Glass over a map; a dialog dims the page behind it itself, and is glass over the page. */
body.map-page,
.leaflet-container {
  --glass-filter: var(--glass-filter-map);
  --muted: #a3aeb5;
}

dialog {
  --glass-filter: var(--glass-filter-page);
}

/* The accent says where the page runs; --home and --cloud say what a thing belongs to. */
:root[data-side='home'] {
  --accent: var(--home);
  --accent-soft: var(--home-soft);
}

:root[data-side='cloud'] {
  --accent: var(--cloud);
  --accent-soft: var(--cloud-soft);
}

[x-cloak] {
  display: none !important;
}

/*
  What x-if draws as it opens comes in as it does. Alpine moves only what x-show hides, so
  whatever opens and can be x-show is, with x-collapse or x-transition; this is for what can't,
  such as a part that reads what is not there while it is closed.
*/
.appears {
  animation: geo-appear var(--motion) var(--motion-ease);
}

@keyframes geo-appear {
  from {
    opacity: 0;
    transform: translateY(-0.4rem);
  }
}

/*
  Whatever opens, closes, folds or slides does it at once for whoever asked for less motion. The
  durations go, not the transitions, so what waits for a transition's end still hears of it. A
  spinner keeps turning, slowly: it says that something is under way.
*/
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  ::backdrop {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }

  .appears {
    animation: none;
  }
}

/* ── the page ───────────────────────────────────────────────────────────── */

html {
  scroll-padding-top: var(--header-height);
}

body {
  margin: 0;
  padding-top: var(--header-height);
  background: var(--ground);
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem;
}

h2 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.75rem;
}

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

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

code,
.path {
  font-family: var(--mono);
}

.path {
  font-size: 0.85rem;
  word-break: break-all;
}

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

.hint,
.muted {
  color: var(--muted);
}

.hint {
  font-size: 0.9rem;
}

.problem {
  color: var(--bad);
}

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

.num {
  text-align: right;
}

.num,
.when,
time {
  font-variant-numeric: tabular-nums;
}

/* A moment is one unit; broken over two lines, the date and the time read as two values. */
.when {
  white-space: nowrap;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.card h2:first-child {
  margin-top: 0;
}

.login {
  max-width: 22rem;
  margin: 3rem auto;
  display: grid;
  gap: 0.75rem;
}

.login h2 {
  margin: 0;
}

.swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  vertical-align: middle;
}

/* ── the header and its menu ────────────────────────────────────────────── */

/* Always in sight on a wide screen, over the page as it scrolls by. */
.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1050;
  box-sizing: border-box;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 0 1.5rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border-bottom: 1px solid var(--glass-line);
}

.brand {
  flex: none;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
}

.brand .geo {
  color: var(--accent);
  font-weight: 500;
}

/* A trail inside the page, such as Memory's timeframe, after the brand. */
.trail {
  min-width: 0;
  margin-left: -1.25rem;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trail button.link {
  font-size: inherit;
}

.app-menu {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.app-menu nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.app-menu nav a {
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.app-menu nav a:hover {
  color: var(--ink);
}

.app-menu nav a[aria-current='page'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.who {
  margin-left: auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

/*
  The other services, apart from the page's own links: a group of their pictures at the right,
  each in the colour of the side it is on, its name in title and aria-label, and a small arrow
  that says it leaves this service rather than opening one of its pages. They open in this tab,
  as a page of the same app would; the browser's own ways open one beside it. The pictures are
  the files in shared/icons, which each service's favicon is drawn from too (Pages.cs).
*/
:root {
  --icon-monitor: url('icons/monitor.svg');
  --icon-explorer: url('icons/explorer.svg');
  --icon-upload: url('icons/upload.svg');
  --icon-share: url('icons/share.svg');
  --icon-memory: url('icons/memory.svg');
  --icon-cloud: url('icons/cloud.svg');
  --icon-away: url('icons/away.svg');
}

.app-menu nav.sites {
  margin-left: auto;
  gap: 0.15rem;
  align-items: center;
}

/* Its links are drawn by a template, so it is never :empty. */
.app-menu nav.sites:not(:has(a)) {
  display: none;
}

.app-menu nav.sites:has(a) + .who {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
}

.app-menu nav.sites a {
  --icon: var(--icon-monitor);
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--accent);
}

.app-menu nav.sites a:hover {
  border-color: var(--line);
  background: var(--tint);
  color: var(--accent-hover);
}

.app-menu nav.sites a::before {
  content: '';
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
}

/* Leaving this service: up and away, in a corner of the picture. */
.app-menu nav.sites a::after {
  content: '';
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--muted);
  mask: var(--icon-away) center / contain no-repeat;
}

.app-menu nav.sites a:hover::after {
  background: var(--ink);
}

/* The name is said, and shown where the menu has room for it. */
.app-menu nav.sites a span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.app-menu nav.sites a.explorer {
  --icon: var(--icon-explorer);
}

.app-menu nav.sites a.upload {
  --icon: var(--icon-upload);
}

.app-menu nav.sites a.share {
  --icon: var(--icon-share);
}

.app-menu nav.sites a.memory {
  --icon: var(--icon-memory);
}

/* This service's copy in the cloud, from home: the cloud's own colour, apart from home's links. */
.app-menu nav.sites a.cloud {
  --icon: var(--icon-cloud);
  margin-left: 0.5rem;
  color: var(--cloud);
}

.app-menu nav.sites a.cloud:hover {
  color: color-mix(in oklab, var(--cloud), white 14%);
}

.menu-button {
  display: none;
}

/* One breakpoint for every page. */
@media (max-width: 48rem) {
  html {
    scroll-padding-top: 0;
  }

  body {
    padding-top: 0;
  }

  main {
    padding: 1rem;
  }

  /*
    In the flow, so it scrolls out of view with the page; the menu button stays. Nothing passes
    under it, so it is solid, and a backdrop filter would hold the fixed button and menu inside it.
  */
  .app-header {
    position: static;
    height: auto;
    min-height: var(--header-height);
    padding: 0.5rem 4.5rem 0.5rem 1rem;
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .trail {
    margin-left: -1rem;
  }

  .menu-button {
    position: fixed;
    top: var(--float-gap);
    right: var(--float-gap);
    z-index: 1060;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--glass-line);
    border-radius: var(--radius);
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-filter);
    backdrop-filter: var(--glass-filter);
    color: var(--ink);
    box-shadow: var(--glass-shadow);
  }

  .menu-button:where(:enabled:hover) {
    background: color-mix(in oklab, var(--glass), white 6%);
    color: var(--ink);
  }

  .menu-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  .menu-button .close,
  .app-header.open .menu-button .open {
    display: none;
  }

  .app-header.open .menu-button .close {
    display: block;
  }

  .app-menu {
    position: fixed;
    top: calc(var(--float-gap) + 44px + 6px);
    right: var(--float-gap);
    z-index: 1060;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: min(18rem, calc(100vw - 2 * var(--float-gap)));
    max-height: calc(100dvh - 44px - 3 * var(--float-gap));
    box-sizing: border-box;
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid var(--glass-line);
    border-radius: var(--radius);
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-filter);
    backdrop-filter: var(--glass-filter);
    box-shadow: var(--glass-shadow);
    /* It drops open from the button, and back; display waits for the fade to end. */
    opacity: 0;
    transform: translateY(-0.4rem);
    transform-origin: top right;
    transition:
      opacity var(--motion) var(--motion-ease),
      transform var(--motion) var(--motion-ease),
      display var(--motion) allow-discrete;
  }

  .app-header.open .app-menu {
    display: flex;
    opacity: 1;
    transform: none;
  }

  @starting-style {
    .app-header.open .app-menu {
      opacity: 0;
      transform: translateY(-0.4rem);
    }
  }

  .app-menu nav {
    flex-direction: column;
    gap: 0;
  }

  .app-menu nav a {
    padding: 0.6rem 0.75rem;
    border-bottom: 0;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
  }

  .app-menu nav a:hover {
    background: var(--tint);
  }

  .app-menu nav a[aria-current='page'] {
    border-left-color: var(--accent);
    background: var(--tint);
  }

  .who {
    margin: 0;
    padding: 0.6rem 0.75rem;
  }

  .who button.link {
    margin-left: auto;
  }

  /* A table scrolls sideways here, so a path keeps a width to be read at. */
  .table td.path {
    min-width: 12rem;
  }

  .app-menu nav + .who {
    margin-top: 0.4rem;
    border-top: 1px solid var(--line);
  }

  .app-menu nav + nav.sites {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--line);
  }

  .app-menu nav.sites {
    margin-left: 0;
    align-items: stretch;
  }

  .app-menu nav.sites:has(a) + .who {
    padding-left: 0.75rem;
    border-left: 0;
  }

  .app-menu nav.sites a {
    padding: 0.6rem 0.75rem;
    border: 0;
    border-radius: 4px;
  }

  .app-menu nav.sites a.cloud {
    margin-left: 0;
  }

  /* Here the arrow follows the name, at the end of its line. */
  .app-menu nav.sites a::after {
    position: static;
    margin-left: auto;
    width: 0.7rem;
    height: 0.7rem;
  }

  .app-menu nav.sites a span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    color: var(--ink);
  }

  /* Where the map is the page, it takes all of a narrow screen: only the menu button is left. */
  body.map-page .app-header {
    position: fixed;
    min-height: 0;
    height: 0;
    padding: 0;
    border: 0;
    overflow: visible;
  }

  body.map-page .app-header > :not(.menu-button, .app-menu) {
    display: none;
  }
}

/* ── controls ───────────────────────────────────────────────────────────── */

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input:not([type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']),
select,
textarea {
  box-sizing: border-box;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--ground);
  color: var(--ink);
  font: inherit;
}

select {
  padding-block: 0.4rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
}

input[type='checkbox'],
input[type='radio'],
input[type='range'],
progress {
  accent-color: var(--accent);
}

/*
  Every slider looks the same in every browser, and the same as the two thumbs of a .range2: a
  thin track, filled in the accent up to the thumb, and a round thumb in the accent ringed by the
  surface. The browsers' own differ from each other, and a range with two ends cannot be built
  from them. Chromium has no part for the fill, so the thumb's border-image draws the track as a
  band out to either side, the accent on its left, which the input's overflow cuts off at the
  ends.
*/
input[type='range'] {
  --thumb: 1rem;
  --track: 4px;
  box-sizing: border-box;
  height: 1.5rem;
  padding: 0;
  overflow: hidden;
  background: none;
  cursor: pointer;
  appearance: none;
}

input[type='range']::-webkit-slider-runnable-track {
  height: var(--track);
  border-radius: calc(var(--track) / 2);
  background: var(--line-strong);
}

input[type='range']::-moz-range-track {
  height: var(--track);
  border-radius: calc(var(--track) / 2);
  background: var(--line-strong);
}

input[type='range']::-moz-range-progress {
  height: var(--track);
  border-radius: calc(var(--track) / 2);
  background: var(--accent);
}

input[type='range']::-webkit-slider-thumb {
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
  border-image: linear-gradient(90deg, var(--accent) 50%, var(--line-strong) 0) 0 1 /
    calc(50% - var(--track) / 2) 100vw / 0 100vw;
  appearance: none;
}

input[type='range']::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}

input[type='range']:focus-visible {
  outline: none;
}

input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--accent);
}

input[type='range']:focus-visible::-moz-range-thumb {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--accent);
}

/*
  Two thumbs on one track, such as From and To: two such sliders laid over each other, without
  their tracks and fills, which let the pointer through to the thumbs, over one track drawn as
  theirs are, filled between --from and --to. It is inset by half a thumb, as far as a thumb's
  centre can travel.
*/
.range2 {
  --from: 0%;
  --to: 100%;
  --thumb: 1rem;
  --track: 4px;
  position: relative;
  height: 1.5rem;
}

.range2::before {
  content: '';
  position: absolute;
  inset: calc(50% - var(--track) / 2) calc(var(--thumb) / 2);
  border-radius: calc(var(--track) / 2);
  background: linear-gradient(
    to right,
    var(--line-strong) var(--from),
    var(--accent) var(--from) var(--to),
    var(--line-strong) var(--to)
  );
}

/* As specific as a page's own margin on its sliders, which would shift the two apart. */
.range-field .range2 input[type='range'] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  pointer-events: none;
}

.range2 input[type='range']::-webkit-slider-runnable-track {
  background: none;
}

.range2 input[type='range']::-moz-range-track,
.range2 input[type='range']::-moz-range-progress {
  background: none;
}

.range2 input[type='range']::-webkit-slider-thumb {
  border-image: none;
  pointer-events: auto;
}

.range2 input[type='range']::-moz-range-thumb {
  pointer-events: auto;
}

/* The low thumb is lifted over the high one where the high one would hide it, at the top end. */
.range2.low-on-top input[type='range']:first-child {
  z-index: 1;
}

/* A field of such a range: what it stands at above it, and its choices below. */
.range-field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.range-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
}

input[type='color'] {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--ground);
}

/*
  A choice the browser's select cannot draw, such as a palette shown as its colours (Picker in
  geo.js): a button drawn as a select, captioned as a label is, and its list fixed to the window.
*/
.picker {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.picker-button {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--ground);
  color: var(--ink);
  font-weight: 400;
  text-align: left;
  box-shadow: none;
}

.picker-button:where(:enabled:hover) {
  border-color: var(--muted);
}

.picker-button[aria-expanded='true'],
.picker-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

/* The select's arrow. */
.picker-button::after {
  content: '';
  flex: none;
  width: 0.4rem;
  height: 0.4rem;
  margin: 0 0.15rem 0.2rem auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  rotate: 45deg;
}

.picker-list {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.picker-list [role='option'] {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  background: none;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.picker-list [role='option']:where(:enabled:hover),
.picker-list [role='option']:focus-visible {
  background: var(--tint);
  color: var(--ink);
  outline: none;
}

.picker-list [role='option'][aria-selected='true'] {
  background: var(--accent-soft);
  font-weight: 600;
}

/* A palette as its colours, beside its name. */
.picker .ramp-swatch {
  flex: none;
  box-sizing: border-box;
  width: 5rem;
  height: 0.85rem;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%);
}

.picker .ramp-swatch.empty {
  border: 1px dashed var(--line-strong);
  box-shadow: none;
}

/* Primary: the accent, with the ground's colour on it. */
button,
a.button {
  display: inline-block;
  box-sizing: border-box;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.1s,
    border-color 0.1s,
    box-shadow 0.1s;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

/*
  A button answers the pointer: lighter under it, and darker and sunk in while it is held, so a
  click that only queues something is still seen to land. :where() adds nothing to the
  specificity, so a button styled by its place keeps its own look; :enabled leaves a disabled
  one still.
*/
button:where(:enabled:hover),
a.button:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

button:where(:enabled:active) {
  background: var(--accent-pressed);
  box-shadow: inset 0 2px 3px rgb(0 0 0 / 30%);
}

/* Secondary: outlined, on whatever it lies on. */
button.secondary,
a.button.secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 400;
}

button.secondary:where(:enabled:hover),
a.button.secondary:hover {
  background: var(--tint);
  border-color: var(--muted);
  color: var(--ink);
}

button.secondary:where(:enabled:active) {
  background: var(--tint-strong);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 30%);
}

/* Destructive: outlined in red, until it is the one being confirmed. */
button.danger {
  background: transparent;
  border-color: color-mix(in oklab, var(--bad), transparent 40%);
  color: var(--bad);
  font-weight: 400;
}

button.danger:where(:enabled:hover) {
  background: color-mix(in oklab, var(--bad), transparent 88%);
  border-color: var(--bad);
  color: var(--bad);
}

button.danger:where(:enabled:active) {
  background: color-mix(in oklab, var(--bad), transparent 80%);
}

/* In a question, the destructive button is the one being confirmed. */
dialog.question button.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: var(--on-accent);
  font-weight: 550;
}

dialog.question button.danger:where(:enabled:hover) {
  background: color-mix(in oklab, var(--bad), white 14%);
  color: var(--on-accent);
}

dialog.question button.danger:where(:enabled:active) {
  background: color-mix(in oklab, var(--bad), black 18%);
}

/* A link: text in the accent. */
button.link,
a.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: inherit;
  text-decoration: none;
}

button.link:where(:enabled:hover),
a.link:hover {
  background: none;
  color: var(--accent-hover);
  text-decoration: underline;
}

button.link:where(:enabled:active) {
  background: none;
  box-shadow: none;
  color: var(--accent-pressed);
}

button.link.danger {
  color: var(--bad);
}

/* Buttons of which one is chosen, side by side as one control. */
.toggles {
  display: inline-flex;
}

/* Square where two buttons meet. Of-type rather than child: x-for leaves its template first. */
.toggles button {
  border-radius: 0;
  margin-left: -1px;
}

.toggles button:first-of-type {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
  margin-left: 0;
}

.toggles button:last-of-type {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* Icon buttons in a group keep the group's outline, which they have none of alone, and join
   as the group's other buttons do: button.icon rounds every corner. */
.toggles button.icon {
  border-color: var(--line);
  border-radius: 0;
  margin-left: -1px;
}

.toggles button.icon:first-of-type {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
  margin-left: 0;
}

.toggles button.icon:last-of-type {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* button.icon is transparent and muted, and comes later; a chosen one is drawn as chosen. */
.toggles button.icon[aria-pressed='true'],
.toggles button.icon[aria-pressed='true']:where(:enabled:hover) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* In a group, a chosen button's border goes over the neighbours' it overlaps. */
.toggles button[aria-pressed='true'] {
  position: relative;
  z-index: 1;
}

button[aria-pressed='true'],
button[aria-pressed='true']:where(:enabled:hover) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 550;
}

/* ── the heat's curves (shared/curves.js) ───────────────────────────────── */

/*
  Opacity, glow and trail width along the heat's ramp, on one chart, each line in its colour
  (--kind, one of the --curve-* tokens): each one's name at the left where its line begins, its
  scale at the right, and under the chart the ramp's colours, their x axis, with a line up the
  chart wherever one colour gives way to the next. The presets stand above, a group per curve in
  its colour.
*/
.curves {
  display: grid;
  gap: 0.5rem;
}

.curve-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Where there is no chart to name the colours, each group has its name over it. */
.curve-preset-group {
  display: grid;
  gap: 0.15rem;
  color: var(--kind);
  font-size: 0.75rem;
  font-weight: 550;
}

/* Every preset as large as every other, whatever its words; its curve and words in its colour. */
.curve-presets button.curve-preset {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.05rem;
  width: 2.9rem;
  height: 2.4rem;
  padding: 0;
  border-color: var(--line);
  background: transparent;
  color: var(--kind);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
}

.curve-presets button.curve-preset:where(:enabled:hover) {
  background: var(--tint);
  color: var(--kind);
}

.curve-presets button.curve-preset[aria-pressed='true'],
.curve-presets button.curve-preset[aria-pressed='true']:where(:enabled:hover) {
  background: var(--kind);
  border-color: var(--kind);
  color: var(--on-accent);
}

.curve-preset svg {
  width: 1.8rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.curve-chart {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  column-gap: 0.45rem;
  row-gap: 0.3rem;
  font-size: 0.75rem;
}

.curve-labels,
.curve-scale {
  position: relative;
}

/* Level with the start of its line, and beside the chart rather than over it; a press on one
   brings its line to the front, and the one in front is underlined. */
.curve-labels button.link {
  position: absolute;
  right: 0;
  padding: 0;
  transform: translateY(-50%);
  color: var(--kind);
  font-size: inherit;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.curve-labels button.link:where(:enabled:hover) {
  color: var(--kind);
}

.curve-labels button.link[aria-pressed='true'] {
  background: none;
  border-color: transparent;
  color: var(--kind);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The names, and a scale's values, again, unseen and flat, so each column is as wide as the
   longest of what stands in it. */
.curve-labels .curve-sizer,
.curve-scale .curve-sizer {
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 550;
  white-space: nowrap;
}

.curve-scales {
  display: flex;
  gap: 0.35rem;
}

.curve-scale span:not(.curve-sizer) {
  position: absolute;
  left: 0;
  transform: translateY(-50%);
  color: var(--kind);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.curve-plot {
  position: relative;
  height: 9rem;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: crosshair;
  /* A drag on a phone moves the point, not the page. */
  touch-action: none;
}

.curve-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.curve-grid {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.curve-stops {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

.curve-stroke {
  fill: none;
  stroke: var(--kind);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.curve-plot button.curve-point {
  position: absolute;
  width: 0.85rem;
  height: 0.85rem;
  margin: -0.425rem 0 0 -0.425rem;
  padding: 0;
  border: 2px solid var(--kind);
  border-radius: 50%;
  background: var(--surface);
  cursor: grab;
  touch-action: none;
  transition: transform var(--motion) var(--motion-ease);
}

.curve-plot button.curve-point:where(:enabled:hover),
.curve-plot button.curve-point:focus-visible {
  background: var(--kind);
  transform: scale(1.3);
}

.curve-plot button.curve-point:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.curve-axis {
  grid-column: 2;
  display: grid;
  gap: 0.15rem;
}

/* The ramp over the checks that show its opacity, with a handle where each of its colours lies
   and the box of the colour clicked under it. */
.ramp-bar {
  position: relative;
  padding-bottom: 0.6rem;
}

.curve-axis .curve-ramp {
  height: 0.9rem;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.curve-axis .curve-ramp.editable {
  cursor: copy;
}

.ramp-thumbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* A tab hanging from the ramp's lower edge, in its colour, ringed so it shows on any. */
.ramp-thumbs button.ramp-thumb {
  position: absolute;
  top: 0.35rem;
  width: 0.75rem;
  height: 1rem;
  margin-left: -0.375rem;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--ground);
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
  transition: transform var(--motion) var(--motion-ease);
}

.ramp-thumbs button.ramp-thumb:where(:hover, :focus-visible),
.ramp-thumbs button.ramp-thumb[aria-expanded='true'] {
  transform: scale(1.2);
}

.ramp-thumbs button.ramp-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stop-edit {
  position: absolute;
  z-index: 2;
  top: 1.6rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.35rem;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  box-shadow: var(--shadow);
}

.stop-edit input[type='color'] {
  width: 2.4rem;
  height: 1.9rem;
  padding: 0.1rem;
}

.curve-axis .curve-ends {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

/* ── icon buttons ───────────────────────────────────────────────────────── */

/*
  An action on a thing is a button with a picture of what it does, its words in title and
  aria-label: a bin rather than "Remove". The pictures are masks over the text's colour, so they
  follow the theme and the button's state; a picture's own colours could not.
*/
.icons {
  display: inline-flex;
  gap: 0.15rem;
  align-items: center;
}

button.icon,
a.icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  vertical-align: middle;
  cursor: pointer;
}

button.icon::before,
a.icon::before {
  content: '';
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
}

button.icon.small {
  width: 1.5rem;
  height: 1.5rem;
}

button.icon.small::before {
  width: 0.9rem;
  height: 0.9rem;
}

button.icon:where(:enabled:hover),
a.icon:hover {
  border-color: var(--line);
  background: var(--tint);
  color: var(--ink);
}

button.icon:where(:enabled:active) {
  background: var(--tint-strong);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 30%);
}

/* Taking something away is red, as a destructive button is. */
button.icon.remove,
button.icon.remove:where(:enabled:hover) {
  color: var(--bad);
}

/* The chevron that folds what it heads, pointing down while open. */
.icon.chevron {
  color: var(--ink);
  transition: transform var(--motion) var(--motion-ease);
}

.icon.chevron.folded {
  transform: rotate(-90deg);
}

/*
  A <details> says whether it is open by the same chevron before its summary, in place of the
  browser's triangle, which jumps rather than turns. It turns as soon as a close starts: geo.js
  keeps the <details> open while it rolls up, and marks it .closing meanwhile.
*/
summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '';
  display: inline-block;
  flex: none;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.3em;
  vertical-align: -0.08em;
  background: currentColor;
  mask: var(--icon-chevron) center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform var(--motion) var(--motion-ease);
}

details[open]:not(.closing) > summary::before {
  transform: none;
}

/* The pictures, one for each action, for whatever else draws one beside its words. */
:root {
  --icon-remove: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E");
  --icon-add: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --icon-duplicate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
  --icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='2' width='8' height='4' rx='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3C/svg%3E");
  --icon-export: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M5 21h14'/%3E%3C/svg%3E");
  --icon-import: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21V9M7 14l5-5 5 5M5 3h14'/%3E%3C/svg%3E");
  --icon-undo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E");
  --icon-redo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14l5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13'/%3E%3C/svg%3E");
  --icon-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13M22 2l-7 20-4-9-9-4z'/%3E%3C/svg%3E");
  --icon-history: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5M12 7v5l3 2'/%3E%3C/svg%3E");
  --icon-resolve: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E");
  --icon-retire: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='5' rx='1'/%3E%3Cpath d='M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8M10 12h4'/%3E%3C/svg%3E");
  --icon-restore: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E");
  --icon-retry: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-9-9c2.5 0 4.9 1 6.7 2.7L21 8M21 3v5h-5'/%3E%3C/svg%3E");
  --icon-edit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5zM15 5l4 4'/%3E%3C/svg%3E");
  --icon-save: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --icon-preview: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --icon-reverse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7.5h15M15 3.75 18.75 7.5 15 11.25M20 16.5H5M9 12.75 5.25 16.5 9 20.25'/%3E%3C/svg%3E");
  --icon-nest: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 10l5 5-5 5M4 4v7a4 4 0 0 0 4 4h12'/%3E%3C/svg%3E");
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --icon-heat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3c1 4 5 5.5 5 10a5 5 0 0 1-10 0c0-2.5 1.5-3.5 2-5.5 1 1.5 1.5 2 2.5 2C11.5 7.5 11 5 12 3z'/%3E%3C/svg%3E");
  --icon-wheel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 3v18M3 12h18M5.6 5.6l12.8 12.8M18.4 5.6 5.6 18.4'/%3E%3C/svg%3E");
  --icon-monotonicity: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h14M14 3l4 4-4 4M4 17h14M14 13l4 4-4 4'/%3E%3C/svg%3E");
  --icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  --icon-passes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2l7 19-7-4-7 4z'/%3E%3C/svg%3E");
  --icon-distance: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='8' width='20' height='8' rx='1'/%3E%3Cpath d='M6 8v3M10 8v4M14 8v3M18 8v4'/%3E%3C/svg%3E");
  --icon-compact: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7'/%3E%3C/svg%3E");
}

.icon.remove {
  --icon: var(--icon-remove);
}

.icon.compact {
  --icon: var(--icon-compact);
}

.icon.heat {
  --icon: var(--icon-heat);
}

.icon.wheel {
  --icon: var(--icon-wheel);
}

.icon.monotonicity {
  --icon: var(--icon-monotonicity);
}

.icon.time {
  --icon: var(--icon-time);
}

.icon.passes {
  --icon: var(--icon-passes);
}

.icon.distance {
  --icon: var(--icon-distance);
}

.icon.add {
  --icon: var(--icon-add);
}

.icon.duplicate {
  --icon: var(--icon-duplicate);
}

.icon.copy {
  --icon: var(--icon-copy);
}

.icon.export {
  --icon: var(--icon-export);
}

.icon.import {
  --icon: var(--icon-import);
}

.icon.undo {
  --icon: var(--icon-undo);
}

.icon.redo {
  --icon: var(--icon-redo);
}

.icon.send {
  --icon: var(--icon-send);
}

.icon.retire {
  --icon: var(--icon-retire);
}

.icon.history {
  --icon: var(--icon-history);
}

.icon.resolve {
  --icon: var(--icon-resolve);
}

.icon.restore {
  --icon: var(--icon-restore);
}

.icon.retry {
  --icon: var(--icon-retry);
}

.icon.edit {
  --icon: var(--icon-edit);
}

.icon.save {
  --icon: var(--icon-save);
}

.icon.preview {
  --icon: var(--icon-preview);
}

.icon.reverse {
  --icon: var(--icon-reverse);
}

.icon.nest {
  --icon: var(--icon-nest);
}

.icon.close {
  --icon: var(--icon-close);
}

.icon.chevron {
  --icon: var(--icon-chevron);
}
.loading-spinner {
  width: 1.1rem;
  height: 1.1rem;
  box-sizing: border-box;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: geo-spin 0.8s linear infinite;
}

@keyframes geo-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation-duration: 3s;
  }
}

/* ── tables and badges ──────────────────────────────────────────────────── */

.table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
}

th.num,
td.num {
  text-align: right;
}

tr.failed td {
  color: var(--bad);
}

/* A column head that sorts its table: the head's own text, with an arrow that says which way. */
button.sort {
  display: inline-flex;
  gap: 0.3rem;
  align-items: baseline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: inherit;
  white-space: nowrap;
}

th[aria-sort='ascending'],
th[aria-sort='descending'] {
  color: var(--ink);
}

button.sort .arrow {
  font-size: 0.75em;
}

th[aria-sort='none'] button.sort .arrow {
  opacity: 0.35;
}

button.sort:where(:enabled:hover, :enabled:active) {
  background: none;
  box-shadow: none;
  color: var(--ink);
}

button.sort:where(:enabled:active) {
  opacity: 0.7;
}

/* A name that wraps reads from the left, as the column does. */
td button.link {
  text-align: left;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover td {
  background: var(--tint);
}

/*
  A table with a scroll container of its own keeps its head at the top of it. The shadow stands
  in for the bottom border, which a collapsed border leaves behind when the head sticks.
*/
.table.scroll {
  max-height: calc(100vh - 9rem);
  overflow: auto;
}

.table.scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--line);
}

/*
  The page's own tables keep their heads below the header on a wide screen, where it is fixed.
  Only there do they give up scrolling sideways, which would make their box the one the head
  sticks to; a narrow screen has no fixed header and scrolls them instead.
*/
@media (min-width: 48.01rem) {
  .table:not(.scroll, .float .table, .leaflet-container .table) {
    overflow: visible;
  }

  .table:not(.scroll, .float .table, .leaflet-container .table) thead th {
    position: sticky;
    top: var(--header-height);
    z-index: 1;
    box-shadow: inset 0 -1px 0 var(--line);
  }
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--tint-strong);
  color: var(--muted);
  font-size: 0.8rem;
}

.badge.added,
.badge.good {
  background: color-mix(in oklab, var(--good), transparent 84%);
  color: var(--good);
}

.badge.replaced,
.badge.warn {
  background: color-mix(in oklab, var(--warn), transparent 84%);
  color: var(--warn);
}

.badge.failed,
.badge.bad {
  background: color-mix(in oklab, var(--bad), transparent 84%);
  color: var(--bad);
}

/* ── the notice ─────────────────────────────────────────────────────────── */

/*
  What the last action came to, fixed to the window so a button far down the page still shows
  it: one toast at the top centre, below the header.
*/
.toast {
  position: fixed;
  z-index: 1100;
  top: calc(var(--header-height) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: max-content;
  max-width: min(32rem, calc(100vw - 2rem));
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem 0.6rem 0.9rem;
  border: 1px solid var(--glass-line);
  border-left: 4px solid var(--good);
  border-radius: 6px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
}

.toast.failed {
  border-color: color-mix(in oklab, var(--bad), transparent 55%);
  border-left-color: var(--bad);
}

/* The cross beside the sentence, at the height of its first line. */
.toast button.icon {
  margin: -0.1rem -0.25rem -0.1rem 0;
}

body.map-page .toast {
  top: calc(var(--header-height) + var(--float-gap));
}

@media (max-width: 48rem) {
  /* Below the menu button, which keeps the top right corner. */
  .toast,
  body.map-page .toast {
    top: calc(44px + 2 * var(--float-gap));
  }
}

/* ── dialogs ────────────────────────────────────────────────────────────── */

/* Every question a page asks is asked in a dialog of its own, never confirm() or alert(). */
dialog.question {
  z-index: 1200;
  box-sizing: border-box;
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
}

/*
  A dialog rises into place over a darkening page, and sinks back as it closes. Display and the
  top layer wait for the fade to end; a browser without allow-discrete closes it at once.
*/
dialog.question {
  transition:
    opacity var(--motion) var(--motion-ease),
    transform var(--motion) var(--motion-ease),
    overlay var(--motion) allow-discrete,
    display var(--motion) allow-discrete;
}

dialog.question:not([open]) {
  opacity: 0;
  transform: translateY(0.75rem) scale(0.98);
}

@starting-style {
  dialog.question[open] {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.98);
  }
}

dialog.question::backdrop {
  background: rgb(0 0 0 / 0%);
  transition:
    background-color var(--motion) var(--motion-ease),
    overlay var(--motion) allow-discrete,
    display var(--motion) allow-discrete;
}

/* Light enough that the page still shows through the glass of the dialog, blurred. */
dialog.question[open]::backdrop {
  background: rgb(0 0 0 / 35%);
}

@starting-style {
  dialog.question[open]::backdrop {
    background: rgb(0 0 0 / 0%);
  }
}

/* What the dialog asks for, when it asks for a line of text, such as the name of something new. */
dialog.question label.field {
  margin-bottom: 1rem;
}

dialog.question label.field input {
  width: 100%;
}

/* Why what was asked for could not be done; the dialog stays open, to change it and try again. */
dialog.question p.problem {
  margin-top: -0.25rem;
}

/* A dialog of a page's own, with more in it than a question, such as a table to choose from. */
dialog.question.wide {
  width: min(56rem, calc(100vw - 2rem));
}

dialog.question h2 {
  margin: 0 0 0.5rem;
}

dialog.question p {
  margin: 0 0 1rem;
  line-height: 1.45;
}

dialog.question textarea {
  width: 100%;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* A textarea has no type="password"; a private key pasted into one is drawn as dots instead. */
dialog.question textarea.secret {
  -webkit-text-security: disc;
}

dialog.question .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ── the timeline ───────────────────────────────────────────────────────── */

/* Things down a time axis (timeline.js): years, then the lanes of bars, then the leaders, then the
   labels, each placed in rem. A label is two lines of a set height, a name above a muted line, and
   cut short rather than wrapped, which would throw the layout out. The years are written on
   --gtl-ground, the colour of what the timeline stands on. */
.gtl {
  position: relative;
  margin: 0.6rem 0 0.2rem;
}

.gtl-year {
  position: absolute;
  left: 0;
  height: 0;
  border-top: 1px dashed var(--line);
}

.gtl-year span {
  position: absolute;
  top: -0.55rem;
  left: 0;
  padding-right: 0.25rem;
  background: var(--gtl-ground, var(--raised));
  font-size: 0.75rem;
  line-height: 1.1rem;
  color: var(--muted);
}

/* In front of the bars, which a leader crosses on its way to the bar it is for; clicks go
   through to them. */
.gtl-leaders {
  position: absolute;
  top: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.gtl-leaders path {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/* --tf is the item's own colour, set on its bar, its label and its lit leader, which are drawn in
   it as they would be in the accent. */
.gtl-leaders path.lit {
  stroke: var(--tf, var(--accent));
}

.gtl-bar {
  position: absolute;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
}

.gtl-bar.on {
  border-color: var(--tf, var(--accent));
  background: var(--tf, var(--accent));
}

.gtl-bar:where(:hover),
.gtl-bar.lit {
  border-color: var(--tf, var(--accent));
  background: color-mix(in oklab, var(--tf, var(--accent)) 22%, var(--ground));
}

.gtl-bar.on:where(:hover),
.gtl-bar.on.lit {
  background: color-mix(in oklab, var(--tf, var(--accent)), white 14%);
}

/* Behind its bar's pieces, which it joins: the item's colour, faint, so that it reads as time
   without data, and stronger while the item is lit. */
.gtl-thread {
  position: absolute;
  border-radius: 1px;
  background: var(--line-strong);
  pointer-events: none;
}

.gtl-thread.on {
  background: color-mix(in oklab, var(--tf, var(--accent)) 45%, transparent);
}

.gtl-thread.lit {
  background: var(--tf, var(--accent));
}

.gtl-label {
  position: absolute;
  right: 0;
  display: flex;
  height: 2.4rem;
  overflow: hidden;
}

/* In a waterfall a label stands among the columns, where nothing else is drawn but the years'
   lines, which it covers rather than be crossed by them. */
.gtl.waterfall .gtl-label {
  background: var(--gtl-ground, var(--raised));
}

.gtl-label > * {
  flex: 1;
  min-width: 0;
}

.gtl-label label.check {
  align-items: flex-start;
  cursor: pointer;
}

.gtl-label input {
  margin-top: 0.2rem;
  accent-color: var(--tf, var(--accent));
}

/* The two lines of a label: its name, and a muted line under it. */
.gtl-lines {
  display: grid;
  min-width: 0;
}

.gtl-lines > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gtl-name {
  font-size: 0.9rem;
  line-height: 1.3rem;
}

/* A name with what can be done to it at the right of its line. */
.gtl-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.gtl-head .gtl-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gtl-label.lit .gtl-name {
  color: var(--tf, var(--accent));
}

.gtl-lines .muted {
  font-size: 0.78rem;
  line-height: 1.1rem;
}

/* ── maps and their floating boxes ──────────────────────────────────────── */

/* Where the map is the page, it fills the window below the header, and the page never scrolls. */
body.map-page {
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
}

body.map-page > main {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  max-width: none;
  padding: 0;
}

.map-stage,
.map-stage > .map-fill {
  position: absolute;
  inset: 0;
}

/*
  Where one map is the page, it reaches up under the glass header, and Leaflet's own controls
  start below it as the boxes do; GeoMap counts the header as a box over the map. A map of many
  maps, such as Memory's, stays below the header: only the top row would be under it. In full
  screen, the header is not there.
*/
@media (min-width: 48.01rem) {
  body.map-page .map-stage:not(:fullscreen) > .map-fill.leaflet-container {
    top: calc(-1 * var(--header-height));
  }

  body.map-page .map-stage:not(:fullscreen) > .map-fill.leaflet-container .leaflet-top {
    top: var(--header-height);
  }
}

/*
  The controls lie over the map in boxes. The overlay lets clicks through to the map, and each
  box takes them back, so the map between the boxes still pans.
*/
.overlay {
  position: absolute;
  inset: 0;
  z-index: 1010;
  pointer-events: none;
}

.float {
  position: absolute;
  box-sizing: border-box;
  max-width: calc(100% - 2 * var(--float-gap));
  max-height: calc(100% - var(--float-gap) - var(--float-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.float.top-right,
.float.top,
.float.right {
  top: var(--float-gap);
}

.float.top-right,
.float.bottom-right,
.float.right {
  right: var(--float-gap);
}

.float.bottom-left,
.float.bottom-right,
.float.bottom {
  bottom: var(--float-bottom);
}

.float.bottom-left,
.float.bottom {
  left: var(--float-gap);
}

/* Leaflet's zoom keeps the top left corner, so a box there starts beside it. */
.float.top-left {
  top: var(--float-gap);
  left: calc(var(--float-gap) + 44px);
}

.float.top,
.float.bottom {
  right: var(--float-gap);
}

.float.right {
  bottom: var(--float-bottom);
  width: var(--side-width);
}

/*
  A box down the right takes that side from top to bottom, and Leaflet's attribution moves to its
  left rather than holding the box above itself; folded, the box is its head, and the attribution
  goes back to the corner. --credit-right is set on the stage with no weight, so a page whose box
  does not lie over its map, or not down all of it, sets it back to 0 with any selector.
*/
@media (min-width: 48.01rem) {
  .float.right {
    bottom: var(--float-gap);
    max-height: none;
  }

  :where(.map-stage:has(> .overlay > .float.right:not(.folded))) {
    --credit-right: calc(var(--side-width) + 2 * var(--float-gap));
  }
}

.map-stage .leaflet-bottom.leaflet-right {
  right: var(--credit-right, 0px);
  transition: right var(--motion) var(--motion-ease);
}

.float.top {
  left: calc(var(--float-gap) + 44px);
}

/* A box's head names it and folds it; folded, the head is all there is of it. */
.float-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border-bottom: 1px solid var(--glass-line);
}

.float.folded .float-head {
  border-bottom: 0;
}

.float.folded > :not(.float-head) {
  display: none;
}

/* A box down an edge is as tall as its head once folded. */
.float.folded.right {
  bottom: auto;
}

.float-head > h2,
.float-head > strong {
  margin: 0;
  font-size: 1rem;
}

button.fold {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}

button.fold:where(:enabled:hover) {
  background: var(--tint);
  color: var(--ink);
}

button.fold svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s;
}

.float.folded button.fold svg {
  transform: rotate(-90deg);
}

/* Inside a box, its cards are sections of it, parted by a line. */
.float .card {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.float .card:last-child {
  border-bottom: 0;
}

.float table,
.float th {
  background: none;
}

@media (max-width: 48rem) {
  /*
    The menu button keeps the top right corner of a narrow screen and Leaflet's zoom the top
    left, and a box the width of the screen starts below both.
  */
  .float.top-right,
  .float.right {
    top: calc(64px + 2 * var(--float-gap));
  }

  .float.top-right,
  .float.right,
  .float.bottom-left,
  .float.bottom-right {
    left: var(--float-gap);
    right: var(--float-gap);
    width: auto;
  }
}

/* A route without its line is its places joined straight (GeoStyle.sketch in geo.js): its dashes
   move from start to end while it is asked for, one dash and gap (8 + 8) a beat, and stand still in
   the colour of trouble once it failed. */
.leaflet-overlay-pane path.route-sketch.failed {
  stroke: var(--bad);
}

.leaflet-overlay-pane path.route-sketch.pending {
  animation: geo-sketch-moves 0.8s linear infinite;
}

@keyframes geo-sketch-moves {
  to {
    stroke-dashoffset: -16;
  }
}

@media (prefers-reduced-motion: reduce) {
  .leaflet-overlay-pane path.route-sketch.pending {
    animation: none;
  }
}

/* ── Leaflet, in the dark ───────────────────────────────────────────────── */

/* The tiles are never inverted or filtered; Leaflet's own controls are darkened instead. */
.leaflet-container {
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
}

.leaflet-container a {
  color: var(--accent);
}

.leaflet-bar,
.leaflet-touch .leaflet-bar {
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  box-shadow: var(--glass-shadow);
}

.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  border-bottom-color: var(--glass-line);
  background-color: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
}

.leaflet-bar a:hover,
.leaflet-bar a:focus,
.leaflet-touch .leaflet-bar a:hover {
  background-color: color-mix(in oklab, var(--glass), white 8%);
  color: var(--ink);
}

.leaflet-bar a.leaflet-disabled,
.leaflet-touch .leaflet-bar a.leaflet-disabled {
  background-color: var(--glass);
  color: var(--line-strong);
}

.leaflet-touch .leaflet-bar a:first-child {
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

.leaflet-touch .leaflet-bar a:last-child {
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
}

/* Glass as every other control over the map, so the map shows through all of them alike. */
.leaflet-control-attribution,
.leaflet-container .leaflet-control-attribution {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--muted);
}

.leaflet-control-scale-line {
  border-color: var(--muted);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  text-shadow: none;
}

.leaflet-control-layers,
.leaflet-touch .leaflet-control-layers {
  border: 1px solid var(--glass-line);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--muted);
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--ink);
}

.leaflet-tooltip {
  border-color: var(--line);
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.leaflet-tooltip-top::before {
  border-top-color: var(--raised);
}

.leaflet-tooltip-bottom::before {
  border-bottom-color: var(--raised);
}

.leaflet-tooltip-left::before {
  border-left-color: var(--raised);
}

.leaflet-tooltip-right::before {
  border-right-color: var(--raised);
}

/* ── equations ─────────────────────────────────────────────────────────── */

/* KaTeX (x-tex in geo.js) sets math in its own fonts, in the colour of the text around it. An
   equation on a line of its own scrolls sideways rather than widen a narrow page. */
.katex {
  font-size: 1.1em;
}

.katex-display {
  margin: 0.4em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* A note written over several lines keeps them, wherever it is shown. */
.note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The heat's legend, on the heat page and a share's map: where the colour under the pointer lies
   on the ramp, and what it says. */
.ramp-tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ground);
}

/* A ramp's legend is the ramp alone, drawn as Leaflet's scale line above it is, to take no more
   of the map than the scale does: its border, padding and line, and its font, which both take from
   the map. It has a size of its own, so that nothing written on it moves it or the scale. */
.heat-legend.ramp-only {
  width: 14rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

.heat-legend.ramp-only .ramp {
  box-sizing: border-box;
  height: auto;
  padding: 2px 5px 1px;
  border: 2px solid var(--muted);
  border-top: 0;
  border-radius: 0;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

/* While the pointer is over the map, what the colour under it stands for, on a dark chip so that
   it reads over any palette. Empty, it still holds the line, so the bar keeps its height. Cut
   sideways only: a line of 1.1 is shorter than the letters reach below it. */
.ramp-label {
  position: relative;
  display: inline-block;
  max-width: 100%;
  min-height: 1.1em;
  padding: 0 4px;
  border-radius: 3px;
  vertical-align: top;
  overflow-x: clip;
  text-overflow: ellipsis;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ramp-label.shown {
  background: rgb(0 0 0 / 62%);
}

.heat-hover {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  /* One line, whatever it says: the legend keeps its height as the pointer moves. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.heat-hover span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The way travelled, pointing up for north and turned by the heading. */
.heat-hover-arrow {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  stroke: var(--ground);
  stroke-width: 1;
}

/* The tile grid of the heat page and the share page's editor. Over the tiles, light or dark:
   dark writing with a light halo reads on either. */
.tile-grid {
  box-sizing: border-box;
  border: 1px solid rgb(31 111 235 / 45%);
  color: #0a3069;
  font:
    11px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  padding: 2px 4px;
  text-shadow: 0 0 2px #fff;
}

/* The area of a share, or of the heat page's view, on its map (shared/area.js): a corner of
   it, the first one to close it, and the handle in the middle of an edge. */
.area-handle {
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--raised);
  cursor: grab;
}

.area-handle.first {
  background: var(--accent);
  cursor: pointer;
}

/* Smaller by its icon's size, never by a transform: Leaflet places a marker by its transform. */
.area-handle.middle {
  border-width: 1px;
  opacity: 0.7;
}
