/* Colors: Catppuccin Mocha; the app is always dark.
   --blue is the system accent color when the app provides one (--accent). */
:root {
  color-scheme: dark;
  --crust: #11111b;
  --mantle: #181825;
  --base: #1e1e2e;
  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;
  --overlay0: #6c7086;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --text: #cdd6f4;
  --blue: var(--accent, #89b4fa);
  --green: #a6e3a1;
  --teal: #94e2d5;
  --red: #f38ba8;
  --yellow: #f9e2af;
  --peach: #fab387;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; /* light text on dark, like native dark-mode apps */
  display: flex;
  background: var(--base);
  color: var(--text);
  font-size: 13px;
}

/* The map fills the window. --top-inset keeps things along the top edge below
   the traffic lights (the title bar is hidden in the app: html.mac). */
:root {
  --panel-gap: 10px;
  --top-inset: 10px;
}
html.mac {
  --top-inset: 40px;
}
#map {
  position: absolute;
  inset: 0;
}
/* Title bar: the window's own is hidden so the map can run edge to edge; this
   is what you see and grab (the drag area itself is native, MacUI.swift) */
#titlebar {
  display: none;
}
html.mac #titlebar {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  z-index: 50;
  background: color-mix(in srgb, var(--mantle) 6%, transparent);
  backdrop-filter: blur(3px);
  border-bottom: 1px solid color-mix(in srgb, var(--surface1) 12%, transparent);
  pointer-events: none;
}
/* Zoom / compass / Map / Key: top left, under the traffic lights */
.maplibregl-ctrl-top-left {
  top: calc(var(--top-inset) - 10px);
}

#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, var(--base) 93%, transparent);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  padding: 28px 36px;
  text-align: center;
  z-index: 10;
  min-width: 260px;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--surface0);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#load-status {
  font-size: 12px;
  color: var(--subtext0);
}

#legend {
  font-size: 11px;
  line-height: 1.8;
}

/* Small floating windows (Map, Key): toggled from the map controls, dragged by their title */
.float-win {
  display: none;
  position: absolute;
  z-index: 35;
  top: var(--top-inset);
  left: 54px;
  min-width: 200px;
  padding: 10px 14px 14px;
  background: color-mix(in srgb, var(--mantle) 96%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  box-shadow: 0 10px 32px #000a;
  /* Taller than the window (a short window, or a long Map window): scroll */
  max-height: calc(100% - var(--top-inset) - 12px);
  overflow-y: auto;
  box-sizing: border-box;
}
.float-win.open {
  display: block;
}
.fw-head {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  cursor: grab;
}
#map-zoom {
  margin-left: 8px;
  vertical-align: 1px;
}
/* Minimum zoom for layers that need one, while zoomed out below it */
.bm-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bm-zoom:empty {
  display: none;
}
.bm-zoom {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface0);
  color: var(--subtext0);
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  font-variant-numeric: tabular-nums;
}
.fw-head h3 {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.map-ctrl-btn svg {
  display: block;
  margin: auto;
  stroke: var(--text);
}
.map-ctrl-btn.on {
  background-color: var(--surface1) !important;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Map layers panel: one basemap (segmented) + independent overlays (checkboxes) */
#basemap-switch {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 290px;
}
#basemap-switch .bm {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
/* Preview of each basemap (same spot for all: Issaquah, WA, zoom 14) */
.bm-thumb {
  width: 52px;
  height: 40px;
  flex: none;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--surface1);
}
#basemap-switch .bm.on .bm-thumb {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
#basemap-switch .bm:hover {
  background: var(--surface0);
}
#basemap-switch .bm.on {
  background: var(--surface1);
}
#basemap-switch .bm[hidden] {
  display: none;
}
.bm-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.bm-desc {
  font-size: 12px;
  color: var(--subtext0);
  line-height: 1.35;
}
.bm-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
}
#basemap-switch .grp-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtext0);
  margin: 4px 0 4px 8px;
}
/* Data rows: a checkbox beside a title + description */
#basemap-switch .chk {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
#basemap-switch .chk + .chk {
  margin-top: 2px;
}
/* The box's top lines up with the top of the title's capitals (16px line,
   13px text: caps start ~3px down) */
