:root {
  /* Light theme (default) */
  --bg: #e8ecf0;
  --panel: rgba(0, 0, 0, 0.06);
  --text: rgba(0, 0, 0, 0.88);
  --muted: rgba(0, 0, 0, 0.6);
  --border: rgba(0, 0, 0, 0.14);
  --accent: #0a7ea4;
  --shadow-bottom-right: 2px 2px 4px rgba(0, 0, 0, 0.08), 4px 4px 6px rgba(0, 0, 0, 0.06);
  --green-light: #68997a;
  --green-dark: #057335;
  --green-light-muted: #7a9a8a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --panel: rgba(255, 255, 255, 0.08);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.7);
    --border: rgba(255, 255, 255, 0.14);
    --accent: #66e3ff;
    --shadow-bottom-right: 2px 2px 4px rgba(0, 0, 0, 0.22), 4px 4px 6px rgba(0, 0, 0, 0.14);
    --green-light: #68997a;
    --green-dark: #057335;
    --green-light-muted: #7a9a8a;
  }
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  height: 100%;
  /* iOS Safari: avoid 100vh including address bar; allow safe area */
  min-height: 100%;
  min-height: -webkit-fill-available;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  body {
    background: radial-gradient(1200px 600px at 20% 10%, #18203c, var(--bg));
  }
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  min-width: 0; /* allow shrink in flex/grid on small screens */
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  box-shadow: none;
  font-size: 14px;
}

input:focus,
textarea:focus {
  border-color: rgba(102, 227, 255, 0.6);
  box-shadow: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

button {
  border: 1px solid rgba(102, 227, 255, 0.35);
  background: rgba(102, 227, 255, 0.12);
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: none;
}

button:hover {
  background: rgba(102, 227, 255, 0.18);
}

button.secondary {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

/* Queering the Map style: full-screen wrapper (fixed), map absolute inside so only map content zooms */
.map-wrapper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
  touch-action: none; /* so only the map zooms, not the page */
}

.map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* below .leftControls / .rightControls (z-index: 1000) when inside .map-wrapper */
  /* MDN: disable browser gestures so only the map zooms */
  touch-action: none;
}

/* MapLibre sets touch-action on canvas via classes; we enforce none so browser never zooms page on map. */
.maplibregl-canvas-container,
.maplibregl-canvas {
  touch-action: none;
}

/* Vector style handles colors directly, no filter needed */

/* MapLibre popup styling */
/* When popup opens below marker (anchor-top), pull it up so it sits right under the pin */
.maplibregl-popup-anchor-top,
.maplibregl-popup-anchor-top-left,
.maplibregl-popup-anchor-top-right {
  margin-top: -60px;
}
/* Popup tip (arrow) – triangle via border trick */
.maplibregl-popup-tip {
  width: 0;
  height: 0;
  border: 10px solid transparent;
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: #ef95bd !important;
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: #ef95bd !important;
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: #ef95bd !important;
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: #ef95bd !important;
}

/* Style the close button (X) – no shadow */
.maplibregl-popup-close-button {
  color: #000;
  font-size: 14px;
  padding: 2px 4px;
  top: 2px;
  right: 2px;
  left: auto;
  box-shadow: none !important;
}

.maplibregl-popup-close-button:hover {
  background-color: transparent;
  opacity: 1;
}

/* Marker pin color – saved notes: red (light) / purple (dark); preview pin (click-once): black */
.maplibregl-marker [data-marker="true"] .pin1-st0,
.maplibregl-marker [data-marker="true"] .pin2-st0,
.maplibregl-marker [data-marker="true"] svg path,
.maplibregl-marker [data-marker="true"] svg polygon,
.maplibregl-marker [data-marker="true"] svg line,
.maplibregl-marker [data-marker="true"] svg circle {
  fill: #cd1719 !important;
  stroke: none !important;
}
.maplibregl-marker [data-preview-marker="true"] .pin3-st0,
.maplibregl-marker [data-preview-marker="true"] svg path,
.maplibregl-marker [data-preview-marker="true"] svg polygon,
.maplibregl-marker [data-preview-marker="true"] svg line,
.maplibregl-marker [data-preview-marker="true"] svg circle {
  fill: #000 !important;
  stroke: none !important;
}


