/* Full-screen map */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #e5e5e5;
}

/* ── Kill native-web tap flash on ALL elements (makes app feel truly native) ── */
*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
button, a, [role="button"] {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

#map {
  height: 100%;
  width: 100%;
  position: fixed;
  /* so the icon is positioned inside the map */
  inset: 0;
}

/* ── Unified fade-in for all UI elements — all appear at the same time ───── */
@keyframes ui-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#loc-btn,
#info-btn,
.layer-switcher-btn,
.map-search {
  animation: ui-fade-in 0.25s ease forwards;
}

/* ── Bottom Map Buttons (GPS & Layers) ──────────────────────────────────── */

.map-btn,
.layer-switcher-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  z-index: 1000;
  background: rgba(28, 30, 33, 0.92);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 48px;
  height: 48px;
  box-sizing: border-box;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: all 0.15s ease;
  user-select: none;
  display: flex !important;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* Ensure it's never pulled up by inherited top values */
  top: auto !important;
}

.map-btn:hover,
.layer-switcher-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.map-btn:active,
.layer-switcher-btn:active {
  transform: scale(0.95);
}

.map-btn {
  left: 12px;
}

.layer-switcher-btn {
  right: 12px;
}

.map-btn.gps-active {
  color: #0b84ff;
}

.layer-switcher-panel {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 142px);
  right: 12px;
  z-index: 1001;
  min-width: 160px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, rgba(20, 22, 25, 0.98), rgba(40, 42, 45, 0.95));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  padding: 8px 0;
  overflow: hidden;
  top: auto !important;
}

@media (max-width: 768px) {
  .map-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    left: 8px;
  }

  .layer-switcher-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    right: 8px;
  }

  .layer-switcher-panel {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 134px);
    right: 8px;
  }
}

.layer-switcher-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 6px 14px 8px;
}

.layer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.layer-option:hover {
  background: rgba(255, 255, 255, 0.07);
}

.layer-option:active {
  background: rgba(11, 132, 255, 0.18);
}

.layer-option input[type=radio] {
  accent-color: #0b84ff;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Hide Leaflet's built-in layer control since we replaced it */
.leaflet-control-layers {
  display: none !important;
}

/* ────────────────────────────────────────────────────────────────────────── */

/* ── Popups: size to content, no forced min-width ───────────────────────── */
.leaflet-popup-content-wrapper {
  width: auto !important;
  min-width: 0 !important;
  white-space: nowrap;
}

.leaflet-popup-content {
  width: auto !important;
  min-width: 0 !important;
  margin: 10px 14px !important;
  white-space: nowrap;
}

/* ────────────────────────────────────────────────────────────────────────── */

/* SEO content — source for the web modal info section */
.seo-content {
  display: none; /* Hidden by default, shown as modal on web */
  position: fixed;
  inset: 0;
  z-index: 200000;
  background: rgba(13, 15, 17, 0.95);
  backdrop-filter: blur(20px);
  color: rgba(255, 255, 255, 0.9);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* When the modal is active on web */
body.about-open .seo-content {
  display: block;
  animation: modal-fade-in 0.3s ease-out;
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.about-content-inner {
  max-width: 800px;
  margin: 60px auto;
  padding: 40px 24px;
}

.about-close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  z-index: 200001;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.about-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.seo-content h1 {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 40px;
  text-align: center;
}

.about-lang-section {
  margin-bottom: 48px;
  padding: 32px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: justify; /* Properly aligned text */
}

.about-lang-section[lang="ckb"] {
  text-align: justify;
  direction: rtl;
}

.about-lang-section[lang="en"] {
  text-align: justify;
  direction: ltr;
}

.seo-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0b84ff;
  margin: 32px 0 12px;
  text-align: start; /* Align header to the beginning of the text */
}

.seo-content p {
  margin: 0 0 16px;
  font-size: 16px;
  opacity: 0.85;
}

.seo-content footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
  .about-content-inner {
    margin: 40px auto;
    padding: 30px 16px;
  }
  
  .about-lang-section {
    padding: 20px;
  }
}

/* Ensure mobile native app doesn't see this modal structure by default */
.is-native .seo-content {
  display: none !important;
}



.app-suspended *,
.app-suspended *::before,
.app-suspended *::after {
  animation-play-state: paused !important;
}

.map-search {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, calc(100% - 28px));
  z-index: 100000;
}

