html,
body {
  height: 100%;
  margin: 0;
}

body {
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: min(12vh, 140px);
  z-index: 1000;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(246, 211, 0, 0.9), transparent);
}

#map {
  height: 100%;
  width: 100%;
}

.landing-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.landing-overlay-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.landing-hidden {
  display: none;
}

.desktop-redirect-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: #ffffff;
}

.desktop-redirect-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}


/* Top banner */
.banner {
  position: fixed;
  top: 9%;
  left: 12px;
  right: 12px;  
  z-index: 2000;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.2;
}

#bannerText {
  flex: 1;
}

.banner-hidden {
  display: none;
}

.banner-notice {
  background: rgba(255, 249, 232, 0.98);
  border: 1px solid rgba(190, 145, 0, 0.35);
}

.banner-btn-hidden {
  display: none;
}


/* Bottom sheet layers panel */
.layers {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;

  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.16);

  transform: translateY(0);
  transition: transform 180ms ease, opacity 180ms ease;
}

.layers-hidden {
  display: block; /* keep in flow so we can animate */
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

.layers-header {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  gap: 6px;
  padding: 2px 0 10px;
}

.layers-handle {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.layers-title {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.82);
}

.layers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* Tile style buttons like Google Maps */
.layer-tile {
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 12px 12px;
  cursor: pointer;

  display: grid;
  gap: 6px;
  align-content: start;

  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.layer-tile:active {
  transform: scale(0.99);
}

.layer-tile-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.86);
}

.layer-tile-subtitle {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.62);
}

/* Optional "selected" state you can toggle from JS */
.layer-tile.is-active {
  border-color: rgba(0, 120, 255, 0.45);
  box-shadow: 0 8px 22px rgba(0, 120, 255, 0.18);
}


.banner-btn {
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}

.banner-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.banner-btn-secondary {
  opacity: 0.8;
}

