:root {
  --nav-h: 0px;
  --foot-h: 0px;
  --skz-freeze-scale: 1;

  /* used by label-freeze */
}

/* Map wrapper fills viewport between navbar/footer */
#map-wrap {
  height: calc(100dvh - var(--nav-h) - var(--foot-h));
}

/* Base document sizing (no custom page layout classes needed here) */
html,
body {
  height: 100%;
}

/* Keep navbar/footer on top of Leaflet UIs */
#navbar,
#footer {
  position: relative;
  z-index: 5000;
  flex: 0 0 auto;

  /* above Leaflet/Geoman panels */
}

/* Map + background */
#map-wrap,
#map {
  position: relative;
  z-index: 1;
}

#map {
  position: absolute;
  inset: 0;
  background-color: #0a0b0f;
  background-image:
    url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'>\
  <filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter>\
  <rect width='100%' height='100%' filter='url(%23n)' opacity='0.11'/></svg>"),
    url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128' viewBox='0 0 128 128'>\
  <filter id='n2'><feTurbulence type='fractalNoise' baseFrequency='0.45' numOctaves='2' stitchTiles='stitch'/></filter>\
  <rect width='100%' height='100%' filter='url(%23n2)' opacity='0.06'/></svg>"),
    radial-gradient(100% 140% at 15% 20%, rgb(255 255 255 / 5%), transparent 40%),
    radial-gradient(120% 150% at 85% 10%, rgb(255 255 255 / 3%), transparent 45%),
    radial-gradient(120% 120% at 50% 40%, transparent 58%, rgb(0 0 0 / 45%) 78%, rgb(0 0 0 / 75%) 100%);
  background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat;
  background-position: 0 0, 0 0, center, center, center;
  background-size: 160px 160px, 420px 420px, 100% 100%, 100% 100%, 100% 100%;
}

.leaflet-container {
  background: #0b0e13;
}

/* Perf hints */
.leaflet-image-layer,
.leaflet-pane,
.leaflet-zoom-animated,
.leaflet-marker-icon,
.leaflet-tooltip.skz-label {
  will-change: transform;
}

/* Labels + freeze scaling actually applied */
.leaflet-tooltip.skz-label {
  font-size: .8rem;
  font-weight: 800;
  color: black;
  text-shadow: 0 0 2px #fff, 0 0 6px #fff, 0 0 12px rgb(255 255 255 / 80%);
  background: transparent;
  border: none;
  box-shadow: none;
  transform: scale(var(--skz-freeze-scale));
  transform-origin: bottom center;
}

.leaflet-zoom-anim .skz-label {
  opacity: 12%;
  transition: opacity .12s linear;
}

/* Kill all Leaflet tooltip pointers */
.leaflet-tooltip::before,
.leaflet-tooltip::before,
.leaflet-tooltip-left::before,
.leaflet-tooltip-right::before,
.leaflet-tooltip-top::before,
.leaflet-tooltip-bottom::before {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  content: none !important;
  border: 0 !important;
}

/* Label sizes per type */
.leaflet-tooltip.skz-label--kingdom {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .2em;
}

.leaflet-tooltip.skz-label--city {
  font-size: 15px;
  font-weight: 700;
  color: red;
}

.leaflet-tooltip.skz-label--town,
.leaflet-tooltip.skz-label--poi,
.leaflet-tooltip.skz-label--ruin {
  font-size: 12px;
}

/* Popup styling */
.leaflet-popup.skz-popup-wrap .leaflet-popup-content-wrapper {
  color: #efe9d8;
  background: #11131a;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 40%);
}

.leaflet-popup.skz-popup-wrap .leaflet-popup-tip {
  background: #11131a;
  border: 1px solid rgb(255 255 255 / 18%);
}

.skz-popup .t {
  margin-bottom: 4px;
  font-weight: 700;
  color: #efe9d8;
}

.skz-popup .d {
  margin: 2px 0 6px;
  color: #d4cdbb;
  opacity: 90%;
}

.skz-popup a {
  color: #d7c38b;
  text-decoration: none;
}

.skz-popup a:hover {
  text-decoration: underline;
}

/* Icons */
.skz-divicon-diamond {
  position: relative;
  width: 10px;
  height: 10px;
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / 45%)) drop-shadow(0 6px 14px rgb(0 0 0 / 25%));
}

.skz-divicon-diamond .gem {
  position: absolute;
  inset: 0;
  margin: 0;
  background: #243a73;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.skz-divicon-diamond:hover .gem {
  filter: brightness(1.08);
}

.pin {
  width: 15px;
  height: 15px;
}

.pin>span {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid rgb(0 0 0 / 45%);
  border-radius: 50%;
}

.pin.pin--town>span {
  background-color: #2b3e4a;
  border-color: #1c2a31;
}

.pin.pin--ruin>span {
  background-color: #6b3a3a;
  border-color: #2a1818;
  transform: rotate(45deg);
}

.pin.pin--poi>span {
  background-color: #d4a627;
  border-color: #594409;
}


/* add visibility for kingdom pins used in JS */
.pin.pin--kingdom>span {
  background-color: #3a2b4a;
  border-color: #1f1630;
}

/* Search/list overlay */
.skz-ui {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1500;
  width: 280px;
  max-height: calc(100% - 24px);
  padding: 10px;
  overflow: hidden auto;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #efe9d8;
  scrollbar-color: rgb(255 255 255 / 35%) transparent;
  scrollbar-width: thin;
  background: rgb(18 19 25 / 88%);
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 40%);
  backdrop-filter: blur(4px);
  -webkit-overflow-scrolling: touch;
}

