/* Base map viewport sizing + shell layout extracted from style.css */

@supports (height: 100svh) {
  :root {
    --app-vh: 100svh;
  }
}

/* Final startup-stable mobile topbar geometry (no boot toggles): keep search width constant on refresh. */
@media (min-width: 501px) and (max-width: 748px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 154px !important;
    column-gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: grid !important;
    grid-template-columns: 104px 44px !important;
    column-gap: 6px !important;
    align-items: center !important;
    justify-items: end !important;
    width: 154px !important;
    min-width: 154px !important;
    max-width: 154px !important;
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    white-space: nowrap !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin {
    display: inline-flex !important;
    grid-column: 1 !important;
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    display: inline-flex !important;
    grid-column: 2 !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
  }
}

@media (min-width: 749px) and (max-width: 932px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 336px !important;
    column-gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: grid !important;
    grid-template-columns: 84px 104px 98px 44px !important;
    column-gap: 6px !important;
    align-items: center !important;
    justify-items: end !important;
    width: 336px !important;
    min-width: 336px !important;
    max-width: 336px !important;
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    white-space: nowrap !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: inline-flex !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters {
    grid-column: 1 !important;
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin {
    grid-column: 2 !important;
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    grid-column: 3 !important;
    width: 98px !important;
    min-width: 98px !important;
    max-width: 98px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    display: inline-flex !important;
    grid-column: 4 !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
  }
}

/* Portrait mobile (0-500): auth badge must live only in map-bound position, never topbar. */
@media (max-width: 500px) {
  html.mobile.portrait #mobile-topbar .mobile-auth-inline {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html.mobile.portrait #mobile-auth-inline.auth-map-bound,
  html.mobile.portrait .leaflet-control-zoom .mobile-auth-inline.auth-map-bound {
    display: inline-flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  /* Logged-out state: never show floating mobile auth chip. */
  html.mobile.portrait.auth-anon #mobile-auth-inline.auth-map-bound,
  html.mobile.portrait.auth-anon .leaflet-control-zoom .mobile-auth-inline.auth-map-bound {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@supports (height: 100dvh) {
  :root {
    --app-vh: 100dvh;
  }
}

#map {
  position: fixed;
  top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) + var(--ticker-gap));
  left: 0;
  right: 0;
  height: calc(var(--app-vh, 100vh) - (var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) + var(--ticker-gap)));
  min-height: 300px;
  width: 100%;
  z-index: 0;
  pointer-events: auto;
}

/* Leaflet base zoom control positioning + surface */
.leaflet-control-zoom a {
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
}

.leaflet-control-zoom {
  position: absolute !important;
  top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) + var(--ticker-gap) - 72px);
  left: 0px;
  z-index: 1300;
}

.leaflet-top .leaflet-left {
  margin-top: 0 !important;
}

.leaflet-control-zoom a:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: var(--shadow-elev-2);
}

/* Base locate control layout + geometry */
.leaflet-bottom.leaflet-left .locate-control {
  margin-bottom: 12px;
  transform: none !important;
  background: transparent;
  box-shadow: none;
}

html:not(.mobile):not(.tablet) .leaflet-bottom.leaflet-left .locate-control {
  margin-bottom: 22px;
}

.leaflet-bar.locate-control {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.locate-control {
  background: transparent;
  box-shadow: none;
}

.locate-control a {
  box-shadow: var(--shadow-elev-2);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-6) !important;
}

.locate-control .locate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}

.locate-control .locate-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.locate-control a:hover,
.locate-control a:active {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* Base country/world split control layout */
.country-split {
  display: inline-flex;
  align-items: stretch;
  height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-8);
  overflow: hidden;
  box-shadow: var(--shadow-elev-2);
  background: #ffffff;
}

.country-split .country-half {
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  text-decoration: none;
  color: #0f172a;
  background: #ffffff !important;
  border: none;
  box-shadow: none;
  cursor: pointer;
  border-radius: 0 !important;
}

.country-split .country-half:hover,
.country-split .country-half:active {
  background: #f8fafc !important;
}

.country-split .country-half:focus {
  outline: none;
}

.country-split .country-half:visited {
  color: inherit;
}

.country-split .country-half-left {
  border-right: 1px solid #cbd5e1;
  border-radius: var(--radius-8) 0 0 var(--radius-8) !important;
}

.country-split .country-half-right {
  border-radius: 0 var(--radius-8) var(--radius-8) 0 !important;
}

/* Shared interaction transition for map controls */
.leaflet-control-zoom a,
.locate-control a,
.country-split .country-half {
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

/* Keep Leaflet controls interactive over map canvas */
.leaflet-control-container {
  pointer-events: auto !important;
}

.leaflet-control {
  pointer-events: auto !important;
}

.leaflet-top,
.leaflet-bottom {
  pointer-events: auto !important;
}

/* Base Leaflet pane/radar interaction behavior */
.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-marker-pane,
.leaflet-shadow-pane {
  pointer-events: auto !important;
}

/* Prevent marker position easing while dragging/zooming */
.leaflet-marker-icon,
.leaflet-marker-shadow {
  transition: none !important;
}

.leaflet-rainviewer-layer,
.leaflet-rainviewer-frames,
.leaflet-rainviewer-frame,
.leaflet-rainviewer-overlay {
  pointer-events: none !important;
  z-index: 0 !important;
}

.leaflet-rainviewer-controls {
  pointer-events: auto !important;
}

/* Dark mode map-control treatment */
body.dark-mode .leaflet-control-zoom a {
  background: #1f2937 !important;
  color: #e2e8f0 !important;
  border-color: #374151 !important;
}

body.dark-mode .leaflet-control-zoom a:hover {
  background: #324261 !important;
  border-color: #4b5563 !important;
}

body.dark-mode .locate-control a {
  background: #1f2937 !important;
  color: #e2e8f0 !important;
  border-color: #374151 !important;
  box-shadow: var(--shadow-elev-2);
}

body.dark-mode .locate-control a:hover {
  background: #324261 !important;
  border-color: #4b5563 !important;
}

body.dark-mode .locate-control .locate-btn {
  color: #ffffff;
}

body.dark-mode .country-split {
  border-color: #374151;
  box-shadow: var(--shadow-elev-2);
  background: #1f2937;
}

body.dark-mode .country-split .country-half {
  background: #1f2937;
  color: #e2e8f0;
}

body.dark-mode .country-split .country-half-left {
  border-color: #111827;
}

body.dark-mode .country-split .country-half:hover,
body.dark-mode .country-split .country-half:active {
  background: #324261;
}

/* Base map-tile mode toggle visibility + maps tab treatment */
.layer-toggle--maps-open .tile-option--base {
  display: flex;
}

body.mobile .layer-toggle:not(.layer-toggle--maps-open) .tile-option--base {
  display: none;
}

body:not(.mobile) #tile-maps {
  display: none;
}

.tile-option--maps {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1;
}

.tile-option--maps .tile-label {
  color: #0f172a;
  text-shadow: none;
  letter-spacing: 0.5px;
}

body.dark-mode .tile-option--maps {
  background-color: #ffffff !important;
  border-color: #cbd5e1;
}

body.dark-mode .tile-option--maps .tile-label {
  color: #0f172a;
  text-shadow: none;
}

body.mobile .tile-option--maps {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1;
}

body.mobile .tile-option--maps .tile-label {
  color: #0f172a;
  text-shadow: none;
}

body.mobile.dark-mode .tile-option--maps {
  background-color: #ffffff !important;
  border-color: #cbd5e1;
}

body.mobile.dark-mode .tile-option--maps .tile-label {
  color: #0f172a;
  text-shadow: none;
}

#tile-snow.tile-option.active,
#tile-rain.tile-option.active {
  border-color: transparent;
}

#tile-snow.tile-option.active::after,
#tile-rain.tile-option.active::after {
  content: none;
}

.tile-option--maps.active::after {
  content: none;
}

@keyframes border-sheen-x {
  0% { background-position: 0 50%; }
  100% { background-position: -3072px 50%; }
}

@keyframes border-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.tile-preview--osm {
  background-image: url('/static/img/base-previews/osm.png');
}

.tile-preview--img {
  background-image: url('/static/img/base-previews/imagery.png');
}

.tile-preview--topo {
  background-image: url('/static/img/base-previews/topo.png');
}

.tile-preview--snow {
  background-image:
    linear-gradient(135deg, #0ea5e9 0%, #e0f2fe 40%, #ffffff 70%, #bfdbfe 100%),
    linear-gradient(45deg, rgba(255,255,255,0.4), rgba(14,165,233,0.35));
}

.tile-preview--rain {
  background-image:
    radial-gradient(circle at 70% 30%, rgba(96, 165, 250, 0.9), rgba(96, 165, 250, 0) 55%),
    radial-gradient(circle at 30% 70%, rgba(59, 130, 246, 0.85), rgba(59, 130, 246, 0) 60%),
    linear-gradient(135deg, #0f172a, #1d4ed8);
  position: absolute;
  inset: 0;
  opacity: 1 !important;
  filter: none !important;
}

.rain-pulse {
  animation: none;
}

.rain-pulse .rain-toggle-btn,
.rain-pulse.rain-toggle-btn {
  animation: none;
}

.rain-pulse .tile-preview--rain {
  animation: none;
}

.rain-pulse .tile-preview--rain::after {
  content: none;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-online {
  background: #22c55e;
}

.status-offline {
  background: #ef4444;
}

#sync-status {
  position: fixed;
  bottom: 70px;
  right: 20px;
  padding: 6px 10px;
  border-radius: var(--radius-6);
  font-size: 13px;
  background: #0f172a;
  color: #f8fafc;
  z-index: 2500;
  display: none;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

.rain-toggle-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  border: none;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(15,23,42,0.85);
  color: #0ea5e9;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  z-index: 4;
}

.rain-toggle-btn.is-on,
.rain-toggle-btn[aria-pressed="true"] {
  background: #0f172a;
  color: #16a34a;
}

.rain-toggle-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

#tile-rain.rain-unavailable:not(.active) {
  opacity: 0.85;
}

.rain-toggle-btn.rain-unavailable:not(.is-on):not([aria-pressed="true"]) {
  background: rgba(51, 65, 85, 0.9);
  color: #f59e0b;
}

.snow-toggle-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  border: none;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(15,23,42,0.85);
  color: #0ea5e9;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  z-index: 4;
}

.snow-toggle-btn.is-on,
.snow-toggle-btn[aria-pressed="true"] {
  background: #0f172a;
  color: #22c55e;
}

.snow-toggle-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Weather widget shell + card visuals */
#weather-widget {
  position: fixed;
  left: 10px;
  top: 70%;
  transform: translateY(-50%);
  z-index: 2200;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#weather-widget .place {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

#weather-widget .loc-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

#weather-widget .tile {
  width: 156px;
  height: 104px;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.dark-mode #weather-widget .tile {
  background: linear-gradient(135deg, #0f172a, #111827);
  border: 1px solid #0b1220;
}

#weather-widget .weather-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(79,212,255,0.45) 0%, rgba(27,43,84,0.8) 40%, transparent 60%),
    radial-gradient(circle at 80% 30%, rgba(107,77,255,0.45) 0%, rgba(21,22,58,0.8) 45%, transparent 70%),
    radial-gradient(circle at 30% 80%, rgba(255,79,154,0.45) 0%, rgba(26,18,54,0.8) 40%, transparent 70%),
    radial-gradient(circle at 80% 80%, rgba(26,42,100,0.45) 0%, rgba(5,4,20,0.85) 55%, transparent 85%);
  background-repeat: no-repeat;
  background-size: 200% 200%;
  animation: weather-loading-aurora 18s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}

#weather-widget .weather-loading.hidden {
  display: none !important;
}

@keyframes weather-loading-aurora {
  0% {
    background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
  }
  50% {
    background-position: 100% 100%, 0% 100%, 100% 0%, 0% 0%;
  }
  100% {
    background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
  }
}

#weather-widget .icon {
  font-size: 102px;
  line-height: 1;
}

#weather-widget .icon img {
  width: 120px;
  height: 120px;
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  display: block;
  margin: 110px auto 0 auto;
}

#weather-widget .icon #weather-emoji {
  margin-left: 4px;
}

#weather-widget .weather-opts label {
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

#weather-widget .temp {
  position: absolute;
  top: 8px;
  left: 10px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-6);
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #000000;
  opacity: 0.7;
}

#weather-widget .desc-badge {
  position: absolute;
  bottom: 8px;
  left: 10px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-6);
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #000000;
  opacity: 0.7;
}

body.dark-mode #weather-widget .temp,
body.dark-mode #weather-widget .desc-badge {
  background: rgba(255, 255, 255, 0.9);
  border-color: #e5e7eb;
  color: #000000;
}

.rain-legend {
  position: absolute;
  bottom: 47px;
  left: calc(16px + 4 * 66px + 78px);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.4;
  z-index: 1002;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
}

#rain-legend-desktop {
  left: calc(16px + 4 * 66px + 61px);
  background: rgba(15, 23, 42, 0.82);
}

#rain-legend-mobile-ls,
#rain-legend-mobile-pt {
  left: 16px;
  right: 16px;
}

html:not(.mobile) #rain-legend-mobile-ls,
html:not(.mobile) #rain-legend-mobile-pt {
  display: none !important;
}

html.mobile #rain-legend-desktop {
  display: none !important;
}

html.mobile.portrait #rain-legend-mobile-ls {
  display: none !important;
}

html.mobile:not(.portrait) #rain-legend-mobile-pt {
  display: none !important;
}

html.mobile.portrait #rain-legend-mobile-pt {
  right: auto;
  width: 220px;
  bottom: 115px;
  left: clamp(12px, calc(50vw - 142px), calc(100vw - 220px - 12px));
  background: rgba(15, 23, 42, 0.82);
}

html.mobile.portrait #rain-legend-mobile-pt .rain-legend-bar {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

html.mobile:not(.portrait) #rain-legend-mobile-ls {
  right: auto;
  width: 220px;
  bottom: 115px;
  left: clamp(12px, calc(50vw - 142px), calc(100vw - 220px - 12px));
  background: rgba(15, 23, 42, 0.82);
}

html.mobile:not(.portrait) #rain-legend-mobile-ls .rain-legend-bar {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

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

.rain-legend-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rain-legend-scale {
  display: flex;
  align-items: center;
  gap: var(--gap-8);
}

.rain-legend-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rain-legend-bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  overflow: hidden;
}

.rain-legend-bar span:nth-child(1) { background: #c7d2fe; }
.rain-legend-bar span:nth-child(2) { background: #93c5fd; }
.rain-legend-bar span:nth-child(3) { background: #60a5fa; }
.rain-legend-bar span:nth-child(4) { background: #facc15; }
.rain-legend-bar span:nth-child(5) { background: #f97316; }
.rain-legend-bar span:nth-child(6) { background: #dc2626; }

@media (max-width: 500px) {
  html.auth-map-mode #mobile-auth-inline.auth-map-bound {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin-left: 58px !important;
    margin-top: 13px !important;
    z-index: 12000 !important;
  }

  html.mobile.portrait.portrait-bar-open.auth-map-mode #mobile-auth-inline.auth-map-bound {
    margin-top: calc(13px + var(--topbar-h)) !important;
  }

  html.mobile.portrait.portrait-bar-open .leaflet-control-zoom {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--topbar-h) - 47px) !important;
  }

  html.mobile #rain-legend-mobile-pt,
  html.mobile #rain-legend-mobile-ls {
    left: clamp(12px, calc(50vw - 142px), calc(100vw - 220px - 12px)) !important;
    right: auto !important;
    width: 220px !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  html.mobile #rain-legend-mobile-pt .rain-legend-scale,
  html.mobile #rain-legend-mobile-ls .rain-legend-scale {
    min-width: 0 !important;
    width: 100% !important;
  }

  html.mobile #rain-legend-mobile-pt .rain-legend-bar,
  html.mobile #rain-legend-mobile-ls .rain-legend-bar {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
  }

  html.mobile #rain-legend-mobile-pt .rain-legend-label,
  html.mobile #rain-legend-mobile-ls .rain-legend-label {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 932px) {
  html.mobile #rain-legend-mobile-pt,
  html.mobile #rain-legend-mobile-ls {
    display: none !important;
  }
}

@media (max-width: 700px) {
  #rain-legend-mobile-ls,
  #rain-legend-mobile-pt {
    left: 16px;
    right: 16px;
  }
}

@media (max-width: 500px) {
  html.mobile .leaflet-control-zoom {
    top: calc(var(--brandbar-h) + var(--topbar-h) - 47px);
    left: -2px;
  }

  html.mobile #mobile-auth-buttons {
    top: calc(var(--brandbar-h) + var(--topbar-h) + 8px);
    right: 8px;
  }

  html.mobile.portrait.portrait-bar-open .leaflet-control-zoom {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--topbar-h) - 47px);
  }

  html.mobile.portrait.portrait-bar-open #mobile-auth-buttons {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--topbar-h) + 8px);
  }

  html.mobile.portrait #mobile-auth-inline {
    position: fixed;
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-gap) + 13px);
    left: 56px;
    margin-left: 0;
    z-index: 12000;
    background: rgba(255, 255, 255, 0.6);
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    max-width: 180px;
  }

  body.dark-mode html.mobile.portrait #mobile-auth-inline {
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  }

  html.mobile.portrait.portrait-bar-open #mobile-auth-inline {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--topbar-h) + var(--ticker-gap) + 13px);
  }

  html.mobile.portrait #map {
    top: calc(var(--brandbar-h) + var(--topbar-h) - 1px);
    height: calc(var(--app-vh, 100vh) - (var(--brandbar-h) + var(--topbar-h) - 1px));
  }

  body.mobile #mobile-topbar .lang-trigger {
    padding: 4.5px 8px;
  }

  body.mobile #ticker {
    display: none;
    visibility: hidden;
  }
}

