#app, body.offline-map {
  display: grid;
  grid-template: "heading heading" auto "tools map" minmax(0, 1fr) "tools info" auto / calc(74px + env(safe-area-inset-left)) minmax(0, 1fr);
}
#app > header, .offline-map > header { grid-area: heading; padding-left: max(15px, env(safe-area-inset-left)); }
.map-tools {
  grid-area: tools;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 4px max(8px, env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
  border-right: 1px solid #496353;
  background: #20372a;
}
.map-tools :is(button, a) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: none;
  width: 100%;
  min-height: 54px;
  padding: 5px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f1f6ec;
  font: 600 12px/1.15 system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
}
.map-tools svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-tools .primary, .map-tools [aria-expanded="true"] { background: #c7e79a; color: #192b23; }
.map-tools .danger { background: #f5c5bd; color: #651e17; }
.map-tools :focus-visible { outline: 2px solid white; outline-offset: -3px; }
#app > #map, .offline-map > #map { grid-area: map; min-width: 0; min-height: 0; }
#app > #panel, .offline-map > section {
  grid-area: info;
  min-width: 0;
  max-height: 42dvh;
  overflow: auto;
  padding-right: max(12px, env(safe-area-inset-right));
}
#friends { min-width: 0; }
#layerOptions .leaflet-control-layers { float: none; margin: 0; box-shadow: none; }
#layerOptions label { padding: 4px; }
#waypoints:not([open]), #waypoints > summary { display: none; }
/* Short phones (such as an iPhone SE): give the map more of the screen. The panel scrolls. */
@media (max-height: 740px) {
  #app > header, .offline-map > header { padding-top: 6px; padding-bottom: 6px; }
  #app > header h1, .offline-map > header h1 { font-size: 19px; }
  #app > #panel, .offline-map > section { max-height: 30dvh; padding-top: 6px; gap: 6px; }
  .map-tools :is(button, a) { min-height: 48px; gap: 2px; }
  #app #status { font-size: 15px; }
  .leaflet-control-attribution { font-size: 10px; }
}
