* { box-sizing: border-box; }

:root {
  --bg: #0f1221;
  --panel: #171a2e;
  --panel-2: #1f2440;
  --border: #2c3156;
  --text: #e9ebf5;
  --text-dim: #9aa0c3;
  --accent: #ff5d8f;
  --accent-2: #5d8fff;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

/* Site name, links home from every page. On sub-pages the page's own
   heading follows it on the same line; on the main page it is the heading. */
.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title h1::before {
  content: "/";
  color: var(--text-dim);
  margin-right: 10px;
  font-weight: 400;
}

.brand-link {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-link:hover {
  color: var(--accent-2);
}

.brand-link.brand-home {
  color: var(--text);
  font-size: inherit;
  font-weight: inherit;
}

.brand-link.brand-home:hover {
  color: var(--accent-2);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.btn:hover { border-color: var(--accent-2); }

a.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.req-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
}

.notif-wrap {
  position: relative;
}

#notifBtn {
  position: relative;
}

#notifBadge {
  position: absolute;
  top: -4px;
  right: -4px;
}

.settings-wrap {
  position: relative;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 1500;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.settings-item:hover {
  background: var(--panel-2);
}

.settings-logout {
  color: #ff5d6c;
  font-weight: 600;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
}

.notif-mark-all {
  background: transparent;
  border: none;
  color: var(--accent-2);
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

.notif-mark-all:hover {
  text-decoration: underline;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notif-item {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
}

.notif-item.unread {
  border-color: var(--accent-2);
  background: rgba(93, 143, 255, 0.1);
}

.notif-item-title {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 2px;
  padding-right: 20px;
}

.notif-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 20px;
  cursor: pointer;
}

.notif-delete:hover {
  background: var(--border);
  color: var(--text);
}

.notif-item-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.notif-item-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}

.notif-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  font-weight: 600;
}

.btn-small { padding: 4px 8px; font-size: 12px; }
.btn-icon { padding: 8px 10px; }

/* --topbar-h is kept up to date by script.js; dvh accounts for phone
   browsers' sliding address bars. */
.app {
  display: flex;
  height: calc(100vh - var(--topbar-h, 53px));
  height: calc(100dvh - var(--topbar-h, 53px));
}

#map {
  flex: 1;
  height: 100%;
}

.sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: margin-right 0.2s ease;
}

.sidebar.collapsed {
  margin-right: -340px;
}

.panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.hint {
  color: var(--text-dim);
  font-size: 12px;
  margin: 0 0 10px;
}

form label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

form input, form textarea {
  width: 100%;
  margin-top: 4px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 13px;
  font-family: inherit;
}

form .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  cursor: pointer;
}

form .checkbox-label input {
  width: auto;
  margin: 0;
}

.latlng-row {
  display: flex;
  gap: 8px;
}

.search-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.search-row input {
  margin-top: 0;
  flex: 1;
}

.search-row .btn {
  flex-shrink: 0;
}

.search-results {
  list-style: none;
  margin: -8px 0 12px;
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.search-results li {
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.search-results li:last-child {
  border-bottom: none;
}

.search-results li:hover {
  background: var(--panel-2);
  color: var(--accent-2);
}

.search-results li.search-status {
  color: var(--text-dim);
  cursor: default;
}

.search-results li.search-status:hover {
  background: transparent;
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

#imagePreviewWrap {
  margin-bottom: 10px;
}

#imagePreview {
  max-width: 100%;
  max-height: 140px;
  border-radius: 8px;
  display: block;
  margin-bottom: 6px;
}

.hidden { display: none !important; }

#searchInput {
  width: 100%;
  margin-bottom: 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 13px;
}

.view-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.view-toggle-btn {
  flex: 1;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.view-toggle-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--text);
  border-color: transparent;
  font-weight: 600;
}

.pin-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.15s ease;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-item .gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  color: #fff;
  font-size: 10px;
  padding: 10px 6px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-empty {
  grid-column: 1 / -1;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}