/* Dual scale control base layout */
.leaflet-control.dual-scale {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: 24px !important;
  transform: translateX(-50%);
  margin: 0 !important;
  z-index: 2300;
  pointer-events: none;
}

.leaflet-control.dual-scale .ds-wrap {
  position: relative;
  height: 40px;
}

.leaflet-control.dual-scale .ds-bar {
  position: absolute;
  left: 0;
  top: 14px;
  height: 3px;
  width: 120px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}

.leaflet-control.dual-scale .ds-tick {
  position: absolute;
  width: 2px;
  background: #ffffff;
}

.leaflet-control.dual-scale .tick-l {
  top: 6px;
  height: 16px;
}

.leaflet-control.dual-scale .tick-m {
  top: 14px;
  height: 10px;
}

.leaflet-control.dual-scale .tick-r {
  top: 6px;
  height: 16px;
}

.leaflet-control.dual-scale .ds-label {
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  line-height: 1.1;
}

.leaflet-control.dual-scale .ds-metric,
.leaflet-control.dual-scale .ds-imperial {
  position: absolute;
  transform: translateX(-50%);
}

.leaflet-control.dual-scale .ds-metric {
  top: -22px;
  transform: translateX(-50%);
}

.leaflet-control.dual-scale .ds-imperial {
  top: 28px;
  font-size: 13px;
  font-weight: 700;
}

/* Leaflet divIcon circle markers (transparent background) */
.marker-dot-wrapper {
  background: transparent;
  border: none;
}

.marker-dot {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.25);
  transform-origin: 50% 50%;
}

.marker-dot--gold {
  background: #f59e0b;
}

.marker-dot--blue {
  background: #60a5fa;
}

.marker-dot--purple {
  background: url('/static/img/scrolling-banner/options-banner.png') repeat-x center center;
  background-size: 1536px 100%;
  animation: none;
  background-position: var(--banner-x) 0;
}

.marker-dot-wrapper {
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: filter 0.15s ease;
}

.marker-dot-wrapper > .marker-dot,
.marker-dot-wrapper > svg {
  display: block;
  margin: 0;
}

/* Deterministic pin center rendering: avoid visual drift from shadow/scale effects. */
.marker-dot-wrapper--svg {
  filter: none !important;
}

.leaflet-marker-icon.marker-dot-wrapper--svg:hover,
.leaflet-marker-icon.marker-dot-wrapper--svg:active {
  filter: none !important;
}

.leaflet-marker-icon.marker-dot-wrapper--svg:hover svg,
.leaflet-marker-icon.marker-dot-wrapper--svg:active svg {
  transform: none !important;
}

.leaflet-marker-icon.marker-dot-wrapper:hover {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.leaflet-marker-icon.marker-dot-wrapper:hover .marker-dot,
.leaflet-marker-icon.marker-dot-wrapper:hover svg {
  transform: scale(1.14);
}

.leaflet-marker-icon.marker-dot-wrapper:active {
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35));
  transition-duration: 60ms;
}

.leaflet-marker-icon.marker-dot-wrapper:active .marker-dot,
.leaflet-marker-icon.marker-dot-wrapper:active svg {
  transform: scale(0.95);
  transition-duration: 60ms;
}

.marker-dot-wrapper.marker-tail-active::after {
  display: none;
}

body:not(.clusters-ready) .marker-dot-wrapper {
  opacity: 0;
}

/* Connection status chip */
#connection-status {
  position: fixed;
  bottom: 30px;
  right: 20px;
  padding: 6px 10px;
  border-radius: var(--radius-6);
  font-size: 13px;
  background: #1e293b;
  color: #f8fafc;
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

html.mobile #connection-status,
body.mobile #connection-status {
  display: none !important;
}

html.mobile.portrait #connection-status {
  bottom: 18px;
}

@media (max-height: 780px) {
  #weather-widget {
    display: none !important;
  }
}

@media (max-height: 365px) {
  #map {
    min-height: 0;
  }
  .leaflet-bottom.leaflet-left,
  .leaflet-bottom.leaflet-right {
    position: fixed !important;
    bottom: 0 !important;
  }
}

@media (pointer: coarse) and (max-width: 1100px),
(pointer: coarse) and (max-width: 1180px),
(pointer: coarse) and (max-width: 840px),
(pointer: coarse) and (max-width: 1366px),
(pointer: coarse) and (max-width: 1024px),
(max-device-width: 1366px),
(max-device-width: 1024px) {
  .leaflet-control.dual-scale {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .leaflet-control.dual-scale {
    display: none !important;
  }
}

/* Popup close button treatment */
.leaflet-container a.leaflet-popup-close-button {
  color: #475569;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  font-size: 22px;
  font-weight: 400;
  top: 3px;
  right: 3px;
  z-index: 20010;
  pointer-events: auto !important;
  touch-action: manipulation;
}

body.dark-mode .leaflet-container a.leaflet-popup-close-button {
  color: #f8fafc;
  background: transparent;
  border: none;
}

body.dark-mode .leaflet-container a.leaflet-popup-close-button:hover,
body.dark-mode .leaflet-container a.leaflet-popup-close-button:focus {
  color: #e2e8f0;
  background: transparent;
  border: none;
}

html.mobile .leaflet-container a.leaflet-popup-close-button {
  width: 24px;
  height: 24px;
  line-height: 24px;
  font-size: 22px;
  top: 3px;
  right: 3px;
}

.leaflet-popup.comments-open a.leaflet-popup-close-button {
  display: none;
}

.leaflet-popup-content-wrapper,
.leaflet-popup {
  width: auto !important;
  max-width: none !important;
  border-radius: 14px;
  overflow: visible !important;
}

.leaflet-popup-content-wrapper[data-pin-closed="1"] {
  overflow: hidden;
  -webkit-clip-path: inset(0 round 14px);
  clip-path: inset(0 round 14px);
}

.leaflet-popup-content-wrapper[data-pin-closed="1"]::before {
  content: "";
  position: absolute;
  inset: -12%;
  background-image: url("/static/img/temporarily-closed/temporarily_closed_tape.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 110%;
  transform: rotate(-5deg);
  pointer-events: none;
  z-index: 25;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  opacity: 0.96;
}

html.mobile .leaflet-popup.comments-open,
html.mobile .leaflet-popup.comments-open .leaflet-popup-content-wrapper {
  overflow: visible !important;
}

html.mobile .leaflet-popup.comments-open .leaflet-popup-content-wrapper {
  overflow: hidden !important;
  border-radius: 14px;
}

html.mobile .leaflet-popup.comments-open .leaflet-popup-content {
  border-radius: 14px;
}

html.mobile .leaflet-popup.comments-open .leaflet-popup-content-wrapper,
html.mobile .leaflet-popup.comments-open .leaflet-popup-content {
  border-radius: 14px;
  overflow: hidden;
}

/* Base popup content sizing/scroll behavior */
.leaflet-popup-content {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: visible;
  max-width: none !important;
  width: auto !important;
}

html.mobile .leaflet-popup-content {
  max-height: none;
  overflow-y: visible;
}

html.mobile .leaflet-popup.comments-open .pin-popup-comments {
  display: flex !important;
  position: absolute;
  inset: 0;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 14px !important;
}

html.mobile .leaflet-popup.comments-open .pin-popup-main {
  visibility: hidden;
  pointer-events: none;
}

html.mobile .leaflet-popup.comments-open .pin-popup-snow-bg,
html.mobile .leaflet-popup.comments-open .pin-popup-snow-area,
html.mobile .pin-popup.comments-open .pin-popup-snow-bg,
html.mobile .pin-popup.comments-open .pin-popup-snow-area {
  filter: blur(5px) !important;
}

html.mobile .leaflet-popup.comments-open .pin-popup-overlay-bg,
html.mobile .leaflet-popup.comments-open .pin-popup-overlay-area {
  filter: blur(5px) !important;
}

html.mobile .leaflet-popup-content {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

html.mobile .pin-popup {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

html.mobile .pin-popup.comments-open {
  position: relative;
}

body.dark-mode .pin-popup .pin-popup-snow-bg,
body.dark-mode .pin-popup-overlay .pin-popup-overlay-bg {
  background: rgba(15,23,42,0.85) !important;
}

body.dark-mode .leaflet-popup,
body.dark-mode .leaflet-popup-content,
body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-content .pin-popup,
body.dark-mode .leaflet-popup-content .pin-popup-main {
  background: transparent !important;
  box-shadow: none !important;
}

body.dark-mode .leaflet-popup-content-wrapper {
  background: #0b1220 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.08);
}

body:not(.dark-mode) .leaflet-popup-content-wrapper {
  overflow: hidden;
}

body:not(.dark-mode) .leaflet-popup-content-wrapper,
body:not(.dark-mode) .leaflet-popup-content,
body:not(.dark-mode) .leaflet-popup-content .pin-popup {
  border-radius: 14px;
  overflow: hidden !important;
  -webkit-clip-path: inset(0 round 14px);
  clip-path: inset(0 round 14px);
}

.leaflet-popup-content .pin-popup {
  position: relative;
  display: flex;
  gap: 16px;
  width: auto;
  min-width: 420px;
  align-items: stretch;
  overflow: hidden;
  --pin-popup-panel-height: 280px;
}

.pin-popup-main {
  background: transparent;
}

.leaflet-popup-content .pin-popup.comments-open {
  min-width: 880px;
}

html.mobile .leaflet-popup-content .pin-popup.comments-open {
  min-width: auto;
}

.leaflet-popup-content .pin-popup-main {
  flex: 0 0 420px;
  min-width: 420px;
  min-height: var(--pin-popup-panel-height);
  padding-top: 48px;
  position: relative;
  z-index: 2;
}

.leaflet-popup-content .pin-popup-comments {
  flex: 0 0 400px;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 12px 20px;
  display: none;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(15,23,42,0.18);
  align-self: stretch;
  height: var(--pin-popup-panel-height);
  min-height: var(--pin-popup-panel-height);
  max-height: var(--pin-popup-panel-height);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.reaction-cluster {
  position: absolute;
  top: 8px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-8);
  align-items: flex-end;
}

.reaction-cluster .pin-comments-toggle-row {
  text-align: right;
}

.leaflet-popup-content .pin-popup-main,
.leaflet-popup-content .pin-popup-main * {
  text-shadow:
    0 0 2px #fff,
    0 0 4px #fff,
    0 0 6px #fff,
    0 0 8px #fff;
}

body.dark-mode .leaflet-popup-content .pin-popup-main {
  background: transparent;
  box-shadow: none;
}

body.dark-mode .leaflet-popup-content .pin-popup-main,
body.dark-mode .leaflet-popup-content .pin-popup-main * {
  text-shadow: none !important;
  color: #ffffff !important;
}

.leaflet-popup-content .pin-popup.comments-open .pin-popup-comments {
  display: flex;
}

/* Vendor overrides: Leaflet popup chrome */
.leaflet-popup-pane .leaflet-popup {
  overflow: visible !important;
}

html.mobile .leaflet-popup-pane {
  overflow: visible !important;
}

html.mobile .leaflet-container {
  overflow: visible !important;
}

html.auth-map-mode #mobile-auth-inline {
  width: auto;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

html.auth-map-mode #mobile-topbar .mobile-auth-inline {
  display: none !important;
}

html.auth-map-mode #mobile-auth-inline.auth-map-bound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 6px;
  height: 32px;
  box-sizing: border-box;
  margin-left: 58px;
  margin-top: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  visibility: visible;
}

body.dark-mode html.auth-map-mode #mobile-auth-inline.auth-map-bound {
  background: rgba(15, 23, 42, 0.6);
  border-color: #374151;
}

@media (max-width: 949px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-auth-inline {
    display: flex !important;
    background: rgba(255, 255, 255, 0.6);
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    visibility: hidden;
  }

  html.mobile:not(.portrait) body.dark-mode #mobile-topbar .mobile-auth-inline {
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  }

  html.mobile:not(.portrait) .leaflet-control-zoom .mobile-auth-inline.auth-map-bound {
    position: relative;
    margin-left: 6px;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
}

html.mobile.portrait .mobile-portrait-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  width: 100%;
  gap: var(--ribbon-gap);
  padding-right: 4px;
  box-sizing: border-box;
}

html.mobile.portrait .mobile-portrait-actions #mobile-btn-filters {
  justify-self: start;
  min-width: 124px;
  margin-left: 3px;
}

html.mobile.portrait .mobile-portrait-actions #mobile-btn-pin {
  justify-self: center;
  min-width: 124px;
  margin-left: 0;
}

html.mobile.portrait .mobile-portrait-actions #mobile-btn-toggle-theme {
  justify-self: end;
  min-width: 124px;
  margin-right: 3px;
}

html.mobile.portrait .mobile-portrait-actions .btn-secondary {
  transform: translateY(-5px);
}

@media (max-width: 500px) {
  html.mobile.portrait .mobile-portrait-actions {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: var(--ribbon-gap) !important;
    padding-right: 0 !important;
  }

  html.mobile.portrait .mobile-portrait-actions #mobile-btn-filters,
  html.mobile.portrait .mobile-portrait-actions #mobile-btn-pin,
  html.mobile.portrait .mobile-portrait-actions #mobile-btn-toggle-theme {
    justify-self: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 380px) {
  html.mobile.portrait .mobile-portrait-actions #mobile-btn-filters,
  html.mobile.portrait .mobile-portrait-actions #mobile-btn-pin,
  html.mobile.portrait .mobile-portrait-actions #mobile-btn-toggle-theme {
    min-width: 108px;
  }

  html.mobile.portrait .mobile-portrait-actions .btn-secondary {
    padding: 0 8px;
  }
}

html.mobile.portrait #mobile-topbar {
  z-index: 14000;
}

html.mobile.portrait #mobile-topbar {
  right: 0;
}

html.mobile.portrait #mobile-topbar {
  padding-right: 8px;
}

html.mobile.portrait #mobile-topbar .mobile-options {
  margin-right: 0;
}

html.mobile.portrait #mobile-topbar {
  padding-right: 8px !important;
}

html.mobile.portrait #mobile-topbar {
  right: -1px;
  left: 0;
}

html.mobile.portrait #mobile-topbar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 2px;
  height: 100%;
  background: inherit;
}

@media (max-width: 700px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    gap: 6px;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    padding-right: 110px;
  }
}

@media (min-width: 459px) and (max-width: 649px) {
  :root {
    --ls-actions-w: 154px;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    width: 100%;
    padding-right: calc(6px + var(--ls-actions-w, 160px));
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    width: 100%;
    max-width: none;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    position: static;
    transform: none;
    margin: 0;
    gap: 6px;
    display: flex;
    align-items: center;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }
}

@media (min-width: 649px) and (max-width: 748px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    width: 100%;
    padding-right: calc(6px + var(--ls-actions-w-3, 238px));
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    width: 100%;
    max-width: none;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    position: static;
    transform: none;
    margin: 0;
    gap: 6px;
    display: flex;
    align-items: center;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters {
    display: inline-flex !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }
}

@media (min-width: 749px) and (max-width: 932px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: inline-flex !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) max-content !important;
    column-gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
    position: relative !important;
    justify-content: stretch !important;
    justify-items: stretch !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
  }

  html.mobile:not(.portrait) #mobile-topbar {
    padding-right: 0 !important;
    overflow: visible !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    display: flex !important;
    grid-column: 3;
    justify-self: end !important;
    align-items: center !important;
    gap: 6px !important;
    position: static !important;
    transform: none !important;
    white-space: nowrap;
    width: max-content !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions > * {
    flex-shrink: 0 !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    position: static !important;
    transform: none !important;
    margin: 0 !important;
    gap: 6px !important;
    display: flex !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-logo--portrait {
    grid-column: 1;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 1 1 auto !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left,
  html.mobile:not(.portrait) #mobile-topbar .search-wrapper,
  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    min-width: 0 !important;
  }
}

html.mobile #mobile-topbar .mobile-options {
  width: var(--mobile-lang-w, 44px);
  margin-right: 0 !important;
}

html.mobile.portrait .mobile-portrait-auth {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 500px) {
  html.mobile #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile #mobile-topbar .mobile-actions #mobile-btn-pin,
  html.mobile #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }

  html.mobile #mobile-topbar .mobile-search-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    column-gap: 7px;
    align-items: center;
    width: 100%;
    padding-right: 0 !important;
  }

  html.mobile #mobile-topbar .mobile-left {
    display: contents;
  }

  html.mobile #mobile-topbar .mobile-actions {
    display: contents;
  }

  html.mobile #mobile-topbar .search-wrapper {
    grid-column: 2;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile #mobile-topbar .mobile-options {
    grid-column: 3;
    justify-self: end;
    position: static;
    transform: none;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  html.mobile #mobile-topbar .search-wrapper input,
  html.mobile #mobile-topbar input {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 768px) {
  #topbar.desktop-ribbon {
    display: none;
  }

  #mobile-topbar {
    display: block;
    height: var(--topbar-h);
    box-sizing: border-box;
  }

  #mobile-topbar .mobile-search-row {
    height: 100%;
    align-items: center;
  }

  #mobile-auth-buttons {
    display: flex;
  }

  #auth-buttons,
  #auth-logout {
    display: none;
  }

  #ticker {
    top: calc(var(--brandbar-h) + var(--topbar-h));
  }

  #map {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) - var(--ribbon-gap));
    height: calc(var(--app-vh, 100vh) - (var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) - var(--ribbon-gap)));
  }
}