#basemap-switch .chk .box {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex: none;
  border-radius: 4px;
  border: 1.5px solid var(--overlay0);
  display: flex;
  align-items: center;
  justify-content: center;
}
#basemap-switch .chk .bm-name {
  line-height: 16px;
}
#basemap-switch .chk.on .box {
  background: var(--green);
  border-color: var(--green);
}
/* Region row: name + data date (opens Map data), and a refresh button that
   spins while busy */
#region-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
#btn-region,
#btn-region-update {
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
#btn-region {
  flex: 1;
  display: flex;
  padding: 7px 8px;
  text-align: left;
}
#btn-region-update {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subtext0);
}
#btn-region:hover,
#btn-region-update:hover {
  background: var(--surface0);
}
#btn-region-update:hover {
  color: var(--text);
}
#btn-region-update[hidden] {
  display: none;
}
#btn-region-update.busy {
  cursor: default;
}
#btn-region-update.busy svg {
  animation: region-spin 1s linear infinite;
}
@keyframes region-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #btn-region-update.busy svg {
    animation: none;
  }
}
#basemap-switch .chk.on .box::after {
  content: "";
  width: 4px;
  height: 9px;
  margin-top: -2px;
  border: solid var(--crust);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.legend-swatch {
  width: 20px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Floating editing toolbar, bottom center of the map */
#toolbar {
  /* centered with auto margins, not translateX(-50%): a half-pixel offset blurs the text */
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: color-mix(in srgb, var(--mantle) 95%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  box-shadow: 0 8px 28px #0008;
}
.tb-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--subtext0);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.tb-btn.icon {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.tb-btn:hover:not(:disabled) {
  background: var(--surface0);
  color: var(--text);
}
/* Active tool: stays highlighted while hovered, too */
.tb-btn.on,
.tb-btn.on:hover:not(:disabled) {
  background: var(--green);
  color: var(--crust);
}
.tb-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.tb-btn[hidden] {
  display: none;
}
.tb-sep {
  width: 1px;
  height: 20px;
  margin: 0 5px;
  background: var(--surface1);
}

/* Inspector (selected trail) above the legend on the right */
:root {
  --insp-w: 300px;
}
#right-col {
  position: absolute;
  top: var(--top-inset);
  right: var(--panel-gap);
  bottom: 20px;
  z-index: 30;
  width: var(--insp-w);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
#right-col > * {
  pointer-events: auto;
}
#trail-info {
  display: none;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 16px;
  background: color-mix(in srgb, var(--mantle) 95%, transparent);
  border: 1px solid var(--surface0);
  border-radius: 14px;
  box-shadow: 0 8px 28px #0008;
}
#trail-info.active {
  display: block;
}
#trail-info h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--overlay0);
  margin-bottom: 8px;
  font-weight: 600;
}
.insp-head {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.insp-head h2 {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sr-hint kbd {
  font:
    10px "SF Mono",
    ui-monospace,
    monospace;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface0);
  color: var(--subtext0);
}

/* Search palette */
#search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  background: #11111b66;
}
#search-backdrop.open {
  display: flex;
}
#search-box {
  width: 560px;
  max-width: calc(100% - 32px);
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 14px;
  box-shadow: 0 20px 60px #000c;
  overflow: hidden;
}
#search-input {
  width: 100%;
  padding: 14px 18px;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 17px;
}
#search-results {
  max-height: 50vh;
  overflow-y: auto;
  border-top: 1px solid var(--surface0);
  padding: 6px;
}
#search-results:empty {
  display: none;
}
.sr-group {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--overlay0);
  padding: 8px 10px 4px;
}
.sr-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.sr-item.on {
  background: var(--blue);
}
.sr-item.on .sr-name,
.sr-item.on .sr-meta {
  color: var(--crust);
}
.sr-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.sr-meta {
  font-size: 11px;
  color: var(--overlay0);
}
.sr-hint {
  padding: 10px;
  font-size: 12px;
  color: var(--overlay0);
}
.name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
#trail-osm-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}
#trail-osm-link:hover {
  text-decoration: underline;
}
.details-toggle {
  display: block;
  margin-top: 14px;
  padding: 4px 0;
  background: none;
  border: none;
  color: var(--overlay0);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
}
.details-toggle:hover {
  color: var(--subtext0);
}
.details-toggle.on {
  color: var(--text);
}
#trail-tags {
  display: none;
}
#trail-tags.open {
  display: block;
}

