.map-page-mode {
  height: 100dvh;
  overflow: hidden;
}

.map-page-mode main {
  flex: 1;
  min-height: 0;
}

.map-page-mode .site-footer {
  display: none;
}

.full-map-page,
.v2-map {
  width: 100%;
  height: calc(100dvh - var(--header-height));
  min-height: 620px;
}

.v2-map {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #e8eee8;
}

.v2-map-layer {
  position: absolute;
  inset: -3%;
  overflow: hidden;
  background-color: #e7eee6;
  background-image:
    linear-gradient(28deg, transparent 45%, rgb(255 255 255 / 70%) 46%, rgb(255 255 255 / 70%) 47%, transparent 48%),
    linear-gradient(116deg, transparent 45%, rgb(255 255 255 / 58%) 46%, rgb(255 255 255 / 58%) 47%, transparent 48%),
    repeating-linear-gradient(0deg, rgb(103 133 111 / 13%) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(90deg, rgb(103 133 111 / 13%) 0 1px, transparent 1px 42px);
  background-size: 150px 150px, 210px 210px, 100% 100%, 100% 100%;
  transform: scale(var(--v2-zoom, 1));
  transform-origin: center;
  transition: transform 180ms ease;
}

.v2-water {
  position: absolute;
  z-index: 1;
  top: -15%;
  left: 49%;
  width: 5.2%;
  height: 140%;
  border-right: 5px solid rgb(255 255 255 / 72%);
  border-left: 5px solid rgb(255 255 255 / 72%);
  border-radius: 43% 57% 46% 54%;
  background: #9dd3e0;
  transform: rotate(6deg);
  box-shadow: 0 0 0 1px rgb(65 137 158 / 22%);
}

.v2-park {
  position: absolute;
  z-index: 0;
  display: grid;
  place-items: center;
  border: 1px solid #9cc596;
  border-radius: 45% 55% 46% 54%;
  color: #397348;
  background: #cce5c6;
  font-size: .7rem;
  font-weight: 600;
}

.park-one {
  top: 31%;
  left: 43%;
  width: 11%;
  height: 8%;
}

.park-two {
  top: 60%;
  left: 68%;
  width: 13%;
  height: 9%;
}

.v2-road,
.v2-transit-line {
  position: absolute;
  z-index: 2;
  top: var(--y);
  left: var(--x);
  width: var(--w);
  height: 7px;
  border: 2px solid white;
  background: #dbc47f;
  box-shadow: 0 0 0 1px rgb(157 133 72 / 55%);
  transform: rotate(var(--r));
  transform-origin: left center;
}

.v2-road.secondary {
  height: 5px;
  background: #e7d7a7;
}

.v2-road span,
.v2-transit-line span {
  position: absolute;
  top: 8px;
  left: 45%;
  min-width: max-content;
  padding: 1px 5px;
  border-radius: 3px;
  color: #565c61;
  background: rgb(255 255 255 / 78%);
  font-size: clamp(.58rem, .75vw, .72rem);
  font-weight: 600;
  transform: rotate(calc(-1 * var(--r)));
  transform-origin: center;
}

.v2-transit-line {
  z-index: 3;
  height: 3px;
  border: 0;
  background: var(--line);
  box-shadow: 0 0 0 2px rgb(255 255 255 / 72%);
}

.v2-transit-line span {
  top: 5px;
  color: var(--line);
  font-weight: 700;
}

.v2-place-label {
  position: absolute;
  z-index: 4;
  padding: 2px 5px;
  color: #4e5960;
  font-size: clamp(.68rem, 1vw, .92rem);
  font-weight: 600;
  text-shadow: 0 1px 0 white, 1px 0 0 white, 0 -1px 0 white, -1px 0 0 white;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.v2-place-label.region {
  color: #273b45;
  font-size: clamp(.82rem, 1.25vw, 1.15rem);
  font-weight: 700;
  letter-spacing: .035em;
}

.v2-place-label.capital {
  color: var(--navy-950);
  font-size: clamp(1rem, 1.65vw, 1.45rem);
  font-weight: 700;
}

.v2-place-label.district {
  font-size: clamp(.62rem, .85vw, .8rem);
}

.map-command-bar {
  position: absolute;
  z-index: 50;
  top: 16px;
  left: 50%;
  width: min(calc(100% - 180px), 980px);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  transform: translateX(-50%);
}

#v2-map-search {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 16px;
  border: 1px solid rgb(197 201 209 / 85%);
  border-radius: 12px;
  background: rgb(255 255 255 / 97%);
  box-shadow: var(--shadow-2);
}

#v2-map-search > span {
  color: var(--navy-950);
  font-size: 1.4rem;
}

#v2-map-search input {
  min-height: 40px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
}

#v2-map-search input:focus {
  outline: 0;
}

#v2-map-search button {
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--navy-950);
  font-weight: 700;
}

.view-switch.compact {
  min-height: 52px;
  box-shadow: var(--shadow-2);
}