@media (min-width: 501px) and (max-width: 932px) {
  #topbar.desktop-ribbon {
    display: none;
  }

  #mobile-topbar {
    display: block;
    height: var(--topbar-h);
    box-sizing: border-box;
  }

  #mobile-topbar .mobile-search-row {
    height: 100%;
    align-items: center;
  }

  #mobile-auth-buttons {
    display: none !important;
  }

  body.mobile #mobile-auth-buttons,
  body.tablet #mobile-auth-buttons,
  html.mobile #mobile-auth-buttons,
  html.tablet #mobile-auth-buttons {
    display: none !important;
  }

  html.auth-anon #auth-buttons {
    display: flex !important;
  }

  html.auth-anon #auth-logout {
    display: none !important;
  }

  html.auth-token #auth-buttons {
    display: none !important;
  }

  html.auth-token #auth-logout {
    display: flex !important;
  }

  #ticker {
    top: calc(var(--brandbar-h) + var(--topbar-h));
  }

  #map {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) - var(--ribbon-gap));
    height: calc(var(--app-vh, 100vh) - (var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) - var(--ribbon-gap)));
  }

  #mobile-topbar {
    width: auto;
    left: 0;
    right: 0;
    transform: none;
    padding: 4px 8px;
  }

  #mobile-topbar .mobile-search-row {
    gap: 4px;
    align-items: center;
  }

  #mobile-topbar input {
    padding: 4px 6px;
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }

  #mobile-topbar #mobile-btn-filters {
    padding: 4px 8px;
  }

  #mobile-btn-pin {
    padding: 4px 8px;
  }

  #mobile-topbar #mobile-btn-toggle-theme {
    padding: 4px 8px;
  }

  #mobile-topbar #mobile-user-info {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
  }

  #mobile-topbar .lang-trigger {
    padding: 4.5px 8px;
  }

  body.mobile #ticker,
  body.tablet #ticker {
    display: flex !important;
    top: calc(var(--brandbar-h) + var(--topbar-h));
    height: var(--ticker-h);
    width: 100%;
    left: 0;
    right: 0;
    align-items: center;
    font-size: 16px;
    line-height: var(--ticker-h);
    padding-left: 6px;
    padding-right: 0;
  }

  body.mobile #ticker .ticker-track,
  body.tablet #ticker .ticker-track {
    animation: ticker-scroll 49.2143s linear infinite;
    letter-spacing: 0.08em;
    align-items: center;
    height: 100%;
  }

  body.mobile #ticker .ticker-track span,
  body.tablet #ticker .ticker-track span {
    padding-right: 16px;
    display: inline-flex;
    align-items: center;
    line-height: var(--ticker-h);
  }

  .leaflet-control-zoom {
    top: 2px !important;
    transform: translateY(2px) !important;
  }
}

@media (min-width: 501px) and (max-width: 700px) {
  #ticker .ticker-track {
    animation-name: ticker-scroll !important;
    animation-duration: 49.2143s !important;
  }
}

@media (min-width: 769px) and (max-width: 932px) {
  .layer-toggle {
    bottom: 36px;
    left: 0;
    flex-direction: row;
    gap: var(--gap-8);
    flex-wrap: nowrap;
  }

  .tile-option {
    width: 58px;
    height: 58px;
    padding: 0;
    font-size: 0;
    border-radius: 8px;
    border: 2px solid transparent;
    background-color: transparent !important;
    transform: none !important;
    transition: border-color 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tile-option.active {
    border-color: transparent;
    background-color: transparent !important;
    transform: none !important;
  }

  .tile-option:hover {
    background-color: transparent !important;
    transform: none !important;
  }

  .tile-preview {
    display: block;
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }

  .tile-label {
    position: relative;
    z-index: 3;
    font-size: 11px;
    font-weight: 700;
    color: #f8fafc;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  }
}

@media (min-width: 933px) {
  html.tablet #topbar.desktop-ribbon {
    display: flex !important;
  }

  html.tablet #mobile-topbar.mobile-ribbon {
    display: none !important;
  }

  html.auth-anon #auth-buttons {
    display: flex !important;
  }

  html.auth-anon #auth-logout {
    display: none !important;
  }

  html.auth-token #auth-buttons {
    display: none !important;
  }

  html.auth-token #auth-logout {
    display: flex !important;
  }

  #mobile-auth-buttons {
    display: none !important;
  }

  .leaflet-control-zoom {
    top: 2px !important;
    transform: translateY(2px) !important;
  }

  #search-container {
    gap: 2px;
  }

  #search-container .desktop-logo {
    margin-right: 4px;
  }
}

@media (min-width: 933px) and (max-width: 1366px) {
  body .layer-toggle {
    bottom: 38px !important;
  }

  .layer-toggle {
    bottom: 38px !important;
  }

  .layer-toggle.layer-toggle {
    bottom: 38px !important;
  }
}

@media (width: 1366px) {
  body .layer-toggle,
  html body .layer-toggle,
  html body .layer-toggle.layer-toggle,
  html body .layer-toggle.layer-toggle.layer-toggle {
    bottom: 38px !important;
  }
}

#mobile-topbar #mobile-search-results {
  left: 0;
  right: 0;
  top: calc(100% + 6px);
}

html.auth-map-mode #mobile-auth-inline.auth-map-bound #mobile-user-avatar-badge {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
}

html.auth-map-mode #mobile-auth-inline img,
html.auth-map-mode #mobile-auth-inline svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* Hide auth blocks while options are open on mobile/tablet only. */
html.mobile.options-open #auth,
html.mobile.options-open #auth-buttons,
html.mobile.options-open #auth-logout,
html.mobile.options-open #mobile-auth-buttons,
html.mobile.options-open #mobile-auth-inline,
html.tablet.options-open #auth,
html.tablet.options-open #auth-buttons,
html.tablet.options-open #auth-logout,
html.tablet.options-open #mobile-auth-buttons,
html.tablet.options-open #mobile-auth-inline,
body.mobile.options-open #auth,
body.mobile.options-open #auth-buttons,
body.mobile.options-open #auth-logout,
body.mobile.options-open #mobile-auth-buttons,
body.mobile.options-open #mobile-auth-inline,
body.tablet.options-open #auth,
body.tablet.options-open #auth-buttons,
body.tablet.options-open #auth-logout,
body.tablet.options-open #mobile-auth-buttons,
body.tablet.options-open #mobile-auth-inline {
  visibility: hidden;
  pointer-events: none;
}

html.mobile.options-panel-open #auth,
html.mobile.options-panel-open #auth-buttons,
html.mobile.options-panel-open #auth-logout,
html.mobile.options-panel-open #mobile-auth-buttons,
html.mobile.options-panel-open #mobile-auth-inline,
html.tablet.options-panel-open #auth,
html.tablet.options-panel-open #auth-buttons,
html.tablet.options-panel-open #auth-logout,
html.tablet.options-panel-open #mobile-auth-buttons,
html.tablet.options-panel-open #mobile-auth-inline,
body.mobile.options-panel-open #auth,
body.mobile.options-panel-open #auth-buttons,
body.mobile.options-panel-open #auth-logout,
body.mobile.options-panel-open #mobile-auth-buttons,
body.mobile.options-panel-open #mobile-auth-inline,
body.tablet.options-panel-open #auth,
body.tablet.options-panel-open #auth-buttons,
body.tablet.options-panel-open #auth-logout,
body.tablet.options-panel-open #mobile-auth-buttons,
body.tablet.options-panel-open #mobile-auth-inline {
  visibility: hidden;
  pointer-events: none;
}

/* Keep auth visible when opening options drawer/panels at 501+ widths. */
@media (min-width: 501px) {
  html.mobile.options-open #auth,
  html.mobile.options-open #auth-buttons,
  html.mobile.options-open #auth-logout,
  html.mobile.options-open #mobile-auth-buttons,
  html.mobile.options-open #mobile-auth-inline,
  html.tablet.options-open #auth,
  html.tablet.options-open #auth-buttons,
  html.tablet.options-open #auth-logout,
  html.tablet.options-open #mobile-auth-buttons,
  html.tablet.options-open #mobile-auth-inline,
  body.mobile.options-open #auth,
  body.mobile.options-open #auth-buttons,
  body.mobile.options-open #auth-logout,
  body.mobile.options-open #mobile-auth-buttons,
  body.mobile.options-open #mobile-auth-inline,
  body.tablet.options-open #auth,
  body.tablet.options-open #auth-buttons,
  body.tablet.options-open #auth-logout,
  body.tablet.options-open #mobile-auth-buttons,
  body.tablet.options-open #mobile-auth-inline,
  html.mobile.options-panel-open #auth,
  html.mobile.options-panel-open #auth-buttons,
  html.mobile.options-panel-open #auth-logout,
  html.mobile.options-panel-open #mobile-auth-buttons,
  html.mobile.options-panel-open #mobile-auth-inline,
  html.tablet.options-panel-open #auth,
  html.tablet.options-panel-open #auth-buttons,
  html.tablet.options-panel-open #auth-logout,
  html.tablet.options-panel-open #mobile-auth-buttons,
  html.tablet.options-panel-open #mobile-auth-inline,
  body.mobile.options-panel-open #auth,
  body.mobile.options-panel-open #auth-buttons,
  body.mobile.options-panel-open #auth-logout,
  body.mobile.options-panel-open #mobile-auth-buttons,
  body.mobile.options-panel-open #mobile-auth-inline,
  body.tablet.options-panel-open #auth,
  body.tablet.options-panel-open #auth-buttons,
  body.tablet.options-panel-open #auth-logout,
  body.tablet.options-panel-open #mobile-auth-buttons,
  body.tablet.options-panel-open #mobile-auth-inline {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

/* Keep true desktop topbar auth visible while options drawer/panels are open. */
html:not(.mobile):not(.tablet).options-open #auth,
html:not(.mobile):not(.tablet).options-open #auth-buttons,
html:not(.mobile):not(.tablet).options-open #auth-logout,
html:not(.mobile):not(.tablet).options-panel-open #auth,
html:not(.mobile):not(.tablet).options-panel-open #auth-buttons,
html:not(.mobile):not(.tablet).options-panel-open #auth-logout,
body:not(.mobile):not(.tablet).options-open #auth,
body:not(.mobile):not(.tablet).options-open #auth-buttons,
body:not(.mobile):not(.tablet).options-open #auth-logout,
body:not(.mobile):not(.tablet).options-panel-open #auth,
body:not(.mobile):not(.tablet).options-panel-open #auth-buttons,
body:not(.mobile):not(.tablet).options-panel-open #auth-logout {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Opening Filters from topbar on mobile should hide overlapping auth ribbons. */
html.mobile.filters-panel-open #mobile-auth-buttons,
body.mobile.filters-panel-open #mobile-auth-buttons,
html.tablet.filters-panel-open #mobile-auth-buttons,
body.tablet.filters-panel-open #mobile-auth-buttons,
html.mobile.filters-panel-open #mobile-auth-inline,
body.mobile.filters-panel-open #mobile-auth-inline,
html.tablet.filters-panel-open #mobile-auth-inline,
body.tablet.filters-panel-open #mobile-auth-inline {
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 932px) {
  #filters-panel {
    z-index: 13050 !important;
  }

  #filters-header {
    z-index: 13051 !important;
  }

  html.filters-panel-open #auth,
  body.filters-panel-open #auth,
  html.filters-panel-open #auth-buttons,
  body.filters-panel-open #auth-buttons,
  html.filters-panel-open #auth-logout,
  body.filters-panel-open #auth-logout,
  html.filters-panel-open #mobile-auth-buttons,
  body.filters-panel-open #mobile-auth-buttons,
  html.filters-panel-open #mobile-auth-inline,
  body.filters-panel-open #mobile-auth-inline {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (min-width: 501px) and (max-width: 932px) {
  html.mobile .options-drawer,
  html.mobile .options-drawer.open,
  html.mobile #user-pins-panel,
  html.mobile #all-pins-panel,
  html.mobile #reports-panel,
  html.mobile #comment-reports-panel,
  html.mobile #ticker-panel,
  html.mobile #all-users-panel,
  html.mobile #filters-panel,
  html.mobile #collections-panel,
  html.mobile #profile-panel,
  html.mobile #violations-panel {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h)) !important;
    bottom: 0 !important;
  }
}

/* ================= LEGACY MOBILE TOPBAR/PORTRAIT LAYOUT (MOVED) ================= */
body.mobile #mobile-topbar {
    display: block;
}
body.tablet #mobile-topbar {
    display: block;
}
body.mobile #mobile-topbar,
body.tablet #mobile-topbar {
    height: var(--topbar-h);
    box-sizing: border-box;
}
body.mobile #mobile-topbar .mobile-search-row,
body.tablet #mobile-topbar .mobile-search-row {
    height: 100%;
    align-items: center;
}
html.mobile .mobile-logo--landscape,
html.tablet .mobile-logo--landscape,
body.mobile .mobile-logo--landscape,
body.tablet .mobile-logo--landscape {
    display: none;
}
html.mobile .mobile-logo--portrait,
html.tablet .mobile-logo--portrait,
body.mobile .mobile-logo--portrait,
body.tablet .mobile-logo--portrait {
    display: block;
}
body.mobile #ticker,
body.tablet #ticker {
    top: calc(var(--brandbar-h) + var(--topbar-h));
}
body.mobile.portrait #ticker {
    display: none !important;
}
body.mobile #map,
body.tablet #map {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) - var(--ribbon-gap));
    height: calc(var(--app-vh, 100vh) - (var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) - var(--ribbon-gap)));
}
#mobile-topbar .mobile-search-row {
    display: flex;
    gap: 3px;
    align-items: center;
    position: relative;
    justify-content: flex-start;
    overflow: visible;
}
#mobile-topbar {
    position: relative;
    padding-left: 0 !important;
}
#mobile-topbar .mobile-logo--portrait {
    position: static;
    margin: 0;
    z-index: 10;
}
#mobile-topbar .mobile-search-row {
    z-index: 1;
}

@media (max-width: 932px) {
    #mobile-topbar .mobile-search-row {
        display: grid;
        grid-template-columns: 40px 1fr auto;
        align-items: center;
        column-gap: 8px;
        padding-left: 0 !important;
    }
    #mobile-topbar .mobile-left {
        display: contents;
    }
}
#mobile-topbar .mobile-left {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1 1 auto;
    min-width: 0;
}
#mobile-topbar .search-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
}
#mobile-topbar input {
    flex: 1 1 160px;
    max-width: none;
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-6);
    box-sizing: border-box;
    height: 32px;
    line-height: 32px;
}
#mobile-topbar .search-wrapper input {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding-left: 12px;
}

@media (max-width: 500px) {
    #mobile-topbar .search-wrapper {
        --mobile-search-pad-x: 20px;
    }
    #mobile-topbar .search-wrapper input {
        padding-left: var(--mobile-search-pad-x);
    }
}
#mobile-topbar input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}
/* Mobile: align shimmer by centering within the input box */
/* Let mobile reuse the base search shimmer */
body.dark-mode #mobile-topbar input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}
#mobile-topbar #mobile-btn-filters {
    padding: 0 10px;
    height: 32px;
    line-height: 32px;
    width: 78px;
    text-align: center;
}
#mobile-topbar .mobile-options {
    display: flex;
    gap: 6px;
    align-items: center;
}
#mobile-topbar .btn-secondary,
#mobile-topbar .lang-trigger {
    box-sizing: border-box;
    height: 32px;
    line-height: 32px;
    padding: 0 10px;
}
#mobile-topbar .mobile-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
    white-space: nowrap;
    flex-shrink: 0;
}
#mobile-topbar .mobile-auth-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
    white-space: nowrap;
    flex: 0 0 auto;
    max-width: 160px;
    overflow: hidden;
    width: 160px;
    height: 32px;
}
#mobile-topbar #mobile-user-avatar-badge {
    width: 22px;
    height: 22px;
}
#mobile-topbar #mobile-user-info {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    min-width: 80px;
    line-height: 32px;
}
body.mobile #mobile-user-avatar-badge.hidden,
body.tablet #mobile-user-avatar-badge.hidden {
    display: inline-flex !important;
    visibility: hidden;
}
body.dark-mode #mobile-topbar #mobile-user-info {
    color: #e5e7eb;
}
#mobile-topbar #mobile-btn-toggle-theme {
    padding: 0 10px;
    width: 96px;
    height: 32px;
    line-height: 32px;
    text-align: center;
}
 #mobile-topbar #mobile-btn-pin {
     width: 96px;
     text-align: center;
     height: 32px;
     line-height: 32px;
     padding: 0 10px;
 }
#mobile-topbar .search-logo {
    height: 30px;
    margin-right: 8px;
}
.mobile-logo--landscape {
    display: none;
}
.mobile-logo--portrait {
    display: block;
}
#mobile-topbar .mobile-logo--landscape,
#mobile-topbar .mobile-logo--portrait {
    margin: 0;
    height: 30px;
    display: block;
}

/* Lock SL logo + shine to identical box to keep shine aligned at all widths */
@media (max-width: 932px) {
    #mobile-topbar .logo-container.sl-logo {
        width: 34px;
        height: 24px;
    }
    #mobile-topbar .logo-container.sl-logo .logo-base {
        width: 100%;
        height: 100%;
        display: block;
    }
    #mobile-topbar .logo-container.sl-logo .logo-shine-sl {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        -webkit-mask-image: url('/static/img/logos/SL_2.png');
        mask-image: url('/static/img/logos/SL_2.png');
        -webkit-mask-size: 100% 100%;
        mask-size: 100% 100%;
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
    }
}
.mobile-portrait-toggle {
    position: fixed;
    left: 50%;
    top: calc(var(--brandbar-h) + var(--topbar-h) - 6px);
    width: 46px;
    height: 14px;
    margin-left: -23px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 11001;
    box-shadow: var(--shadow-elev-2);
    cursor: pointer;
}
.mobile-portrait-toggle .toggle-caret {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #0f172a;
    transition: transform 0.2s ease;
}
.mobile-portrait-bar {
    position: fixed;
    left: 0;
    right: 0;
    width: 100vw;
    top: calc(var(--brandbar-h) + var(--topbar-h));
    height: 0;
    overflow: hidden;
    background: #ffffff;
    z-index: 11000;
    display: none;
    box-shadow: var(--shadow-elev-2);
}
html.mobile.portrait .mobile-portrait-bar {
    left: -1px;
    right: auto;
    width: calc(100vw + 2px);
    margin-left: 0;
}
.mobile-portrait-row {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ribbon-gap);
    padding: 4px 8px;
}
body.dark-mode .mobile-portrait-toggle {
    background: #111827;
    border-color: #374151;
}
body.dark-mode .mobile-portrait-toggle .toggle-caret {
    border-top-color: #e2e8f0;
}
body.dark-mode .mobile-portrait-bar {
    background: #111827;
}
html.mobile.portrait .mobile-portrait-toggle,
html.mobile.portrait .mobile-portrait-bar {
    display: flex;
}
html.mobile.portrait .mobile-portrait-bar {
    display: block;
}
@media (max-width: 500px) {
    html.mobile .mobile-portrait-toggle {
        display: none !important;
    }
    html.mobile .mobile-portrait-bar {
        display: none !important;
    }
}
html.mobile.portrait.portrait-bar-open .mobile-portrait-bar {
    height: var(--topbar-h);
}
html.mobile.portrait.portrait-bar-open .mobile-portrait-toggle {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--topbar-h) - 6px);
}
html.mobile.portrait.portrait-bar-open .mobile-portrait-toggle .toggle-caret {
    transform: rotate(180deg);
}