.tags-table {
  margin: 4px 0 0;
}
.tag-r {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-size: 12px;
}
.tag-r .tag-v {
  text-align: right;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}
.tag-k {
  color: var(--overlay0);
}
.tag-v {
  color: var(--text);
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
}
.tag-r.edit {
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.tag-r.edit .tag-k {
  flex: 0 0 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-in,
.tag-new input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 11px;
  outline: none;
}
.tag-in:hover {
  border-color: var(--surface0);
}
.tag-in:focus,
.tag-new input {
  border-color: var(--surface1);
  background: var(--base);
}
.tag-in:focus,
.tag-new input:focus {
  border-color: var(--blue);
}
select.tag-in {
  background: var(--base);
  border-color: var(--surface0);
  cursor: pointer;
}
.tag-x {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--overlay0);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  visibility: hidden;
}
.tag-r.edit:hover .tag-x,
.tag-x:focus {
  visibility: visible;
}
.tag-x:hover {
  color: var(--red);
  background: var(--surface0);
}
.tag-add {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}
.tag-add-btn {
  padding: 2px 0;
  border: none;
  background: none;
  color: var(--blue);
  font-size: 11px;
  cursor: pointer;
}
.tag-add-btn:hover {
  text-decoration: underline;
}
.tag-new {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.tag-new[hidden] {
  display: none;
}
.tag-new-ok {
  flex: none;
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  background: var(--blue);
  color: var(--crust);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.imba-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.imba-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 2px solid var(--surface0);
  border-radius: 8px;
  background: var(--base);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition:
    border-color 0.12s,
    background 0.12s;
}
.imba-btn:hover {
  border-color: #45475a;
  background: #313244;
}
.imba-btn.selected {
  border-color: #89b4fa;
  background: #313244;
}
.imba-btn .kb {
  margin-left: auto;
  font-size: 10px;
  font-family: "SF Mono", monospace;
  background: var(--surface0);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--overlay0);
}
.imba-sym {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.i0 .imba-sym {
  color: #f5e0dc;
}
.i1 .imba-sym {
  color: #2e9e3e;
}
.i2 .imba-sym {
  color: #89b4fa;
}
.i3 .imba-sym {
  color: #585b70;
}
.i4 .imba-sym {
  color: #585b70;
}
.i5 .imba-sym {
  color: #fe640b;
}

#btn-pending {
  display: flex;
  margin-left: 4px;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border: none;
  border-radius: 18px;
  background: var(--green);
  color: var(--crust);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px #0006;
}
#btn-pending:hover {
  background: var(--teal);
}
#btn-pending[hidden],
.tb-sep[hidden] {
  display: none;
}
#p-badge:not(:empty) {
  padding: 0 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--crust) 20%, transparent);
}

