* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px; overflow: hidden; }

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

#wind-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
  display: none;
}

/* ── Control panel ─────────────────────────────────────────────────────── */

#panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 280px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  z-index: 10;
  transition: transform 0.2s ease;
}

#panel.hidden { transform: translateX(290px); }

#panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #1a5276;
  color: #fff;
  border-radius: 8px 8px 0 0;
  cursor: default;
}

#panel-title { font-weight: bold; font-size: 14px; }

#panel-toggle {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  transition: transform 0.2s;
}

#panel.hidden #panel-toggle { transform: rotate(180deg); }

.panel-section {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
}

.panel-section h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.panel-section label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #333;
}

.panel-section input[type=number] {
  width: 70px;
  padding: 3px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
}

#required-depth-display { font-size: 12px; color: #555; margin-top: 4px; }

select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 6px;
}

#current-level { font-size: 12px; color: #555; }

/* Time slider */

#time-display {
  font-size: 12px;
  color: #1a5276;
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
}

input[type=range] {
  width: 100%;
  cursor: pointer;
  accent-color: #1a5276;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}

#tide-level-display { font-size: 12px; color: #555; margin-top: 4px; text-align: center; }

/* Tide chart */

#tide-chart {
  display: block;
  width: 100%;
  height: 100px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #f8fbff;
}

/* Legend */

.legend { display: flex; flex-direction: column; gap: 4px; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 16px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.15); flex-shrink: 0; }

/* Layer toggles */

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  justify-content: flex-start !important;
}

.toggle input { cursor: pointer; }

/* Hover popup */

#feature-popup {
  position: absolute;
  background: rgba(255,255,255,0.97);
  border: 1px solid #aac;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  max-width: 220px;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  line-height: 1.5;
}

/* ── Bottom tide bar ───────────────────────────────────────────────────── */

#tide-bar {
  position: absolute;
  top: calc(100vh - 100px);
  left: 0;
  width: 100vw;
  height: 100px;
  background: #111e2b;
  border-top: 2px solid #1e3a55;
  z-index: 50;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  display: block;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  margin-bottom: 100px;
}

/* ── Tool buttons ──────────────────────────────────────────────────────── */

.tool-btn {
  margin-top: 5px;
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: pointer;
}
.tool-btn:hover { background: #e0e0e0; }

#feature-popup.hidden { display: none; }

#feature-popup strong { display: block; margin-bottom: 3px; font-size: 13px; color: #1a5276; }