/* ================= MIN-WIDTH 769 TOPBAR TUNING (MOVED) ================= */
@media (min-width: 769px) {
    :root {
        --topbar-h: 46px;
    }
    #topbar {
        padding: 8px 8px;
    }
    #search-container {
        flex: 0 0 auto;
        min-width: 0;
    }
    #btn-toggle-theme {
        min-width: 96px;
    }
}

/* ================= RIBBON VISIBILITY (AUTHORITATIVE) (MOVED) ================= */
/* ================= RIBBON VISIBILITY (AUTHORITATIVE) ================= */
#topbar.desktop-ribbon {
    display: flex;
}
#search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--ribbon-gap);
    flex: 0 0 auto;
    overflow: visible;
}
#search-container .search-logo {
    height: 72px;
    margin-right: 10px;
}
#search-container .desktop-logo {
    height: 24px;
    margin-right: 8px;
}
#topbar .search-wrapper {
    flex: 0 0 auto;
}
#topbar .search-wrapper::after {
    transform: translateY(-0.5px);
}

@media (min-width: 933px) and (max-width: 1093px) {
  #search-container .desktop-logo {
    margin-left: 3px !important;
    margin-right: 5px !important;
    transform: none !important;
  }
}

/* Boundary lock: prevent 1093px one-step logo nudge. */
@media (min-width: 1092px) and (max-width: 1094px) {
  #topbar.desktop-ribbon #search-container .logo-container.desktop-logo {
    margin-left: 3px !important;
    margin-right: 5px !important;
    position: relative !important;
    left: 2px !important;
    transform: none !important;
  }
}
#mobile-topbar.mobile-ribbon {
    display: none;
}
#ticker {
    position: fixed;
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-gap));
    z-index: 1002;
    height: var(--ticker-h);
    display: flex;
    align-items: center;
    overflow: hidden;
    padding-left: 6px;
    left: 0;
    right: 0;
    padding-right: 0;
}
html.mobile #topbar.desktop-ribbon {
    display: none !important;
}
html.mobile #mobile-topbar.mobile-ribbon {
    display: flex !important;
}
html.tablet #topbar.desktop-ribbon {
    display: flex;
}
html.tablet #mobile-topbar.mobile-ribbon {
    display: none;
}
body.mobile #topbar.desktop-ribbon {
    display: none !important;
}
body.mobile #mobile-topbar.mobile-ribbon {
    display: flex !important;
}
body.tablet #topbar.desktop-ribbon {
    display: flex;
}
body.tablet #mobile-topbar.mobile-ribbon {
    display: none;
}

/* ================= OPTIONS TOGGLE + 501-768 AUTH WIDTH OVERRIDES (MOVED) ================= */
#options-toggle-theme {
  
    display: none;
}

body.mobile #options-toggle-theme {
  
    display: block;
}
body.tablet #options-toggle-theme {
  
    display: block;
}

/* Prevent stretched desktop auth buttons in 501-768 range. */
@media (min-width: 501px) and (max-width: 768px) {
    #auth button,
    #auth #btn-login,
    #auth #btn-register,
    #auth #btn-logout {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }
    #btn-login,
    #btn-register {
        min-width: 0 !important;
        width: auto !important;
    }
    #auth {
        width: auto !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 8px !important;
    }
    /* Use desktop-style auth placement in 501-768 range. */
    html.auth-anon #auth-buttons {
        display: flex !important;
    }
    html.auth-anon #auth-logout {
        display: none !important;
    }
    html.auth-token #auth-buttons {
        display: none !important;
    }
    html.auth-token #auth-logout {
        display: flex !important;
    }
    #auth-logout {
        position: absolute !important;
        top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) + 4.5px) !important;
        right: 11px !important;
    }
}

/* ================= TOPBAR/TICKER <=768 RESPONSIVE BLOCK (MOVED) ================= */
    #topbar, #ticker {
     width: 100%;
}
  @media (max-width: 768px) {
     #topbar {
         padding: 6px;
         gap: 6px;
         flex-wrap: wrap;
         height: auto;
         overflow: hidden;
  }
     #auth {
         width: 100%;
         flex-wrap: wrap;
         gap: 4px;
         align-items: center;
         justify-content: space-between;
  }
#auth button,   #auth #btn-login,   #auth #btn-register,   #auth #btn-logout {
    flex: 1 1 120px;
}
#btn-logout {
    transform: translateY(6px);
}
     #btn-login {
         min-width: 120px;
  }
     #search-container {
         flex: 1 1 100%;
         margin-left: 0;
         order: 2;
  }
     #search-input {
         width: 100%;
         font-size: 14px;
         line-height: 1.4;
         box-sizing: border-box;
  }
     #btn-filters,   #btn-pin-at-device,   #btn-toggle-theme {
         flex: 1 1 calc(50% - 6px);
         margin-left: 0;
  }
     #ticker {
         height: 22px;
         font-size: 11px;
         padding-left: 6px;
         padding-right: 6px;
  }
     #ticker .ticker-track span {
         padding-right: 12px;
  }
     #weather-widget {
         display: none !important;
  }
     .layer-toggle {
         bottom: 36px;
         left: 0px;
         flex-direction: row;
         gap: var(--gap-8);
         flex-wrap: nowrap;
 }
     .tile-option {
         width: 58px;
         height: 58px;
         padding: 0;
         font-size: 0;
         border-radius: 8px;
         border: 2px solid transparent;
         background-color: transparent !important;
         transform: none !important;
         transition: border-color 0.2s ease;
         position: relative;
         overflow: hidden;
         display: flex;
         align-items: center;
     justify-content: center;
  }
    .tile-option.active {
        border-color: transparent;
        background-color: transparent !important;
        transform: none !important;
  }
     .tile-option:hover {
         background-color: transparent !important;
         transform: none !important;
  }
     .tile-preview {
         display: block;
         position: absolute;
         inset: 0;
         border-radius: inherit;
         background-size: cover;
         background-position: center;
         background-repeat: no-repeat;
  }
.tile-label {
     position: relative;
     z-index: 3;
     font-size: 11px;
     font-weight: 700;
     color: #f8fafc;
     text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
}
body.mobile #topbar.desktop-ribbon {
    display: none;
}
body.tablet #topbar.desktop-ribbon {
    display: flex;
}
body.tablet #auth-buttons,
body.tablet #auth-logout {
    display: none;
}

/* ================= MOBILE AUTH + TOPBAR SHELL + TICKER SPEED (MOVED) ================= */
/* Mobile auth buttons */
#mobile-auth-buttons {
    display: none;
    position: fixed;
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) + 4px);
    right: 10px;
    gap: var(--gap-8);
    z-index: 12000;
}
body.mobile #mobile-auth-buttons {
    display: flex;
}
#mobile-auth-buttons .btn-secondary {
    padding: 6px 12px;
    font-size: 13px;
}
body.mobile #mobile-auth-buttons {
    display: flex !important;
}
html.tablet #mobile-auth-buttons,
body.tablet #mobile-auth-buttons {
    display: none !important;
}
html:not(.mobile):not(.tablet) #mobile-auth-buttons,
body:not(.mobile):not(.tablet) #mobile-auth-buttons {
    display: none !important;
}

/* Mobile topbar */
#mobile-topbar {
    display: none;
    position: fixed;
    top: var(--brandbar-h);
    left: 0;
    right: 0;
    z-index: 12000;
    background: #f4f4f4;
    border-bottom: 1px solid #ddd;
    padding: 6px 10px;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    overflow: visible;
}
body.dark-mode #mobile-topbar,
#mobile-topbar,
#mobile-topbar * {
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}
#mobile-topbar .btn-secondary,
#mobile-topbar .lang-trigger,
#mobile-topbar input,
#mobile-topbar .mobile-auth-inline {
    height: 32px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    line-height: 0;
}
#mobile-topbar .btn-label,
#mobile-topbar .auth-label {
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
body.dark-mode #mobile-topbar {
    background: #111827;
    border-bottom: 1px solid #1f2937;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
body.dark-mode #mobile-topbar input {
    background: #192233;
    color: #ffffff;
    border-color: #0b1220;
}
body.dark-mode #mobile-topbar .btn-secondary {
    background: #1f2937;
    color: #e2e8f0;
    border-color: #374151;
}
@media (max-width: 700px) {
    .ticker,
    #ticker {
        animation-duration: var(--ticker-speed, 18s) !important;
    }
    .ticker .ticker-inner,
    #ticker .ticker-inner {
        animation-duration: var(--ticker-speed, 18s) !important;
    }
    #ticker .ticker-track {
        animation-name: ticker-scroll-faststart !important;
        animation-duration: 24s !important;
        animation-timing-function: linear !important;
    }
}

/* ================= OPTIONS MENU + SIDE PANEL GEOMETRY (MOVED) ================= */
  /* ==============================    Options Dropdown (Top Right) ============================== */
 #options-menu {
     position: fixed;
     /* anchor to viewport */
     top: calc(var(--brandbar-h) + 13px);
     right: 14px;
     /* snug to edge */
     z-index: 4000;
     /* above map/panels */
}
  #options-dropdown {
     padding: 6px;
     border-radius: var(--radius-6);
     background: #fff;
     font-weight: 600;
     cursor: pointer;
     box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
     border: 1px solid #ccc;
}
 /* ==============================    Side Panels (right) ============================== */
#user-pins-panel,  #all-pins-panel, #reports-panel, #comment-reports-panel, #ticker-panel, #all-users-panel, #filters-panel, #collections-panel, #profile-panel, #violations-panel {
       position: fixed;
       right: 0;
       top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 14px);
       bottom: 72px;
     /* slightly shorter panels to sit above footer */
     overflow: hidden;
     pointer-events: auto;
     color: #111827;
     width: 320px;
                  /* ensure all panels are visible */
      background: #fff;
              /* match Reports/Collections theme */
      border-left: 0;
      border-radius: 8px 0 0 8px;
       z-index: 3400;
      box-shadow: -2px 0 6px rgba(0,0,0,0.08);
    font-size: 13px;
 }
html:not(.mobile):not(.tablet) #user-pins-panel,
html:not(.mobile):not(.tablet) #all-pins-panel,
html:not(.mobile):not(.tablet) #reports-panel,
html:not(.mobile):not(.tablet) #comment-reports-panel,
html:not(.mobile):not(.tablet) #ticker-panel,
html:not(.mobile):not(.tablet) #all-users-panel,
html:not(.mobile):not(.tablet) #filters-panel,
html:not(.mobile):not(.tablet) #collections-panel,
html:not(.mobile):not(.tablet) #profile-panel,
html:not(.mobile):not(.tablet) #violations-panel {
       top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 5px);
}
@media (max-width: 380px) {
  html.mobile.portrait .tile-option {
    width: 52px;
    height: 52px;
  }
  html.mobile.portrait .layer-toggle {
    gap: 6px;
  }
  html.mobile.portrait .tile-label {
    font-size: 11px;
  }
}
html.mobile.portrait #user-pins-panel,
html.mobile.portrait #all-pins-panel,
html.mobile.portrait #reports-panel,
html.mobile.portrait #comment-reports-panel,
html.mobile.portrait #ticker-panel,
html.mobile.portrait #all-users-panel,
html.mobile.portrait #filters-panel,
html.mobile.portrait #collections-panel,
html.mobile.portrait #profile-panel,
html.mobile.portrait #violations-panel {
       top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 84px);
       bottom: 172px;
       right: -1px;
}
html.mobile.portrait #filters-panel .panel-body {
    overflow-y: auto;
    scrollbar-width: thin;
}
html.mobile.portrait #filters-panel .panel-body::-webkit-scrollbar {
    width: 8px;
}
html.mobile.portrait #filters-panel .panel-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}
body.dark-mode html.mobile.portrait #filters-panel .panel-body::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.7);
}
html.mobile.portrait #user-pins-header,
html.mobile.portrait #all-pins-header,
html.mobile.portrait #reports-header,
html.mobile.portrait #comment-reports-header,
html.mobile.portrait #ticker-header,
html.mobile.portrait #all-users-header,
html.mobile.portrait #filters-header,
html.mobile.portrait #collections-header,
html.mobile.portrait #profile-header,
html.mobile.portrait #violations-header {
       height: var(--options-header-h, auto);
       min-height: var(--options-header-h, auto);
       padding: 0 10px;
}
html.mobile.portrait .panel-header {
       font-weight: 600;
}
html.mobile.portrait .panel-header .panel-title,
html.mobile.portrait #options-header span {
       font-family: inherit;
       font-size: 16px;
       font-weight: 600;
       line-height: 1;
       letter-spacing: 0;
       text-transform: none;
}
html.mobile.portrait #options-header {
       padding: 12.5px 10px;
}

/* Mobile options panels: unify header typography/box model (portrait + landscape) */
html.mobile .panel-header,
html.mobile #options-header {
       height: 44px;
       min-height: 44px;
       display: flex;
       align-items: center;
       padding: 0 14px;
       box-sizing: border-box;
       font-size: 15px;
       font-weight: 700;
       line-height: 1;
       margin: 0;
       letter-spacing: 0;
       white-space: nowrap;
}
html.mobile .panel-header h1,
html.mobile .panel-header h2,
html.mobile .panel-header h3,
html.mobile .panel-header h4,
html.mobile #options-header h1,
html.mobile #options-header h2,
html.mobile #options-header h3,
html.mobile #options-header h4,
html.mobile #options-header span {
       margin: 0;
       padding: 0;
       font: inherit;
       line-height: 1;
}
html.mobile .panel-actions button,
html.mobile #options-close {
       height: 28px;
       width: 28px;
       display: inline-flex;
       align-items: center;
       justify-content: center;
}
html.mobile:not(.portrait) #user-pins-panel,
html.mobile:not(.portrait) #all-pins-panel,
html.mobile:not(.portrait) #reports-panel,
html.mobile:not(.portrait) #comment-reports-panel,
html.mobile:not(.portrait) #ticker-panel,
html.mobile:not(.portrait) #all-users-panel,
html.mobile:not(.portrait) #filters-panel,
html.mobile:not(.portrait) #collections-panel,
html.mobile:not(.portrait) #profile-panel,
html.mobile:not(.portrait) #violations-panel {
       top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 11px);
       bottom: 0;
}
html.mobile:not(.portrait) #filters-panel .panel-body {
       overflow-y: auto;
       max-height: calc(100vh - (var(--brandbar-h) + var(--topbar-h) + var(--ticker-h) + 80px));
       scrollbar-width: thin;
}
html.mobile:not(.portrait) #filters-panel .panel-body::-webkit-scrollbar {
       width: 8px;
}
html.mobile:not(.portrait) #filters-panel .panel-body::-webkit-scrollbar-thumb {
       background: #cbd5e1;
       border-radius: 8px;
}
body.dark-mode html.mobile:not(.portrait) #filters-panel .panel-body::-webkit-scrollbar-thumb {
       background: #334155;
}

/* ================= MOBILE <=500 PANEL/MAP/TOPBAR OVERRIDES (MOVED) ================= */
/* Responsive breakpoint tweaks (phones) */
@media (max-width: 480px) {
    :root {
        --ribbon-gap: 4px;
    }
    #user-pins-panel,  #all-pins-panel, #reports-panel, #comment-reports-panel, #ticker-panel, #all-users-panel, #filters-panel, #collections-panel, #profile-panel, #violations-panel {
        width: 100%;
        left: 0;
        right: 0;
    }
    #user-pins-header,  #all-pins-header, #reports-header, #comment-reports-header, #ticker-header, #all-users-header, #filters-header, #collections-header, #profile-header, .panel-header {
        font-size: 14px;
        padding: 8px;
    }
}


/* Force options drawer + subpanels to match the 501px (landscape-style) look for 0-1366px; override coarse-pointer rules. */
@media (max-width: 500px) {
    html.mobile .options-drawer,
    html.mobile .options-drawer.open {
        top: 69px !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 320px !important;
        max-width: 320px !important;
        border-radius: 8px 0 0 8px !important;
    }

    html.mobile .options-tab {
        top: 50% !important;
    }
    html.mobile .options-tab.open {
        transform: translate(-320px, -50%) !important;
    }

    html.mobile #user-pins-panel,
    html.mobile #all-pins-panel,
    html.mobile #reports-panel,
    html.mobile #comment-reports-panel,
    html.mobile #ticker-panel,
    html.mobile #all-users-panel,
    html.mobile #filters-panel,
    html.mobile #collections-panel,
    html.mobile #profile-panel,
    html.mobile #violations-panel {
        top: 69px !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 320px !important;
        max-width: 320px !important;
        left: auto !important;
        border-radius: 8px 0 0 8px !important;
        box-sizing: border-box !important;
    }

    html.mobile #user-pins-header,
    html.mobile #all-pins-header,
    html.mobile #reports-header,
    html.mobile #comment-reports-header,
    html.mobile #ticker-header,
    html.mobile #all-users-header,
    html.mobile #filters-header,
    html.mobile #collections-header,
    html.mobile #profile-header,
    html.mobile #violations-header,
    html.mobile .panel-header,
    html.mobile #options-header {
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 14px !important;
        font-size: 15px !important;
    }

    /* Bottom-left footer links: lock to 449px position for 0-1366px. */
    html.mobile .footer-links {
        bottom: 12px !important;
    }

    /* Force consistent right inset for 0-1366px. */
    html.mobile #mobile-topbar,
    html.mobile.portrait #mobile-topbar {
        padding-right: 12px !important;
    }
}


