* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: sans-serif; }
#map { width: 100vw; height: 100vh; }

/* Toggle button — always visible, sits at top-right */
#panel-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #1a1a2e;
  transition: background 0.15s;
}
#panel-toggle:hover { background: #f0f0f0; }

#panel {
  position: absolute;
  top: 56px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 14px 16px;
  width: 240px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Slide + fade transition */
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 1;
  transform: scale(1);
}

#panel.collapsed {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#panel h2 { font-size: 14px; font-weight: 600; color: #1a1a2e; }

.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group label { font-size: 12px; color: #555; }

select, input[type=range] { width: 100%; }
select { padding: 4px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

.toggle-row { display: flex; justify-content: space-between; align-items: center; }
.toggle-label { font-size: 12px; color: #555; }

.contour-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.contour-legend-item { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #555; }
.contour-legend-line { flex-shrink: 0; width: 28px; border-radius: 2px; }
.contour-legend-line.minor { height: 1px; background: #888; }
.contour-legend-line.major { height: 2px; background: #333; }

.contour-label {
  font-size: 10px;
  font-family: monospace;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.4;
}

.range-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.range-row input[type=range] { flex: 1; }
.range-row span { font-size: 11px; color: #333; width: 48px; text-align: right; white-space: nowrap; }

#legend {
  display: flex;
  align-items: center;
  gap: 8px;
}
#legend-bar {
  flex: 1;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(to right, #081450, #0f46a0, #2882c3, #64b9d7, #73b478, #6eaa50, #91af37, #b48c41, #9b5523, #783219, #9b8773);
}
.legend-labels { display: flex; justify-content: space-between; font-size: 10px; color: #555; }

#status { font-size: 11px; color: #888; min-height: 16px; }

#export-btn {
  width: 100%;
  padding: 7px 0;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
}
#export-btn:hover { background: #2e2e50; }
#export-btn:disabled { background: #aaa; cursor: default; }

#bounds-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.bounds-key { color: #888; width: 14px; padding-right: 2px; }
.bounds-val { color: #1a1a2e; font-weight: 600; font-variant-numeric: tabular-nums; padding-right: 8px; }


#statusbar {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 30, 0.72);
  color: #e8e8f0;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-family: monospace;
  pointer-events: none;
  display: none;
  white-space: nowrap;
  z-index: 1000;
  letter-spacing: 0.03em;
}

#statusbar .elev { color: #7dd3fc; font-weight: 600; }