.map-top-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, rgba(20, 22, 25, 0.98), rgba(40, 42, 45, 0.95));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 100001;
}

.map-tel-btn {
  right: 64px; /* info button 44px + 12px position + 8px gap => 64px */
  width: auto;
  padding: 0 14px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

body.is-native .map-tel-btn {
  display: none !important;
}

.map-play-btn {
  left: 12px;
  right: auto; /* Prevents stretching from inherited right: 12px (no !important so mobile can override) */
  width: auto;
  padding: 0 14px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

body.is-native .map-play-btn {
  display: none !important;
}

.map-top-btn:active {
  transform: scale(0.96);
}

.map-top-btn-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.map-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 100002;
}

.map-panel {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  right: 12px;
  width: min(360px, calc(100% - 24px));
  z-index: 100003;
}

.map-panel-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, rgba(20, 22, 25, 0.98), rgba(40, 42, 45, 0.95));
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
  overflow: hidden;
  /* Promote to a dedicated compositor layer for buttery smooth performance */
  will-change: transform, opacity;
  transform: translateZ(0);
}

.map-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.map-panel-title {
  font-size: 15px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
}

.map-panel-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.map-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.map-panel-section {
  padding: 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.map-panel-section+.map-panel-section {
  margin-top: 10px;
}

.map-panel-section-title {
  font-size: 13px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 6px;
}

.map-panel-text {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

.map-panel-action {
  width: 100%;
  margin-top: 10px;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(11, 132, 255, 0.55);
  background: rgba(11, 132, 255, 0.18);
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.map-panel-action:active {
  transform: scale(0.98);
}

.map-panel-hint {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
}

/* ── Settings & Info Hub (Native Only) ── */
.info-hub-card {
  max-height: 85vh; /* give it nice room but not strictly 100% */
}

.info-hub-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  overflow-y: scroll; /* Force a scroll layer for better momentum on Android */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  /* Disable smooth scroll on mobile to prioritize native momentum performance */
  scroll-behavior: auto;
}

.info-hub-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.app-brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-brand-logo-wrap {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

.app-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.5);
  transform-origin: center;
}

.app-brand-name {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.3px;
}

.app-brand-tagline {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.2;
}

.info-hub-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-hub-section-title svg {
  color: #0b84ff;
}

.community-blurb {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.35;
  margin-top: 6px;
}


.info-hub-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  margin-top: 10px;
  transition: background 0.2s, transform 0.15s;
  box-sizing: border-box;
}

.info-hub-action-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.08);
}

.telegram-btn {
  background: rgba(42, 171, 238, 0.1);
  border-color: rgba(42, 171, 238, 0.25);
}
.playstore-btn {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.25);
}
.offline-layers {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Download Cards */
.offline-layer-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 10px;
}
.offline-layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 14px 10px;
}
.offline-layer-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.offline-layer-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}
.offline-layer-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  min-height: 16px;
}
.offline-layer-controls {
  display: flex;
  gap: 8px;
}
.offline-layer-action {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(11, 132, 255, 0.15);
  color: #0b84ff;
}
.offline-layer-action:active {
  opacity: 0.6;
}
.offline-layer-action:disabled {
  opacity: 0.2;
  pointer-events: none;
}
.action-stop {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
}
.offline-layer-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.04);
  width: 100%;
}
.offline-layer-progress-fill {
  height: 100%;
  width: 0%;
  background: #0b84ff;
}

.map-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px; /* Increased to fix descender clipping */
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(34, 36, 42, 0.96);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.map-search-input-wrap:focus-within {
  border-color: rgba(11, 132, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(11, 132, 255, 0.14);
}

.map-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 17px;
  font-weight: 500;
  line-height: normal;
  text-align: center;
  word-spacing: 0px;
  height: auto;
  box-sizing: border-box;
  padding: 4px 0 8px 0; /* Huge bottom padding to guarantee lower tails aren't sliced */
}

