* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#map { position: absolute; inset: 0; }

.panel {
  position: absolute;
  z-index: 2;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
}

.title-card {
  top: 12px;
  left: 12px;
  max-width: 340px;
}

.title-card h1 {
  margin: 0 0 6px;
  font-size: 18px;
}

.title-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #374151;
}

.legend {
  bottom: 34px;
  left: 12px;
  min-width: 200px;
  transition: opacity 0.25s ease;
}

.legend.hidden {
  opacity: 0;
  pointer-events: none;
}

.legend h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.legend .gradient {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(to right, #fff7ed, #7c2d12);
}

.legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #4b5563;
  margin-top: 3px;
}

.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12.5px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
}

.legend .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  opacity: 0.75;
  flex: none;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.credits {
  bottom: 0;
  right: 0;
  border-radius: 6px 0 0 0;
  padding: 4px 10px;
  font-size: 11px;
  color: #4b5563;
}

.credits a { color: #1d4ed8; text-decoration: none; }
.credits a:hover { text-decoration: underline; }

.maplibregl-popup-content {
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 6px;
}

@media (max-width: 640px) {
  .title-card { max-width: calc(100% - 24px); }
  .title-card p { display: none; }
}
