body.map-page {
  min-height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--map-text);
  background:
    radial-gradient(circle at top left, rgba(21, 105, 228, 0.12), transparent 24%),
    linear-gradient(180deg, #f7fbff 0%, var(--map-bg) 100%);
}

.map-page-layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.map-page-header {
  position: relative;
  z-index: 1000;
  padding: 9px 10px 7px;
}

.map-page-header-inner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 9px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: var(--map-surface);
  box-shadow: var(--map-shadow);
  backdrop-filter: blur(12px);
}

.map-page-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 21px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(21, 105, 228, 0.1);
  color: var(--map-primary-strong);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.5rem;
  white-space: nowrap;
}

.map-page-title-group {
  min-width: 0;
}

.map-page-title {
  margin: 0;
  font-size: clamp(0.7rem, 2vw, 1.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.map-page-subtitle {
  margin: 3px 0 0;
  color: var(--map-text-soft);
  font-size: 0.49rem;
}

.map-page-main {
  min-height: 0;
  padding: 0 20px 20px;
}

.map-stage {
  position: relative;
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--map-shadow);
  background: #dfe9f8;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.map-note {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  margin: 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 244, 241, 0.96);
  border: 1px solid #ffd9cf;
  color: #9a3d2b;
  box-shadow: 0 12px 28px rgba(154, 61, 43, 0.16);
}

.map-page .leaflet-container {
  width: 100%;
  height: 100%;
  background: #d8e5f5;
}

.map-page .leaflet-control-container .leaflet-top,
.map-page .leaflet-control-container .leaflet-bottom {
  z-index: 800;
}

.map-page .leaflet-top.leaflet-left {
  display: grid;
  gap: 8px;
}

.map-tool-control {
  margin-top: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.96);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  cursor: pointer;
  box-shadow: var(--map-shadow);
}

.map-tool-control:hover {
  background-color: #ffffff;
}

.map-tool-control:focus-visible {
  outline: 2px solid rgba(49, 99, 179, 0.32);
  outline-offset: 2px;
}

.map-measure-control.is-active {
  background-color: rgba(23, 105, 224, 0.14);
  box-shadow:
    var(--map-shadow),
    inset 0 0 0 1px rgba(23, 105, 224, 0.2);
}

.map-page .leaflet-container.is-measuring {
  cursor: crosshair;
}

.map-measure-distance {
  background: transparent;
  border: 0;
}

.map-measure-distance span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.map-measure-distance--total span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.9);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
}

.map-measure-distance--segment span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(23, 105, 224, 0.18);
  color: #12407a;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(18, 64, 122, 0.14);
}

.map-page .leaflet-control-layers {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  box-shadow: var(--map-shadow);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.map-page .leaflet-control-layers-toggle {
  border-radius: 8px;
}

.map-page .leaflet-control-layers-expanded {
  padding: 12px 12px 10px;
}

.map-page .leaflet-control-layers-list {
  gap: 8px;
}

.map-page .leaflet-control-layers-expanded .leaflet-control-layers-list {
  display: grid;
}

.map-page .leaflet-control-layers-base label,
.map-page .leaflet-control-layers-overlays label {
  color: var(--map-text);
  font-weight: 600;
}

.map-basemap-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-basemap-option__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
}

.map-basemap-option__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.map-basemap-option__text {
  line-height: 1.2;
}

.map-basemap-opacity {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(27, 62, 112, 0.12);
}

.map-page .leaflet-control-layers:not(.leaflet-control-layers-expanded) .map-basemap-opacity {
  display: none;
}

.map-basemap-opacity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-basemap-opacity-label {
  color: var(--map-text-soft);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.map-basemap-opacity-value {
  color: var(--map-primary-strong);
  font-size: 0.92rem;
}

.map-basemap-opacity-slider {
  width: 100%;
  margin: 0;
  accent-color: var(--map-primary);
  cursor: pointer;
}

@media (max-width: 720px) {
  .map-page-header {
    padding: 7px 7px 5px;
  }

  .map-page-header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 6px 7px;
    border-radius: 8px;
  }

  .map-page-main {
    padding: 0 14px 14px;
  }

  .map-stage {
    border-radius: 8px;
  }

  .map-page-title {
    font-size: clamp(0.8rem, 3.5vw, 1.2rem);
  }
}