.map-search-input::-webkit-search-cancel-button,
.map-search-input::-webkit-search-decoration,
.map-search-input::-webkit-search-results-button,
.map-search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.map-search-input::-ms-clear,
.map-search-input::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

.map-search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  word-spacing: 0px;
}

.map-search-icon {
  flex-shrink: 0;
  pointer-events: none;
  display: block;
}

::selection{
  color: white;
  background-color: rgb(189, 62, 189);
}

.map-search-clear {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.65);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.map-search-clear:hover {
  background: rgba(255, 255, 255, 0.18);
}

.map-search-clear:active {
  transform: scale(0.9);
}

/* Suggestions float below — absolutely positioned so they NEVER inflate the search bar */
.map-search-suggestions {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(34, 36, 42, 0.97);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  max-height: 260px;
  overflow-y: auto;
}

.map-search-suggestion {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  text-align: left;
}

.map-search-suggestion:hover,
.map-search-suggestion.is-active {
  background: rgba(11, 132, 255, 0.16);
}

.map-search-suggestion:active {
  background: rgba(11, 132, 255, 0.22);
}

.map-search-suggestion-name {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-search-suggestion-type {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 768px) {
  .map-search {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    right: 64px;
    transform: none;
    width: auto;
  }

  .map-search-input-wrap {
    height: 45px; /* Bumped from 40px to securely hold the 'ڕ' tail on mobile */
    padding: 0 14px;
  }

  .map-search-input {
    font-size: 16px; /* keeps iOS from zooming on focus */
  }

  .map-top-btn {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 16px;
  }

  .map-panel {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 10px;
    width: min(360px, calc(100% - 20px));
  }

  .map-search-suggestion {
    padding: 14px 14px;
  }

  .map-search-suggestion-name {
    font-size: 15px;
  }
}

/* ── Tablet & phone (≤1200px): icon-only buttons stacked on the right ── */
/* Covers: all phones, all iPads (portrait+landscape), iPad Pro up to 1194px.
   Laptops and desktop (>1200px) get the full labelled buttons. */
@media (max-width: 1200px) {
  .map-top-btn {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: 12px;
    width: 44px;
    height: 44px;
  }

  /* Contact: icon-only, stacked below Info */
  .map-contact-btn {
    top: calc(env(safe-area-inset-top, 0px) + 64px); /* 12 + 44 + 8 */
    right: 12px;
    left: auto;
    width: 44px !important;
    height: 44px;
    padding: 0 !important;
  }

  .map-contact-btn span {
    display: none !important;
  }

  /* Download: icon-only, stacked below Contact */
  .map-play-btn {
    top: calc(env(safe-area-inset-top, 0px) + 116px); /* 64 + 44 + 8 */
    left: auto;
    right: 12px;
    width: 44px !important;
    height: 44px;
    padding: 0 !important;
  }

  .map-play-btn span {
    display: none !important;
  }
}

/* Popup buttons */
.popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.popup-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(145deg, #0a0a0a, #1a1a1a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.popup-buttons button:hover {
  transform: translateY(-1px);
  border-color: rgba(11, 132, 255, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(11, 132, 255, 0.25);
}

.popup-buttons button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}

.leaflet-popup-content-wrapper {
  background: linear-gradient(145deg, rgba(20, 22, 25, 0.98), rgba(40, 42, 45, 0.95)) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(18px) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 6px 12px !important;
  min-width: 180px;
  max-width: 280px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (max-width: 768px) {
  .leaflet-popup-content {
    min-width: 200px;
    max-width: 320px;
    margin: 6px 10px !important;
  }

  .popup-buttons {
    gap: 6px;
    margin-top: 6px;
  }

  .popup-buttons button {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 16px;
    border-radius: 14px;
  }
}

.leaflet-popup-content br {
  display: none;
}

.leaflet-popup-content strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-bottom: 2px;
  text-align: center;
  /* Equal padding on both sides so text is visually centered under the × button */
  padding: 0 32px;
}

/* Custom popup close button — subtle, only noticeable on hover */
.popup-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.20);
  color: rgba(255, 255, 255, 0.75);
}

.popup-close-btn:active {
  transform: scale(0.90);
}

