:root {
  --ink: #1c1c1c; --soft: #5d6066; --line: #dcdde0; --day1: #b8322a; --day2: #1d5fa6; --here: #0a7cff; --ok: #1f7a45;
  --top: calc(12px + env(safe-area-inset-top)); --right: calc(12px + env(safe-area-inset-right));
  --bottom: calc(12px + env(safe-area-inset-bottom)); --left: calc(12px + env(safe-area-inset-left));
}
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
body { font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); }
#map { position: fixed; inset: 0; background: #e2dfda; }
.leaflet-control-attribution { font-size: 10px; padding-left: calc(4px + env(safe-area-inset-left)); padding-bottom: env(safe-area-inset-bottom); }

/* Labels: each is moved to a clear spot beside its point, and is hidden when there is none. */
.label-anchor { pointer-events: none; }
.label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; visibility: hidden; }
.label.shown { visibility: visible; }

/* Place names */
.stop {
  padding: 3px 7px; border-radius: 4px; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  font: 600 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); text-align: center;
}
.stop small { display: none; font-size: 11px; font-weight: 400; }
.stop.close small { display: block; }

/* What a leg adds, on a chip beside it. The chip of a leg that is taken is solid. */
.chip {
  pointer-events: auto; cursor: pointer; display: block; padding: 3px 8px 4px; border-radius: 9px; border: 1.5px solid; text-align: left;
  font: 12px/1.25 system-ui, -apple-system, "Segoe UI", sans-serif; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2);
}
.chip b, .chip span { display: block; }
.chip span { font-size: 11px; font-variant-numeric: tabular-nums; }
.chip.day1 { color: var(--day1); border-color: var(--day1); }
.chip.day2 { color: var(--day2); border-color: var(--day2); }
.chip[aria-pressed="true"] { color: #fff; box-shadow: 0 1px 6px rgb(0 0 0 / 0.35); }
.chip.day1[aria-pressed="true"] { background: var(--day1); }
.chip.day2[aria-pressed="true"] { background: var(--day2); }

/* Small round controls in the corners */
.round {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--ink); background: #fff; box-shadow: 0 1px 6px rgb(0 0 0 / 0.3);
  font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.round svg { width: 22px; height: 22px; }
#corner { position: fixed; z-index: 1000; top: var(--top); right: var(--right); display: grid; gap: 8px; }
#about i { font: italic 700 19px/1 Georgia, "Times New Roman", serif; }

#offline .check, #offline #offline-percent { display: none; }
#offline[data-state="pending"] { color: #9a9da3; }
#offline[data-state="detailed"] { color: var(--ok); }
#offline[data-state="detailed"] .arrow { display: none; }
#offline[data-state="detailed"] .check { display: block; }
#offline[data-state="saving"] { background: conic-gradient(var(--here) calc(var(--progress, 0) * 1turn), #d8dade 0); }
#offline[data-state="saving"] .arrow { display: none; }
#offline[data-state="saving"] #offline-percent {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #fff;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}

#locate { position: fixed; z-index: 1000; right: var(--right); bottom: calc(var(--bottom) + 14px); width: 52px; height: 52px; color: #7b7e85; }
#locate svg { width: 24px; height: 24px; }
#locate[data-mode="on"] { color: var(--here); }
#locate[data-mode="follow"] { color: #fff; background: var(--here); }

/* The position: an arrowhead that points the way of travel. The compass needle points north. */
.cursor svg { display: block; width: 34px; height: 34px; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.45)); }
#north svg { width: 26px; height: 26px; }
.stop.next { color: var(--here); }

/* One line of tracking information, only while tracking */
#pill {
  position: fixed; z-index: 1000; left: var(--left); right: calc(var(--right) + 62px); bottom: calc(var(--bottom) + 20px);
  width: fit-content; max-width: 420px; margin: 0 auto; padding: 9px 13px; border-radius: 20px; font-size: 13px;
  background: #fff; box-shadow: 0 1px 6px rgb(0 0 0 / 0.3); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
}
#pill.off { color: #fff; background: #a3261f; }

/* A small popover beside the corner buttons. It closes when anything outside it is tapped. */
#pop {
  position: fixed; z-index: 1001; top: var(--top); right: calc(var(--right) + 52px); width: min(250px, calc(100vw - 100px));
  padding: 10px 12px; border-radius: 12px; background: #fff; box-shadow: 0 2px 12px rgb(0 0 0 / 0.3); font-size: 13px;
}
#pop p { margin: 0 0 7px; }
#pop p:last-child { margin-bottom: 0; }
#pop .fine { color: var(--soft); font-size: 12px; }
#pop button { font: inherit; font-weight: 600; color: #fff; background: var(--ink); border: 0; border-radius: 9px; padding: 8px 12px; cursor: pointer; }
#pop progress { width: 100%; height: 8px; }
