:root {
  --bg: #0b1622;
  --panel: #0f1f30;
  --line: #1d3247;
  --text: #e8f0f7;
  --muted: #8aa0b6;
  --accent: #4cc3ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

/* Make the land/water edge and borders pop on the dark base. The base land
   tiles get a contrast lift; the labels/borders pane is brightened further. */
.leaflet-tile-pane {
  filter: brightness(var(--base-brightness, 2.5)) contrast(1.05) saturate(0.9);
}
.leaflet-labels-pane {
  filter: brightness(1.45) contrast(1.1);
}

/* Keep the zoom buttons clear of the topbar brand (they share the top-left). */
.leaflet-top.leaflet-left .leaflet-control-zoom {
  margin-top: 60px;
}

/* Leaflet attribution / zoom contrast on the dark basemap */
.leaflet-control-attribution {
  background: rgba(11, 22, 34, 0.7) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a {
  color: var(--accent) !important;
}

#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(11, 22, 34, 0.92), rgba(11, 22, 34, 0));
  pointer-events: none;
}
#topbar .brand {
  font-size: 18px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
#topbar .brand span {
  color: var(--muted);
  font-size: 13px;
}
.tb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.status {
  font-size: 13px;
  color: var(--muted);
  background: rgba(15, 31, 48, 0.8);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* Display settings popover */
#settings-panel {
  position: absolute;
  top: 52px;
  right: 16px;
  z-index: 800;
  background: rgba(15, 31, 48, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 230px;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
#settings-panel.hidden {
  display: none;
}
.set-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.set-row label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.set-row label span {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.set-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.set-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.set-pills .toggle {
  font-size: 12px;
  padding: 4px 10px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
  background: rgba(15, 31, 48, 0.66);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px 5px;
}
.legend .bar {
  width: 200px;
  height: 8px;
  border-radius: 4px;
  /* gradient set inline from the wind stops in renderLegend() */
}
.legend .ticks {
  position: relative;
  width: 200px;
  height: 12px;
  font-variant-numeric: tabular-nums;
}
.legend .ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}
.legend-unit {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

/* smooth wind-speed colour raster (under the particles) */
.wind-color {
  position: absolute;
  pointer-events: none;
}

/* ---- Windy-style horizontal forecast strip ---- */
#forecast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 700;
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease;
  --lw: 84px; /* width of the day-label column */
}
#forecast.hidden {
  transform: translateY(110%);
}

.toggle {
  background: rgba(15, 31, 48, 0.85);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
}
.toggle.active {
  background: var(--accent);
  color: #04121f;
  border-color: var(--accent);
  font-weight: 600;
}

.fc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}
#fc-play {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #04121f;
  font-size: 13px;
  cursor: pointer;
  flex: 0 0 auto;
}
.fc-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 132px;
}
.fc-title {
  font-size: 15px;
  font-weight: 600;
}
.fc-sub {
  font-size: 12px;
  color: var(--muted);
}
.fc-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  padding: 5px 12px;
  background: #11263b;
  color: var(--text);
  border: none;
  cursor: pointer;
  font-size: 12px;
}
.seg button.active {
  background: var(--accent);
  color: #04121f;
  font-weight: 600;
}
.fc-model {
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.fc-model select {
  background: #11263b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}
#fc-clear {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
#fc-clear:hover {
  color: var(--text);
}

/* Vertical day grid: rows = days, columns = local hour 0..23.
   Smooth colour bands for every hour; the focused day expands to show numbers. */
.fc-grid {
  display: flex;
  flex-direction: column;
}
.fc-axis,
.fc-row {
  display: grid;
  grid-template-columns: var(--lw) 1fr;
}
.fc-axis {
  border-bottom: 1px solid var(--line);
}
.fc-cells {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
}
.fc-axis-h span {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}
.fc-axis-h span.t3 {
  box-shadow: inset 1px 0 0 var(--line);
}

.fc-rl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--text);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}
.fc-rl.axis {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 9px;
}
.fc-rl-max {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 0 5px;
  font-variant-numeric: tabular-nums;
}

.fc-rows {
  max-height: 212px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.fc-row {
  height: 26px;
  border-bottom: 1px solid rgba(11, 22, 34, 0.5);
  transition: height 0.15s ease;
}
.fc-row.focused {
  height: 64px;
}
.fc-row .fc-rl {
  font-weight: 600;
}

.fc-c {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: ew-resize;
  overflow: hidden;
}
/* subtle vertical line every 3 hours (spans all rows as cells stack) */
.fc-c.t3 {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.1);
}
.fc-c.empty {
  background: transparent !important;
  cursor: default;
}
/* numbers only on the focused day; everyone else is a clean colour band */
.fc-row:not(.focused) .fc-c > * {
  display: none;
}
.fc-dv {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fc-arrow {
  font-size: 13px;
  line-height: 1;
}
.fc-dg {
  font-size: 9px;
  line-height: 1;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}
/* focused-day stack: weather+temp, wind, gust (time comes from the 3h axis) */
.fc-wx {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fc-ico {
  font-size: 12px;
  line-height: 1;
}
.fc-c.cursor {
  outline: 2px solid #fff;
  outline-offset: -2px;
  z-index: 3;
}
.fc-c.now::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}

/* ViVA station markers */
.viva-marker {
  background: transparent;
  border: none;
}
.viva-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.viva-dot .vd-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.viva-dot .vd-arrow {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.viva-dot .vd-calm {
  color: #e8f0f7;
  font-size: 18px;
}
.viva-dot .vd-val {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(4, 18, 31, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}
.fc-msg {
  padding: 30px 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
}

/* Kitesurf spot markers */
.kite-marker {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  white-space: nowrap;
  cursor: pointer;
}
.kite-marker .kite-pin {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 2px #000);
}
.kite-marker .kite-name {
  margin-left: 3px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(232, 240, 247, 0.85);
  background: rgba(11, 22, 34, 0.55);
  border-radius: 4px;
  padding: 0 5px;
  text-shadow: 0 0 2px #000;
}
.kite-marker:hover .kite-name {
  color: #fff;
  background: rgba(11, 22, 34, 0.85);
}
/* Hide spot names when zoomed out; the pin alone is enough at low zoom. */
#map.kite-labels-off .kite-name {
  display: none;
}

.arrow {
  display: inline-block;
}
