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

#map {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Controls */
#controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255,255,255,0.95);
  padding: 6px 8px;
  border-top: 1px solid #ccc;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
  font-size: clamp(10px, 2vw, 14px);
  gap: 8px;
  box-sizing: border-box;
  z-index: 1000;
}

/* Inputs inside controls */
#controls label,
#controls select,
#controls input[type=range],
#controls input[type=number],
#controls button {
  font-size: inherit;
  max-width: 100%;
  flex-shrink: 1;
}

#controls label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Sliders and number inputs */
#controls input[type=range] {
  width: 80px;
}

#controls input[type=number] {
  width: 50px;
  margin-top: 2px;
}

/* Dropdowns */
#controls select {
  width: auto;
  max-width: 100%;
}

/* Play button */
#controls button {
  padding: 4px 8px;
}

/* Legend */
#legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
}

#legend span {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #000;
}

/* Timeline range */
#timeline {
  width: clamp(100px, 30vw, 200px);
  margin: 0 8px;
}

/* Responsive adjustments */
@media (orientation: portrait) {
  #controls {
    flex-direction: row;
    flex-wrap: wrap;
    font-size: 11px;
    padding: 6px 4px;
    gap: 4px;
  }

  #controls label {
    font-size: inherit;
  }

  #controls input[type=range] {
    width: 70px;
  }

  #controls input[type=number] {
    width: 40px;
  }

  #timeline {
    width: 100%;
    max-width: 300px;
  }

  #legend span {
    width: 10px;
    height: 10px;
  }
}
