:root {
  color-scheme: light;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.18);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(246, 246, 248, 0.86);
  --accent: #4f6b61;
  --accent-dark: #344b43;
  --danger: #a33a42;
  --shadow-lg: 0 30px 90px rgba(24, 31, 28, 0.18), 0 2px 10px rgba(24, 31, 28, 0.06);
  --shadow-md: 0 16px 48px rgba(24, 31, 28, 0.13), 0 1px 4px rgba(24, 31, 28, 0.05);
  --shadow-sm: 0 8px 24px rgba(24, 31, 28, 0.10);
  --radius-xxl: 36px;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  font-family: "Segoe UI Variable", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--text); background: #aab4af; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(79, 107, 97, 0.24);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.map-app, .map-canvas { position: absolute; inset: 0; }
.map-canvas {
  background: #9ca7a2;
  transition: filter .26s ease, transform .26s ease;
  transform-origin: center;
}
.map-canvas.is-softened {
  filter: blur(7px) saturate(.84) brightness(1.06);
  transform: scale(1.018);
}
.leaflet-container { font-family: inherit; background: #9ca7a2; }
.leaflet-tile-pane { will-change: transform; }
.leaflet-tile { image-rendering: auto; backface-visibility: hidden; }
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: 16px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  width: 48px;
  height: 48px;
  line-height: 47px;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  background: rgba(255,255,255,.92) !important;
  color: #2a2a2c !important;
  font-size: 24px;
}
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }
.leaflet-control-zoom a:hover { background: white !important; }

.map-marker-host { background: transparent; border: 0; }
.map-marker {
  width: var(--marker-size);
  height: var(--marker-size);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: 0 8px 22px rgba(13, 24, 20, .25), 0 0 0 1px rgba(20, 35, 29, .08);
  opacity: var(--marker-opacity);
  transform: translateZ(0);
}
.map-marker::after {
  content: "";
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: var(--marker-color);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.water-path { stroke-linecap: round; stroke-linejoin: round; }

.feature-popup-shell .leaflet-popup-content-wrapper {
  border-radius: 24px;
  corner-shape: squircle;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 68px rgba(20, 28, 25, .24);
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(255,255,255,.96);
}
.feature-popup-shell .leaflet-popup-content { margin: 0; width: min(340px, 76vw) !important; }
.feature-popup-shell .leaflet-popup-tip { background: rgba(255,255,255,.98); }
.feature-popup-shell .leaflet-popup-close-button {
  width: 42px;
  height: 42px;
  font-size: 24px;
  color: #2d2d2f;
  z-index: 2;
}
.feature-popup-card { direction: rtl; text-align: right; }
.feature-popup-image { width: 100%; height: 180px; display: block; object-fit: cover; background: #ecefed; }
.feature-popup-content { padding: 18px 20px 21px; }
.feature-popup-content h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.01em; }
.feature-popup-content p { margin: 0; color: #66666b; font-size: 14px; line-height: 1.75; }

.glass-button, .close-button, .mini-button, .tool-button, .ghost-button, .danger-button, .solid-button {
  border: 0;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.glass-button:active, .close-button:active, .mini-button:active, .tool-button:active, .ghost-button:active, .danger-button:active, .solid-button:active { transform: scale(.975); }
.glass-button {
  min-height: 50px;
  padding: 0 20px;
  border-radius: 16px;
  corner-shape: squircle;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.92);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 690;
}
.glass-button:hover { background: rgba(255,255,255,.98); }
.glass-button.primary { background: rgba(255,255,255,.94); }
.glass-button.icon-only { width: 50px; padding: 0; }

.solid-button {
  min-height: 50px;
  padding: 0 23px;
  border-radius: 16px;
  corner-shape: squircle;
  background: var(--accent);
  color: white;
  font-weight: 760;
  box-shadow: 0 10px 24px rgba(52, 75, 67, .22);
}
.solid-button:hover { background: var(--accent-dark); }
.solid-button.compact { min-height: 44px; padding-inline: 18px; border-radius: 14px; }

.close-button {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  corner-shape: squircle;
  background: rgba(245,245,247,.94);
  border: 1px solid rgba(60,60,67,.08);
  color: #2d2d2f;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 7px 22px rgba(30, 37, 34, .08);
}
.close-button.small { width: 44px; height: 44px; border-radius: 14px; font-size: 24px; }

.muted { color: var(--muted); line-height: 1.65; }
.form-field { display: grid; gap: 8px; }
.form-field > span { color: #5d5d62; font-size: 13px; font-weight: 670; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  border: 1px solid rgba(60,60,67,.14);
  background: rgba(255,255,255,.82);
  border-radius: 14px;
  corner-shape: squircle;
  padding: 12px 14px;
  color: var(--text);
  min-height: 46px;
}
.form-field input:hover, .form-field textarea:hover, .form-field select:hover { border-color: rgba(60,60,67,.24); }
.form-field textarea { resize: vertical; }
.form-field.inline { display: flex; align-items: center; gap: 12px; }
.form-field.inline select { min-width: 270px; }
.switch-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: #3b3b3f;
  font-weight: 650;
}
.switch-row input { width: 22px; height: 22px; accent-color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10000;
  background: rgba(29,29,31,.94);
  color: white;
  border-radius: 15px;
  corner-shape: squircle;
  padding: 12px 18px;
  box-shadow: 0 14px 38px rgba(0,0,0,.22);
  max-width: min(560px, 88vw);
  text-align: center;
}
.feature-name-label {
  border: 1px solid rgba(255,255,255,.88) !important;
  border-radius: 11px !important;
  background: rgba(255,255,255,.92) !important;
  color: #242426 !important;
  box-shadow: 0 7px 20px rgba(20,28,25,.14) !important;
  padding: 6px 10px !important;
  font-weight: 700 !important;
  direction: rtl;
}
.feature-name-label::before, .measurement-tooltip::before { display: none !important; }
.measurement-tooltip {
  border: 0 !important;
  border-radius: 11px !important;
  background: rgba(29,29,31,.92) !important;
  color: white !important;
  padding: 7px 10px !important;
  font-weight: 700 !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.18) !important;
}

