body {
  margin: 0;
  padding: 0;
}
#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}
#legend {
  position: absolute;
  bottom: 80px;
  left: 5px;
  right: 5px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  font-family: sans-serif;
  font-size: 14px;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  width: 50%;
  left: 25%;
}
#legend .legend-item {
  display: flex;
  align-items: center;
  margin: 4px 8px;
}
#footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  font-family: sans-serif;
  font-size: 12px;
  line-height: 1.4;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}
#footer p {
  margin: 0;
  flex: 1;
}
#title-box {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 16px;
  border-radius: 4px;
  text-align: center;
  font-family: sans-serif;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
#title-box h1 {
  margin: 0;
  font-size: 18px;
}
#title-box h2 {
  margin: 0;
  font-size: 14px;
  font-weight: normal;
}
#controls {
  position: absolute;
  top: 70px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px;
  font-family: sans-serif;
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
#controls label {
  font-size: 14px;
}
#controls select {
  margin-top: 4px;
  font-size: 14px;
}
.color-box {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  border: 1px solid #444;
}
#footer button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  margin-left: 12px;
}
@media (max-width: 600px) {
  #title-box {
    top: 5px;
    left: 5px;
    right: 5px;
    transform: none;
    width: auto;
    padding: 6px 10px;
  }
  #controls {
    top: 60px;
    left: 5px;
    right: 5px;
    width: auto;
    padding: 6px 10px;
    text-align: center;
  }
  #legend {
    bottom: 120px;
    padding: 6px 8px;
    justify-content: center;
    width: 90%;
    left: 5%;
  }
  #footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 10px;
  }
}
/* ---------- Chart panel ---------- */
#chart-panel {
  position: absolute;
  width:  clamp(300px, 42vw, 520px); 
  height: clamp(220px, 38vh, 340px);
  top: 22vh;
  right: 3vw;
  left: auto;
  background: rgba(255,255,255,0.97);
  border: 1px solid #888;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  padding: 10px 12px 16px;
  z-index: 3;
  display: none;
  font-family: var(--chart-font, "Inter", "Helvetica Neue", Arial, sans-serif);
}

#chart-panel-header {
  cursor: move;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  letter-spacing: .2px;
}

#chart-canvas {
  width: 100% !important;  
  height: calc(100% - 26px) !important;
}

#chart-panel-close {
  float: right;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
} 
/* pinch-zoom hint */
#zoom-hint {
  position: absolute;
  max-width: 25%;
  max-height: 25%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.7;               /* 70% transparent */
  pointer-events: none;       /* clicks pass through */
  z-index: 1000000;              /* on top of everything */
  transition: opacity 0.5s ease;
}
