html, body { height: 100%; margin: 0; }
#map { height: 100vh; width: 100%; }

.popup {
  font-size: 12px;
  line-height: 1.4;
}
.popup .title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.popup .meta {
  color: #555;
  margin-bottom: 4px;
}
.popup table {
  width: 100%;
  border-collapse: collapse;
}
.popup th, .popup td {
  border: 1px solid #d0d0d0;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}
.popup th {
  width: 35%;
  background: #f8fafc;
  font-weight: 600;
}
.popup .section {
  margin-top: 6px;
}
.popup .empty {
  color: #888;
}
.marker-label {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  color: #222;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.marker-label.leaflet-tooltip {
  border: 1px solid #c8c8c8;
  pointer-events: auto;
  cursor: pointer;
}
.marker-label .label-title {
  display: block;
  font-weight: 700;
}
.marker-label .label-price {
  display: block;
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}
.marker-label-land-public {
  background: #dbeafe;
  border-color: #93c5fd;
}
.marker-label-land-pref {
  background: #dcfce7;
  border-color: #86efac;
}
.marker-label-transaction {
  background: #fef3c7;
  border-color: #fcd34d;
}
.marker-label-contract {
  background: #ffe4e6;
  border-color: #fda4af;
}
.leaflet-control-locate {
  margin-bottom: 10px;
}
.locate-button {
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.locate-button svg {
  width: 18px;
  height: 18px;
  stroke: #374151;
  stroke-width: 2;
  fill: none;
}
.locate-button:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.locate-button:active {
  transform: translateY(1px);
}

.menu-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1001;
  width: 72px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}
.menu-backdrop.open {
  opacity: 1;
  pointer-events: none;
}
.side-menu {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 320px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(10px);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 1002;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.side-menu.open {
  transform: translateX(0);
}
.menu-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.menu-header {
  font-size: 16px;
  font-weight: 700;
}
.menu-catch {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: 12px;
  color: #1f2937;
  line-height: 1.5;
  display: grid;
  gap: 6px;
}
.menu-catch strong {
  font-weight: 700;
}
.menu-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: #1f2937;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.menu-close:active {
  transform: translateY(1px);
}
.menu-label {
  display: block;
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
}
.menu-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}
.menu-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.menu-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.menu-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.menu-button {
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.8);
  color: #1f2937;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.menu-button:hover {
  filter: brightness(0.98);
}
.menu-button:active {
  transform: translateY(1px);
}
.menu-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}
.menu-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.menu-license {
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
  display: grid;
  gap: 4px;
}
.menu-license a {
  color: #2563eb;
  text-decoration: none;
}
.menu-license a:hover {
  text-decoration: underline;
}
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
  max-width: min(520px, 70vw);
}
.details-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  z-index: 2000;
}
.details-modal.open {
  display: flex;
}
.details-container {
  width: min(720px, 94%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.3);
  padding: 16px;
  max-height: 85vh;
  overflow: auto;
}
.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.details-title {
  font-size: 16px;
  font-weight: 700;
}
.details-body .popup {
  font-size: 13px;
}
.menu-section {
  margin-top: 12px;
}
.menu-subtitle {
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
}
.menu-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.menu-option input {
  margin: 0;
}
.menu-tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #c8c8c8;
  background: #ffffff;
  font-size: 12px;
}
.menu-legend {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid transparent;
}
.legend-land-public {
  background: #60a5fa;
  border-color: #2563eb;
}
.legend-land-pref {
  background: #4ade80;
  border-color: #16a34a;
}
.legend-transaction {
  background: #fbbf24;
  border-color: #d97706;
}
.legend-contract {
  background: #f87171;
  border-color: #dc2626;
}

@media (max-width: 768px) {
  .side-menu {
    width: 100vw;
    max-width: 100vw;
    height: 55vh;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    border-radius: 16px 16px 0 0;
    gap: 8px;
    transform: translateY(100%);
  }
  .side-menu.open {
    transform: translateY(0);
  }
  .menu-toggle {
    top: auto;
    left: auto;
    bottom: 16px;
    right: 12px;
    width: 80px;
    height: 48px;
    font-size: 14px;
  }
  .menu-close {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
  .menu-label {
    font-size: 13px;
  }
  .menu-input {
    font-size: 15px;
    padding: 10px 12px;
  }
  .menu-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .menu-button {
    width: 100%;
    font-size: 13px;
    padding: 10px 12px;
  }
  .menu-grid {
    grid-template-columns: 1fr;
  }
  .marker-label {
    font-size: 10px;
    padding: 2px 5px;
  }
  .marker-label .label-price {
    font-size: 9px;
  }
  .leaflet-popup-content {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .leaflet-popup-close-button {
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 32px;
  }
}
