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

#bike-legend {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,0.94);
  padding: 8px 12px 6px;
  border-radius: 6px;
  z-index: 10;
  font: 12px/1.5 sans-serif;
  color: #333;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  max-width: 240px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
#bike-legend .title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
/* Collapsible: the header stays, a chevron shows the state, the body hides. */
#bike-legend-title { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; gap: 8px; }
#bike-legend-title::after {
  content: ''; flex-shrink: 0;
  width: 6px; height: 6px; margin: 0 2px 3px 6px;
  border-right: 2px solid #666; border-bottom: 2px solid #666;
  transform: rotate(45deg); transition: transform 0.15s;
}
#bike-legend.collapsed #bike-legend-title { margin-bottom: 0; }
#bike-legend.collapsed #bike-legend-title::after { transform: rotate(-45deg); margin-bottom: -2px; }
#bike-legend.collapsed #bike-legend-body { display: none; }
#bike-legend .sub { font-weight: normal; color: #777; font-size: 11px; }
#bike-legend .hint { color: #777; font-size: 11px; margin-top: 6px; border-top: 1px solid #e5e5e5; padding-top: 4px; }
.bike-row {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; margin: 2px 0;
}
.bike-row.off { opacity: 0.4; }
.bike-row .swatch {
  width: 36px; height: 14px; flex-shrink: 0; position: relative;
}
/* two-line look: wide dark outline with a narrower light fill on top */
.bike-row .swatch .outline {
  position: absolute; left: 0; right: 0; top: 2px; height: 10px; border-radius: 5px;
}
.bike-row .swatch .outline.dashed {
  background: repeating-linear-gradient(90deg, var(--o) 0 7px, var(--bg) 7px 10px);
}
.bike-row .swatch .fill {
  position: absolute; left: 2px; right: 2px; top: 5px; height: 4px; border-radius: 2px;
}
.bike-row .swatch .casing {
  position: absolute; left: 3px; right: 3px; top: 0; height: 2px; opacity: 0.7;
}

#bike-tip {
  position: fixed;
  background: rgba(255,255,255,0.96);
  color: #222;
  padding: 6px 10px;
  border-radius: 4px;
  font: 12px/1.4 sans-serif;
  pointer-events: none;
  z-index: 9999;
  display: none;
  max-width: 260px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
#bike-tip b { font-size: 13px; }

.maplibregl-popup-content { font: 12px/1.4 sans-serif; max-width: 280px; }
.maplibregl-popup-content h4 { margin: 0 0 4px; font-size: 13px; }
.maplibregl-popup-content table { border-collapse: collapse; }
.maplibregl-popup-content td { padding: 0 6px 0 0; vertical-align: top; }
.maplibregl-popup-content td:first-child { color: #777; white-space: nowrap; }

/* Station legend section */
#bike-legend .title.station { margin-top: 6px; border-top: 1px solid #e5e5e5; padding-top: 5px; cursor: pointer; user-select: none; }
#bike-legend .title.station.off { opacity: 0.4; }
.station-row { display: flex; align-items: center; margin: 2px 0; }
.station-row.sub { color: #777; font-size: 11px; }
.station-row i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin: 0 8px 0 11px; border: 1px solid rgba(0,0,0,0.5); box-sizing: border-box; }
.station-row i.spots { background: rgba(42,110,200,0.7); }
.station-row i.bikes { background: rgba(33,139,51,0.7); }

/* Station donuts (d3 SVG over the MapLibre canvas), see stations.js */
svg.station-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
svg.station-layer g.station { pointer-events: all; cursor: pointer; }
svg.station-layer g.station circle.station-inner { fill: rgba(220,220,220,0.7); }
svg.station-layer g.station:hover circle.station-inner { fill: #dcdcdc; }
svg.station-layer g.station path.status { stroke: #000; }
svg.station-layer g.station path.spots { fill: rgba(42,110,200,0.7); }
svg.station-layer g.station:hover path.spots { fill: rgb(42,110,200); }
svg.station-layer g.station path.bikes { fill: rgba(33,139,51,0.7); }
svg.station-layer g.station:hover path.bikes { fill: #218b33; }
svg.station-layer g.station path.inactive { fill: rgba(89,89,89,0.7); }
svg.station-layer g.station path.text { fill: none; stroke: none; }
svg.station-layer g.station text.text { text-anchor: middle; font-family: sans-serif; fill: #111; pointer-events: none; }
svg.station-layer g.station text.range { font-weight: bold; fill: #222; }
svg.station-layer g.station text.range tspan.range-low { fill: rgb(185,20,20); }
svg.station-layer g.station text.range tspan.range-short { fill: rgb(205,80,10); }
svg.station-layer g.station image.station-icon { pointer-events: none; }

/* E-bike ring segments by remaining range (EBIKE_BANDS in stations.js); legend swatches share the classes */
svg.station-layer g.station path.ebikes.range-long, .station-row i.ebikes.range-long { fill: rgba(255,210,0,0.7); background: rgba(255,210,0,0.7); }
svg.station-layer g.station path.ebikes.range-mid, .station-row i.ebikes.range-mid { fill: rgba(255,160,0,0.7); background: rgba(255,160,0,0.7); }
svg.station-layer g.station path.ebikes.range-short, .station-row i.ebikes.range-short { fill: rgba(240,95,20,0.7); background: rgba(240,95,20,0.7); }
svg.station-layer g.station path.ebikes.range-low, .station-row i.ebikes.range-low { fill: rgba(205,30,30,0.7); background: rgba(205,30,30,0.7); }
svg.station-layer g.station path.ebikes.range-unknown, .station-row i.ebikes.range-unknown { fill: rgba(255,230,120,0.7); background: rgba(255,230,120,0.7); }
svg.station-layer g.station:hover path.ebikes.range-long { fill: rgb(255,210,0); }
svg.station-layer g.station:hover path.ebikes.range-mid { fill: rgb(255,160,0); }
svg.station-layer g.station:hover path.ebikes.range-short { fill: rgb(240,95,20); }
svg.station-layer g.station:hover path.ebikes.range-low { fill: rgb(205,30,30); }
svg.station-layer g.station:hover path.ebikes.range-unknown { fill: rgb(255,230,120); }
