html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, sans-serif;
}

#map {
  width: 100%;
  height: 100%;
}

#map-toolbar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  max-width: 90vw;
}

.map-toolbar-btn {
  flex-shrink: 0;
  font-size: 13px;
  font-family: inherit;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.map-toolbar-btn:hover:not(:disabled) {
  background: rgba(245, 245, 245, 0.98);
}

.map-toolbar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mode-menu {
  position: relative;
  flex-shrink: 0;
}

.mode-menu__button {
  padding-right: 10px;
}

.mode-menu__popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 180px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.16);
  padding: 6px;
  z-index: 1100;
}

.mode-menu__popover--hidden {
  display: none;
}

.mode-menu__item {
  width: 100%;
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.9);
}

.mode-menu__item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.mode-menu__check {
  width: 16px;
  display: inline-block;
  text-align: center;
  color: rgba(0, 0, 0, 0.8);
}

.mode-menu__label {
  white-space: nowrap;
}

#status {
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

#status.error {
  background: rgba(255, 230, 230, 0.95);
}

#status.loading {
  background: rgba(255, 248, 220, 0.95);
}

#status.has-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  white-space: normal;
  min-width: 180px;
}

#status-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.status-progress--hidden {
  display: none;
}

.status-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: #0066cc;
  transition: width 0.12s ease-out;
}

#status .range-capped {
  color: #8b0000;
}

.leaflet-tile-pane.grayscale img {
  filter: grayscale(100%) contrast(1.05) url(#map-basemap-black-lift);
}

.los-overlay-pane {
  pointer-events: none;
}

.map-toolbar-btn.is-active {
  background: rgba(230, 240, 255, 0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.elevation-legend {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-user-select: none;
}

.elevation-legend--hidden {
  display: none;
}

.elevation-legend__bar {
  width: 18px;
  height: min(70vh, 340px);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  background: linear-gradient(
    to top,
    hsl(220, 100%, 55%) 0%,
    hsl(190, 100%, 50%) 16%,
    hsl(150, 100%, 40%) 34%,
    hsl(95, 100%, 45%) 50%,
    hsl(55, 100%, 55%) 67%,
    hsl(25, 100%, 55%) 84%,
    hsl(0, 100%, 55%) 100%
  );
}

.elevation-legend--rf .elevation-legend__bar {
  background: linear-gradient(
    to top,
    hsl(0, 92%, 48%) 0%,
    hsl(28, 92%, 48%) 20%,
    hsl(52, 92%, 47%) 38%,
    hsl(68, 92%, 46%) 48%,
    hsl(95, 92%, 44%) 56%,
    hsl(125, 92%, 42%) 64%,
    hsl(185, 92%, 44%) 76%,
    hsl(215, 92%, 46%) 88%,
    hsl(240, 92%, 48%) 100%
  );
}

.elevation-legend__labels {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: max-content;
  height: min(70vh, 340px);
  padding: 2px 0;
  font-size: 11px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.86);
}

.elevation-legend__labels--scaled {
  justify-content: flex-start;
}

.elevation-legend__scale-spacer {
  flex: 1 1 0;
  min-height: 0;
}

.elevation-legend__label {
  flex-shrink: 0;
  white-space: nowrap;
}

#map-help {
  position: absolute;
  right: 12px;
  bottom: 40px;
  z-index: 1000;
}

.map-toolbar-btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
}

.about-modal--hidden {
  display: none;
}

.about-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.about-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow: auto;
  padding: 28px 20px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
}

.about-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #888;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.about-modal__close:hover,
.about-modal__close:focus {
  color: #444;
  background: rgba(0, 0, 0, 0.06);
}

.about-modal__content {
  padding-bottom: 28px;
}

.about-modal__version {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 12px;
  color: #888;
  pointer-events: none;
  user-select: none;
}

.about-modal__content h2 {
  margin: 0 32px 12px 0;
  font-size: 18px;
  font-weight: 600;
}

.about-modal__content h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.about-modal__content p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(0, 0, 0, 0.88);
}

.about-modal__content a {
  color: #0066cc;
}

.about-modal__content a:hover {
  text-decoration: underline;
}

.browse-marker {
  cursor: pointer;
}

.browse-distance-label-wrap {
  background: transparent !important;
  border: none !important;
}

.browse-distance-label {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: #000;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