/* Make wrapper relative so close btn positions correctly */
.leaflet-popup-content-wrapper {
  position: relative !important;
}

.leaflet-popup-tip {
  background: rgba(20, 22, 25, 0.98) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35) !important;
}

/* Hide the popup close (X) button */
.leaflet-popup-close-button {
  display: none !important;
}

.route-arrow {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}

.route-arrow>div {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: rgba(20, 22, 25, 0.88);
  border: 1px solid rgba(11, 132, 255, 0.55);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
}

.route-arrow svg {
  width: 16px;
  height: 16px;
}

.route-chevron {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}

.route-chevron .route-chevron-glyph {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  opacity: 0.9;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  transform-origin: 50% 50%;
  will-change: transform;
}

/* ── Stable markers during zoom ──────────────────────────────────────────────
   markerZoomAnimation: false = no jumping. Markers stay visible throughout
   the zoom transition at their pre-zoom positions (~300ms). This is far less
   noticeable than making them disappear and reappear. */

/* ─────────────────────────────────────────────────────────────────────────── */

.station-marker {
  background: transparent !important;
  border: none !important;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

.station-marker-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

.station-marker-bus {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(0, 0, 0, 0.62);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 0 0 6px rgba(255, 255, 255, 0.10);
}

.station-marker-bus svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: rgba(11, 132, 255, 0.9);
}

.station-marker--no-route .station-marker-bus {
  background: rgba(232, 10, 10, 0.78);
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 0 6px rgba(255, 255, 255, 0.06);
}

.station-marker--no-route .station-marker-bus svg {
  fill: rgba(255, 255, 255, 0.92);
}

.station-marker-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(0, 0, 0, 0.62);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 0 0 6px rgba(255, 255, 255, 0.10);
  position: relative;
}

.station-marker-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: rgba(11, 132, 255, 0.35);
}

.station-marker-dot.station-marker-dot--no-route {
  background: rgba(232, 10, 10, 0.78);
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 0 6px rgba(255, 255, 255, 0.06);
}

.station-marker-dot.station-marker-dot--no-route::after {
  background: rgba(120, 126, 138, 0.42);
}

.live-loc-icon {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}

.route-destination {
  background: transparent !important;
  border: none !important;
}

.route-destination .route-destination-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0b84ff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22), 0 10px 22px rgba(0, 0, 0, 0.5);
}

.route-destination .route-destination-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid rgba(11, 132, 255, 0.55);
  animation: routePulse 1.8s ease-in-out infinite;
}