/* Map controls */
.map-controls {
  position: absolute;
  z-index: 1500;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.map-controls-top-left {
  position: absolute;
  z-index: 1500;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.map-controls-left {
  position: absolute;
  z-index: 1500;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.control-btn {
  pointer-events: auto;
  border: 2px solid var(--tg-accent-black, #000000);
  background: var(--tg-accent-yellow, #f6d300);
  color: var(--tg-accent-black, #000000);
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.control-btn:hover {
  background: var(--tg-accent-yellow-hover, #f6d300);
}

.control-btn.is-tracking {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.14),
    inset 0 0 0 2px rgba(10, 132, 255, 0.22);
}

.control-btn.is-tracking:hover {
  background: var(--tg-accent-yellow-hover, #f6d300);
}

.control-btn.is-tracking .control-btn-icon {
  filter: brightness(0) saturate(100%) invert(36%) sepia(91%) saturate(2555%) hue-rotate(197deg)
    brightness(102%) contrast(102%);
}

.control-btn-icon {
  width: 37px;
  height: 37px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.control-btn-icon-info {
  width: 43px;
  height: 43px;
}

.control-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.language-menu {
  position: absolute;
  z-index: 2200;
  top: 62px;
  left: 12px;
  min-width: 210px;
  max-width: calc(100vw - 24px);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.language-menu-hidden {
  display: none;
}

.language-menu-title {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.78);
  margin: 0 0 8px;
}

.language-options {
  display: grid;
  gap: 6px;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  text-align: left;
}

.language-option:hover {
  background: rgba(0, 0, 0, 0.04);
}

.language-option.is-active {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.language-option-flag {
  font-size: 18px;
  line-height: 1;
  width: 24px;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.language-btn-flag {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.language-flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Too far banner */
.distance-banner {
  position: absolute;
  z-index: 1500;
  right: 12px;
  bottom: 2%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
}

/* POI marker (emoji) */
.poi-icon {
  background: transparent;
  border: none;
}

.poi-marker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -100%);
  user-select: none;
  pointer-events: auto;
  isolation: isolate;
}

.poi-visual-frame {
  position: relative;
  z-index: 2;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--poi-frame-background, #f6d300);
  border: 2px solid var(--poi-frame-border-color, rgba(0, 0, 0, 0.92));
  border-radius: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.poi-marker.is-nearest-active .poi-visual-frame {
  box-shadow:
    0 0 0 0 rgba(242, 201, 76, 0.7),
    0 4px 10px rgba(0, 0, 0, 0.14);
}

.poi-marker.is-nearest-active .poi-visual-frame::after {
  content: "";
  position: absolute;
  inset: -9px;
  z-index: -1;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(255, 225, 72, 0.9) 0%, rgba(242, 201, 76, 0.55) 42%, rgba(242, 201, 76, 0) 76%);
  animation: poi-nearest-glow 1.15s ease-in-out infinite;
  pointer-events: none;
}

.poi-marker.is-nearest-active.dot-only .poi-visual-frame::after {
  inset: -11px;
  border-radius: 999px;
}

.poi-marker.is-nearest-active .poi-dot {
  box-shadow:
    0 0 0 0 rgba(255, 225, 72, 0.8),
    0 4px 10px rgba(0, 0, 0, 0.2);
}

.poi-emoji {
  font-size: 32px;
  line-height: 1;
}

.poi-image {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.poi-image-miner {
  width: 26px;
  height: 26px;
}

.poi-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--poi-dot-color, rgba(0, 120, 255, 0.95));
  border: 2px solid var(--poi-dot-outline-color, #fff);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.poi-marker.dot-only .poi-visual-frame {
  width: auto;
  height: auto;
  flex-basis: auto;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.poi-label {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  z-index: 2;
  height: 34px;
  margin-left: -2px;
  padding: 4px 10px;
  box-sizing: border-box;
  align-items: center;
  border-radius: 2px;
  background: var(--poi-label-background, rgba(18, 18, 18, 0.96));
  color: var(--poi-label-text-color, rgba(248, 248, 244, 0.98));
  border: 2px solid var(--poi-label-border-color, #000000);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  opacity: 1;
  transform: translateX(0);
  transform-origin: left center;
}

.poi-marker.show-label .poi-label {
  display: inline-flex;
}

.poi-marker.show-label.animate-label-reveal .poi-label {
  display: inline-flex;
  animation: var(--poi-label-reveal-animation-name, poi-label-reveal)
    var(--poi-label-reveal-duration, 360ms)
    var(--poi-label-reveal-easing, cubic-bezier(0.22, 1, 0.36, 1))
    both;
}

@keyframes poi-label-reveal {
  from {
    opacity: 0;
    transform: translateX(calc(-1 * var(--poi-label-reveal-distance, 12px)));
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes poi-nearest-glow {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.92);
  }

  50% {
    opacity: 1;
    transform: scale(1.28);
  }
}

/* Full screen overlay that sits on top of the map */
.poi-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.poi-overlay-hidden {
  display: none;
}

.poi-overlay-bar {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.10);
}

.poi-overlay-inline-controls .poi-overlay-bar {
  display: none;
}

.poi-overlay-close {
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
}

.poi-overlay-close:hover {
  background: rgba(0, 0, 0, 0.04);
}

.poi-overlay-frame {
  width: 100%;
  height: calc(100% - 56px);
  border: 0;
  opacity: 1;
  transition: opacity 120ms ease;
}

.poi-overlay-inline-controls .poi-overlay-frame {
  height: 100%;
}

.info-overlay-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.info-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.info-nav-btn {
  white-space: nowrap;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
}

.info-nav-btn.is-active {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.poi-overlay.is-loading .poi-overlay-frame {
  opacity: 0;
}

/* Complete button in overlay bar */
.poi-complete-btn {
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
}

.poi-complete-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.poi-complete-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
}

.poi-complete-btn.is-complete .poi-complete-box::after {
  content: "✓";
  font-size: 14px;
  line-height: 1;
}

.poi-complete-btn.is-complete #poiCompleteLabel {
  font-weight: 600;
}

/* Greyed out POI markers */
.poi-marker.is-completed {
  opacity: 0.35;
  filter: grayscale(1);
}

.poi-marker.is-completed .poi-label {
  opacity: 0.85;
}

.poi-marker.is-completed .poi-visual-frame {
  opacity: 0.85;
}

.poi-marker.is-completed .poi-dot {
  opacity: 0.7;
}

/* User heading marker */
.user-heading-icon {
  background: transparent;
  border: none;
}

.user-heading {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 120, 255, 0.95);
  border: 2px solid #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  position: relative;
}

/* Arrow "tip" */
.user-heading::after {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid rgba(0, 120, 255, 0.95);
  opacity: 0;
}

/* Only show arrow when we actually have a heading */
.user-heading.has-heading::after {
  opacity: 1;
}

/* Rotate the whole dot+arrow */
.user-heading.has-heading {
  transform: rotate(calc(var(--heading, 0) * 1deg));
  transform-origin: 50% 50%;
}



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

@media (max-width: 768px), (pointer: coarse) {
  .banner {
    top: 12px;
    left: 10px;
    right: 10px;
    padding: 14px;
    gap: 12px;
    font-size: 16px;
    border-radius: 14px;
  }

  .banner-btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 15px;
  }

  .map-controls {
    top: 10px;
    right: 10px;
    gap: 12px;
  }

  .map-controls-top-left {
    top: 10px;
    left: 10px;
  }

  .map-controls-left {
    left: 10px;
    bottom: 10px;
  }

  .control-btn {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 22px;
  }

  .control-btn-icon {
    width: 43px;
    height: 43px;
  }

  .control-btn-icon-info {
    width: 50px;
    height: 50px;
  }

  .language-menu {
    top: 70px;
    left: 10px;
    min-width: min(280px, calc(100vw - 20px));
    padding: 12px;
    border-radius: 14px;
  }

  .language-menu-title {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .language-option {
    min-height: 44px;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 15px;
  }

  .layers {
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
  }

  .layers-title {
    font-size: 18px;
  }

  .layers-grid {
    gap: 12px;
  }

  .layer-tile {
    min-height: 72px;
    padding: 14px;
    border-radius: 18px;
  }

  .layer-tile-title {
    font-size: 15px;
  }

  .layer-tile-subtitle {
    font-size: 13px;
  }

  .poi-emoji {
    font-size: 40px;
  }

  .poi-visual-frame {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .poi-image {
    width: 40px;
    height: 40px;
  }

  .poi-image-miner {
    width: 26px;
    height: 26px;
  }

  .poi-dot {
    width: 13px;
    height: 13px;
  }

  .poi-label {
    height: 34px;
    font-size: 13px;
    padding: 4px 10px;
  }

  .poi-overlay-bar {
    height: 64px;
    padding: 0 10px;
  }

  .poi-overlay-close,
  .poi-complete-btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 12px;
  }

  .info-nav-btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 15px;
  }

  .info-nav {
    gap: 10px;
  }

  .poi-complete-box {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .poi-overlay-frame {
    height: calc(100% - 64px);
  }
}

.route-flow-line {
  stroke-linecap: round;
  stroke-dashoffset: var(--route-dash-offset, 0);
}