@media (max-width: 720px) {
  .leaflet-control-zoom a { width: 50px; height: 50px; line-height: 49px; }
  .glass-button { min-height: 48px; }
  .feature-popup-image { height: 145px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* V5 — formal, high-legibility visual system */
:root {
  --text: #1b2938;
  --muted: #5c6873;
  --line: rgba(27, 41, 56, .14);
  --line-strong: rgba(27, 41, 56, .22);
  --surface: rgba(255, 253, 248, .92);
  --surface-strong: #fffdf8;
  --surface-soft: #f2efe7;
  --accent: #225a73;
  --accent-dark: #153f55;
  --accent-soft: #e7eff2;
  --heritage: #92723e;
  --danger: #98363d;
  --shadow-lg: 0 28px 76px rgba(20, 34, 45, .20), 0 2px 9px rgba(20, 34, 45, .08);
  --shadow-md: 0 15px 40px rgba(20, 34, 45, .15), 0 1px 4px rgba(20, 34, 45, .07);
  --shadow-sm: 0 8px 22px rgba(20, 34, 45, .12);
}
body { background: #a8b0ae; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible,
summary:focus-visible { outline-color: rgba(34, 90, 115, .34); }
.map-canvas, .leaflet-container { background: #929d9a; }
.map-canvas.is-softened { filter: blur(5px) saturate(.72) brightness(1.02); }
.glass-button {
  background: rgba(255, 253, 248, .96);
  border-color: rgba(255, 255, 255, .96);
  color: var(--text);
  font-size: 16px;
}
.solid-button { background: var(--accent); box-shadow: 0 10px 24px rgba(21, 63, 85, .25); }
.close-button { background: #f3efe7; color: var(--text); }
.form-field > span { color: #465564; font-size: 14px; }
.form-field input, .form-field textarea, .form-field select {
  border-color: rgba(27, 41, 56, .17);
  background: #fffefa;
  color: var(--text);
  font-size: 16px;
}

/* Large landmark card that remains inside the viewport. */
.feature-popup-shell.leaflet-popup { max-width: calc(100vw - 28px) !important; }
.feature-popup-shell .leaflet-popup-content-wrapper {
  width: min(700px, calc(100vw - 36px));
  max-height: calc(100vh - 120px);
  border-radius: 28px;
  background: #fffdf8;
  border: 1px solid rgba(255,255,255,.98);
  box-shadow: 0 28px 76px rgba(15, 29, 39, .30);
}
.feature-popup-shell .leaflet-popup-content {
  width: 100% !important;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}
.feature-popup-shell .leaflet-popup-tip { background: #fffdf8; }
.feature-popup-shell .leaflet-popup-close-button {
  top: 12px;
  right: 12px;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 253, 248, .94);
  box-shadow: 0 7px 20px rgba(20, 34, 45, .13);
  color: var(--text);
  font-size: 27px;
}
.feature-popup-card {
  max-height: calc(100vh - 120px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.feature-popup-image {
  width: 100%;
  height: clamp(250px, 36vh, 390px);
  object-fit: cover;
  background: #e9e5db;
}
.feature-popup-content { padding: clamp(24px, 3vw, 36px); }
.feature-popup-kicker {
  display: block;
  margin-bottom: 9px;
  color: var(--heritage);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
}
.feature-popup-content h3 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: clamp(27px, 2.5vw, 38px);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.feature-popup-content p {
  margin: 0;
  color: #4e5c68;
  font-size: clamp(17px, 1.3vw, 20px);
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.feature-popup-empty { color: var(--muted) !important; }
.feature-name-label {
  border-color: rgba(255,255,255,.96) !important;
  background: rgba(255,253,248,.96) !important;
  color: var(--text) !important;
  font-size: 14px !important;
}

@media (max-width: 700px) {
  .feature-popup-shell .leaflet-popup-content-wrapper {
    width: min(94vw, 560px);
    max-height: calc(100vh - 90px);
    border-radius: 22px;
  }
  .feature-popup-shell .leaflet-popup-content,
  .feature-popup-card { max-height: calc(100vh - 90px); }
  .feature-popup-image { height: clamp(190px, 31vh, 285px); }
  .feature-popup-content { padding: 22px 20px 25px; }
  .feature-popup-content h3 { font-size: 26px; }
  .feature-popup-content p { font-size: 17px; }
}


/* V6 — brand palette supplied by the client, with accessible dark companions. */
:root {
  --brand-green: #3F978E;
  --brand-blue: #4C788E;
  --brand-gray: #6D6E71;
  --brand-mint: #7EBDB3;
  --brand-sand: #A99484;
  --brand-green-dark: #28665F;
  --brand-blue-dark: #31566A;
  --text: #26373D;
  --muted: #667176;
  --line: rgba(76, 120, 142, .18);
  --line-strong: rgba(76, 120, 142, .30);
  --surface: rgba(255, 254, 250, .93);
  --surface-strong: #FFFEFA;
  --surface-soft: #F3F1ED;
  --accent: var(--brand-blue);
  --accent-dark: var(--brand-blue-dark);
  --accent-soft: #E9F0F2;
  --heritage: var(--brand-sand);
  --danger: #9A3F46;
  --shadow-lg: 0 30px 82px rgba(38, 55, 61, .22), 0 3px 10px rgba(38, 55, 61, .08);
  --shadow-md: 0 16px 42px rgba(38, 55, 61, .16), 0 2px 6px rgba(38, 55, 61, .06);
  --shadow-sm: 0 9px 24px rgba(38, 55, 61, .13);
}
body { background: #9BA7A8; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline-color: rgba(63, 151, 142, .38);
}
.solid-button { background: var(--brand-blue); box-shadow: 0 11px 26px rgba(49, 86, 106, .26); }
.solid-button:hover { background: var(--brand-blue-dark); }
.switch-row input { accent-color: var(--brand-green); }
.map-marker::after { background: var(--marker-color, var(--brand-green)); }

/* Precise media frame: no side gap, no exposed background, balanced crop. */
.feature-popup-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.6;
  min-height: 230px;
  max-height: min(42vh, 360px);
  overflow: hidden;
  background: linear-gradient(135deg, #E8EFEE, #DCE6E8);
  border-bottom: 1px solid rgba(76, 120, 142, .14);
}
.feature-popup-media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(38,55,61,.10), transparent);
}
.feature-popup-image {
  width: 100%;
  height: 100%;
  min-width: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(1.018);
  transform-origin: center;
  background: #E8EFEE;
}
.feature-popup-shell .leaflet-popup-content-wrapper { background: #FFFEFA; border-color: rgba(255,255,255,.98); }
.feature-popup-shell .leaflet-popup-tip { background: #FFFEFA; }
.feature-popup-kicker { color: var(--brand-sand); }

@media (max-width: 680px) {
  .feature-popup-media { min-height: 185px; max-height: 34vh; aspect-ratio: 16 / 9.2; }
}

/* Do not reserve an RTL scrollbar gutter: it was the white strip visible on the left of the image. */
.feature-popup-card { scrollbar-gutter: auto; overflow-x: hidden; }


/* V8 — stable transparent map labels and truly optional landmark media. */
.feature-name-label-host,
.feature-name-label-host.leaflet-div-icon {
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  pointer-events: none !important;
}
.feature-name-text {
  --label-font-size: 13px;
  --label-opacity: 1;
  --label-offset-y: 0px;
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  max-width: min(210px, 42vw);
  transform: translate(-50%, calc(-50% + var(--label-offset-y)));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #173940;
  font-size: var(--label-font-size);
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: var(--label-opacity);
  pointer-events: none;
  user-select: none;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,.92),
     1px -1px 0 rgba(255,255,255,.92),
    -1px  1px 0 rgba(255,255,255,.92),
     1px  1px 0 rgba(255,255,255,.92),
     0 2px 5px rgba(13,35,39,.32);
}
.feature-popup-card.no-media .feature-popup-content {
  padding-top: clamp(68px, 6vw, 82px);
}
.feature-popup-card.no-media {
  min-height: 0;
}
.feature-popup-card.no-media .feature-popup-kicker {
  margin-inline-end: 48px;
}
@media (max-width: 680px) {
  .feature-name-text { max-width: 150px; }
  .feature-popup-card.no-media .feature-popup-content { padding-top: 66px; }
}

/* V10.4 — compact marker choices and directional route hints. */
.map-marker {
  position: relative;
  color: var(--marker-color);
}
.map-marker.is-circle::after {
  content: "";
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: var(--marker-color);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.map-marker:not(.is-circle)::after { content: none; }
.map-marker.is-pin {
  height: calc(var(--marker-size) * 1.18);
  border-radius: 52% 52% 52% 8%;
  transform: rotate(-45deg) translateZ(0);
  background: var(--marker-color);
  border: 3px solid rgba(255,255,255,.96);
  box-shadow: 0 8px 22px rgba(13,24,20,.28), 0 0 0 1px rgba(20,35,29,.09);
}
.map-marker.is-pin::before {
  content: "";
  width: 32%;
  height: 32%;
  border-radius: 50%;
  background: white;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.map-marker.is-mosque,
.map-marker.is-mountain,
.map-marker.is-well,
.map-marker.is-museum,
.map-marker.is-star,
.map-marker.is-custom {
  background: rgba(255,255,255,.98);
  border: 2px solid var(--marker-color);
}
.map-marker svg {
  width: 58%;
  height: 58%;
  display: block;
  fill: currentColor;
}
.map-marker-custom-symbol {
  display: block;
  max-width: 78%;
  overflow: hidden;
  color: currentColor;
  font-size: calc(var(--marker-size) * .46);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.route-arrow-host,
.route-arrow-host.leaflet-div-icon {
  border: 0 !important;
  background: transparent !important;
  pointer-events: none !important;
}
.route-arrow {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--route-arrow-color);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(var(--route-arrow-angle));
  text-shadow: -1px -1px 0 rgba(255,255,255,.95), 1px -1px 0 rgba(255,255,255,.95), -1px 1px 0 rgba(255,255,255,.95), 1px 1px 0 rgba(255,255,255,.95), 0 2px 4px rgba(0,0,0,.28);
}
.toast {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.toast-action {
  min-height: 32px;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 10px;
  padding: 0 11px;
  background: rgba(255,255,255,.13);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.toast[hidden] { display: none !important; }