@keyframes routePulse {
  0% {
    transform: scale(0.95);
    opacity: 0.35;
  }

  50% {
    transform: scale(1.25);
    opacity: 0.2;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.area-label {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
  /* Don't block clicks */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform, opacity;
  z-index: 800 !important;
  /* Above station icons (700) */
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.area-label-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Station name labels — BELOW popups so they never cover an open popup */
.leaflet-tooltip-pane {
  z-index: 650 !important;
}

/* Popup pane — above tooltips so open popups are always on top */
.leaflet-popup-pane {
  z-index: 850 !important;
}

/* Optimize area polygon rendering during pan/zoom */
.leaflet-overlay-pane svg,
.leaflet-overlay-pane canvas {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* Ensure smooth rendering of area polygons */
.area-polygon {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.label-text {
  font-size: 15px !important;
  font-weight: bold !important;
  color: #ffffff !important;
  white-space: nowrap;
  text-align: center;
  text-shadow: 1px 1px 3px #000000, 0 0 5px #000000;
  /* Better readability */
  pointer-events: none !important;
  /* Don't block clicks */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

@media (max-width: 768px) {
  .label-text {
    font-size: 13px !important;
  }
}

/* Marker cluster styles for optimized label grouping */
.area-cluster {
  background: rgba(11, 132, 255, 0.75) !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  border-radius: 50% !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.2s ease !important;
}

.area-cluster:hover {
  transform: scale(1.1) !important;
}

.cluster-inner {
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7) !important;
}

.station-name-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  padding: 0 !important;
  margin-top: 2px;
  pointer-events: none !important;
}

.station-name-label.leaflet-tooltip::before {
  display: none !important;
}

@media (max-width: 768px) {
  .station-name-label {
    font-size: 13px !important;
  }
}

/* Simple Layer Control */
/* =====================
   LAYER CONTROL — pure CSS :hover, zero flicker
   The toggle button is always visible.
   The list fades in via opacity/max-height — no display:none, no JS, no reflow.
   ===================== */

.leaflet-control-layers {
  margin-bottom: 80px !important;
  border-radius: 14px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  /* Needed so :hover works over the whole container including the expanding list */
  overflow: visible !important;
}

/* The toggle button — solid black, white icon only, like GPS button */
.leaflet-control-layers-toggle {
  width: 44px !important;
  height: 44px !important;
  background: #0d0d0d !important;
  background-image: none !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7) !important;
  cursor: pointer !important;
  position: relative !important;
  display: block !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  background-size: 0 !important;
  background-repeat: no-repeat !important;
  outline: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

/* Map layers icon */
.leaflet-control-layers-toggle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.92)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6"/><line x1="8" y1="2" x2="8" y2="18"/><line x1="16" y1="6" x2="16" y2="22"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Hover state on toggle button alone */
.leaflet-control-layers-toggle:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65) !important;
  border-color: rgba(11, 132, 255, 0.45) !important;
}



/* The panel — hidden by default, shown on :hover via smooth transition */
.leaflet-control-layers-list {
  position: absolute !important;
  bottom: 100% !important;
  /* sit flush against button — no gap */
  padding-bottom: 12px !important;
  /* invisible bridge so mouse doesn't leave the hover zone */
  right: 0 !important;
  min-width: 190px !important;
  max-width: 230px !important;
  background: linear-gradient(145deg, rgba(20, 22, 25, 0.98), rgba(40, 42, 45, 0.95)) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  border-radius: 14px !important;
  padding: 8px !important;
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Hidden state */
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transform: translateY(6px) scale(0.97);
  transform-origin: bottom right;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    max-height 0.25s ease;
}

/* LAYER PANEL: toggle via .list-hidden class on the list element.
   Leaflet never modifies the list element's own classes, so this is reliable. */
.leaflet-control-layers-list.list-hidden {
  display: none !important;
}


/* Collapsed state override — just ensure button shows */
.leaflet-control-layers.leaflet-control-layers-collapsed {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* Expanded state — Leaflet adds this class, keep it minimal */
.leaflet-control-layers.leaflet-control-layers-expanded {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.leaflet-control-layers label {
  display: flex !important;
  align-items: center !important;
  padding: 10px 8px !important;
  margin: 4px 0 !important;
  border-radius: 10px !important;
  transition: background 0.15s ease, border-color 0.15s ease !important;
  cursor: pointer !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.leaflet-control-layers label:hover {
  background: rgba(11, 132, 255, 0.18) !important;
  color: #ffffff !important;
  border-color: rgba(11, 132, 255, 0.35) !important;
}

.leaflet-control-layers-base label:has(input:checked) {
  background: linear-gradient(135deg, rgba(11, 132, 255, 0.28), rgba(11, 132, 255, 0.18)) !important;
  color: #ffffff !important;
  border-color: rgba(11, 132, 255, 0.5) !important;
  font-weight: 600 !important;
}

.leaflet-control-layers input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  margin-right: 10px !important;
  cursor: pointer !important;
  accent-color: #0b84ff !important;
  flex-shrink: 0 !important;
}

.leaflet-control-layers-base {
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.leaflet-control-layers label span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaflet-control-layers-separator {
  display: none !important;
}

.leaflet-control-layers-list::-webkit-scrollbar {
  width: 6px;
}

.leaflet-control-layers-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.leaflet-control-layers-list::-webkit-scrollbar-thumb {
  background: rgba(11, 132, 255, 0.5);
  border-radius: 999px;
}

.leaflet-control-layers-list::-webkit-scrollbar-thumb:hover {
  background: rgba(11, 132, 255, 0.75);
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  background: rgba(20, 22, 25, 0.9) !important;
  backdrop-filter: blur(16px) !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45) !important;
}

.leaflet-control-zoom a {
  width: 46px !important;
  height: 46px !important;
  line-height: 46px !important;
  color: rgba(255, 255, 255, 0.92) !important;
  background: transparent !important;
  border: none !important;
  transition: background 0.2s ease, transform 0.15s ease;
}

.leaflet-control-zoom a:hover {
  background: rgba(11, 132, 255, 0.18) !important;
}

.leaflet-control-zoom a:active {
  transform: scale(0.98);
}

.leaflet-control-zoom a.leaflet-disabled {
  opacity: 0.35;
}

.leaflet-control-attribution {
  background: rgba(20, 22, 25, 0.8) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  border-radius: 10px !important;
  padding: 6px 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(14px) !important;
}

.leaflet-control-attribution a {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* GPS Settings Popup */
.gps-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  background: rgba(20, 22, 25, 0.98);
  border: 2px solid #0b84ff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  max-width: 400px;
  width: 90%;
  animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.gps-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99998;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.gps-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.gps-popup-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #0b84ff, #0066cc);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s ease-in-out infinite;
}

.gps-popup-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.gps-popup-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.gps-popup-content {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 24px;
  text-align: center;
}

.gps-popup-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.gps-popup-button {
  padding: 14px 48px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.gps-popup-button.primary {
  background: #0b84ff;
  color: white;
}

.gps-popup-button.primary:hover {
  background: #0066cc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(11, 132, 255, 0.4);
}

.gps-popup-button.primary:active {
  transform: scale(0.98);
}

/* Bigger icon placed inside the map at bottom-right */
#map-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 1000;
  /* above Leaflet layers/controls */
  width: 64px;
  /* increased size */
  height: 64px;
  /* increased size */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
}

/* Ensure the inline SVG scales to the container */
#map-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Hover/focus styles */
#map-icon:hover,
#map-icon:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

/* ensure map can position children */
#map {
  position: fixed;
  inset: 0;
}

/* placeholder pinned inside the map (bottom-right) */
#map-icon-placeholder {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 1000;
  display: inline-block;
  background: linear-gradient(145deg, #0a0a0a, #1a1a1a);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;

  /* added for smooth hover transition */
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
}

/* hover / focus: change to "fdark" (dark) and lift */
#map-icon-placeholder:hover,
#map-icon-placeholder:focus {
  background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(11, 132, 255, 0.25);
}

/* ensure icon image adapts on dark background; remove if you prefer original colors */
#map-icon-placeholder:hover #map-icon-img,
#map-icon-placeholder:focus #map-icon-img {
  filter: brightness(0) invert(1);
}