/* Mobile portrait panels should match the options drawer width */
html.mobile.portrait #user-pins-panel,
html.mobile.portrait #all-pins-panel,
html.mobile.portrait #reports-panel,
html.mobile.portrait #comment-reports-panel,
html.mobile.portrait #ticker-panel,
html.mobile.portrait #all-users-panel,
html.mobile.portrait #filters-panel,
html.mobile.portrait #collections-panel,
html.mobile.portrait #profile-panel,
html.mobile.portrait #violations-panel {
    width: 320px;
    max-width: 320px;
    left: auto;
    right: -1px;
    box-sizing: border-box;
}

/* Lock mobile layout for 0-1366px. */
@media (max-width: 500px) {
    body.mobile #map {
        top: 47px !important;
        height: calc(var(--app-vh, 100vh) - 47px) !important;
    }
    .leaflet-control-zoom {
        top: 0 !important;
        left: 0px !important;
    }
}

@media (max-width: 500px) {
    html.mobile {
        --ticker-h: 26px;
        --ticker-gap: 0px;
    }
    html.mobile.portrait #ticker {
        display: block !important;
    }
    html.mobile #mobile-topbar {
        width: 100%;
        left: 0;
        right: 0;
        transform: none;
        padding: 4px 12px !important;
    }
    html.mobile .mobile-logo--portrait {
        display: block !important;
    }
    html.mobile .mobile-logo--landscape {
        display: none !important;
    }

    html.mobile #mobile-topbar .mobile-search-row {
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        column-gap: 8px !important;
        align-items: center !important;
        width: 100% !important;
        padding-right: 0 !important;
    }
    html.mobile #mobile-topbar .mobile-left {
        display: contents !important;
    }
    html.mobile #mobile-topbar .mobile-actions {
        position: static !important;
        display: contents !important;
        transform: none !important;
    }
    html.mobile #mobile-topbar .mobile-options {
        grid-column: 3 !important;
        justify-self: end !important;
        position: static !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
    html.mobile #mobile-topbar .search-wrapper {
        grid-column: 2;
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        --mobile-search-pad-x: 11px;
        --mobile-search-pad-y: 4px;
        --mobile-search-font-size: 14px;
        --mobile-search-line: 32px;
    }
    html.mobile #mobile-topbar .search-wrapper {
        margin-left: -2px !important;
    }
    html.mobile #mobile-topbar input,
    html.mobile #mobile-topbar .search-wrapper input {
        width: 100%;
        max-width: none;
        min-width: 0;
        padding: var(--mobile-search-pad-y) var(--mobile-search-pad-x);
        font-size: var(--mobile-search-font-size);
        line-height: var(--mobile-search-line);
    }
    html.mobile #mobile-topbar .mobile-actions #mobile-btn-filters,
    html.mobile #mobile-topbar .mobile-actions #mobile-btn-pin,
    html.mobile #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
        display: none !important;
    }

}

/* ===================== TOPBAR AUTHORITATIVE (WIDTH-ONLY) ===================== */
:root {
  --search-placeholder-x: 12px;
}

@media (max-width: 932px) {
  #topbar {
    display: none !important;
  }

  #mobile-topbar {
    display: flex !important;
    height: var(--topbar-h) !important;
    padding: 4px 12px 4px 8px !important;
    box-sizing: border-box;
    left: 0 !important;
    right: 0 !important;
    overflow: hidden !important;
  }

  #mobile-topbar .mobile-search-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 !important;
    width: 100%;
    min-width: 0;
  }

  #mobile-topbar .mobile-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #mobile-topbar .mobile-logo--portrait {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    margin: 0 !important;
    height: 24px !important;
    width: auto !important;
    flex: 0 0 auto !important;
    z-index: 5 !important;
  }

  #mobile-topbar .search-wrapper {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #mobile-topbar .search-wrapper input {
    width: 100% !important;
    padding-left: var(--search-placeholder-x) !important;
    padding-right: 10px !important;
    height: 32px !important;
    line-height: 32px !important;
    box-sizing: border-box;
  }

  #mobile-topbar .search-wrapper::after {
    inset: 1px !important;
    padding-left: var(--search-placeholder-x) !important;
    padding-right: 10px !important;
    font-size: 14px !important;
    line-height: 32px !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    transform: none !important;
  }

  #mobile-topbar .mobile-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: auto !important;
    position: static !important;
  }

  #mobile-topbar .mobile-actions > * {
    align-self: center !important;
    margin-top: 0 !important;
    top: auto !important;
    transform: none !important;
  }

  #mobile-topbar .mobile-actions .btn-secondary,
  #mobile-topbar .mobile-actions .lang-trigger {
    height: 32px !important;
    line-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #mobile-topbar .mobile-options {
    margin-left: 6px !important;
    position: static !important;
  }
}

@media (min-width: 500px) and (max-width: 748px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    padding-right: 0 !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    position: static !important;
    transform: none !important;
    right: auto !important;
    top: auto !important;
  }
}

@media (max-width: 748px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions > * {
    margin-top: 0 !important;
    transform: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    top: auto !important;
    transform: none !important;
  }
}

@media (min-width: 933px) {
  #topbar {
    display: flex !important;
  }

  #mobile-topbar {
    display: none !important;
  }
}

@media (max-width: 932px) {
  body {
    overflow-x: hidden;
  }

  html {
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  #mobile-topbar {
    width: 100%;
    max-width: 100vw;
    touch-action: pan-y;
  }

  #mobile-topbar * {
    touch-action: pan-y;
  }
}

@media (max-width: 500px) {
  #mobile-portrait-toggle,
  #mobile-portrait-bar {
    display: flex !important;
  }
}

@media (min-width: 933px) {
  .options-drawer {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 5px) !important;
  }

  #user-pins-panel,
  #all-pins-panel,
  #reports-panel,
  #comment-reports-panel,
  #ticker-panel,
  #all-users-panel,
  #filters-panel,
  #collections-panel,
  #profile-panel,
  #violations-panel {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 5px) !important;
  }
}

/* ================= TOPBAR CLEANUP: WIDTH-BASED ONLY ================= */
@media (min-width: 933px) {
  #mobile-topbar {
    display: none !important;
  }
}

@media (max-width: 932px) {
  #mobile-topbar {
    padding: 4px 12px 4px 8px !important;
  }

  #mobile-topbar .mobile-search-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 12px 0 8px !important;
  }

  #mobile-topbar .mobile-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
  }

  #mobile-topbar .mobile-logo--portrait {
    position: static !important;
    flex: 0 0 auto !important;
  }

  #mobile-topbar .search-wrapper {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #mobile-topbar .search-wrapper input {
    width: 100% !important;
    max-width: none !important;
  }

  #mobile-topbar .mobile-actions {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: 8px !important;
    flex: 0 0 auto !important;
  }

  #mobile-topbar .mobile-options {
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
  }
}

@media (max-width: 500px) {
  html.mobile .mobile-portrait-toggle,
  html.mobile .mobile-portrait-bar,
  .mobile-portrait-toggle,
  .mobile-portrait-bar {
    display: flex !important;
  }
}

@media (max-width: 500px) {
  #mobile-topbar .mobile-actions #mobile-btn-filters,
  #mobile-topbar .mobile-actions #mobile-btn-pin,
  #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }

  .options-tab {
    display: flex !important;
  }
}

@media (min-width: 501px) and (max-width: 748px) {
  #mobile-topbar .mobile-actions #mobile-btn-filters,
  #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-pin {
    display: inline-flex !important;
  }
}

@media (min-width: 749px) and (max-width: 932px) {
  #mobile-topbar .mobile-actions #mobile-btn-filters,
  #mobile-topbar .mobile-actions #mobile-btn-pin,
  #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: inline-flex !important;
  }
}

@media (max-width: 932px) {
  #mobile-topbar {
    padding: 8px !important;
  }

  #mobile-topbar .mobile-search-row {
    padding: 0 !important;
    gap: 6px !important;
  }

  #mobile-topbar .search-wrapper input {
    padding: 6px 10px !important;
    line-height: 1.4 !important;
    height: 32px !important;
  }

  #mobile-topbar .search-wrapper::after {
    inset: 1px !important;
    padding: 6px 10px !important;
    line-height: 1.4 !important;
  }

  body.dark-mode #mobile-topbar input,
  body.dark-mode #mobile-topbar .btn-secondary,
  body.dark-mode #mobile-topbar .lang-trigger {
    background: #1f2937 !important;
    color: #e2e8f0 !important;
    border-color: #374151 !important;
  }

  #mobile-topbar .logo-container.sl-logo {
    width: 34px !important;
    height: 24px !important;
  }

  #mobile-topbar .logo-container.sl-logo .logo-base,
  #mobile-topbar .logo-container.sl-logo .logo-shine-sl {
    width: 100% !important;
    height: 100% !important;
  }

  #mobile-topbar .logo-container.sl-logo .logo-shine-sl {
    -webkit-mask-image: url('/static/img/logos/SL_2.png') !important;
    mask-image: url('/static/img/logos/SL_2.png') !important;
    -webkit-mask-size: cover !important;
    mask-size: cover !important;
    -webkit-mask-position: center !important;
    mask-position: center !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
  }
}

@media (max-width: 932px) {
  #mobile-topbar .mobile-logo--portrait {
    position: static !important;
    margin: 0 6px 0 0 !important;
    height: 30px !important;
    width: auto !important;
  }

  #mobile-topbar .mobile-search-row {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* ================= OPTIONS DRAWER COMPONENT RULES ================= */
  .options-tab {
      position: fixed;
      top: 50%;
      right: -1px;
      transform: translate(var(--options-tab-shift), -50%);
     background: #ffffff;
     color: #111827;
     padding: 12px 8px;
     border-radius: 4px 0 0 4px;
     font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      writing-mode: vertical-rl;
      cursor: pointer;
       z-index: 12000;
       pointer-events: auto;
      box-shadow: 0 2px 6px rgba(0,0,0,0.25);
      transition: transform 0.25s ease;
}
html.mobile.portrait .options-tab {
      opacity: 0;
      transition: transform 0.25s ease, opacity 0.2s ease;
}
html.mobile.portrait.options-tab-ready .options-tab {
      opacity: 1;
}
.options-tab.open {
     transform: translate(-320px, -50%);
}
html.mobile.portrait .options-tab.open {
     transform: translate(-319px, -50%);
}
  .options-drawer {
       position: fixed;
       top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 14px);
       bottom: 72px;
       right: 0;
       width: 320px;
       background: #ffffff;
       border-left: 0;
       border-radius: 8px 0 0 8px;
       box-shadow: 0 8px 18px rgba(15,23,42,0.18);
       transform: translateX(100%);
       transition: transform 0.25s ease;
        z-index: 12000;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        scrollbar-width: none;
        pointer-events: auto;
  }
  html:not(.mobile):not(.tablet) .options-drawer {
       top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 19px);
  }
html.mobile.portrait .options-drawer {
     top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 84px);
     bottom: 172px;
     right: -1px;
}


  .options-drawer.open {
     transform: translateX(0);
}
.options-drawer-header {
         display: flex;
         align-items: center;
         justify-content: space-between;
         padding: 10px;
         width: 100%;
         margin: 0;
         box-sizing: border-box;
         border-bottom: 1px solid #e2e8f0;
         font-weight: 700;
         font-size: 16px;
         background: url('/static/img/scrolling-banner/options-banner.png') repeat-x center center;
         background-size: 1536px 100%;
         background-position: var(--banner-x) 50%;
         position: relative;
         overflow: hidden;
         color: #ffffff;
    }
  .options-close {
       border: none;
       background: transparent;
       font-size: 18px;
       cursor: pointer;
       line-height: 1;
       color: #ffffff;
   }

/* Aurora gradient overlay (seamless, tiled) */
.options-drawer-header::before,
.options-drawer-header::after {
  display: none;
}

@keyframes options-banner-scroll {
  0% { background-position: 0 50%; }
  100% { background-position: 1536px 50%; }
}
  .options-drawer-body {
     padding: 24px 12px 12px;
     overflow-y: auto;
     display: flex;
     flex-direction: column;
     gap: var(--gap-8);
     flex: 1;
     min-height: 0;
     scrollbar-width: none;
}
.options-drawer-body::-webkit-scrollbar {
     width: 0;
     height: 0;
}
.options-drawer-body button {
    text-align: left;
    padding: 8px 10px;
    border-radius: var(--radius-6);
    border: 1px solid #e2e8f0;
     background: #f8fafc;
     font-weight: 600;
     cursor: pointer;
     transition: background 0.15s ease, border-color 0.15s ease;
     position: relative;
  }
  .options-drawer-body button:hover {
     background: #f8fafc;
     border-color: #94a3b8;
  }
  .options-drawer-body button[data-requires-admin="true"]:hover {
     background: #991b1b;
     border-color: #7f1d1d;
  }
  /* Hide Messages option without removing functionality */
  #options-contact-btn {
     display: none !important;
  }
  .options-drawer-body button[data-requires-admin="true"] {
     border-style: solid;
     background: #b91c1c;
     color: #ffffff;
     border-color: #991b1b;
     padding-right: 10px;
  }
  .options-drawer-body button[data-requires-admin="true"]::after {
     content: none;
  }
  .options-drawer-body button[data-requires-admin="true"]:hover {
     background: #991b1b;
     border-color: #7f1d1d;
  }

.option-badge {
    position: absolute;
    top: 6px;
    right: 10px;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    pointer-events: none;
}
.option-badge.hidden {
    display: none;
}
.badge-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.options-drawer-body button.has-unread {
    border-color: #f87171;
}

html.mobile:not(.portrait) .options-drawer {
  top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 11px);
  bottom: 0;
}

@media (max-width: 500px) {
  html.mobile.portrait .options-tab {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 13px + (var(--app-vh, 100vh) - (var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 72px)) / 2);
  }

  html.mobile.portrait .options-tab.open {
    transform: translate(-320px, -50%);
  }

  html.mobile.portrait .options-drawer {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) - 11px);
    bottom: 0;
    right: 0;
  }
}

.options-drawer::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.options-drawer.no-transition {
  transition: none !important;
}

.options-tab.no-transition {
  transition: none !important;
}

/* ================= CANONICAL HEADER NORMALIZATION (MOVED) ================= */
/* Desktop-only canonical header spec */
html:not(.mobile):not(.tablet) .options-drawer-header,
html:not(.mobile):not(.tablet) .panel-header,
html:not(.mobile):not(.tablet) #user-pins-header,
html:not(.mobile):not(.tablet) #all-pins-header,
html:not(.mobile):not(.tablet) #reports-header,
html:not(.mobile):not(.tablet) #comment-reports-header,
html:not(.mobile):not(.tablet) #ticker-header,
html:not(.mobile):not(.tablet) #all-users-header,
html:not(.mobile):not(.tablet) #filters-header,
html:not(.mobile):not(.tablet) #collections-header,
html:not(.mobile):not(.tablet) #profile-header,
html:not(.mobile):not(.tablet) #violations-header {
    height: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}
html:not(.mobile):not(.tablet) .options-drawer-header > span,
html:not(.mobile):not(.tablet) .options-drawer-header > h1,
html:not(.mobile):not(.tablet) .options-drawer-header > h2,
html:not(.mobile):not(.tablet) .options-drawer-header > h3,
html:not(.mobile):not(.tablet) .options-drawer-header > h4,
html:not(.mobile):not(.tablet) .panel-header > span,
html:not(.mobile):not(.tablet) .panel-header > h1,
html:not(.mobile):not(.tablet) .panel-header > h2,
html:not(.mobile):not(.tablet) .panel-header > h3,
html:not(.mobile):not(.tablet) .panel-header > h4,
html:not(.mobile):not(.tablet) .panel-header .panel-title,
html:not(.mobile):not(.tablet) #options-header span {
    font: inherit;
    margin: 0;
    padding: 0;
    line-height: 1;
    letter-spacing: 0;
}
html:not(.mobile):not(.tablet) .options-close,
html:not(.mobile):not(.tablet) #options-close,
html:not(.mobile):not(.tablet) .panel-header .panel-actions button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: 700;
}
html:not(.mobile):not(.tablet) .panel-header > .panel-title,
html:not(.mobile):not(.tablet) .panel-header > span,
html:not(.mobile):not(.tablet) #options-header > span,
html:not(.mobile):not(.tablet) #user-pins-header > .panel-title,
html:not(.mobile):not(.tablet) #all-pins-header > .panel-title,
html:not(.mobile):not(.tablet) #reports-header > .panel-title,
html:not(.mobile):not(.tablet) #comment-reports-header > .panel-title,
html:not(.mobile):not(.tablet) #ticker-header > .panel-title,
html:not(.mobile):not(.tablet) #all-users-header > .panel-title,
html:not(.mobile):not(.tablet) #filters-header > .panel-title,
html:not(.mobile):not(.tablet) #collections-header > .panel-title,
html:not(.mobile):not(.tablet) #profile-header > .panel-title,
html:not(.mobile):not(.tablet) #violations-header > .panel-title {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    margin: 0;
    padding: 0;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

/* Mobile (portrait + landscape) canonical header normalization */
html.mobile .options-drawer-header,
html.mobile .panel-header,
html.mobile #user-pins-header,
html.mobile #all-pins-header,
html.mobile #reports-header,
html.mobile #comment-reports-header,
html.mobile #ticker-header,
html.mobile #all-users-header,
html.mobile #filters-header,
html.mobile #collections-header,
html.mobile #profile-header,
html.mobile #violations-header {
    height: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}
