body {
  margin: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}
#map {
  position: absolute;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  transition: width 0.3s, margin-right 0.3s;
}

/* Loading overlay */
#boot-loader {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(2px);
}
#boot-loader .box {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 16px 18px;
  min-width: 260px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
  font-family: 'Inter','Segoe UI',system-ui,-apple-system,sans-serif;
}
#boot-loader .title { font-weight: 700; color: #111827; margin-bottom: 10px; }
#boot-loader .hint { font-size: 12px; color: #6b7280; margin-top: 8px; }
#boot-loader .progress { width: 100%; height: 8px; background:#e5e7eb; border-radius:999px; overflow:hidden; }
#boot-loader .progress .bar { height:100%; width:0%; background:linear-gradient(90deg,#2563eb,#06b6d4); transition: width .2s ease; }

/* boot-loader styles removed when reverting to Leaflet */
#map.shifted {
  width: calc(100vw - 350px);
  margin-right: 0;
}
#info-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  overflow-y: auto;
  z-index: 1001;
  transition: transform 0.3s ease;
  border-left: 1px solid #e8e9ea;
  padding: 28px 20px 40px 20px;
}
#info-panel.hidden {
  transform: translateX(100%);
}
.popup-table { font-size: 12px; }
.popup-table th, .popup-table td { padding: 2px 6px; }
.popup-table th { text-align: left; }
#info-panel h2 {
  margin-top: 0;
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #1a1a1a;
  font-weight: 700;
  letter-spacing: -0.025em;
}
#info-panel table {
  width: 100%;
  border-collapse: collapse;
}
#info-panel th, #info-panel td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f1f2;
  font-size: 14px;
}
#info-panel th {
  text-align: left;
  color: #6b7280;
  width: 50%;
  font-weight: 600;
  font-size: 13px;
}
#info-panel td {
  color: #1f2937;
  font-weight: 500;
}

/* Left-side detail overlay for city image */
#detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 380px; /* will be updated via JS to match info-panel width */
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 950; /* below the info panel (1001) and UI controls (~1000), above the map */
  transition: transform 0.3s ease, opacity 0.25s ease;
  opacity: 1;
  transform: translate3d(-100%, 0, 0);
  will-change: transform;
  transform-style: preserve-3d;
}

#detail-overlay.hidden {
  display: none;
  opacity: 0;
}

/* Overlay enter state: slide in from left */
#detail-overlay.open {
  transform: translate3d(0, 0, 0);
}

/* Image element inside overlay for crisp rendering */
#detail-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill; /* 不裁切：拉伸/填充整个区域 */
  image-rendering: auto; /* prefer quality for photos */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Center loading modal */
#loading-modal {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

#loading-modal .box {
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#overlay-back {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  z-index: 1002;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 48px;
  height: 144px; /* 高度为原来的三倍 */
  padding: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
  color: rgba(255,255,255,0.95);
  text-decoration: none;
  border-radius: 12px; /* 方形，略带圆角 */
  font-weight: 700;
  font-size: 24px;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.5);
  cursor: pointer;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  transition: width 0.35s ease, height 0.35s ease, box-shadow 0.25s ease, background 0.25s ease;
}

#overlay-back:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.32), rgba(255,255,255,0.18));
  box-shadow: 0 12px 28px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
  height: calc(100vh - 32px);  /* 悬浮时上下各留 16px 空隙 */
  width: 96px;   /* 悬浮时宽度加倍 */
}

/* 扁长双箭头图标尺寸（更扁更长的 << 形状） */
#overlay-back .chevrons {
  width: 28px;
  height: 12px;
  opacity: 0.95;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
}

#overlay-back:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.45), 0 8px 24px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.5);
}

/* Weighted FDI container styling */
.fdi-container {
  margin-top: 20px;
  padding-bottom: 30px;
}

.fdi-container table {
  width: 100%;
  border-collapse: collapse;
}

