:root {
  --bg: #f4f0e6;
  --surface: rgba(255, 251, 241, 0.86);
  --surface-strong: rgba(255, 251, 241, 0.97);
  --accent: #54b66d;
  --accent-warm: #f2cf57;
  --blue: #4aa3d8;
  --blue-deep: #247eaf;
  --ink: #182114;
  --muted: #67705b;
  --line: rgba(41, 56, 30, 0.12);
  --shadow: 0 24px 60px rgba(84, 71, 25, 0.14);
  --panel-width: 25%;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 224, 129, 0.36), transparent 24%),
    radial-gradient(circle at top right, rgba(74, 163, 216, 0.18), transparent 20%),
    linear-gradient(160deg, #fbf8f1 0%, #f2ecde 48%, #ebe2cf 100%);
}

.page-shell {
  width: min(100%, 1720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.hero {
  margin-bottom: 18px;
}

.hero-bar,
.map-card,
.parcel-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 28px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-bar {
  display: grid;
  grid-template-columns: auto minmax(520px, 55%);
  gap: 22px;
  align-items: center;
  padding: 18px 22px;
}

.hero-title {
  min-width: 0;
}

.hero-bar h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.map-counts {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.filters {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 14px;
  align-items: center;
}

.verified-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(24, 33, 20, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.verified-toggle-text {
  display: grid;
  gap: 1px;
  text-align: center;
}

.verified-toggle-mark {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  font-size: 18px;
  line-height: 1;
}

.verified-toggle.is-active {
  border-color: rgba(42, 168, 74, 0.34);
  background: rgba(84, 182, 109, 0.17);
}

.range-filter {
  min-width: 0;
}

.filter-title {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.range-values {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.range-slider {
  position: relative;
  height: 24px;
}

.range-slider::before,
.range-fill {
  position: absolute;
  top: 11px;
  height: 4px;
  border-radius: 999px;
  content: "";
}

.range-slider::before {
  right: 0;
  left: 0;
  background: rgba(74, 163, 216, 0.2);
}

.range-fill {
  right: 0;
  left: 0;
  background: linear-gradient(90deg, var(--blue), var(--blue-deep));
}

.range-slider input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  appearance: none;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--blue-deep);
  box-shadow: 0 7px 16px rgba(36, 126, 175, 0.26);
  cursor: grab;
  pointer-events: auto;
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--blue-deep);
  box-shadow: 0 7px 16px rgba(36, 126, 175, 0.26);
  cursor: grab;
  pointer-events: auto;
}

.map-layout {
  display: flex;
  flex-direction: row-reverse;
  gap: 16px;
  min-height: 78vh;
}

.map-card {
  flex: 1 1 100%;
  min-width: 0;
  padding: 10px;
  transition:
    flex-basis 0.34s ease,
    width 0.34s ease,
    transform 0.34s ease;
}

.map-layout.panel-open .map-card {
  flex-basis: calc(100% - var(--panel-width) - 16px);
}

#map {
  width: 100%;
  height: 78vh;
  min-height: 620px;
  border-radius: 22px;
  overflow: hidden;
  background: #e5ecd1;
}

.parcel-panel {
  position: relative;
  flex: 0 0 0;
  width: 0;
  max-width: 0;
  height: 78vh;
  min-height: 620px;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-18px);
  transition:
    flex-basis 0.34s ease,
    width 0.34s ease,
    max-width 0.34s ease,
    opacity 0.24s ease,
    transform 0.34s ease;
}

.map-layout.panel-open .parcel-panel {
  flex-basis: var(--panel-width);
  width: var(--panel-width);
  max-width: var(--panel-width);
  opacity: 1;
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(26, 33, 20, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 25px;
  line-height: 1;
  box-shadow: 0 10px 20px rgba(41, 46, 31, 0.14);
}

.panel-content {
  height: 100%;
  overflow: hidden;
  padding: 18px 16px;
}

.parcel-details {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  height: 100%;
  min-height: 0;
}

.parcel-details h2 {
  max-width: calc(100% - 38px);
  margin: 0 0 8px;
  font-size: clamp(26px, 2.5vw, 38px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.filter-warning {
  min-height: 16px;
  margin: -1px 0 8px;
  color: #c92727;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.filter-warning--empty {
  visibility: hidden;
}

.details-list {
  display: grid;
  gap: 7px;
}

.detail-row,
.price-card {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid rgba(26, 33, 20, 0.08);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
}

.detail-row span,
.price-card span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.detail-row strong {
  font-size: 18px;
  line-height: 1.2;
}

.photo-grid {
  display: grid;
  min-height: 0;
  margin: 10px 0;
  gap: 7px;
  align-content: stretch;
}

.photo-grid--1 {
  grid-template-columns: 1fr;
}

.photo-grid--2,
.photo-grid--4 {
  grid-template-columns: 1fr 1fr;
}

.photo-grid--3 {
  grid-template-columns: 1.08fr 0.92fr;
}

.photo-grid--3 .parcel-photo:first-child {
  grid-row: span 2;
}

.parcel-photo {
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(26, 33, 20, 0.08);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(234, 239, 217, 0.72));
  cursor: zoom-in;
}

.parcel-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  object-fit: cover;
  transform: scale(2);
  border-radius: 18px;
}

.price-card {
  margin-top: 0;
  background: color-mix(in srgb, var(--accent-warm) 20%, white);
}

.price-card strong {
  font-size: 27px;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.action-link--phone {
  grid-column: 1 / -1;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid rgba(26, 33, 20, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(35, 38, 20, 0.1);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.action-link img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.action-link:hover {
  transform: translateY(-1px);
  background: white;
  box-shadow: 0 14px 26px rgba(35, 38, 20, 0.16);
}

.panel-empty {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.leaflet-container {
  font: inherit;
}

.parcel-marker {
  background: transparent;
  border: none;
}

.emoji-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--marker-accent) 18%, white);
  box-shadow:
    0 16px 30px rgba(98, 83, 25, 0.18),
    0 0 0 7px color-mix(in srgb, var(--marker-accent) 18%, transparent);
  font-size: 24px;
  line-height: 1;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.emoji-pin:hover {
  transform: scale(1.07);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(11, 17, 14, 0.78);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.photo-lightbox[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lightbox-close,
.lightbox-tools button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  font-size: 31px;
  line-height: 1;
}

.lightbox-tools {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.lightbox-tools button {
  min-width: 42px;
  height: 42px;
  padding: 0 13px;
  font-size: 18px;
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(94vw, 1400px);
  height: min(88vh, 920px);
  overflow: hidden;
  touch-action: none;
}

.lightbox-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  will-change: transform;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
}

.lightbox-arrow--prev {
  left: 12px;
}

.lightbox-arrow--next {
  right: 12px;
}

@media (max-width: 1200px) {
  .hero-bar {
    grid-template-columns: 1fr;
  }

  .hero-bar h1 {
    white-space: normal;
  }

  .map-layout.panel-open .parcel-panel {
    flex-basis: 32%;
    width: 32%;
    max-width: 32%;
  }
}

@media (max-width: 960px) {
  .page-shell {
    padding: 14px;
  }

  .hero {
    margin-bottom: 12px;
  }

  .hero-bar {
    display: grid;
    grid-template-columns: 1fr;
    padding: 16px 18px;
  }

  .filters {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.48);
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .verified-toggle {
    justify-self: start;
  }

  .map-layout,
  .map-layout.panel-open {
    flex-direction: column-reverse;
    gap: 12px;
    min-height: auto;
  }

  .map-card,
  .map-layout.panel-open .map-card {
    flex: 0 0 auto;
    width: 100%;
  }

  #map {
    height: 68vh;
    min-height: 430px;
  }

  .parcel-panel,
  .map-layout.panel-open .parcel-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: 0;
    opacity: 0;
    transform: translateY(-16px);
  }

  .map-layout.panel-open .parcel-panel {
    height: min(58vh, 620px);
    width: 100%;
    max-width: 100%;
    opacity: 1;
    transform: translateY(0);
  }

  .panel-content {
    padding: 16px 14px;
  }

  .parcel-details {
    grid-template-rows: auto auto auto 1fr auto auto;
  }

  .parcel-details h2 {
    font-size: 24px;
  }

  .details-list {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .detail-row strong,
  .price-card strong {
    font-size: 16px;
  }

  .parcel-photo {
    margin: 0;
  }

  .parcel-photo img {
    min-height: 0;
    transform: scale(2);
  }

  .price-card strong {
    font-size: 23px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 10px;
  }

  .hero-bar,
  .map-card,
  .parcel-panel {
    border-radius: 22px;
  }

  #map {
    min-height: 390px;
    border-radius: 18px;
  }

  .map-layout.panel-open .parcel-panel {
    height: 64vh;
  }

  .details-list {
    grid-template-columns: 1fr;
  }

  .panel-actions {
    grid-template-columns: 1fr 1fr;
  }

  .verified-toggle {
    width: 100%;
  }

  .verified-toggle-text {
    display: inline;
  }

  .verified-toggle-text span {
    display: inline;
  }

  .verified-toggle-text span + span::before {
    content: " ";
  }

  .action-link:not(.action-link--phone) span {
    display: none;
  }

  .lightbox-tools {
    top: auto;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
  }

  .lightbox-close {
    top: 16px;
    right: 16px;
  }
}
