/* The whole page is one chart. Contours, a planned route and a flying dot on the canvas;
   a small title block in the corner, like the legend of a survey map. */
:root {
  --bg: #e6e9e2;
  --ink: #1b2420;
  --muted: #5d6a62;
  --contour: rgba(52, 72, 60, 0.16);
  --contour-major: rgba(52, 72, 60, 0.34);
  --grid: rgba(52, 72, 60, 0.55);
  --route: #c4501a;
  --search: rgba(196, 80, 26, 0.24);
  --obstacle: #8a3b2f;
  --obstacle-fill: rgba(138, 59, 47, 0.10);
  --zone: rgba(27, 36, 32, 0.55);
  --panel: rgba(230, 233, 226, 0.94);
  --f-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1513;
    --ink: #d9e2dc;
    --muted: #8c9b93;
    --contour: rgba(160, 196, 176, 0.10);
    --contour-major: rgba(160, 196, 176, 0.22);
    --grid: rgba(160, 196, 176, 0.46);
    --route: #f2873f;
    --search: rgba(242, 135, 63, 0.22);
    --obstacle: #e0806c;
    --obstacle-fill: rgba(224, 128, 108, 0.10);
    --zone: rgba(217, 226, 220, 0.55);
    --panel: rgba(15, 21, 19, 0.94);
    color-scheme: dark;
  }
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-mono);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: manipulation;
}

.block {
  position: fixed;
  left: max(28px, calc(env(safe-area-inset-left, 0px) + 20px));
  bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  box-sizing: border-box;
  max-width: calc(100vw - 2 * max(28px, calc(env(safe-area-inset-left, 0px) + 20px)));
  padding: 12px 14px 10px;
  background: var(--panel);
  border: 1.5px solid var(--ink);
  pointer-events: none;
}
h1 {
  margin: 0 0 6px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.readout {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.readout b { font-weight: 400; color: var(--muted); }
/* Fixed widths so the values can change without moving their neighbours. */
#r-dist { display: inline-block; min-width: 6ch; }
#r-hdg { display: inline-block; min-width: 4ch; }
.readout .status { min-width: 8ch; color: var(--route); }
.hint {
  margin: 8px 0 0;
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--muted);
  transition: opacity 600ms ease;
}
.hint.gone { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .hint { transition: none; }
}

.key {
  position: fixed;
  top: max(18px, calc(env(safe-area-inset-top, 0px) + 12px));
  right: max(18px, calc(env(safe-area-inset-right, 0px) + 12px));
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: 50%;
}
.key svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.key:hover, .key:focus-visible { color: var(--route); }
.key:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; }

@media (max-width: 480px) {
  .block {
    left: max(22px, calc(env(safe-area-inset-left, 0px) + 12px));
    bottom: max(22px, calc(env(safe-area-inset-bottom, 0px) + 12px));
    max-width: calc(100vw - 2 * max(22px, calc(env(safe-area-inset-left, 0px) + 12px)));
  }
  .readout { gap: 2px 12px; }
}

/* Without JavaScript the map is blank, so the title block moves to the middle. */
.no-js .block { left: 50%; bottom: 50%; transform: translate(-50%, 50%); }
.no-js .readout, .no-js .hint { display: none; }