#pending-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--crust) 60%, transparent);
  display: none;
  align-items: center;
  justify-content: center;
}
#pending-backdrop.open {
  display: flex;
}
#shortcuts-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: color-mix(in srgb, var(--crust) 60%, transparent);
  display: none;
  align-items: center;
  justify-content: center;
}
#shortcuts-backdrop.open {
  display: flex;
}
#resolve-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: color-mix(in srgb, var(--crust) 60%, transparent);
  display: none;
  align-items: center;
  justify-content: center;
}
#resolve-backdrop.open {
  display: flex;
}
#resolve-modal {
  width: 520px;
  max-width: calc(100% - 32px);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 14px 18px 16px;
  box-shadow: 0 12px 40px #000c;
}
#resolve-modal .modal-head {
  cursor: default;
}
#resolve-intro {
  font-size: 12px;
  color: var(--subtext0);
  margin: 0 0 10px;
}
.res-item {
  padding: 10px 0;
  border-top: 1px solid var(--surface0);
}
.res-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.res-sub {
  font-size: 11px;
  color: var(--overlay0);
  margin: 2px 0 6px;
}
.res-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.res-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.res-actions button {
  width: auto;
  margin: 0;
  padding: 7px 14px;
}
#regions-backdrop {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: color-mix(in srgb, var(--crust) 60%, transparent);
  display: none;
  align-items: center;
  justify-content: center;
}
#regions-backdrop.open {
  display: flex;
}
#regions-modal {
  width: 440px;
  max-width: calc(100% - 32px);
  height: min(640px, 85vh);
  display: flex;
  flex-direction: column;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 14px 18px 12px;
  box-shadow: 0 12px 40px #000c;
}
#regions-modal .modal-head {
  cursor: default;
}
.rg-intro {
  font-size: 12px;
  color: var(--subtext0);
  margin: 0 0 10px;
  line-height: 1.45;
}
.rg-intro a {
  color: var(--blue);
  text-decoration: none;
}
.rg-intro a:hover {
  text-decoration: underline;
}
.rg-note {
  font-size: 12px;
  color: var(--yellow);
  margin: 0 0 10px;
}
.rg-note[hidden] {
  display: none;
}
#regions-mine {
  flex: none;
  max-height: 40%;
  overflow-y: auto;
}
.rg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--surface0);
}
.rg-row:last-child {
  border-bottom: 1px solid var(--surface0);
}
.rg-main {
  flex: 1;
  min-width: 0;
}
.rg-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.rg-sub {
  font-size: 11px;
  color: var(--overlay0);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.rg-bar {
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--surface0);
  overflow: hidden;
}
.rg-bar > div {
  height: 100%;
  background: var(--blue);
  transition: width 0.2s;
}
.rg-act {
  width: auto;
  margin: 0;
  padding: 0;
  font-size: 12px;
}
.rg-del {
  color: var(--red);
}
.rg-badge {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 9px;
  vertical-align: 1px;
  background: color-mix(in srgb, var(--green) 20%, transparent);
  color: var(--green);
  font-size: 10px;
  font-weight: 600;
}
.rg-rebuild {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--subtext0);
  padding: 0 0 8px;
}
.rg-spin {
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface1);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.rg-empty {
  font-size: 12px;
  color: var(--overlay0);
  padding: 8px 0;
}
#regions-filter {
  flex: none;
  margin: 14px 0 6px;
  padding: 7px 10px;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#regions-filter:focus {
  border-color: var(--blue);
}
#regions-catalog {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.rg-group {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--overlay0);
  margin: 10px 0 4px;
}
.rg-pick {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rg-pick:hover {
  background: var(--surface0);
}
.rg-dl {
  font-size: 11px;
  color: var(--blue);
  visibility: hidden;
}
.rg-pick:hover .rg-dl,
.rg-pick:focus .rg-dl {
  visibility: visible;
}

#shortcuts-modal {
  width: 560px;
  max-width: calc(100% - 32px);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 14px 18px 16px;
  box-shadow: 0 12px 40px #000c;
}
#shortcuts-modal .modal-head {
  cursor: default;
}
.sc-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 28px;
}
.sc-group h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--overlay0);
  margin: 12px 0 6px;
  font-weight: 600;
}
.sc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--text);
}
.sc-keys {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.sc-keys kbd {
  font:
    11px ui-monospace,
    "SF Mono",
    monospace;
  color: var(--text);
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}
#pending-modal {
  width: 440px;
  max-width: calc(100% - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 14px 16px 12px;
  box-shadow: 0 12px 40px #000c;
}
#pending-modal .modal-head {
  cursor: default;
}
/* About eight changes in view (rows are ~45px); the rest scroll */
#pending-list {
  max-height: calc(8 * 45px);
  overflow-y: auto;
  min-height: 0;
  flex-shrink: 1;
}
.pending-empty {
  font-size: 12px;
  color: var(--overlay0);
  padding: 8px 0;
}
.pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--surface0);
}
.pending-item .pi-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.pending-item .pi-main:hover .pi-name {
  text-decoration: underline;
}
.pending-item .pi-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-item .pi-change {
  color: var(--subtext0);
  font-size: 11px;
  margin-top: 1px;
}
.pending-item button {
  background: none;
  border: none;
  color: var(--overlay0);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.pending-item button:hover {
  color: var(--red);
  background: var(--surface0);
}
/* Changeset comment in Pending Changes: a titled field with room above and
   below, set apart from the upload button */
.cs-field {
  padding: 14px 0 16px;
  margin-top: 12px;
  border-top: 1px solid var(--surface0);
}
.cs-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--subtext1);
}
.cs-field .cs-input {
  margin-top: 0;
}
.cs-input {
  width: 100%;
  margin-top: 8px;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.cs-input:focus {
  border-color: var(--blue);
}

.btn-primary {
  width: 100%;
  padding: 9px;
  margin-top: 8px;
  border: none;
  border-radius: 6px;
  background: var(--green);
  color: var(--base);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--teal);
}
.btn-primary:disabled {
  background: var(--surface0);
  color: var(--surface1);
  cursor: default;
}
.btn-link {
  display: block;
  text-align: center;
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--overlay0);
  font-size: 11px;
  cursor: pointer;
  padding: 4px;
}
.btn-link:hover {
  color: var(--subtext0);
}