/* image sizing */
#map-icon-img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

/* Map control button (inside map) */
.map-btn {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 9999;
  /* well above Leaflet controls */
  background: rgba(28, 30, 33, 0.92);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: all .15s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.map-btn:active {
  transform: scale(0.95);
}

/* GPS button active state */
.map-btn.gps-active {
  background: #0b84ff;
  color: #fff;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 6px 18px rgba(11, 132, 255, 0.4);
  }

  50% {
    box-shadow: 0 6px 24px rgba(11, 132, 255, 0.8);
  }
}

.map-btn svg {
  display: block;
}

/* ensure the button accepts touch and clicks reliably on mobile */
.map-btn {
  pointer-events: auto;
  touch-action: manipulation;
  /* allow tap gestures */
  -webkit-tap-highlight-color: transparent;
}

/* make sure located info can be seen/clicked if needed */
#loc-info {
  pointer-events: none;
  /* keep non-interactive so taps go to the button */
}

/* Make sure the locate info box is visible above everything */
#loc-info {
  z-index: 9998;
}

/* If your placeholder/icon overlaps, ensure it sits above controls if needed */
#map-icon-placeholder,
#map-icon {
  z-index: 9997;
}

/* Mobile tweak: smaller padding on narrow screens */
@media (max-width: 420px) {
  .map-btn {
    padding: 6px 8px;
    font-size: 13px;
    left: 8px;
    bottom: 8px;
  }

  #loc-info {
    left: 8px;
    bottom: 48px;
    font-size: 11px;
  }
}

/* ensure the map fills the viewport and can position children */
#map {
  position: fixed;
  /* needed so absolute children sit inside the map */
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 400px;
  /* fallback */
}