/* Icons from icons/ (24×24): mask + background-color so we can theme/hover color */
.iconMask {
  display: inline-block;
  width: 24px;
  height: 24px;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: currentColor;
}
.iconHamburger { mask-image: url("icons/hamburger.svg"); -webkit-mask-image: url("icons/hamburger.svg"); }
.iconX { mask-image: url("icons/x.svg"); -webkit-mask-image: url("icons/x.svg"); }
.iconEn { mask-image: url("icons/en.svg"); -webkit-mask-image: url("icons/en.svg"); }
.iconDe { mask-image: url("icons/de.svg"); -webkit-mask-image: url("icons/de.svg"); }
.iconDark { mask-image: url("icons/dark.svg"); -webkit-mask-image: url("icons/dark.svg"); }
.iconLight { mask-image: url("icons/light.svg"); -webkit-mask-image: url("icons/light.svg"); }
.iconLocation { mask-image: url("icons/location.svg"); -webkit-mask-image: url("icons/location.svg"); }
.iconPlus { mask-image: url("icons/plus.svg"); -webkit-mask-image: url("icons/plus.svg"); }
.iconMinus { mask-image: url("icons/minus.svg"); -webkit-mask-image: url("icons/minus.svg"); }

/* UI: buttons 48×48px; icons inside 24×24 from icons/ */
.leftControls {
  position: fixed;
  top: 14px;
  left: 14px;
  top: calc(14px + env(safe-area-inset-top, 0));
  left: calc(14px + env(safe-area-inset-left, 0));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Location button: bottom aligns with zoom-in top (14px + 48+48 zoom = 110px from bottom) */
.rightControls {
  position: fixed;
  bottom: 110px;
  right: 14px;
  bottom: calc(110px + env(safe-area-inset-bottom, 0));
  right: calc(14px + env(safe-area-inset-right, 0));
  z-index: 1000;
}

.hamburgerSpacer {
  width: 48px;
  height: 144px; /* space for hamburger + lang + dark when moved to body */
  flex-shrink: 0;
}

.hamburgerBtn,
.langBtn,
.darkModeBtn,
.locationBtn {
  border: 2px solid var(--green-dark);
  background: var(--green-light);
  backdrop-filter: blur(10px);
  color: var(--green-dark);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  box-sizing: border-box;
  box-shadow: none;
  flex-shrink: 0;
}

/* When menu is open, hamburger (now ×) stays on top so it’s visible and clickable */
.hamburgerBtn {
  position: relative;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  box-sizing: border-box !important;
  background: #ef95bd;
  border: 1px solid black;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.hamburgerBtn::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 48px;
  background: black;
  pointer-events: none;
  display: none;
}

.langBtn {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  box-sizing: border-box !important;
  background: #ef95bd;
  border: 1px solid black;
  border-top: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #000;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.langBtn:hover {
  background: #000;
  color: #ef95bd;
}

.langBtn.langBtnMenuOpen {
  position: fixed;
  top: calc(62px + env(safe-area-inset-top, 0));
  left: calc(14px + env(safe-area-inset-left, 0));
  z-index: 1002;
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
}

.darkModeBtn.darkModeBtnMenuOpen {
  position: fixed;
  top: calc(110px + env(safe-area-inset-top, 0));
  left: calc(14px + env(safe-area-inset-left, 0));
  z-index: 1002;
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
}

.darkModeBtn {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  box-sizing: border-box !important;
  background: #ef95bd;
  border: 1px solid black;
  border-top: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #000;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.darkModeBtn:hover {
  background: #000;
  color: #ef95bd;
}

.hamburgerIcon {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-block;
}
.hamburgerIcon .iconMask {
  position: absolute;
  left: 0;
  top: 0;
  transition: opacity 0.2s ease;
}
.hamburgerIcon .iconX {
  display: none;
}
.hamburgerBtn.menuOpen .hamburgerIcon .iconHamburger {
  display: none;
}
.hamburgerBtn.menuOpen .hamburgerIcon .iconX {
  display: block;
}

.hamburgerBtn.menuOpen {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0));
  left: calc(14px + env(safe-area-inset-left, 0));
  z-index: 1002;
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  border-right: 1px solid black;
}