#account-backdrop {
  position: fixed;
  inset: 0;
  z-index: 108;
  display: none;
  align-items: center;
  justify-content: center;
  background: #11111b99;
}
#account-backdrop.open {
  display: flex;
}
#account-modal {
  width: 380px;
  max-width: calc(100% - 32px);
  padding: 14px 18px 16px;
  background: var(--mantle);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  box-shadow: 0 12px 40px #000c;
}
#token-user {
  cursor: pointer;
}
#token-user:hover {
  text-decoration: underline;
}
#btn-logout {
  text-align: left;
  padding: 0;
  margin-top: 2px;
}
#token-user {
  font-size: 11px;
  color: var(--green);
  margin-top: 4px;
}
#account-modal input {
  width: 100%;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
#account-modal input:focus {
  border-color: var(--blue);
}
#upload-status {
  display: none;
  position: absolute;
  z-index: 40;
  /* centered in the map */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  max-width: calc(100% - 24px);
  background: color-mix(in srgb, var(--mantle) 96%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px #000a;
}
#upload-status.open {
  display: block;
}
#upload-status .us-head {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
#us-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
#us-title.ok {
  color: var(--green);
}
#us-title.err {
  color: var(--red);
}
#us-result {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
}
#us-result:empty {
  display: none;
}
#us-result a {
  color: var(--blue);
  cursor: pointer;
  text-decoration: none;
}
#us-result a:hover {
  text-decoration: underline;
}
#us-result button {
  margin-top: 8px;
}
#upload-progress {
  display: none;
  margin-bottom: 6px;
}
#upload-progress.active {
  display: block;
}
.up-bar {
  height: 6px;
  background: var(--surface0);
  border-radius: 3px;
  overflow: hidden;
}
.up-fill {
  height: 100%;
  width: 0;
  background: var(--green);
  transition: width 0.2s;
}
.up-text {
  font-size: 11px;
  color: var(--subtext0);
  margin: 4px 0;
}
.up-log {
  max-height: 160px;
  overflow-y: auto;
  font-size: 11px;
  font-family: ui-monospace, monospace;
}
.up-log div {
  padding: 1px 0;
  color: var(--subtext0);
}
.up-log .ok {
  color: var(--green);
}
.up-log .err {
  color: var(--red);
  user-select: text;
  -webkit-user-select: text;
}
.hint {
  font-size: 10px;
  color: var(--surface1);
  margin-top: 4px;
}
.hint a {
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}
.hint a:hover {
  text-decoration: underline;
}

#top-pills {
  position: absolute;
  top: var(--top-inset);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