html.mobile .options-drawer-header > span,
html.mobile .options-drawer-header > h1,
html.mobile .options-drawer-header > h2,
html.mobile .options-drawer-header > h3,
html.mobile .options-drawer-header > h4,
html.mobile .panel-header > span,
html.mobile .panel-header > h1,
html.mobile .panel-header > h2,
html.mobile .panel-header > h3,
html.mobile .panel-header > h4,
html.mobile .panel-header .panel-title,
html.mobile #options-header > span,
html.mobile #user-pins-header > .panel-title,
html.mobile #all-pins-header > .panel-title,
html.mobile #reports-header > .panel-title,
html.mobile #comment-reports-header > .panel-title,
html.mobile #ticker-header > .panel-title,
html.mobile #all-users-header > .panel-title,
html.mobile #filters-header > .panel-title,
html.mobile #collections-header > .panel-title,
html.mobile #profile-header > .panel-title,
html.mobile #violations-header > .panel-title {
    font: inherit;
    margin: 0;
    padding: 0;
    line-height: 1;
    letter-spacing: 0;
}
html.mobile.portrait #options-header > span,
html.mobile:not(.portrait) #options-header > span {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}
html.mobile .options-close,
html.mobile #options-close,
html.mobile .panel-header .panel-actions button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: 700;
}
html.mobile .options-drawer {
    z-index: 13000;
}
html.mobile #user-pins-panel,
html.mobile #all-pins-panel,
html.mobile #reports-panel,
html.mobile #comment-reports-panel,
html.mobile #ticker-panel,
html.mobile #all-users-panel,
html.mobile #filters-panel,
html.mobile #collections-panel,
html.mobile #profile-panel,
html.mobile #violations-panel {
    z-index: 13000;
}

/* ================= FINAL HEADER LOCK: MOVED FROM style.css ================= */
/* Absolute final clamp for mobile actions transform at <=749 */
@media (max-width: 748px) {
    html.mobile #mobile-topbar .mobile-actions,
    html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
        transform: none !important;
        top: auto !important;
    }
}

/* ===== FINAL OVERRIDE: stop mobile-actions translateY jump at <=749 ===== */
@media (max-width: 748px) {
    html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
        transform: none !important;
        top: auto !important;
    }
}

/* Final 501-749 landscape behavior: keep search fluid and actions right-anchored. */
@media (min-width: 501px) and (max-width: 748px) {
    html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        column-gap: 6px !important;
        align-items: center !important;
        width: 100% !important;
        padding-right: 0 !important;
    }

    html.mobile:not(.portrait) #mobile-topbar .mobile-left {
        display: contents !important;
    }

    html.mobile:not(.portrait) #mobile-topbar .mobile-logo--portrait {
        grid-column: 1 !important;
    }

    html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
        grid-column: 2 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
        grid-column: 3 !important;
        justify-self: end !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin-left: 0 !important;
        position: static !important;
        transform: none !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
    }

    html.mobile:not(.portrait) #mobile-topbar .mobile-options {
        margin-left: 0 !important;
        position: static !important;
        transform: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        width: auto !important;
    }
}

/* Progressive button reveal across 501-749. */
@media (min-width: 501px) and (max-width: 579px) {
    #mobile-topbar .mobile-actions #mobile-btn-filters,
    #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
        display: none !important;
    }
    #mobile-topbar .mobile-actions #mobile-btn-pin {
        display: inline-flex !important;
    }
}

@media (min-width: 580px) and (max-width: 679px) {
    #mobile-topbar .mobile-actions #mobile-btn-filters,
    #mobile-topbar .mobile-actions #mobile-btn-pin {
        display: inline-flex !important;
    }
    #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
        display: none !important;
    }
}

@media (min-width: 680px) and (max-width: 748px) {
    #mobile-topbar .mobile-actions #mobile-btn-filters,
    #mobile-topbar .mobile-actions #mobile-btn-pin,
    #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
        display: inline-flex !important;
    }
}


/* Final title lock: keep Options + all subpanel header titles identical. */
#options-header > span,
.options-drawer-header > span,
#user-pins-header > .panel-title,
#all-pins-header > .panel-title,
#reports-header > .panel-title,
#comment-reports-header > .panel-title,
#ticker-header > .panel-title,
#all-users-header > .panel-title,
#collections-header > .panel-title,
#profile-header > .panel-title,
#violations-header > .panel-title,
#filters-header > span {
  font-family: 'Open Sans', sans-serif !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

/* Final header box lock: keep Options + all subpanel headers identical height. */
#options-header,
.options-drawer-header,
#user-pins-header,
#all-pins-header,
#reports-header,
#comment-reports-header,
#ticker-header,
#all-users-header,
#filters-header,
#collections-header,
#profile-header,
#violations-header {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* ================= SINGLE TOPBAR (USE MOBILE TOPBAR AT ALL WIDTHS) ================= */
#topbar {
  display: none !important;
}

#mobile-topbar {
  display: flex !important;
}

.mobile-portrait-toggle,
.mobile-portrait-bar {
  display: none !important;
}

/* ================= FINAL TOPBAR WIDTH-ONLY OVERRIDES ================= */
@media (max-width: 932px) {
  .mobile-portrait-toggle,
  .mobile-portrait-bar,
  html.mobile.portrait .mobile-portrait-toggle,
  html.mobile.portrait .mobile-portrait-bar {
    display: none !important;
  }

  #mobile-topbar {
    padding: 8px 12px 8px 8px !important;
  }

  #mobile-topbar .mobile-search-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #mobile-topbar .mobile-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  #mobile-topbar .mobile-logo--portrait {
    position: static !important;
    margin: 0 6px 0 0 !important;
    z-index: 3 !important;
  }

  #mobile-topbar .search-wrapper {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #mobile-topbar .search-wrapper input {
    width: 100% !important;
    max-width: none !important;
  }
}

/* Deterministic suppression while Filters panel is open (set by JS). */
.filters-auth-suppressed {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Use Leaflet popup tip so the arrow stays flush with popup geometry. */
.leaflet-popup-tip-container,
.leaflet-popup-tip {
  display: block !important;
}

.leaflet-popup-tip {
  background: #f8fafc;
  box-shadow: none;
}

body.dark-mode .leaflet-popup-tip {
  background: #0b1736;
}

.leaflet-popup-content .search-popup {
  min-width: 200px;
  max-width: 260px;
}

.leaflet-popup-content .search-popup-hint {
  margin-top: 6px;
  white-space: nowrap;
  font-size: 12px;
}

/* Search popup uses the same scrolling banner gradient as option headers */
.search-popup {
  min-width: 200px;
  max-width: 260px;
  padding: 6px 8px;
  background: transparent;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  text-align: center;
}

.search-popup-wrap .leaflet-popup-content-wrapper {
  background: url('/static/img/scrolling-banner/options-banner.png') repeat-x center center;
  background-size: 1536px 100%;
  animation: none;
  background-position: var(--banner-x) 0;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.28);
}

body.dark-mode .search-popup-wrap .leaflet-popup-content-wrapper {
  background: url('/static/img/scrolling-banner/options-banner.png') repeat-x center center !important;
  background-size: 1536px 100% !important;
  background-position: var(--banner-x) 0 !important;
}

.search-popup-wrap .leaflet-popup-content {
  margin: 0;
  border-radius: 10px;
}

.search-popup-wrap .leaflet-popup-tip-container,
.search-popup-wrap .leaflet-popup-tip {
  display: none !important;
}

.leaflet-popup-content .search-popup a {
  color: #ffffff;
  text-decoration: underline;
}

.pin-popup-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.pin-popup-overlay-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.pin-popup-overlay-area {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

#snow-area {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.snow-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #ffffff;
}

/* Dark mode: dark backdrop only for the snow animation */
body.dark-mode .snow-bg {
  background: #0f172a !important;
}

/* Light defaults */
.pin-popup .pin-popup-snow-bg,
.pin-popup-overlay .pin-popup-overlay-bg {
  background: transparent;
}

/* Disable inner snow layer; use overlay only */
.pin-popup .pin-popup-snow-bg,
.pin-popup .pin-popup-snow-area {
  display: none !important;
}

.pin-popup--suppress,
.pin-popup--suppress * {
  pointer-events: none !important;
}

.leaflet-popup-content-wrapper {
  position: relative;
}

.pin-popup-snow-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.pin-popup-snow-area {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.pin-popup-section {
  margin: 6px 0;
}

.pin-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pin-popup-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: -40px;
  font-size: 17px;
}

.pin-popup-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pin-popup-links button {
  border: none;
  background: #e2e8f0;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pin-popup-links button:hover {
  background: #dce6f6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.pin-popup-controls button {
  margin: 2px 2px 2px 0;
}

.pin-conditions {
  margin: 6px 0;
  font-size: 12px;
  color: #334155;
}

body.mobile .pin-conditions {
  display: none;
}

.pin-comments-toggle-row {
  text-align: right;
}

.btn-action.btn-pill {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 9999px;
  padding: 4px 10px;
  font-weight: 600;
  min-width: 100px;
  color: #111827;
  cursor: pointer;
  margin: 0;
  width: auto;
  text-align: center;
}

.btn-action.btn-pill:hover {
  background: #e2e8f0;
}

body:not(.dark-mode) .pin-actions-sidebar .pin-action-btn:not(.pin-lock):not(.pin-toggle-closed),
body:not(.dark-mode) .pin-actions-sidebar .pin-comments-toggle {
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: none;
  background-image: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

body:not(.dark-mode) .pin-actions-sidebar .pin-action-btn:not(.pin-lock):not(.pin-toggle-closed):hover,
body:not(.dark-mode) .pin-actions-sidebar .pin-comments-toggle:hover {
  background: rgba(226, 232, 240, 0.9);
  border-color: rgba(148, 163, 184, 0.55);
}

body.dark-mode .pin-actions-sidebar .pin-action-btn:not(.pin-lock):not(.pin-toggle-closed),
body.dark-mode .pin-actions-sidebar .pin-comments-toggle {
  background: rgba(31, 41, 55, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
  box-shadow: none;
  background-image: none;
  backdrop-filter: blur(4px);
  transition: background 0.12s ease, border-color 0.12s ease;
}

body.dark-mode .pin-actions-sidebar .pin-action-btn:not(.pin-lock):not(.pin-toggle-closed):hover,
body.dark-mode .pin-actions-sidebar .pin-comments-toggle:hover {
  background: rgba(45, 59, 85, 0.75);
  border-color: rgba(226, 232, 240, 0.55);
}

body:not(.dark-mode) .pin-actions-sidebar .btn-action.btn-pill:not(.pin-lock):not(.pin-toggle-closed) {
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: none;
  background-image: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

body:not(.dark-mode) .pin-actions-sidebar .btn-action.btn-pill:not(.pin-lock):not(.pin-toggle-closed):hover {
  background: rgba(226, 232, 240, 0.9);
  border-color: rgba(148, 163, 184, 0.55);
}

body.dark-mode .pin-actions-sidebar .btn-action.btn-pill:not(.pin-lock):not(.pin-toggle-closed) {
  background: rgba(31, 41, 55, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
  box-shadow: none;
  background-image: none;
  backdrop-filter: blur(4px);
  transition: background 0.12s ease, border-color 0.12s ease;
}

body.dark-mode .pin-actions-sidebar .btn-action.btn-pill:not(.pin-lock):not(.pin-toggle-closed):hover {
  background: rgba(45, 59, 85, 0.75);
  border-color: rgba(226, 232, 240, 0.55);
}

.pin-actions-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--gap-8);
  align-items: flex-end;
  height: 100%;
  margin-top: 2px;
  justify-content: flex-start;
  transform: translateY(0);
}

.pin-action-btn.pin-lock,
.pin-action-btn.pin-toggle-closed {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.pin-action-btn.pin-lock:hover,
.pin-action-btn.pin-toggle-closed:hover {
  background: #b91c1c !important;
  color: #ffffff !important;
  border-color: #991b1b !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.dark-mode .leaflet-popup-content .pin-popup-main .pin-action-btn.pin-lock,
body.dark-mode .leaflet-popup-content .pin-popup-main .pin-action-btn.pin-toggle-closed {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.dark-mode .leaflet-popup-content .pin-popup-main .pin-action-btn.pin-lock:hover,
body.dark-mode .leaflet-popup-content .pin-popup-main .pin-action-btn.pin-toggle-closed:hover {
  background: #b91c1c !important;
  color: #ffffff !important;
  border-color: #991b1b !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.btn-action.btn-pill.pin-lock,
.btn-action.btn-pill.pin-toggle-closed {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.btn-action.btn-pill.pin-lock:hover,
.btn-action.btn-pill.pin-toggle-closed:hover {
  background: #b91c1c !important;
  color: #ffffff !important;
  border-color: #991b1b !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.pin-actions-wrap {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-top: 0;
}

html.mobile .pin-actions-sidebar.is-mobile {
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

html.mobile.portrait .pin-actions-sidebar.is-mobile {
  align-items: flex-start;
  justify-content: flex-start;
  margin-right: 25px;
}

html.mobile .pin-actions-sidecol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

html.mobile.portrait .pin-actions-sidecol {
  margin-top: -18px;
}

html.mobile .pin-actions-sidecol .pin-action-btn.pin-lock,
html.mobile .pin-actions-sidecol .pin-action-btn.pin-toggle-closed {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.mobile .pin-actions-wrap {
  flex-direction: column;
  align-items: flex-end;
}

html.mobile.portrait .pin-actions-wrap {
  align-items: flex-start;
}

html.mobile.portrait .pin-actions-wrap .pin-comments-toggle-row {
  text-align: left;
}

html.mobile .pin-actions-wrap .pin-comments-toggle-row {
  margin: 0;
}

/* Pin popup action buttons: translucent pills (exclude lock/closed) */
.pin-popup-controls.pin-actions-inline {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.pin-weather-compact {
  min-width: 140px;
  font-size: 12px;
  color: #334155;
  line-height: 1.4;
  text-align: left;
}

.pin-comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 0;
  min-height: 28px;
}

html.mobile.portrait .pin-comments-header {
  min-height: 2px;
  margin-bottom: -16px;
}

html.mobile:not(.portrait) .pin-comments-header {
  transform: translate(-9px, -13px);
}

html.mobile.portrait .pin-comments-header {
  transform: translateY(-10px);
}

.pin-comments-close {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  color: #334155;
  position: relative;
  z-index: 6;
  pointer-events: auto;
}

html.mobile.portrait .pin-comments-close {
  transform: translateX(-40px);
}

html.mobile:not(.portrait) .pin-comments-close {
  transform: translateX(-17px);
}

.pin-comments-close:hover,
.pin-comments-close:focus {
  background: #e2e8f0;
  border-color: #94a3b8;
}

body.dark-mode .pin-comments-close {
  color: #f8fafc;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
}

body.dark-mode .pin-comments-close:hover,
body.dark-mode .pin-comments-close:focus {
  background: #253050;
  border-color: #475569;
}

.pin-comments-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 0;
  min-height: 0;
  margin-top: 16px;
}

html.mobile:not(.portrait) .pin-comments-list {
  margin-top: -18px;
  width: 93%;
  margin-left: -1px;
  margin-bottom: 30px;
}

html.mobile.portrait .pin-comments-list {
  flex: 1 1 auto;
  height: auto;
  width: 89%;
  max-height: calc(100% + 10px);
}

.pin-comments-form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-8);
  margin-top: auto;
  transform: none;
}

html.mobile.portrait .pin-comments-form {
  margin-top: -4px;
  gap: 2px;
}

.pin-comments-placeholder,
.pin-comments-empty,
.pin-comments-error {
  font-size: 13px;
  color: #475569;
  margin: 14px 0 10px 0;
  line-height: 1.4;
}

.pin-comment {
  display: flex;
  gap: var(--gap-8);
  padding: 6px 0;
  border-bottom: 1px solid #e2e8f0;
}

.pin-comment:last-child {
  border-bottom: none;
}

.pin-comment-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(51,65,85,0.2);
}

.pin-comment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.pin-comment-text {
  font-size: 12px;
  color: #0f172a;
  margin: 2px 0;
  word-break: break-word;
}

.pin-comment-actions button {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  cursor: pointer;
  margin-right: 6px;
  padding: 0;
}

.pin-comments-form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-6);
  padding: 6px;
  font-family: inherit;
  resize: none;
  min-height: 48px;
}

.pin-comments-form-actions {
  text-align: right;
  margin-top: 4px;
}

.pin-comments-form-actions button {
  border: none;
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius-6);
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 600;
}

.pin-comments-form-actions button:hover {
  background: #1f2937;
  box-shadow: 0 0 0 1px rgba(148,163,184,0.6), 0 2px 8px rgba(15,23,42,0.35);
}

.pin-comments-signin {
  text-align: center;
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

.pin-comments-login-link {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.pin-comments-login-link:hover,
.pin-comments-login-link:focus {
  color: #1d4ed8;
}

.pin-comments-signin button {
  margin-top: 6px;
  border: 1px solid #0f172a;
  background: #fff;
  border-radius: var(--radius-6);
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
}

html.mobile .pin-comments-signin {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0 12px 24px;
  margin: 0 auto;
  text-align: left;
}

html.mobile .pin-comments-signin p {
  margin: 0;
  margin-left: 110px;
  text-align: left;
}

html.mobile .pin-popup-comments:has(.pin-comments-signin) .pin-comments-list {
  flex: 0 0 auto;
  height: auto;
  max-height: none;
  margin-bottom: 0;
}

html.mobile .pin-popup-comments:has(.pin-comments-signin) .pin-comments-signin {
  flex: 1 1 auto;
  padding: 0 12px;
}

html.mobile .pin-comments-signin button {
  display: none;
}

/* Stronger white outline on pin popup text to keep it readable over effects */
.pin-popup-main,
.pin-popup-main * {
  text-shadow:
    0 0 2px rgba(255,255,255,0.95),
    0 0 6px rgba(255,255,255,0.85);
}

/* Subtle pill-style backdrop behind pin popup text, matching Google/Apple link look */
.pin-popup-main p,
.pin-popup-main a,
.pin-popup-main span,
.pin-popup-main strong,
.pin-popup-main em,
.pin-popup-main label,
.pin-popup-main h1,
.pin-popup-main h2,
.pin-popup-main h3,
.pin-popup-main h4,
.pin-popup-main h5,
.pin-popup-main h6 {
  display: inline-block;
  padding: 1px 2px;
  border-radius: 3px;
  background: rgba(255,255,255,0.9);
  color: inherit;
}

body.dark-mode .leaflet-popup-content .pin-popup-heading strong {
  color: #ffffff;
  background: #0b1220;
}

body.dark-mode .leaflet-popup-content .pin-popup-links a {
  color: #0b5bd3;
  text-decoration: underline;
  background: #0b1220;
}

body.dark-mode .leaflet-popup-content .pin-popup-links span {
  background: #0b1220;
  color: #1d4ed8;
}

body.dark-mode .pin-popup-links a,
body.dark-mode .pin-popup-links a:visited,
body.dark-mode .leaflet-popup-content .pin-popup-links a,
body.dark-mode .leaflet-popup-content .pin-popup-links a:visited {
  color: #0b5bd3 !important;
}

body.dark-mode .pin-popup-links button,
body.dark-mode .leaflet-popup-content .pin-popup-links button {
  color: #0f172a;
}

body.dark-mode .leaflet-popup-content .pin-popup-main .pin-popup-links button {
  color: #0f172a !important;
}

.pin-popup-main a {
  color: #0b5bd3;
}

.pin-info-line {
  display: inline-block;
  padding: 1px 2px;
  border-radius: 3px;
  background: rgba(255,255,255,0.9);
}

body.dark-mode .pin-info-line {
  background: rgba(15,23,42,0.9);
}

body.dark-mode .leaflet-popup-content .pin-popup-main {
  background: transparent;
  color: #e5e7eb;
  text-shadow: none;
  box-shadow: none;
}

body.dark-mode .pin-popup-comments {
  background: #1f2937;
  border-left: 1px solid rgba(0,0,0,0.55);
  box-shadow: 0 2px 12px rgba(15,23,42,0.45);
}

body.dark-mode html.mobile .leaflet-popup-content .pin-popup-comments {
  background: rgba(11, 18, 32, 0.92);
  border-left: none;
  box-shadow: none;
}

body.dark-mode .pin-popup-comments::after {
  background: #1f2937;
}

body.dark-mode .pin-comments-header {
  color: #f1f5f9;
}

body.dark-mode .pin-comments-list {
  background: transparent;
  color: #d1d5db;
}

body.dark-mode .pin-comments-placeholder,
body.dark-mode .pin-comments-empty,
body.dark-mode .pin-comments-error,
body.dark-mode .pin-comments-signin,
body.dark-mode .pin-comments-login,
body.dark-mode .comment-login-cta {
  color: #cbd5e1;
}

body.dark-mode .pin-comments-signin button {
  background: #f8fafc;
  color: #111827;
  border: 1px solid #cbd5e1;
}

body.dark-mode .pin-comments-login-link {
  color: #60a5fa;
}

body.dark-mode .pin-comments-login-link:hover,
body.dark-mode .pin-comments-login-link:focus {
  color: #93c5fd;
}

body.dark-mode .pin-comment {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

body.dark-mode .pin-comment-text {
  color: #e5e7eb;
}

/* Subtle scrollbar (comments list) */
.pin-comments-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.6) transparent;
}

.pin-comments-list::-webkit-scrollbar {
  width: 6px;
}

.pin-comments-list::-webkit-scrollbar-track {
  background: transparent;
}

.pin-comments-list::-webkit-scrollbar-thumb {
  background-color: rgba(148,163,184,0.55);
  border-radius: 6px;
}

.pin-comments-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(148,163,184,0.75);
}

body.dark-mode .pin-comments-list {
  scrollbar-color: rgba(203,213,225,0.45) transparent;
}

body.dark-mode .pin-comments-list::-webkit-scrollbar-thumb {
  background-color: rgba(203,213,225,0.45);
}

body.dark-mode .pin-comments-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(203,213,225,0.65);
}

/* Comment composer (input + Post) */
.comment-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

html.mobile.portrait .comment-composer {
  margin-top: -4px;
}

html.mobile:not(.portrait) .comment-composer {
  transform: translate(-11px, -30px);
}

html.mobile.portrait .comment-composer {
  transform: translateY(11px);
}

.comment-composer textarea,
.comment-composer input {
  flex: 1;
  resize: none;
  height: var(--comment-input-h);
  min-height: var(--comment-input-h);
  max-height: var(--comment-input-h);
  padding: 8px 12px;
  font-size: 13px;
  line-height: 20px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(248, 250, 252, 0.9);
  outline: none;
  overflow-y: auto;
  scrollbar-gutter: auto;
}

html.mobile.portrait .comment-composer textarea,
html.mobile.portrait .comment-composer input {
  flex: 0 0 72%;
}

html.mobile:not(.portrait) .comment-composer textarea,
html.mobile:not(.portrait) .comment-composer input {
  flex: 0 0 80%;
  width: 80%;
  max-width: 80%;
}

body.dark-mode .comment-composer textarea,
body.dark-mode .comment-composer input {
  background: rgba(31, 41, 55, 0.75);
  border-color: rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
}

.comment-composer .btn-post {
  height: var(--comment-input-h);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(248, 250, 252, 0.9);
  cursor: pointer;
  box-shadow: none;
}

.comment-composer .btn-post:hover {
  background: rgba(226, 232, 240, 0.9);
}

body.dark-mode .comment-composer .btn-post {
  background: rgba(31, 41, 55, 0.75);
  border-color: rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
}

body.dark-mode .comment-composer .btn-post:hover {
  background: rgba(45, 59, 85, 0.85);
}

.comment-composer textarea::-webkit-scrollbar {
  width: 6px;
}

.comment-composer textarea::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.6);
  border-radius: 6px;
}