/* Weighted FDI header styling */
#info-panel tr.fdi-header th {
  text-align: center;
  font-weight: 700;
  font-size: 20px;
  color: #2563eb;
  padding: 16px 10px;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-bottom: 2px solid #2563eb;
  border-radius: 8px 8px 0 0;
}

/* Weighted FDI value styling */
#info-panel tr.fdi-value th {
  text-align: center;
  font-weight: 800;
  font-size: 28px;
  color: #2563eb;
  padding: 20px 10px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: 0 0 8px 8px;
}

/* Custom marker styles */
.marker-strong {
  filter: hue-rotate(308deg) saturate(1.5) brightness(0.9) !important;
}

.marker-medium {
  filter:hue-rotate(173deg) saturate(1.2) brightness(1.1) !important;
}

.marker-weak {
  filter: grayscale(1.7) brightness(1.2) !important;
}

/* Marker hover effects */
.leaflet-marker-icon:hover {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

/* Legend styles */
#legend {
  position: absolute;
  bottom: 36px; /* move a bit more up */
  left: 20px; /* move a bit more to the left */
  background: rgba(255, 255, 255, 0.98);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  min-width: 280px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#legend h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #1f2937;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: #4b5563;
  font-weight: 500;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-right: 14px;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.legend-item span {
  line-height: 1.3;
} 

/* Mobile and responsive design */
@media (max-width: 768px) {
  /* Home button responsive */
  body > div:first-child {
    top: 16px !important;
    right: 16px !important;
  }
  
  body > div:first-child a {
    padding: 10px 16px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
  }
  
  body > div:first-child svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* Legend responsive */
  #legend {
    bottom: 16px !important;
    left: 16px !important;
    right: 16px !important;
    min-width: auto !important;
    padding: 16px !important;
    border-radius: 12px !important;
  }
  
  #legend h3 {
    font-size: 15px !important;
    margin-bottom: 12px !important;
  }
  
  .legend-item {
    font-size: 13px !important;
    margin-bottom: 10px !important;
  }
  
  .legend-color {
    width: 16px !important;
    height: 16px !important;
    margin-right: 12px !important;
  }

  /* Info panel responsive */
  #info-panel {
    width: 100% !important;
    padding: 20px 16px 40px 16px !important;
  }
  /* When panel takes full width, hide the left image overlay */
  #detail-overlay { display: none !important; }
  
  #map.shifted {
    width: 100vw !important;
    margin-right: 0 !important;
  }
  
  #info-panel h2 {
    font-size: 1.3rem !important;
    margin-bottom: 16px !important;
  }
  
  #info-panel th, #info-panel td {
    padding: 6px 8px !important;
    font-size: 13px !important;
  }
  
  #info-panel th {
    font-size: 12px !important;
  }
  
  #info-panel tr.fdi-header th {
    font-size: 18px !important;
    padding: 12px 8px !important;
  }
  
  #info-panel tr.fdi-value th {
    font-size: 24px !important;
    padding: 16px 8px !important;
  }
}

/* Hide legend and zoom controls when panel is open */
body.panel-open #legend { display: none !important; }
body.panel-open .leaflet-control-zoom { display: none !important; }

@media (max-width: 480px) {
  /* Extra small screens */
  #legend {
    bottom: 16px !important;
    padding: 12px !important;
  }
  
  #legend h3 {
    font-size: 14px !important;
  }
  
  .legend-item {
    font-size: 12px !important;
    margin-bottom: 8px !important;
  }
  
  .legend-color {
    width: 14px !important;
    height: 14px !important;
    margin-right: 10px !important;
  }
  
  #info-panel {
    padding: 16px 12px 40px 12px !important;
  }
  
  #info-panel h2 {
    font-size: 1.2rem !important;
  }
  
  #info-panel tr.fdi-header th {
    font-size: 16px !important;
  }
  
  #info-panel tr.fdi-value th {
    font-size: 22px !important;
  }
}

@media (min-width: 1200px) {
  /* Large screens */
  #info-panel {
    width: 420px;
  }
  
  #map.shifted {
    width: calc(100vw - 420px);
  }
}