/* WebKit scrollbars */
.skz-ui::-webkit-scrollbar {
  width: 10px;
}

.skz-ui::-webkit-scrollbar-track {
  background: transparent;
}

.skz-ui::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 25%);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 8px;
}

.skz-ui::-webkit-scrollbar-thumb:hover {
  background: rgb(255 255 255 / 38%);
}

.skz-search {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  padding: 8px 10px;
  margin-top: 0;
  color: #efe9d8;
  outline: none;
  background: #0f1116;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 8px;
  box-shadow: 0 4px 8px rgb(0 0 0 / 25%);
}

.skz-list {
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.skz-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 8px;
}

.skz-list li:hover {
  background: rgb(255 255 255 / 6%);
}

.skz-list .n {
  font-weight: 700;
}

.skz-list .c {
  font-size: 12px;
  opacity: 80%;
}

/* Effect pane (sunburst spotlight) */
.leaflet-effects-pane {
  z-index: 650;
  pointer-events: none;
}

.skz-burst {
  position: relative;
  width: 1px;
  height: 1px;
}

.skz-burst svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 96px;
  height: 96px;
  overflow: visible;
  transform: translate(-50%, -50%) scale(1);
}

.skz-burst .rays {
  transform-origin: 50% 50%;
  animation: skz-burst-rays 2500ms ease-out forwards;
}

.skz-burst .rays rect {
  fill: rgb(255 215 128 / 100%);
}

.skz-burst .ring {
  fill: none;
  stroke: rgb(255 230 160 / 100%);
  stroke-width: 2.5;
  transform-origin: 50% 50%;
  animation: skz-burst-ring 2500ms ease-out forwards;
}

.skz-burst .flash {
  fill: rgb(255 245 200 / 100%);
  transform-origin: 50% 50%;
  animation: skz-burst-flash 1800ms ease-out forwards;
}

@keyframes skz-burst-rays {
  0% {
    opacity: 100%;
    filter: blur(0);
    transform: scale(0.6) rotate(0deg);
  }

  100% {
    opacity: 0%;
    filter: blur(1px);
    transform: scale(1.6) rotate(24deg);
  }
}

@keyframes skz-burst-ring {
  0% {
    opacity: 100%;
    stroke-width: 3;
    transform: scale(0.5);
  }

  100% {
    opacity: 0%;
    stroke-width: 0.5;
    transform: scale(2.1);
  }
}

@keyframes skz-burst-flash {
  0% {
    opacity: 100%;
    transform: scale(0.8);
  }

  100% {
    opacity: 0%;
    transform: scale(2.2);
  }
}

/* Keep controls below navbar; keep search panel tucked too */
#map .leaflet-top {
  top: calc(var(--nav-height, 64px) + 8px);
}

#skz-ui {
  top: calc(var(--nav-height, 64px) + 12px);
}

/* Z-index harmonization (below header/footer; above tiles) */
.leaflet-control-container,
.leaflet-top,
.leaflet-bottom,
.leaflet-pm-toolbar,
.skz-ui {
  z-index: 1500 !important;
}

/* Measuring mode visuals */
#map.is-measuring,
#map.is-measuring .leaflet-pane,
#map.is-measuring .leaflet-control,
#map.is-measuring .leaflet-marker-icon,
#map.is-measuring .leaflet-interactive {
  cursor: crosshair !important;
}

/* Ruler UI */
.rm-label.leaflet-tooltip {
  padding: 2px 6px;
  font: 12px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #efe9d8;
  background: rgb(18 19 25 / 90%);
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 35%);
}

.rm-ctrl.active a {
  color: #ffd780;
  background: #2c2f38;
}

/* base circle for all pins (safe even if already present) */
.leaflet-marker-icon.pin>span {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid rgb(0 0 0 / 45%);
  border-radius: 50%;
}

/* kingdom-specific — higher specificity to win any cascade */
.leaflet-marker-icon.pin.pin--kingdom>span {
  background-color: red;

  /* your intended fill */
  border-color: #1f1630;

  /* your intended border */
  box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
  opacity: 10%;
}

/* simple,unobtrusive scalebar */
.skz-scale__bar {
  height: 8px;
  margin-bottom: 6px;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 50%) 0 50%, rgb(255 255 255 / 75%) 50% 100%);
  background-size: 24px 100%;
  border-radius: 4px;
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 35%));
}

.skz-scale__label {
  font-weight: 600;
  color: red;
  text-align: right;
  letter-spacing: .02em;
  opacity: 95%;
}

/* Let the bottom-left corner span the full map width */
.leaflet-bottom.leaflet-left {
  width: 100%;
  pointer-events: none;
}

/* Re-enable interaction for normal controls in that corner */
.leaflet-bottom.leaflet-left .leaflet-control {
  pointer-events: auto;
}

/* Center the scalebar inside that full-width corner */
.leaflet-bottom.leaflet-left .skz-scale {
  position: absolute;
  bottom: 18px;
  left: 50%;

  /* keeps drag/zoom working through it */
  z-index: 2000;
  text-align: center;

  /* or whatever offset you prefer */
  pointer-events: none;
  transform: translateX(-50%);
}

.leaflet-bottom.leaflet-left .skz-scale__label {
  /* avoid wrapping */
  font-variant-numeric: tabular-nums;
  text-align: center;

  /* overrides the old right align */
  white-space: nowrap;

  /* steadier number widths */
}