#top-pills > * {
  pointer-events: auto;
}
#activity {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 11px;
  background: color-mix(in srgb, var(--base) 93%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface1);
  border-radius: 18px;
  box-shadow: 0 2px 8px #0006;
  font-size: 12px;
  color: var(--subtext1);
  white-space: nowrap;
  pointer-events: none;
}
#activity[hidden] {
  display: none;
}
/* How far along, for tasks that know (syncing your edits, region updates) */
#activity {
  position: relative;
  overflow: hidden;
}
#activity-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--surface0);
}
#activity-bar[hidden] {
  display: none;
}
#activity-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  transition: width 0.2s ease-out;
}
.act-spin {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--surface1);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

.hw-grid {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}
.hw-btn {
  flex: 1;
  padding: 7px 4px;
  text-align: center;
  border: 2px solid var(--surface0);
  border-radius: 6px;
  background: var(--base);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}
.hw-btn:hover {
  border-color: var(--surface1);
  background: var(--surface0);
}
.hw-btn.selected {
  border-color: var(--blue);
  background: var(--surface0);
}
#trail-name-input {
  width: 100%;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  margin-bottom: 2px;
  min-width: 0;
}
#trail-name-input:focus {
  border-color: var(--blue);
}

/* Against the right edge; beside the inspector while a trail is selected */
#route-section {
  display: none;
  position: absolute;
  top: var(--top-inset);
  right: var(--panel-gap);
  z-index: 20;
  width: 320px;
  max-height: calc(100% - 68px);
  overflow-y: auto;
  background: color-mix(in srgb, var(--mantle) 96%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 14px 16px 10px;
  box-shadow: 0 8px 32px #000a;
}
#route-section.active {
  display: block;
}
body:has(#trail-info.active) #route-section {
  right: calc(var(--insp-w) + var(--panel-gap) * 2);
}
.modal-head {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  cursor: move;
  user-select: none;
}
.modal-head h3 {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--overlay0);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.modal-close:hover {
  color: var(--text);
}
.route-members-scroll {
  max-height: 200px;
  overflow-y: auto;
}
.route-name-input {
  width: 100%;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  margin-top: 6px;
}
.route-name-input:focus {
  border-color: var(--blue);
}
.route-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--surface0);
}
.route-member button {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}
#route-nearby {
  margin: 8px 0 4px;
}
#route-nearby .nearby-title {
  font-size: 11px;
  color: var(--peach);
  margin-bottom: 4px;
}
#route-nearby .route-tag.chosen {
  background: var(--green);
  color: var(--crust);
}
#route-nearby .nearby-loading {
  font-size: 10px;
  color: var(--overlay0);
}
#trail-routes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ts-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 4px 5px 12px;
  border-radius: 16px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.ts-pill .ts-name {
  cursor: pointer;
}
.ts-pill .ts-name:hover {
  text-decoration: underline;
}
.ts-pill .ts-x {
  background: none;
  border: none;
  color: var(--overlay0);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 5px;
  border-radius: 10px;
}
.ts-pill .ts-x:hover {
  color: var(--red);
  background: var(--surface1);
}
.ts-add {
  width: 30px;
  height: 30px;
  border-radius: 16px;
  border: 1px dashed var(--surface2);
  background: none;
  color: var(--subtext0);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.ts-add:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green);
}
.ts-add:disabled {
  opacity: 0.4;
  cursor: default;
}
.route-hint {
  font-size: 11px;
  color: var(--subtext0);
  margin: 6px 0;
}
.route-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface0);
  color: var(--text);
  margin: 2px 2px 2px 0;
  cursor: pointer;
}
.route-tag:hover {
  background: var(--surface1);
}
.btn-route {
  width: 100%;
  padding: 7px;
  border: 1px solid var(--surface1);
  border-radius: 6px;
  background: var(--surface0);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  margin-top: 6px;
}
.btn-route:hover {
  background: var(--surface1);
}
.btn-route:disabled {
  color: var(--surface2);
  cursor: default;
}

.maplibregl-ctrl-group {
  background: var(--base) !important;
  border-color: var(--surface0) !important;
}
.maplibregl-ctrl-group button {
  background-color: var(--base) !important;
}
.maplibregl-ctrl-group button span {
  filter: invert(0.8);
}
.maplibregl-ctrl-group button + button {
  border-top-color: var(--surface0) !important;
}
