body,
html {
  height: 100%;
  margin: 0;
  background: black;
  font-family: Arial, sans-serif;
}

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 45px;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 20px;
  z-index: 1000;
}

#header h1 {
  color: white;
  margin: 0;
  font-size: 24px;
  font-weight: bold;
}

#randomizeButton.randomize-icon {
  background: transparent;
  color: #888;
  border: 1px solid #555;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s,
    border-color 0.2s;
}

#randomizeButton.randomize-icon:hover {
  color: #ccc;
  border-color: #888;
}

#header .tagline {
  color: #888;
  margin: 0;
  font-size: 14px;
  font-weight: normal;
}

#header .header-left {
  display: flex;
  align-items: center;
  margin-left: -10px; /* pull left to align with map edge (header padding 20px − map border 10px) */
}

#header .tagline-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

#header .tagline {
  position: static;
  transform: none;
}

@media (max-width: 550px) {
  #header .tagline-wrap {
    display: none !important;
  }
}

#copyButton {
  background: black;
  color: white;
  border: 2px solid white;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  transition:
    background 0.3s,
    border-color 0.3s;
  margin-right: -10px; /* pull right to align with map edge (header padding 20px − map border 10px) */
}

#copyButton:hover {
  background: #333;
}

#copyButton:active {
  background: #000;
}

#copyButton.copied {
  background: #222;
}

.map-wrapper {
  box-sizing: border-box;
  border: 10px solid black;
  position: relative;
}

.map-wrapper #map1,
.map-wrapper #map2 {
  width: 100%;
  height: 100%;
}

/* Styles for screens with width greater than height (landscape) */
@media (min-aspect-ratio: 1/1) {
  .map-wrapper {
    height: calc(100vh - 70px);
    width: 50%;
    float: left;
    margin-top: 45px;
  }
  #wrapper1 {
    border-right-width: 0;
  }
  #wrapper2 {
    border-left-width: 10px;
  }
  .toast {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

/* Styles for screens with height greater than width (portrait) */
@media (max-aspect-ratio: 1/1) {
  .map-wrapper {
    height: calc((100vh - 70px) / 2);
    width: 100%;
  }
  #wrapper1 {
    border-bottom-width: 0;
    margin-top: 45px;
  }
  #wrapper2 {
    border-top-width: 10px;
  }
}

/* Portrait + small (phone): thin footer bar, so maps extend to avoid a large black gap */
@media (max-aspect-ratio: 1/1) and (max-width: 480px) {
  .map-wrapper {
    height: calc((100vh - 50px) / 2); /* 45px header + 5px footer */
  }
}

/* Hide geosearch magnifying-glass icon (bar style has input only) */
.leaflet-control-geosearch .leaflet-bar-part,
.leaflet-geosearch-bar .leaflet-bar-part {
  display: none;
}

/* Location button to the right of search input – override library hiding bar in top/bottom */
.leaflet-top .leaflet-geosearch-bar,
.leaflet-bottom .leaflet-geosearch-bar {
  display: flex !important;
}
.leaflet-control-geosearch,
.leaflet-geosearch-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

/* Form must be in flow so location button sits to the right of the search box (library uses position:absolute) */
.leaflet-control-geosearch .leaflet-geosearch-bar,
.leaflet-control-geosearch form,
.leaflet-geosearch-bar form {
  position: relative;
  flex: 1;
  min-width: min(400px, calc(100vw - 125px));
  margin-right: 0;
  padding-right: 0;
}

/* Location button – same as zoom bar links */
.leaflet-control-geosearch .leaflet-control-location-btn,
.leaflet-geosearch-bar .leaflet-control-location-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  background-color: #fff;
  border: none;
  border-left: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  color: #333;
  flex-shrink: 0;
}

.leaflet-control-geosearch .leaflet-control-location-btn:hover:not(:disabled),
.leaflet-geosearch-bar .leaflet-control-location-btn:hover:not(:disabled) {
  background-color: #f4f4f4;
}

.leaflet-control-geosearch .leaflet-control-location-btn:disabled,
.leaflet-geosearch-bar .leaflet-control-location-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  background-color: #f4f4f4;
  color: #bbb;
}

.leaflet-touch .leaflet-control-geosearch .leaflet-control-location-btn,
.leaflet-touch .leaflet-geosearch-bar .leaflet-control-location-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

/* Draw line control – match Leaflet zoom bar exactly */
.leaflet-draw-line.leaflet-bar {
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
  border-radius: 4px;
}

.leaflet-touch .leaflet-draw-line.leaflet-bar {
  box-shadow: none;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background-clip: padding-box;
}

.leaflet-draw-line .leaflet-draw-line-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  font:
    12px/1.5 "Helvetica Neue",
    Arial,
    Helvetica,
    sans-serif;
  color: #333;
  background-color: #fff;
  border: none;
  border-bottom: 1px solid #ccc;
  cursor: pointer;
  box-sizing: border-box;
}

.leaflet-touch .leaflet-draw-line .leaflet-draw-line-btn {
  width: 30px;
  height: 30px;
}

.leaflet-touch .leaflet-draw-line .leaflet-draw-line-btn:first-child {
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
}

.leaflet-touch .leaflet-draw-line .leaflet-draw-line-btn:last-child {
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
}

.leaflet-draw-line .leaflet-draw-line-btn svg {
  display: block;
  margin: auto;
  flex-shrink: 0;
  color: currentColor;
}

.leaflet-draw-line .leaflet-draw-line-icon,
.leaflet-draw-line .leaflet-draw-trash-icon {
  width: 18px;
  height: 18px;
}

.leaflet-touch .leaflet-draw-line .leaflet-draw-line-btn svg {
  width: 22px;
  height: 22px;
}

.leaflet-draw-line .leaflet-draw-line-btn:hover {
  background-color: #f4f4f4;
}

.leaflet-draw-line .leaflet-draw-line-btn:first-child {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.leaflet-draw-line .leaflet-draw-line-btn:last-child {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  border-bottom: none;
}

.leaflet-draw-line .leaflet-draw-line-btn.active {
  background-color: #0088ff;
  color: #fff;
  border-color: rgba(0, 0, 0, 0.2);
}

.leaflet-draw-line .leaflet-draw-line-btn.active .leaflet-draw-line-icon {
  color: #fff;
}

.leaflet-draw-line .leaflet-draw-line-btn.active:hover {
  background-color: #0066cc;
}

.map-wrapper.draw-mode .leaflet-container {
  cursor: crosshair;
}

.map-wrapper.draw-mode.within-close-range .leaflet-container {
  cursor: pointer;
}

@keyframes leaflet-draw-dash {
  to {
    stroke-dashoffset: -20;
  }
}

.leaflet-draw-animated-dash {
  animation: leaflet-draw-dash 0.6s linear infinite;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(50vh + 5px); /* bottom of top map + 15px on portrait */
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s;
  width: max-content;
  max-width: 90vw;
  box-sizing: border-box;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast.visible {
  opacity: 1;
  visibility: visible;
}

.toast.visible.error {
  background: #c00;
  color: #fff;
  border-color: #a00;
}

#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25px;
  line-height: 25px;
  background: rgba(0, 0, 0, 0.9);
  padding: 5px 20px;
  text-align: center;
  z-index: 1000;
  font-size: 12px;
  color: #888;
}

#footer a {
  color: #888;
  text-decoration: none;
}

#footer a:hover {
  color: #aaa;
}

#footer b {
  color: #aaa;
}

@media (max-width: 480px) {
  #footer {
    height: 5px;
    padding: 0;
    line-height: 0;
    font-size: 0;
    overflow: hidden;
  }
}
