*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overscroll-behavior: none;
  height: 100%;
  overflow: hidden;
}

body { 
  margin: 0; 
  background: #000; 
  font-family: sans-serif; 
}

body.light {
  background: #e8e8e8 !important;
}

#map {
  width: 100vw;
  height: calc(var(--vh) * 100);
  touch-action: pan-x pan-y;
  z-index: 1;
  pointer-events: auto;
}

body.light #map {
  background: #e8e8e8 !important;
}

body.light .leaflet-container {
  background: #e8e8e8 !important;
}

/* Unified overlay for loading, retry, or errors */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;

  z-index: 999;
  pointer-events: none;
  gap: 1rem;
  padding: 1rem;
  border-radius: 8px;
}

/* Make overlay children clickable (like retry button) */
.overlay > * {
  pointer-events: auto;
}

/* Error variant
.overlay.error {
  background: rgba(160, 0, 0, 0.95);
  font-weight: 600;
} */

/* Retry button */
.overlay button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: rgba(50,50,50,0.9);
  color: white;
  cursor: pointer;
}

body.light .overlay button {
  background: white;
  color: #222
}

/* Geolocation error button */
#geo-popup {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10000;
  justify-content: center;
  align-items: flex-end;
}

.geo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}

.geo-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: #fff;
  margin: 12px;
  padding: 16px;
  border-radius: 16px;
  max-width: 420px;
  width: calc(100% - 24px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
  animation: geoSlideUp 220ms ease-out;
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

.geo-title {
  font-weight: 600;
  font-size: 18px;
  text-align: center;
  margin-top: 6px;
  margin-bottom: 18px;
}

.geo-icon {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 20px;
  opacity: 0.9;
}

.geo-text {
  font-size: 14px;
  line-height: 1.45;
  color: #444;
  margin-bottom: 24px;
}

.geo-dismiss {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: none;
  background: #007aff;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}

@keyframes geoSlideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Top banner */
.top-banner {
  position: absolute;
  top: 0; left: 0; width: 100%;
  height: 56px;
  background-color: rgba(50,50,50,0.9);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 15px;
  padding-right: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 1001;
}

body.light .top-banner {
  background-color: rgba(255,255,255,0.95) !important;
  color: #222 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

.top-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-banner-left .logo {
  height: 48px;
  width: auto;
}

.top-banner-left h1 {
  font-weight: bold;
  font-size: 1.4em;
  margin: 0;
}

.top-banner .buttons {
  display: flex;
  min-width: 0;
}

.theme-switch {
  /*margin-left: auto;*/
  /*margin-right: 44px;*/
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.25em;
}

body.light .theme-switch {
  color: #222 !important;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255,255,255,0.3);
  border-radius: 999px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

input:checked + .slider {
  background-color: #4285F4;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Hamburger button */
.hamburger-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: #777; 
  border: none;
  color: #fff;
  font-size: 1.25em;
  padding: 3px 8px 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 1002;
  display: none;
}
.hamburger-btn:hover { background: #999; }

/* Top-left UI */
.ui-top-left {
  position: absolute;
  top: 60px; 
  left: 10px;
  display: flex; 
  align-items: center; 
  gap: 6px;
  color: #fff; 
  z-index: 1000; 
  font-weight: bold; 
  font-size: 1.2em;
}

body.light .ui-top-left {
  color: #222 !important;
}

.ui-top-left button {
  padding: 4px 8px; 
  font-size: 0.9em; 
  border: none; 
  border-radius: 4px;
  background-color: rgba(255,255,255,0.1); 
  color: #fff; 
  transition: 0.2s;
  cursor: not-allowed;
  display: none;
}

#search { display: none; }

.ui-top-left button:hover { 
  background-color: rgba(255,255,255,0.3); 
}

/* Bottom-right UI */
.ui-bottom-right {
  bottom: 32px; 
  position: absolute; 
  right: 10px; 
  z-index: 1000; 
  display: flex; 
  gap: 8px;
}

.ui-bottom-right button {
  padding: 4px 8px; 
  font-size: 0.9em; 
  border: none; 
  border-radius: 4px;
  background-color: rgba(255,255,255,0.1); 
  color: #fff; 
  transition: 0.2s;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ui-bottom-right button:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

body.light .ui-bottom-right button {
  background-color: rgba(255,255,255,0.95) !important;
  color: #222 !important;
}

body.light .ui-bottom-right button:hover {
  background-color: #fff !important;
}

/* Active Follow Me button stays blue in both themes */
#follow-me.active {
  background-color: #4285F4 !important;
  color: #fff !important;
  font-weight: bold !important;
  box-shadow: 0 0 20px rgba(66, 133, 244, 0.9) !important;
}

/* Footer */
.ui-footer {
  position: absolute; 
  bottom: 10px; 
  left: 50%; 
  transform: translateX(-50%);
  color: #fff; 
  background-color: rgba(50,50,50,0.9);
  padding: 6px 12px; 
  border-radius: 6px; 
  font-size: 0.8em; 
  z-index: 1000;
}

body.light .ui-footer {
  background-color: rgba(255,255,255,0.95) !important;
  color: #222 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

.ui-footer a { 
  color: #fff; 
  text-decoration: underline; 
}

body.light .ui-footer a { 
  color: #222; 
  text-decoration: underline; 
}

body.light .ui-footer {
  color: #222 !important;
}

/* Marker & lights */
.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 6px 4px;
  margin: 6px 0 0 0;
}

.tag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 1em;
  text-transform: capitalize;
  white-space: nowrap;
  flex: 0 1 calc(33% - 8px);
  box-sizing: border-box;
  line-height: 1.2em;
  text-align: center;
  margin-bottom: 5px;
}

.tag.inflatables { background-color: #FF6F61; color: #fff; }
.tag.lights      { background-color: #FFD700; color: #000; }
.tag.music       { background-color: #4FC3F7; color: #000; }

body.light .tag {
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.marker-container { 
  position: relative; 
  width: 68px; 
  height: 41px; 
  cursor: pointer; 
  pointer-events: auto; 
}

.marker-container img { 
  width: 100%; 
  height: 100%; 
  display: block; 
  pointer-events: none; 
}

.marker-light {
  position: absolute; 
  width: 18px; 
  height: 18px; 
  border-radius: 50%;
  transform: translate(-50%,-50%); 
  pointer-events: none; 
  opacity: 0.35;
  will-change: opacity, transform;
}

/* Zoom controls */
.leaflet-bottom.leaflet-right .leaflet-control-zoom { 
  bottom: 42px; 
}

body.light .leaflet-control-zoom a {
  background: rgba(255,255,255,0.95) !important;
  color: #222 !important;
  border: 1px solid rgba(0,0,0,0.2) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

body.light .leaflet-control-zoom a:hover {
  background: #fff !important;
}

.leaflet-attribution-flag {
  display: none !important;
}

.leaflet-control-attribution {
  font-size: 1em;
  color: rgba(255, 255, 255, 0.5);
  background: none !important;
  padding: 2px 4px;
  border-radius: 4px;
  pointer-events: none;
  text-decoration: none;
  cursor: default;
}

.leaflet-control-attribution.leaflet-control a {
  color: rgba(255, 255, 255, 0.5) !important;
}

body.light .leaflet-control-attribution {
  color: #222 !important;
}

body.light .leaflet-control-attribution.leaflet-control a {
  color: #222 !important;
}

/* Popups */
.leaflet-popup-content-wrapper { 
  background: rgba(50,50,50,0.95) !important; 
  color: #fff; 
  border: none; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.5); 
  max-width: 350px; 
  min-width: 200px; 
}

body.light .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.98) !important;
  color: #222 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

.leaflet-popup-tip { 
  background: rgba(50,50,50,0.95) !important; 
}

body.light .leaflet-popup-tip {
  background: rgba(255,255,255,0.98) !important;
}

.leaflet-popup-content { 
  margin: 0; 
  color: #fff; 
  font-size: 0.9em; 
  width: 100%; 
  white-space: normal; 
}

body.light .leaflet-popup-content {
  color: #222 !important;
}

.popup-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  background-color: transparent;
  color: #fff;
  padding: 14px;
  border-radius: 6px;
  font-size: 1.1em;
  width: 100%;
  box-sizing: border-box;
}

body.light .popup-label {
  color: #222 !important;
}

.popup-label strong {
  font-size: 1.2em;
}

.popup-label small {
  color: #ddd;
  display: block;
  margin: 0;
  font-size: 1em;
}

body.light .popup-label small {
  color: #555 !important;
}

.popup-label .tags {
  margin-top: 6px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .leaflet-bottom.leaflet-right .leaflet-control-zoom { bottom: 125px; }
  .top-banner { padding-left: 8px; padding-right: 8px; }
  .top-banner-left { font-size: 0.9em; gap: 5px; }
  .top-banner-left h1 { display: none; }
  .top-banner-left .logo { height: 52px; width: auto; }
  .top-banner-left button { margin-left: 8px; padding: 3px 6px; font-size: 0.8em; display: none; }
  .theme-switch { margin-right: 5px; }
  /* .ui-top-left { font-size: 1.2em; gap: 6px; } */
  /* .ui-top-left button { margin-left: 8px; padding: 3px 6px; font-size: 0.8em; display: none; } */
  .ui-bottom-right { bottom: 35px; flex-direction: column; gap: 12px; }
  /* #find-me { display: block; } */
  .ui-footer {
    bottom: 10px;
    left: 10px;
    transform: none;
    font-size: 0.7em;
    padding: 4px 8px;
    text-align: left;
    width: min-content;
    min-width: 210px;
  }
  /* #search { display: none; } */
}

/* Desktop */
@media (min-width: 769px) {
  #find-me { display: none; }
  #follow-me { display: none; }
}

/* Pulse animation */
@keyframes subtlePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}