.map-quick-filters {
  position: absolute;
  z-index: 49;
  top: 80px;
  left: 50%;
  width: min(calc(100% - 180px), 980px);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 8px;
  transform: translateX(-50%);
  scrollbar-width: none;
}

.map-quick-filters::-webkit-scrollbar {
  display: none;
}

.map-filter-chip {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 1px solid #a6adb5;
  border-radius: 999px;
  color: var(--navy-950);
  background: rgb(255 255 255 / 96%);
  box-shadow: var(--shadow-1);
  font-size: .84rem;
  font-weight: 700;
}

.map-filter-chip:hover,
.map-filter-chip:focus,
.map-filter-chip.primary {
  border-color: var(--navy-950);
  color: white;
  background: var(--navy-950);
}

.map-results-toggle {
  position: absolute;
  z-index: 48;
  top: 142px;
  left: 16px;
  min-width: 116px;
  min-height: 66px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 6px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--navy-950);
  background: rgb(255 255 255 / 97%);
  box-shadow: var(--shadow-2);
  text-align: left;
}

.map-results-toggle strong {
  grid-row: 1 / 3;
  font-size: 1.55rem;
}

.map-results-toggle span {
  font-weight: 700;
}

.map-results-toggle small {
  color: var(--teal-700);
}

.map-results-drawer {
  position: absolute;
  z-index: 60;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(390px, calc(100% - 24px));
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: white;
  box-shadow: var(--shadow-2);
  transform: translateX(-105%);
  transition: transform 190ms ease;
}

.map-results-drawer.open {
  transform: translateX(0);
}

.map-results-drawer > header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.map-results-drawer > header > div {
  display: grid;
}

.v2-result-list {
  max-height: calc(100% - 70px);
  overflow: auto;
}

.v2-result-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.v2-result-card:hover,
.v2-result-card:focus,
.v2-result-card.active {
  background: var(--teal-100);
  box-shadow: inset 5px 0 0 var(--teal-700);
}

.v2-result-card img {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  object-fit: cover;
}

.v2-result-card h3 {
  margin: 7px 0 4px;
  font-size: 1rem;
}

.v2-result-card p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .82rem;
}

.v2-map-pin {
  position: absolute;
  z-index: 15;
  min-height: 38px;
  padding: 7px 11px;
  border: 3px solid white;
  border-radius: 999px 999px 999px 3px;
  color: white;
  background: var(--navy-950);
  box-shadow: 0 4px 12px rgb(3 22 54 / 34%);
  font-size: .76rem;
  font-weight: 700;
  transform: translate(-50%, -100%);
  transition: background 130ms ease, transform 130ms ease;
}

.v2-map-pin:hover,
.v2-map-pin:focus,
.v2-map-pin.active {
  z-index: 30;
  background: var(--orange-800);
  transform: translate(-50%, -100%) scale(1.15);
}

.v2-map-halo {
  position: absolute;
  z-index: 8;
  width: 190px;
  height: 190px;
  border: 3px solid rgb(34 104 108 / 65%);
  border-radius: 50%;
  background: rgb(34 104 108 / 12%);
  box-shadow: 0 0 0 22px rgb(34 104 108 / 7%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.v2-poi {
  position: absolute;
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: v2-poi-enter 160ms ease-out both;
}

.v2-poi > b {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  box-shadow: 0 3px 9px rgb(3 22 54 / 28%);
  font-size: .72rem;
}

.v2-poi > span {
  min-width: max-content;
  display: grid;
  padding: 5px 8px;
  border: 1px solid rgb(197 201 209 / 80%);
  border-radius: 6px;
  color: var(--navy-950);
  background: rgb(255 255 255 / 97%);
  box-shadow: var(--shadow-1);
  font-size: .72rem;
  font-weight: 700;
}

.v2-poi small {
  color: var(--muted);
  font-weight: 500;
}

.v2-poi.poi-transit > b { background: #3264b8; }
.v2-poi.poi-university > b { background: #6b3aa8; }
.v2-poi.poi-mall > b { background: #ad4d00; }
.v2-poi.poi-hospital > b { background: #b41f35; }

@keyframes v2-poi-enter {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
}

.v2-map-popover {
  position: absolute;
  z-index: 55;
  right: 18px;
  bottom: 24px;
  width: min(560px, calc(100% - 36px));
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 98%);
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.v2-map-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.v2-map-popover > img {
  width: 180px;
  height: 100%;
  min-height: 170px;
  border-radius: 10px;
  object-fit: cover;
}

.v2-map-popover h2 {
  margin: 8px 0 4px;
  font-size: 1.18rem;
}

.v2-map-popover p {
  margin-bottom: 7px;
}

.v2-map-popover .price small {
  color: var(--muted);
  font-size: .85rem;
}

.v2-popover-close {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
}

.v2-nearby {
  color: var(--teal-700);
  font-size: .86rem;
  font-weight: 700;
}

.v2-map-controls {
  position: absolute;
  z-index: 45;
  right: 16px;
  top: 142px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow-2);
}

.v2-map-controls button {
  width: 44px;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--navy-950);
  background: white;
  font-size: 1.2rem;
  font-weight: 700;
}

.v2-map-controls button:last-child {
  border-bottom: 0;
}

.v2-compass {
  position: absolute;
  z-index: 45;
  right: 22px;
  top: 290px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--red-700);
  background: white;
  box-shadow: var(--shadow-1);
  font-size: .75rem;
  font-weight: 700;
}

.v2-map-scale {
  position: absolute;
  z-index: 44;
  right: 18px;
  bottom: 14px;
  display: grid;
  color: #46515a;
  font-size: .67rem;
}

.v2-map-scale span {
  width: 74px;
  height: 5px;
  border-right: 2px solid #46515a;
  border-bottom: 2px solid #46515a;
  border-left: 2px solid #46515a;
}

.v2-map-legend {
  position: absolute;
  z-index: 44;
  bottom: 14px;
  left: 16px;
  display: flex;
  gap: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow-1);
  font-size: .7rem;
}

.v2-map-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.v2-map-legend .poi-icon {
  width: 23px;
  height: 23px;
  flex-basis: 23px;
  border-width: 1px;
}

.map-filter-dialog {
  width: min(calc(100% - 32px), 920px);
  max-height: min(90dvh, 850px);
  overflow: hidden;
}

.map-filter-card {
  max-height: min(90dvh, 850px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: white;
}

.map-filter-card > header,
.map-filter-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}

.map-filter-card > header {
  border-bottom: 1px solid var(--line);
}

.map-filter-card > footer {
  border-top: 1px solid var(--line);
}

.map-filter-card h2,
.map-filter-card p {
  margin: 0;
}

.map-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: auto;
}

.map-filter-grid fieldset {
  min-width: 0;
  margin: 0;
  padding: 22px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.map-filter-grid legend {
  margin-bottom: 12px;
  font-size: 1rem;
}

.map-filter-grid .field + .field {
  margin-top: 11px;
}

.map-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-filter-options label {
  cursor: pointer;
}

.map-filter-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.map-filter-options label > span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy-950);
  background: white;
  font-size: .85rem;
  font-weight: 600;
}