.locationBtn {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  box-sizing: border-box !important;
  background: #ef95bd;
  border: 1px solid black;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.langBtn,
.darkModeBtn {
  color: #000;
}
.langIcon,
.darkModeIcon {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-block;
}
.langIcon .iconMask,
.darkModeIcon .iconMask {
  position: absolute;
  left: 0;
  top: 0;
}
.langBtn .iconDe,
.darkModeBtn .iconLight {
  display: none;
}
[data-lang="en"] .langBtn .iconEn { display: none; }
[data-lang="en"] .langBtn .iconDe { display: block; }
[data-theme="dark"] .darkModeBtn .iconDark { display: none; }
[data-theme="dark"] .darkModeBtn .iconLight { display: block; }

.locationIcon {
  width: 24px;
  height: 24px;
  display: inline-block;
}
.locationIcon .iconMask {
  transition: opacity 0.2s ease;
}

.locationBtn {
  color: #000;
}
.locationBtn:hover {
  background: black;
  border-color: black;
  color: #ef95bd;
}

.hamburgerBtn {
  color: #000;
}
.hamburgerBtn:hover {
  background: black;
  border-color: black;
  color: #ef95bd;
}


.hamburgerBtn:disabled,
.locationBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* MapLibre default (maplibre-gl.css) uses position:absolute for controls.
   We override to fixed so zoom/flyTo doesn’t move or scale the control UI. */
/* Same right offset as .rightControls (14px + safe-area) so location and zoom stay flush on rotation */
.maplibregl-ctrl-bottom-right {
  position: fixed !important;
  bottom: 0 !important;
  right: 0 !important;
  bottom: calc(0px + env(safe-area-inset-bottom, 0)) !important;
  right: 0 !important;
  display: flex !important;
  flex-direction: row-reverse !important;
  flex-wrap: wrap !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  gap: 0 10px !important;
  padding: 0 calc(14px + env(safe-area-inset-right, 0)) calc(14px + env(safe-area-inset-bottom, 0)) 0 !important;
  transform: none !important;
}

/* No bottom margin so zoom stack top (110px) meets location button bottom (110px); no right margin (in padding above) */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl {
  margin: 0 !important;
  float: none !important;
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group {
  position: relative !important;
  transform: none !important;
  width: 48px !important;
  flex-shrink: 0 !important;
  border: 1px solid black !important;
  border-radius: 0 !important;
  overflow: hidden;
  box-shadow: none !important;
  background: #ef95bd !important;
}

.maplibregl-ctrl-group button {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  border-bottom: 1px solid black !important;
  color: black !important;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
  transform: none !important;
}

.maplibregl-ctrl-group button:last-child {
  border-bottom: none !important;
}

.maplibregl-ctrl-group button:hover {
  background: black !important;
  border-bottom-color: black !important;
  color: #ef95bd !important;
}

/* Style MapLibre zoom control icons - remove default from layout so flex centering works */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in,
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  display: none !important;
}

/* Zoom icons from icons/ (mask + background so hover/dark theme can recolor) */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in::before {
  content: '';
  display: block !important;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-right: 1px;
  mask-image: url("icons/plus.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("icons/plus.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: #000 !important;
  background-image: none !important;
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in:hover::before {
  background-color: #ef95bd !important;
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out::before {
  content: '';
  display: block !important;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-right: 1px;
  mask-image: url("icons/minus.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("icons/minus.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: #000 !important;
  background-image: none !important;
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out:hover::before {
  background-color: #ef95bd !important;
}

.maplibregl-ctrl-group button + button {
  border-top: none;
}

.maplibregl-ctrl-group button:first-child,
.maplibregl-ctrl-group button:last-child {
  border-radius: 0 !important;
}

/* Menu: 4 regions (X cell, horizontal bar, vertical bar, content), 1px black borders, responsive */
.menuOverlay {
  --menu-btn-size: 48px;
  position: fixed;
  top: 14px;
  left: 14px;
  top: calc(14px + env(safe-area-inset-top, 0));
  left: calc(14px + env(safe-area-inset-left, 0));
  width: min(640px, calc(100vw - 28px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
  max-width: calc(100vw - 28px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
  min-width: calc(var(--menu-btn-size) + 2px + 80px);
  height: min(80vh, calc(100vh - 28px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)));
  max-height: calc(100vh - 28px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
  z-index: 1001;
  display: none;
  grid-template-columns: minmax(var(--menu-btn-size), var(--menu-btn-size)) minmax(0, 1fr);
  grid-template-rows: minmax(var(--menu-btn-size), var(--menu-btn-size)) minmax(0, 1fr) auto;
  background: #ef95bd;
  border: 1px solid black;
  border-top-width: 0;
  border-left-width: 0;
  border-bottom-width: 0;
  box-sizing: border-box;
  box-shadow: none;
  overflow: visible;
}

.menuOverlay.open {
  display: grid;
}

/* 1) X cell – same size as button; draws right and bottom so they meet the bars (hamburger sits on top with no right/bottom) */
.menuOverlayXCell {
  grid-column: 1;
  grid-row: 1;
  min-width: var(--menu-btn-size);
  min-height: var(--menu-btn-size);
  background: #ef95bd;
  box-shadow: inset 1px 0 0 black, inset 0 1px 0 black;
  box-sizing: border-box;
}

/* 2) Horizontal bar – top and bottom only; no left (hamburger’s right border is the shared line) */
.menuOverlayHorizontalBar {
  grid-column: 2;
  grid-row: 1;
  background: #ef95bd;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
  box-sizing: border-box;
}

/* 3) Vertical bar – full frame: left, top, right; same 48px width as hamburger column */
.menuOverlayVerticalBar {
  grid-column: 1;
  grid-row: 2;
  width: var(--menu-btn-size);
  min-width: var(--menu-btn-size);
  max-width: var(--menu-btn-size);
  background: #ef95bd;
  border-left: 1px solid black;
  border-top: 1px solid black;
  border-right: 1px solid black;
  box-sizing: border-box;
}

/* 4) Large content area; only this and horizontal bar shrink with width/height */
.menuOverlayContent {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ef95bd;
  box-sizing: border-box;
}

.menuOverlayScroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.menuOverlayScroll::-webkit-scrollbar {
  display: none;
}

.menuOverlayBottomBorder {
  grid-column: 1 / -1;
  grid-row: 3;
  height: 1px;
  background: black;
  pointer-events: none;
}

.menuContent {
  margin: 0;
  padding: 0 24px 24px 12px;
  color: #000;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}

/* Sticky bar: 1px strip so text disappears exactly on the border to the horizontal bar, not earlier */
.menuContentHeader {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  height: 1px;
  margin: 0 -24px 0 -12px;
  padding: 0;
  background: #ef95bd;
}

.menuContent h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.menuContent h2:first-child {
  margin-top: 0;
}

/* Remove gap above the first heading (ABOUT) – pull closer to menuContent top */
.menuContent > h2:first-of-type {
  margin-top: 0;
}

/* Clear spacing between the 4 main segments – only 2nd/3rd/4th h2 (Impressum, Privacy, Terms); first h2 is About */
.menuContent > h2:not(:first-of-type) {
  margin-top: 2.25em;
  padding-top: 0.25em;
}

.menuContent h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 4px;
  color: #000;
}

.menuContent h3:first-child {
  margin-top: 0;
}

.menuContent ul {
  margin: 0 0 4px;
  padding-left: 20px;
}

.menuContent li {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 2px;
}

.menuContent a {
  color: #000;
  text-decoration: underline;
  word-break: break-all;
}

.menuContent p {
  font-size: 14px;
  line-height: 1.6;
  color: #000;
  margin: 0 0 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.brandCenter {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  max-width: calc(100vw - 28px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
  padding: 0 8px;
  pointer-events: none;
  text-align: center;
  z-index: 100;
}

.brandCenter strong {
  font-size: clamp(20px, 6vw + 1rem, 36px);
  font-weight: bold;
  color: #68997a;
  -webkit-text-stroke: clamp(2px, 1.2vw, 5px) #057335;
  paint-order: stroke fill;
}

/* Dark theme: UI #bababa, brand #51b68b / #057335, pins #8f6ca5 (set via data-theme="dark" on html) */
[data-theme="dark"] .hamburgerBtn,
[data-theme="dark"] .hamburgerBtn.menuOpen,
[data-theme="dark"] .langBtn,
[data-theme="dark"] .langBtn.langBtnMenuOpen,
[data-theme="dark"] .darkModeBtn,
[data-theme="dark"] .locationBtn {
  background: #bababa !important;
  border-color: black !important;
  color: #000 !important;
}

[data-theme="dark"] .hamburgerBtn:hover,
[data-theme="dark"] .langBtn:hover,
[data-theme="dark"] .darkModeBtn:hover,
[data-theme="dark"] .locationBtn:hover {
  background: black !important;
  color: #bababa !important;
}

[data-theme="dark"] .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group {
  background: #bababa !important;
  border-color: black !important;
}

[data-theme="dark"] .maplibregl-ctrl-group button:hover {
  background: black !important;
  border-bottom-color: black !important;
  color: #bababa !important;
}

[data-theme="dark"] .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in:hover::before,
[data-theme="dark"] .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out:hover::before {
  background-color: #bababa !important;
}

[data-theme="dark"] .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out:hover::before {
  background-color: #bababa !important;
}

[data-theme="dark"] .menuOverlay,
[data-theme="dark"] .menuOverlayXCell,
[data-theme="dark"] .menuOverlayHorizontalBar,
[data-theme="dark"] .menuOverlayVerticalBar,
[data-theme="dark"] .menuOverlayContent {
  background: #bababa !important;
}

[data-theme="dark"] .menuContent,
[data-theme="dark"] .menuContentHeader {
  background: #bababa !important;
}

[data-theme="dark"] .brandCenter strong {
  color: #51b68b;
  -webkit-text-stroke: clamp(2px, 1.2vw, 5px) #057335;
}

[data-theme="dark"] .maplibregl-marker [data-marker="true"] .pin1-st0,
[data-theme="dark"] .maplibregl-marker [data-marker="true"] .pin2-st0,
[data-theme="dark"] .maplibregl-marker [data-marker="true"] svg path,
[data-theme="dark"] .maplibregl-marker [data-marker="true"] svg polygon,
[data-theme="dark"] .maplibregl-marker [data-marker="true"] svg line,
[data-theme="dark"] .maplibregl-marker [data-marker="true"] svg circle {
  fill: #8f6ca5 !important;
  stroke: none !important;
}
[data-theme="dark"] .maplibregl-marker [data-preview-marker="true"] .pin3-st0,
[data-theme="dark"] .maplibregl-marker [data-preview-marker="true"] svg path,
[data-theme="dark"] .maplibregl-marker [data-preview-marker="true"] svg polygon,
[data-theme="dark"] .maplibregl-marker [data-preview-marker="true"] svg line,
[data-theme="dark"] .maplibregl-marker [data-preview-marker="true"] svg circle {
  fill: #000 !important;
  stroke: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  /* Cover dynamic viewport on mobile (address bar hide/show) */
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

.modal.open {
  display: block;
}

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 28px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
  max-height: calc(100vh - 24px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  padding: 12px;
  box-shadow: none;
}

.dialogHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.title {
  font-size: 14px;
  font-weight: 600;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.iconBtn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  line-height: 1;
  box-shadow: none;
}

.iconBtnClose {
  padding: 0;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
}
.iconBtnClose:hover {
  color: #ef95bd;
}

/* Popup container – no rounded corners */
.maplibregl-popup {
  border-radius: 0;
}
/* MapLibre popup – light mode: pink; dark mode: grey (see [data-theme="dark"] below) */
.maplibregl-popup-content {
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  color: #0b1020;
  width: min(320px, calc(100vw - 48px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
  max-width: min(320px, calc(100vw - 48px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
  box-sizing: border-box;
  border-radius: 0;
  background: #ef95bd;
  border: 1px solid #000;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  /* Keep long unbroken text inside popup */
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

/* Add-note popup: own max width, independent of menu; content scales inside */
.maplibregl-popup-content:has(.addNotePopupForm) {
  width: min(320px, calc(100vw - 48px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
  max-width: min(320px, calc(100vw - 48px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
  box-sizing: border-box;
  /* Center content on popup anchor so tip stays under middle of box (same as default popups) */
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.maplibregl-popup-content h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.maplibregl-popup-content p {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Add-note form inside popup – fills popup width, scales with it */
.addNotePopupForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
}

.addNoteTextareaWrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.addNoteConsentHint {
  font-size: 11px;
  color: #0b1020;
  opacity: 0.85;
  line-height: 1.35;
}

.addNoteConsentHint a {
  color: #0b1020;
  text-decoration: underline;
}

.addNoteConsentHint a:hover {
  opacity: 0.8;
}

.addNotePopupForm textarea {
  width: 100%;
  min-width: 0;
  min-height: 80px;
  padding: 8px 10px;
  border: 1px solid #000;
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  color: #0b1020;
  background: #ef95bd;
  resize: vertical;
  box-shadow: none;
  display: block;
  box-sizing: border-box;
}

.addNotePopupForm textarea::placeholder {
  font-size: 13px;
  opacity: 0.85;
}

.addNotePopupForm button[type="submit"] {
  align-self: center;
  width: 46px;
  height: 46px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #000;
  border-radius: 0;
  background: #ef95bd;
  color: #000;
  font: inherit;
  cursor: pointer;
  box-shadow: none;
  box-sizing: border-box;
  position: relative;
  font-size: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.addNotePopupForm button[type="submit"]::before {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  mask-image: url("icons/plus.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("icons/plus.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: currentColor;
  background-image: none;
  transition: opacity 0.2s ease;
}

.addNotePopupForm button[type="submit"]:hover {
  background: #000;
  color: #ef95bd;
  border-color: black;
}

/* Dark theme: popups grey; submit hover icon grey */
[data-theme="dark"] .maplibregl-popup-content {
  background: #bababa;
}
[data-theme="dark"] .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
[data-theme="dark"] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
[data-theme="dark"] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: #bababa !important;
}
[data-theme="dark"] .maplibregl-popup-anchor-top .maplibregl-popup-tip,
[data-theme="dark"] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
[data-theme="dark"] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: #bababa !important;
}
[data-theme="dark"] .maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: #bababa !important;
}
[data-theme="dark"] .maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: #bababa !important;
}
[data-theme="dark"] .addNotePopupForm textarea {
  background: #bababa;
}
[data-theme="dark"] .addNotePopupForm button[type="submit"] {
  background: #bababa !important;
  border-color: black !important;
  color: #000 !important;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
[data-theme="dark"] .addNotePopupForm button[type="submit"]:hover {
  background: black !important;
  border-color: black !important;
  color: #bababa !important;
}

.addNotePopupForm textarea:focus {
  box-shadow: none;
}

/* Tablet and below */
@media (max-width: 920px) {
  .brandCenter {
    width: fit-content;
  }
}

/* Phone – same 14px spacing as base so UI does not jump at breakpoint */
@media (max-width: 480px) {
  .menuOverlay {
    width: min(640px, calc(100vw - 28px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
    max-width: calc(100vw - 28px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
    min-width: calc(var(--menu-btn-size) + 2px + 80px);
    height: min(80vh, calc(100vh - 28px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)));
    max-height: calc(100vh - 28px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
  }
  .menuContent {
    padding: 0 14px 18px 12px;
  }
  .menuContentHeader {
    height: 1px;
    margin: 0 -14px 0 -12px;
  }
  .dialog {
    width: min(100%, calc(100vw - 20px - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)));
    padding: 10px;
    max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
    top: calc(12px + env(safe-area-inset-top, 0));
    transform: translate(-50%, 0); /* top-aligned on phone so keyboard doesn't cover */
  }
  .form .actions button {
    min-height: 44px; /* touch target */
  }
}

/* Small phone */
@media (max-width: 380px) {
  /* Zoom stack = 48+48; location button above it */
  .rightControls {
    bottom: calc(110px + env(safe-area-inset-bottom, 0));
  }
  .brandCenter strong {
    font-size: 18px;
    -webkit-text-stroke: 2px #057335;
  }
  .menuContent {
    padding: 0 12px 16px 12px;
    font-size: 14px;
  }
  .menuContentHeader {
    height: 1px;
    margin: 0 -12px 0 -12px;
  }
  .menuContent h2 {
    font-size: 16px;
  }
  .menuContent h3 {
    font-size: 14px;
  }
}