body.dark-mode .comment-composer textarea::-webkit-scrollbar-thumb {
  background: rgba(226,232,240,0.45);
}

@media (max-width: 932px) {
  .leaflet-popup-content .pin-popup {
    flex-direction: column;
    width: 94vw;
    max-width: 94vw;
    min-width: auto;
    transition: none;
    padding: 8px 0 12px;
    --pin-popup-panel-height: auto;
  }

  .leaflet-popup-content .pin-popup.comments-open {
    min-width: auto;
  }

  .leaflet-popup-content .pin-popup-main {
    flex: 1 1 auto;
    min-width: auto;
    padding: 16px 16px 20px;
  }

  .reaction-cluster {
    position: absolute;
    top: 8px;
    right: 12px;
    bottom: auto;
    transform: none;
  }

  html.mobile.portrait .reactions-row {
    transform: translateX(-25px);
  }

  .pin-actions-sidebar {
    height: auto;
    justify-content: flex-start;
  }

  .pin-actions-wrap {
    margin-top: 0;
  }

  .leaflet-popup-content .pin-popup-comments {
    width: 100%;
    margin-left: 0;
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    display: none;
    box-shadow: none;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    box-sizing: border-box;
    border-left: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    z-index: 3;
  }

  .leaflet-popup-content .pin-popup.comments-open .pin-popup-comments {
    display: flex;
  }

  html.mobile .leaflet-popup-content .pin-popup.comments-open .pin-popup-comments {
    position: absolute;
    inset: 0;
  }
}

.pin-meta-lines {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.pin-hotspot-stamp {
  position: absolute;
  top: 24px;
  right: 46px;
  width: 270px;
  height: 126px;
  margin: 0;
  pointer-events: none;
  opacity: 0.98;
  z-index: 7;
}

.pin-hotspot-stamp img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.22));
  animation: hotspotPulse 1.9s ease-in-out infinite;
  transform-origin: center center;
}

@keyframes hotspotPulse {
  0%, 100% {
    transform: scale(1);
    filter:
      drop-shadow(0 2px 4px rgba(0,0,0,0.22))
      drop-shadow(0 0 2px rgba(255, 45, 45, 0.35))
      drop-shadow(0 0 6px rgba(255, 45, 45, 0.22));
    opacity: 0.92;
  }
  50% {
    transform: scale(1.045);
    filter:
      drop-shadow(0 2px 5px rgba(0,0,0,0.28))
      drop-shadow(0 0 5px rgba(255, 45, 45, 0.65))
      drop-shadow(0 0 12px rgba(255, 45, 45, 0.45));
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pin-hotspot-stamp img {
    animation: none;
  }
}










/* ================= OVERLAY/PROMPT MAP GEOMETRY (MOVED) ================= */
/* Adblock banner */
#adblock-banner {
    position: fixed;
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #0b172a;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3500;
    max-width: 520px;
    width: calc(100% - 32px);
    font-size: 13px;
    line-height: 1.35;
}
.adblock-banner__text {
    flex: 1;
}
.adblock-banner__actions button {
    min-width: 72px;
}

body.dark-mode #adblock-banner {
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}

#verify-banner {
    position: fixed;
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ribbon-gap) + var(--ticker-h) + 74px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #0b172a;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3500;
    max-width: 520px;
    width: calc(100% - 32px);
    font-size: 13px;
    line-height: 1.35;
}
.verify-banner__text { flex: 1; }
.verify-banner__actions button { min-width: 90px; }

body.dark-mode #verify-banner {
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}
html.mobile #test-popup {
    min-width: 0;
    width: 92vw;
    max-width: 370px;
    height: auto;
    max-height: 86vh;
    padding: 20px 16px 24px 16px;
}
html.mobile #test-popup.edit-open {
    height: 96vh;
    max-height: 96vh;
}

/* Supporters edit UI is desktop-only */
html.mobile #supporters-edit,
html.mobile #supporters-save,
html.mobile #supporters-edit-panel {
    display: none !important;
}

/* Mobile: always show scroll track in supporters list */
html.mobile .supporters-list {
    overflow-y: scroll;
    max-height: 52vh;
}
html.mobile:not(.portrait) #test-popup {
    height: auto;
    max-height: 88vh;
    padding: 16px 14px 18px 14px;
}
html:not(.mobile):not(.tablet) #test-popup .test-popup-body .modal-header {
    margin-top: -28px;
}

/* ================= DESKTOP AUTH ANCHOR/LOGOUT POSITION (MOVED) ================= */
/* Desktop: anchor auth buttons below the ticker */
@media (min-width: 769px) {
    /* keep auth inline within the ribbon */
    body #auth {
        position: static !important;
        top: auto !important;
        right: auto !important;
        margin-left: auto !important;
        transform: none !important;
        z-index: 9999;
    }
}

/* Desktop logout (matches login/register position) */
#auth-buttons {
    position: absolute;
    top: calc(var(--brandbar-h) + var(--topbar-h) + 37px);
    right: 11px;
    z-index: 3001;
    display: flex;
    gap: 8px;
    align-items: center;
    pointer-events: auto;
}
#auth-logout {
    position: absolute;
    top: calc(var(--brandbar-h) + var(--topbar-h) + 37px);
    right: 11px;
    z-index: 3000;
    display: flex;
    align-items: center;
    pointer-events: auto;
}
#auth-logout #btn-logout {
    padding: 6px 10px;
}

/* ================= PANEL HIDDEN/NO-TRANSITION STATE (MOVED) ================= */
  /* Hidden slide-off for panels */
 #all-pins-panel.hidden, #reports-panel.hidden, #comment-reports-panel.hidden, #ticker-panel.hidden, #all-users-panel.hidden, #filters-panel.hidden, #user-pins-panel.hidden, #collections-panel.hidden, #profile-panel.hidden, #violations-panel.hidden {
     transform: translateX(100%);
}
 #all-pins-panel.no-transition, #reports-panel.no-transition, #comment-reports-panel.no-transition, #ticker-panel.no-transition, #all-users-panel.no-transition, #filters-panel.no-transition, #user-pins-panel.no-transition, #collections-panel.no-transition, #profile-panel.no-transition, #violations-panel.no-transition {
     transition: none !important;
 }

/* ================= LANG DROPDOWN TOPBAR CLIPPING FIX (MOVED) ================= */
/* Language dropdown visibility fix: prevent clipping in topbar variants */
#topbar,
#mobile-topbar,
#mobile-topbar .mobile-search-row,
#mobile-topbar .mobile-actions,
#mobile-topbar .mobile-options,
#lang-dropdown,
#mobile-lang-dropdown {
  overflow: visible !important;
}
.lang-dropdown {
  z-index: 30000 !important;
}
.lang-menu {
  z-index: 30001 !important;
}
#lang-dropdown .lang-menu {
  left: 0 !important;
  right: auto !important;
}
#mobile-lang-dropdown .lang-menu {
  left: auto !important;
  right: 0 !important;
}

/* ================= TOP BAR SHELL + DARK TOPBAR/TICKER (MOVED) ================= */
/* Sticky Top Bar (auth/search/etc.) */
#topbar {
    position: fixed;
    top: var(--brandbar-h);
    z-index: 12000;
    pointer-events: auto;
    padding: 8px;
    padding-right: 0;
    box-sizing: border-box;
    left: 0;
    right: 0;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--ribbon-gap);
    border-bottom: 1px solid #ddd;
    height: var(--topbar-h);
    white-space: nowrap;
    flex-wrap: nowrap;
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
#topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #ddd;
    pointer-events: none;
}
#topbar,
#topbar * {
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}
#topbar .btn-secondary,
#topbar .lang-trigger,
#topbar input,
#topbar #auth {
    height: 32px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    line-height: 0;
}
#topbar .btn-label,
#topbar .auth-label {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--ribbon-gap);
    margin-left: 1px;
    flex-shrink: 0;
}
#btn-filters,
#btn-pin-at-device,
#btn-toggle-theme {
    height: 32px;
    line-height: 32px;
    width: 96px;
    text-align: center;
}
#btn-pin-at-device {
    width: 120px;
}
.lang-trigger {
    min-width: 50px;
    width: auto;
    justify-content: center;
}
body.dark-mode #topbar {
    background: #111827;
    color: #f8fafc;
    border-bottom: 1px solid #1f2937;
    overflow: visible;
    box-shadow: none;
}
body.dark-mode #topbar::after {
    background: #1f2937;
}
body.dark-mode #topbar input,
body.dark-mode #topbar button {
    background: #1f2937;
    color: #e2e8f0;
    border-color: #374151;
}
body.dark-mode #ticker {
    background: #030712;
    color: #f8fafc;
}

.dark-mode #map {
    background: #020617;
}

/* ================= SCROLLING TICKER (UNDER TOPBAR) (MOVED) ================= */
#ticker {
    background:
      radial-gradient(circle at 3px 3px, rgba(255,200,60,0.08) 0, rgba(255,200,60,0.08) 1px, transparent 1px) repeat;
    background-color: #0a0f1c;
    background-size: 6px 6px;
    color: #f6d33f;
    border-bottom: 1px solid #0a0c18;
    font-size: 16px;
    font-family: 'VT323', 'DM Mono', 'SFMono-Regular', monospace;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-shadow:
      0 0 4px rgba(246, 211, 63, 0.35),
      0 0 6px rgba(250, 180, 0, 0.25);
    box-shadow: inset 0 0 12px rgba(0,0,0,0.45);
}

#ticker .ticker-track {
   display: flex;
   white-space: nowrap;
   will-change: transform;
   animation: ticker-scroll 24s linear infinite;
   letter-spacing: 0.08em;
}
#ticker .ticker-track span {
    display: inline-block;
    padding-right: 16px;
    color: #f8e27c;
    text-shadow:
      0 0 1px rgba(255, 210, 80, 0.60),
      0 0 3px rgba(255, 214, 102, 0.35),
      0 0 6px rgba(255, 180, 30, 0.25);
}
.ticker-loop {
    display: flex;
    flex-wrap: nowrap;
}
.ticker-pad {
    display: inline-block;
    width: 0;
}
@keyframes ticker-scroll {
   0%   { transform: translateX(calc(100vw + 20px)); }
   100% { transform: translateX(-100%); }
}
@keyframes ticker-scroll-faststart {
   0%   { transform: translateX(calc(100vw + 20px)); }
   0.8%  { transform: translateX(calc(100vw - 40px)); }
   100% { transform: translateX(-100%); }
}

/* ================= TICKER PANEL LAYOUT + DARK FIELDS (MOVED) ================= */
/* Keep ticker panel header size stable and allow body scroll */
#ticker-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#ticker-header {
    min-height: 40px;
}
#ticker-header .panel-actions button {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
}
#ticker-panel .panel-stack {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
#ticker-panel .panel-stack > p {
    font-size: 13px;
    margin-bottom: 4px;
}
#ticker-panel .ticker-field {
    font-size: 12px;
}
#ticker-panel .ticker-field input {
    font-size: 13px;
}
body.dark-mode #ticker-panel .panel-stack {
    background: #0f172a;
}
body.dark-mode #ticker-panel .ticker-field {
    background: #0f172a;
}

/* Width/theme for all standard panels (moved) */
#all-pins-panel, #reports-panel, #comment-reports-panel, #ticker-panel, #all-users-panel, #filters-panel, #user-pins-panel, #profile-panel, #violations-panel {
    width: 320px;
    background: #ffffff;
    box-shadow: -2px 0 6px rgba(0,0,0,0.15);
    z-index: 3300;
    display: flex;
    flex-direction: column;
    transition: none;
}

/* Keep reports pager visible at panel bottom (moved) */
#reports-panel,
#comment-reports-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#reports-list,
#comment-reports-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
#reports-pager,
#comment-reports-pager {
    margin-top: auto;
}