.pin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow-y: auto;
}

.pin-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.pin-item:hover { border-color: var(--accent); }

.pin-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.pin-item .pin-info {
  flex: 1;
  min-width: 0;
}

.pin-item .pin-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-item .pin-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.pin-item-actions button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}

.pin-item-actions button:hover { color: var(--accent); }

.draft-marker-pin {
  width: 16px;
  height: 16px;
  background: #e8372f;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  animation: draftPulse 1.4s ease-in-out infinite;
}

@keyframes draftPulse {
  0%,
  100% {
    transform: rotate(-45deg) scale(1);
  }
  50% {
    transform: rotate(-45deg) scale(1.18);
  }
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.leaflet-popup-tip {
  background: var(--panel);
}

.leaflet-popup-close-button {
  color: var(--text-dim) !important;
}

.leaflet-popup-close-button:hover {
  color: var(--accent) !important;
}

/* The close button is 24px square in the top-right corner. Starting the
   content just below it and using a 9px right margin puts the 6px scrollbar
   directly under the ✕; the padding is the gap between content and bar. */
.leaflet-popup-content {
  width: 280px !important;
  max-height: min(70vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  margin: 24px 9px 14px 16px;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.leaflet-popup-content::-webkit-scrollbar {
  width: 6px;
}

.leaflet-popup-content::-webkit-scrollbar-track {
  background: transparent;
}

.leaflet-popup-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.leaflet-popup-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

.popup-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.popup-desc {
  font-size: 12px;
  margin-bottom: 6px;
  white-space: pre-wrap;
}

.popup-img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
}

.popup-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  margin-bottom: 6px;
  border: none;
}

.popup-actions {
  display: flex;
  gap: 6px;
}

.popup-actions button,
.popup-actions a.btn {
  flex: 1;
  font-size: 11px;
  padding: 4px 6px;
}

.popup-actions a.btn {
  color: var(--text);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.popup-reviews {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
}

.reviews-heading {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 4px;
}

.reviews-loading,
.reviews-empty,
.reviews-login-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.reviews-summary {
  font-size: 12px;
  margin-bottom: 6px;
}

.reviews-count {
  color: var(--text-dim);
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.review-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}

.review-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.review-stars {
  color: var(--accent);
  letter-spacing: 1px;
}

.review-author {
  color: var(--text-dim);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
}

.review-delete:hover {
  color: var(--accent);
}

.review-report {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
}

.review-report:hover {
  color: var(--accent);
}

.review-comment {
  font-size: 12px;
  margin-top: 4px;
  white-space: pre-wrap;
}

.review-sort {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.review-sort-btn {
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10.5px;
  cursor: pointer;
}

.review-sort-btn:hover {
  color: var(--text);
}

.review-sort-btn.active {
  color: var(--text);
  border-color: var(--accent-2);
  background: rgba(93, 143, 255, 0.15);
}

.review-pending {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

.review-votes {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.review-vote {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  cursor: pointer;
}

.review-vote:hover:not([disabled]) {
  color: var(--text);
  border-color: var(--accent-2);
}

.review-vote.active {
  color: var(--text);
  border-color: var(--accent-2);
  background: rgba(93, 143, 255, 0.15);
}

.review-vote[disabled] {
  cursor: default;
  opacity: 0.7;
}

.review-image {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin-top: 6px;
  cursor: pointer;
}

.review-form {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.star-picker {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
}

.star-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.review-comment-input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
  font-family: inherit;
  margin-bottom: 6px;
  resize: vertical;
}

.review-image-input {
  font-size: 11px;
  margin-bottom: 6px;
  width: 100%;
}

.review-image-preview-wrap img {
  max-width: 100%;
  max-height: 100px;
  border-radius: 6px;
  margin-bottom: 6px;
  display: block;
}

.review-submit-btn {
  width: 100%;
}

.auth-status {
  font-size: 13px;
  color: var(--text-dim);
  margin-left: 4px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.overlay-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 320px;
}

.overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.overlay-card h2 {
  margin: 0 0 14px;
}

.auth-error {
  background: rgba(255, 93, 143, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  margin: 0 0 10px;
}

.auth-info {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.45);
  color: #6fe0ad;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  margin: 0 0 10px;
}

.auth-switch {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 12px;
  text-align: center;
}

.auth-switch a {
  color: var(--accent-2);
}

.pin-item-owner {
  font-size: 10px;
  color: var(--text-dim);
}

.profile-link {
  color: inherit;
  text-decoration: none;
}

.profile-link:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.users-card {
  width: 360px;
}

.users-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.user-row .user-name {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row .user-name .you-tag {
  color: var(--text-dim);
  font-size: 11px;
}

.user-row select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 12px;
}

.role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
}

.role-badge.mod {
  background: rgba(93, 143, 255, 0.2);
  color: var(--accent-2);
}

.role-badge.admin {
  background: rgba(255, 93, 143, 0.2);
  color: var(--accent);
}

/* ---------- Main page menu ----------
   Wide screens: the page links sit inline in the header (.main-nav acts as if
   it isn't there). Below 1100px they fold into a dropdown under ☰. */
.main-nav {
  display: contents;
}

.nav-toggle {
  display: none;
}

@media (max-width: 1100px) {
  .topbar {
    position: relative;
  }

  .nav-toggle {
    display: inline-block;
  }

  .main-nav {
    display: none;
  }

  .main-nav.open {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: absolute;
    top: calc(100% + 6px);
    right: 10px;
    min-width: 230px;
    max-height: calc(100dvh - var(--topbar-h, 60px) - 20px);
    overflow-y: auto;
    padding: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    z-index: 1600;
  }

  .main-nav .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    text-decoration: none;
  }

  /* Greeting first, as the menu's header line. */
  .main-nav .auth-status {
    order: -1;
    margin: 0 0 4px;
    padding: 2px 4px 8px;
    border-bottom: 1px solid var(--border);
  }

  .main-nav .auth-status:empty {
    display: none;
  }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  /* 16px stops iPhones zooming the page in when a field is tapped. */
  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }

  .topbar h1,
  .brand-link {
    font-size: 16px;
  }

  .topbar-actions {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
  }

  .topbar-actions > .btn,
  .topbar-actions > a.btn {
    white-space: nowrap;
  }

  .btn-icon {
    padding: 7px 9px;
  }

  /* Sub-pages: site name above the page name instead of beside it. */
  .topbar-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .topbar-title .brand-link {
    font-size: 13px;
    color: var(--text-dim);
  }

  .topbar-title h1 {
    font-size: 17px;
  }

  .topbar-title h1::before {
    display: none;
  }

  /* The "Hi, name" greeting crowds sub-page headers; the main page shows it
     in the ☰ menu instead. */
  .topbar-actions > .auth-status {
    display: none;
  }

  /* Main page: Add pin shows just its icon. */
  #addModeBtn .btn-label {
    display: none;
  }

  /* The pin list becomes a sheet sliding up over the lower part of the map,
     so the map stays visible (and tappable) above it. */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    min-width: 0;
    height: 62dvh;
    z-index: 1000;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
    padding: 18px 12px 12px;
    transition: transform 0.25s ease;
  }

  /* Grab-bar look at the top of the sheet. */
  .sidebar::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--border);
  }

  .sidebar.collapsed {
    margin-right: 0;
    transform: translateY(100%);
  }

  .notif-panel {
    position: fixed;
    top: calc(var(--topbar-h, 56px) + 6px);
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 70dvh;
  }

  .overlay-card {
    width: calc(100vw - 24px);
    max-width: 360px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .leaflet-popup-content {
    width: min(280px, calc(100vw - 90px)) !important;
  }

  /* Map credits stay (the tile licence requires them) but on one small line. */
  .leaflet-control-attribution {
    font-size: 9px;
    max-width: 100vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