.map-filter-options input:checked + span {
  border-color: var(--navy-950);
  color: white;
  background: var(--navy-950);
}

.poi-options input:checked + span .poi-icon {
  border-color: white;
}

@media (max-width: 900px) {
  .map-command-bar,
  .map-quick-filters {
    width: calc(100% - 32px);
  }

  .map-command-bar {
    grid-template-columns: 1fr;
  }

  .view-switch.compact {
    position: absolute;
    top: 62px;
    right: 0;
  }

  .map-quick-filters {
    top: 136px;
    padding-right: 120px;
  }

  .map-results-toggle,
  .v2-map-controls {
    top: 198px;
  }
}

@media (max-width: 760px) {
  .full-map-page,
  .v2-map {
    min-height: 540px;
  }

  .map-command-bar {
    top: 10px;
    width: calc(100% - 20px);
  }

  #v2-map-search {
    min-height: 48px;
    padding-left: 10px;
  }

  #v2-map-search button {
    padding-inline: 10px;
  }

  .view-switch.compact {
    top: 56px;
    right: 0;
  }

  .map-quick-filters {
    top: 126px;
    width: calc(100% - 20px);
    padding-right: 0;
  }

  .map-results-toggle,
  .v2-map-controls {
    top: 182px;
  }

  .map-results-toggle {
    left: 10px;
  }

  .v2-map-controls {
    right: 10px;
  }

  .v2-compass {
    top: 330px;
    right: 16px;
  }

  .v2-map-legend {
    right: 10px;
    bottom: 8px;
    left: 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .v2-map-legend span {
    flex: 0 0 auto;
  }

  .v2-map-scale {
    display: none;
  }

  .v2-map-popover {
    right: 10px;
    bottom: 56px;
    left: 10px;
    width: auto;
    grid-template-columns: 96px 1fr;
    gap: 10px;
    padding: 10px;
  }

  .v2-map-popover > img {
    width: 96px;
    min-height: 130px;
  }

  .v2-map-popover h2 {
    padding-right: 28px;
    font-size: 1rem;
  }

  .v2-map-popover p {
    font-size: .78rem;
  }

  .v2-map-popover .price {
    font-size: 1.08rem;
  }

  .v2-poi > span {
    display: none;
  }

  .map-filter-dialog {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .map-filter-card {
    max-height: 100dvh;
  }

  .map-filter-grid {
    grid-template-columns: 1fr;
  }

  .map-filter-grid fieldset {
    border-right: 0;
  }

  .map-filter-card > footer {
    position: sticky;
    bottom: 0;
    background: white;
  }
}

@media (max-width: 430px) {
  #v2-map-search > span {
    display: none;
  }

  #v2-map-search {
    grid-template-columns: 1fr auto;
  }

  .v2-result-card {
    grid-template-columns: 92px 1fr;
  }

  .v2-result-card img {
    width: 92px;
    height: 100px;
  }
}