/* Keep violations pager pinned at panel bottom (moved) */
#violations-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#violations-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
#violations-pager {
    margin-top: auto;
}

/* Unified list/card styling (moved) */
#user-pins-list,  #all-pins-list, #filters-list, #reports-list, #all-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}
#user-pins-list div div, #all-pins-list div, #filters-list div, #reports-list > div, #comment-reports-list > div, #all-users-list > div {
    background: #fff;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}
.report-meta {
    font-size: 12px;
    color: #475569;
    margin-top: 4px;
}
#reports-list .report-row,
#comment-reports-list .report-row {
    background: #f9fafb !important;
}
#comment-reports-list .report-row {
    width: 95%;
    box-sizing: border-box;
}
body.dark-mode .report-meta {
    color: #94a3b8;
}
body.dark-mode #reports-list .report-row,
body.dark-mode #comment-reports-list .report-row {
    background: #1f2937 !important;
}
#user-pins-list .pin-list-row,
#user-pins-list .pin-list-row > div:not(.pin-thumb),
#user-pins-list .pin-list-row .pin-row-body,
#user-pins-list .pin-list-row .pin-row-body div {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

/* Subtle scrollbar (option panels) (moved) */
#user-pins-list,
#all-pins-list,
#filters-list,
#reports-list,
#comment-reports-list,
#collections-list,
.profile-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(148,163,184,0.6) transparent;
}
#user-pins-list::-webkit-scrollbar,
#all-pins-list::-webkit-scrollbar,
#filters-list::-webkit-scrollbar,
#reports-list::-webkit-scrollbar,
#comment-reports-list::-webkit-scrollbar,
#collections-list::-webkit-scrollbar,
.profile-body::-webkit-scrollbar {
    width: 6px;
}
#user-pins-list::-webkit-scrollbar-track,
#all-pins-list::-webkit-scrollbar-track,
#filters-list::-webkit-scrollbar-track,
#reports-list::-webkit-scrollbar-track,
#comment-reports-list::-webkit-scrollbar-track,
#collections-list::-webkit-scrollbar-track,
.profile-body::-webkit-scrollbar-track {
    background: transparent;
}
#user-pins-list::-webkit-scrollbar-thumb,
#all-pins-list::-webkit-scrollbar-thumb,
#filters-list::-webkit-scrollbar-thumb,
#reports-list::-webkit-scrollbar-thumb,
#comment-reports-list::-webkit-scrollbar-thumb,
#collections-list::-webkit-scrollbar-thumb,
.profile-body::-webkit-scrollbar-thumb {
    background-color: rgba(148,163,184,0.55);
    border-radius: 6px;
}
#user-pins-list::-webkit-scrollbar-thumb:hover,
#all-pins-list::-webkit-scrollbar-thumb:hover,
#filters-list::-webkit-scrollbar-thumb:hover,
#reports-list::-webkit-scrollbar-thumb:hover,
#comment-reports-list::-webkit-scrollbar-thumb:hover,
#collections-list::-webkit-scrollbar-thumb:hover,
.profile-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148,163,184,0.75);
}
body.dark-mode #user-pins-list,
body.dark-mode #all-pins-list,
body.dark-mode #filters-list,
body.dark-mode #reports-list,
body.dark-mode #comment-reports-list,
body.dark-mode #collections-list,
body.dark-mode .profile-body {
    scrollbar-color: rgba(203,213,225,0.45) transparent;
}
body.dark-mode #user-pins-list::-webkit-scrollbar-thumb,
body.dark-mode #all-pins-list::-webkit-scrollbar-thumb,
body.dark-mode #filters-list::-webkit-scrollbar-thumb,
body.dark-mode #reports-list::-webkit-scrollbar-thumb,
body.dark-mode #comment-reports-list::-webkit-scrollbar-thumb,
body.dark-mode #collections-list::-webkit-scrollbar-thumb,
body.dark-mode .profile-body::-webkit-scrollbar-thumb {
    background-color: rgba(203,213,225,0.45);
}
body.dark-mode #user-pins-list::-webkit-scrollbar-thumb:hover,
body.dark-mode #all-pins-list::-webkit-scrollbar-thumb:hover,
body.dark-mode #filters-list::-webkit-scrollbar-thumb:hover,
body.dark-mode #reports-list::-webkit-scrollbar-thumb:hover,
body.dark-mode #comment-reports-list::-webkit-scrollbar-thumb:hover,
body.dark-mode #collections-list::-webkit-scrollbar-thumb:hover,
body.dark-mode .profile-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(203,213,225,0.65);
}

/* ================= MOBILE AUTH VISIBILITY MATRIX (FINAL OVERRIDE) ================= */
/* Keep only one auth set visible per mobile/tablet width bucket. */
@media (max-width: 500px) {
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open) #auth-buttons,
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open) #auth-logout {
    display: none !important;
  }
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-anon #mobile-auth-buttons,
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-token #mobile-auth-buttons {
    display: flex !important;
  }
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-token #mobile-login-button,
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-token #mobile-register-button {
    display: none !important;
  }
}

@media (min-width: 501px) and (max-width: 932px) {
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-anon #auth-buttons {
    display: flex !important;
  }
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-anon #auth-logout {
    display: none !important;
  }
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-token #auth-buttons {
    display: none !important;
  }
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open).auth-token #auth-logout {
    display: flex !important;
  }
  html:not(.options-open):not(.options-panel-open):not(.filters-panel-open) #mobile-auth-buttons {
    display: none !important;
  }

  /* Logged-out: never show mobile inline auth badge in 501-932. */
  html.mobile.auth-anon #mobile-auth-inline,
  html.mobile.auth-anon #mobile-auth-inline.auth-map-bound,
  html.tablet.auth-anon #mobile-auth-inline,
  html.tablet.auth-anon #mobile-auth-inline.auth-map-bound {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* Make 501-932 mobile auth badge match the 0-500 visual style */
@media (min-width: 501px) and (max-width: 932px) {
  html.mobile #mobile-auth-inline,
  html.tablet #mobile-auth-inline,
  html.auth-map-mode #mobile-auth-inline.auth-map-bound {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
    height: 32px !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
  }

  html.mobile #mobile-user-avatar-badge,
  html.tablet #mobile-user-avatar-badge {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
  }

  html.mobile #mobile-user-info,
  html.tablet #mobile-user-info,
  html.mobile #mobile-user-info.auth-loading,
  html.tablet #mobile-user-info.auth-loading {
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 32px !important;
    color: #0f172a !important;
  }

  body.dark-mode html.mobile #mobile-auth-inline,
  body.dark-mode html.tablet #mobile-auth-inline,
  body.dark-mode html.auth-map-mode #mobile-auth-inline.auth-map-bound {
    background: rgba(15, 23, 42, 0.6) !important;
    border-color: #374151 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
  }

  body.dark-mode html.mobile #mobile-user-info,
  body.dark-mode html.tablet #mobile-user-info,
  body.dark-mode html.mobile #mobile-user-info.auth-loading,
  body.dark-mode html.tablet #mobile-user-info.auth-loading {
    color: #e5e7eb !important;
  }

  /* Match 0-500 placement model exactly in portrait */
  html.mobile.portrait #mobile-auth-inline,
  html.mobile.portrait #mobile-auth-inline.auth-map-bound {
    position: fixed !important;
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--ticker-gap) + 13px) !important;
    left: 56px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    z-index: 12000 !important;
    max-width: 180px !important;
    width: auto !important;
    overflow: hidden !important;
    visibility: visible !important;
  }

  html.mobile.portrait.portrait-bar-open #mobile-auth-inline,
  html.mobile.portrait.portrait-bar-open #mobile-auth-inline.auth-map-bound {
    top: calc(var(--brandbar-h) + var(--topbar-h) + var(--topbar-h) + var(--ticker-gap) + 13px) !important;
  }
}

/* Canonical dark-mode auth badge style for mobile portrait across 0-932 */
body.dark-mode html.mobile.portrait #mobile-auth-inline,
body.dark-mode html.mobile.portrait #mobile-auth-inline.auth-map-bound {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid #374151 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode html.mobile.portrait #mobile-user-info,
body.dark-mode html.mobile.portrait #mobile-user-info.auth-loading {
  color: #e5e7eb !important;
}

/* Final mobile auth badge styling (0-932): white text, darker translucent bg, white border */
@media (max-width: 932px) {
  html.mobile #mobile-auth-inline,
  html.mobile #mobile-auth-inline.auth-map-bound,
  html.tablet #mobile-auth-inline,
  html.tablet #mobile-auth-inline.auth-map-bound,
  html.auth-map-mode #mobile-auth-inline.auth-map-bound {
    background: rgba(10, 18, 35, 0.72) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
  }

  html.mobile #mobile-user-info,
  html.mobile #mobile-user-info.auth-loading,
  html.tablet #mobile-user-info,
  html.tablet #mobile-user-info.auth-loading,
  html.mobile #mobile-auth-inline .auth-label,
  html.tablet #mobile-auth-inline .auth-label {
    color: #ffffff !important;
  }
}

/* Keep mobile SL shine perfectly locked to the SL image box. */
@media (max-width: 932px) {
  #mobile-topbar .logo-container.sl-logo {
    position: relative !important;
    width: 34px !important;
    height: 24px !important;
    overflow: hidden !important;
  }

  #mobile-topbar .logo-container.sl-logo .logo-base {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  #mobile-topbar .logo-container.sl-logo .logo-shine-sl {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    -webkit-mask-image: url('/static/img/logos/SL_2.png') !important;
    mask-image: url('/static/img/logos/SL_2.png') !important;
    -webkit-mask-size: 100% 100% !important;
    mask-size: 100% 100% !important;
    -webkit-mask-position: center !important;
    mask-position: center !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
    background-size: 200% 100% !important;
    animation: shine-move 20s linear infinite !important;
    pointer-events: none !important;
  }
}

/* Final lock: 501-749 must use the same dynamic topbar layout (prevents 749-only snap). */
@media (min-width: 501px) and (max-width: 748px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    column-gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-logo--portrait {
    grid-column: 1 !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 1 1 auto !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    white-space: nowrap !important;
    width: auto !important;
    flex: 0 0 auto !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: auto !important;
    max-width: none !important;
  }

  /* Kill leftover vertical nudge rules from overlapping breakpoints */
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions > * {
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    translate: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions .btn-secondary,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions .lang-trigger,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    position: static !important;
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    align-self: center !important;
  }
}

/* Absolute fallback lock for 501-749 regardless of html/body mobile/tablet class timing */
@media (min-width: 501px) and (max-width: 748px) {
  #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    column-gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0 !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    grid-auto-rows: 32px !important;
  }

  #mobile-topbar .mobile-left {
    display: contents !important;
  }

  #mobile-topbar .mobile-logo--portrait {
    grid-column: 1 !important;
    margin: 0 6px 0 0 !important;
  }

  #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  #mobile-topbar .search-wrapper input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 32px !important;
    line-height: 32px !important;
  }

  #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
    white-space: nowrap !important;
    width: auto !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  #mobile-topbar .mobile-actions > * {
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    align-self: center !important;
  }

  #mobile-topbar .mobile-actions .btn-secondary,
  #mobile-topbar .mobile-actions .lang-trigger,
  #mobile-topbar .mobile-actions #mobile-btn-filters,
  #mobile-topbar .mobile-actions #mobile-btn-pin,
  #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    height: 32px !important;
    line-height: 32px !important;
    position: static !important;
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    align-self: center !important;
  }

  #mobile-topbar .mobile-options {
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: auto !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  /* Single vertical-alignment contract for the row */
  #mobile-topbar .mobile-search-row > *,
  #mobile-topbar .mobile-left,
  #mobile-topbar .search-wrapper,
  #mobile-topbar .mobile-actions,
  #mobile-topbar .mobile-options {
    align-self: center !important;
  }
}

/* 749px guard: enforce same geometry/placement model as 748px */
@media (width: 748px) {
  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    grid-auto-rows: 32px !important;
    width: 100% !important;
    padding: 0 !important;
    padding-right: 0 !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 !important;
    white-space: nowrap !important;
    width: auto !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options {
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: auto !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row > *,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions,
  html.mobile:not(.portrait) #mobile-topbar .mobile-options,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions > * {
    align-self: center !important;
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
  }
}


/* FINAL LOCK: 649-748 must keep right side as Pin+Lang only (no clipping) */
@media (min-width: 649px) and (max-width: 748px) {
  /* First-paint fallback (before html.mobile classes settle) */
  #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 248px !important;
    align-items: center !important;
    column-gap: 8px !important;
    width: 100% !important;
    overflow: visible !important;
  }

  #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  #mobile-topbar .search-wrapper input {
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: grid !important;
    grid-template-columns: 92px 101px 56px !important;
    align-items: center !important;
    justify-content: end !important;
    gap: 8px !important;
    white-space: nowrap !important;
    width: 262px !important;
    padding-left: 5px !important;
    box-sizing: border-box !important;
    max-width: none !important;
    overflow: visible !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-filters {
    grid-column: 1 !important;
    transform: translateX(5px) !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-pin {
    grid-column: 2 !important;
    width: 98px !important;
    justify-self: end !important;
    transform: translateX(6px) !important;
  }

  #mobile-topbar .mobile-actions .mobile-options {
    grid-column: 3 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 0 !important;
    width: 56px !important;
    min-width: 56px !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-filters,
  #mobile-topbar .mobile-actions #mobile-btn-pin,
  #mobile-topbar .mobile-actions .mobile-options .lang-trigger {
    display: inline-flex !important;
    visibility: visible !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 248px !important;
    align-items: center !important;
    column-gap: 8px !important;
    width: 100% !important;
    overflow: visible !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: grid !important;
    grid-template-columns: 92px 101px 56px !important;
    align-items: center !important;
    justify-content: end !important;
    gap: 8px !important;
    white-space: nowrap !important;
    width: 262px !important;
    padding-left: 5px !important;
    box-sizing: border-box !important;
    max-width: none !important;
    overflow: visible !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme {
    display: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters {
    grid-column: 1 !important;
    transform: translateX(5px) !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin {
    grid-column: 2 !important;
    width: 98px !important;
    justify-self: end !important;
    transform: translateX(6px) !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions .mobile-options {
    grid-column: 3 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 0 !important;
    width: 56px !important;
    min-width: 56px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions .mobile-options .lang-trigger {
    display: inline-flex !important;
    visibility: visible !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-options,
  html.mobile:not(.portrait) #mobile-topbar .mobile-options > * {
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
  }
}

/* FINAL LOCK: 749-932 fixed right action grid to stop refresh left-shift */
@media (min-width: 749px) and (max-width: 932px) {
  /* First-paint fallback (before html.mobile classes settle) */
  #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 354px !important;
    align-items: center !important;
    column-gap: 8px !important;
    width: 100% !important;
    overflow: visible !important;
  }

  #mobile-topbar .mobile-left {
    display: contents !important;
  }

  #mobile-topbar .mobile-logo--portrait { grid-column: 1 !important; }

  #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  #mobile-topbar .search-wrapper input {
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: grid !important;
    grid-template-columns: 84px 104px 98px 44px !important;
    align-items: center !important;
    justify-content: end !important;
    gap: 8px !important;
    white-space: nowrap !important;
    width: 354px !important;
    max-width: none !important;
    overflow: visible !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-filters { grid-column: 1 !important; }
  #mobile-topbar .mobile-actions #mobile-btn-pin { grid-column: 2 !important; }
  #mobile-topbar .mobile-actions #mobile-btn-toggle-theme { grid-column: 3 !important; display: inline-flex !important; }
  #mobile-topbar .mobile-actions .mobile-options {
    grid-column: 4 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 0 !important;
    width: 44px !important;
    min-width: 44px !important;
  }

  #mobile-topbar .mobile-actions #mobile-btn-filters,
  #mobile-topbar .mobile-actions #mobile-btn-pin,
  #mobile-topbar .mobile-actions .mobile-options .lang-trigger {
    display: inline-flex !important;
    visibility: visible !important;
  }

  #mobile-topbar .mobile-search-row > *,
  #mobile-topbar .mobile-left,
  #mobile-topbar .mobile-logo--portrait,
  #mobile-topbar .search-wrapper,
  #mobile-topbar .mobile-actions,
  #mobile-topbar .mobile-options,
  #mobile-topbar .mobile-actions > * {
    align-self: center !important;
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    translate: none !important;
    position: static !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 354px !important;
    align-items: center !important;
    column-gap: 8px !important;
    width: 100% !important;
    overflow: visible !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-left {
    display: contents !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-logo--portrait { grid-column: 1 !important; }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper {
    grid-column: 2 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .search-wrapper input {
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions {
    grid-column: 3 !important;
    justify-self: end !important;
    display: grid !important;
    grid-template-columns: 84px 104px 98px 44px !important;
    align-items: center !important;
    justify-content: end !important;
    gap: 8px !important;
    white-space: nowrap !important;
    width: 354px !important;
    max-width: none !important;
    overflow: visible !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters { grid-column: 1 !important; }
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin { grid-column: 2 !important; }
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-toggle-theme { grid-column: 3 !important; display: inline-flex !important; }
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions .mobile-options {
    grid-column: 4 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 0 !important;
    width: 44px !important;
    min-width: 44px !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-filters,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions #mobile-btn-pin,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions .mobile-options .lang-trigger {
    display: inline-flex !important;
    visibility: visible !important;
  }

  html.mobile:not(.portrait) #mobile-topbar .mobile-search-row > *,
  html.mobile:not(.portrait) #mobile-topbar .mobile-left,
  html.mobile:not(.portrait) #mobile-topbar .mobile-logo--portrait,
  html.mobile:not(.portrait) #mobile-topbar .search-wrapper,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions,
  html.mobile:not(.portrait) #mobile-topbar .mobile-options,
  html.mobile:not(.portrait) #mobile-topbar .mobile-actions > * {
    align-self: center !important;
    top: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    translate: none !important;
    position: static !important;
  }
}