/* Make sure Leaflet controls are visible but below our custom buttons */
.leaflet-control {
  z-index: 1000;
}

/* Ensure page and map fill the viewport and remove default margins */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0b0d10;
  color: rgba(255, 255, 255, 0.92);
  overscroll-behavior: none;
  overflow: hidden;
}

/* Make the map cover the entire viewport (fixed so no scrolling issues) */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Ensure Leaflet controls stay below our custom buttons */
.leaflet-control {
  z-index: 1000;
}

/* Removed shimmer animation for cleaner look */

/* Move custom in-map buttons up so they don't overlap bottom controls */
.map-btn {
  left: 12px;
  bottom: 88px;
  /* raised */
  z-index: 99999;
  /* very high so it's always on top */
}

/* Push the locate info box further up above the button */
#loc-info {
  left: 12px;
  bottom: 138px;
  /* above the button */
  z-index: 99998;
}

/* Move placeholder/icon up to align with the button area */
#map-icon-placeholder,
#map-icon {
  right: 12px;
  bottom: 88px;
  /* raised to match .map-btn */
  z-index: 99997;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .map-btn {
    padding: 10px;
    left: 8px;
    bottom: 78px;
  }

  #loc-info {
    left: 8px;
    bottom: 118px;
    font-size: 11px;
  }

  #map-icon-placeholder,
  #map-icon {
    right: 8px;
    bottom: 78px;
  }

  .leaflet-control-layers.leaflet-control-layers-collapsed {
    width: 46px !important;
    height: 46px !important;
  }

  .leaflet-control-layers.leaflet-control-layers-expanded {
    min-width: 160px !important;
  }

  .leaflet-control-layers-toggle::before {
    width: 22px;
    height: 22px;
  }
}



#shko-easter-egg {
  position: fixed;
  inset: 0;
  z-index: 100000;
}

.shko-egg-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  backdrop-filter: none;
}

.shko-egg-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.shko-egg-cat-wrap {
  width: auto;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.shko-egg-cat {
  width: min(320px, 82vw);
  height: auto;
  transform-origin: 50% 50%;
  animation: none;
  image-rendering: auto;
}

.shko-egg-fallback {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
  text-transform: lowercase;
  animation: none;
}

/* ── Contact Button & Modal ────────────────────────────────────────────── */

.map-contact-btn {
  right: 64px;
  width: auto;
  padding: 0 16px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

body.is-native .map-contact-btn {
  display: none !important;
}

/* Tablet & phone (≤1200px): icon-only stacking — defined again here (after the
   base rule) so the cascade wins. Covers all iPads incl. landscape.
   Laptops/desktop (>1200px) get the full labelled button. */
@media (max-width: 1200px) {
  .map-contact-btn {
    top: calc(env(safe-area-inset-top, 0px) + 64px);
    right: 12px;
    left: auto;
    width: 44px !important;
    height: 44px;
    padding: 0 !important;
  }

  .map-contact-btn span {
    display: none !important;
  }
}

.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 200002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-fade-in 0.3s ease-out;
}

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.contact-modal-content {
  position: relative;
  width: min(440px, 100%);
  background: linear-gradient(145deg, rgba(28, 30, 34, 0.98), rgba(40, 42, 46, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateZ(0);
}

.contact-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.contact-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(90deg);
}

.contact-modal-inner {
  padding: 40px 32px;
}

.contact-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.contact-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  background: #fff;
}

.contact-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.contact-context {
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  margin-bottom: 20px;
}

.contact-context[lang="ckb"] {
  font-size: 15.5px;
  font-weight: 500;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.contact-link:active {
  transform: scale(0.98);
}

.contact-link svg {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
}

.contact-link:hover svg {
  color: #0b84ff;
}

.email-link:hover svg { color: #0b84ff; }
.telegram-link:hover svg { color: #2AABEE; }

.link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-label {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

@media (max-width: 480px) {
  .contact-modal-inner {
    padding: 32px 20px;
  }
  
  .contact-link {
    padding: 14px 16px;
  }
  
  .link-label {
    font-size: 15px;
  }
}