/* ===== The Fisherman's Almanac — dark mode ===== */
:root {
  --navy:        #0a0a0c;
  --navy-2:      #141416;
  --navy-3:      #232326;
  --gold:        #f2b705;
  --gold-dim:    #caa100;
  --teal:        #00b4a0;
  --teal-dim:    #0c7d72;
  --amber:       #f5a623;
  --text:        #e6eef2;
  --text-dim:    #8aa3b0;

  --hot:   #f5853a;
  --good:  #3ec46d;
  --fair:  #e8c33a;

  --wind-ok:   #3ec46d;
  --wind-warn: #e8c33a;
  --wind-bad:  #e8533a;

  --sidebar-w: 360px;
  --radius: 14px;
}

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

html, body { height: 100%; }

body {
  font-family: "Barlow", system-ui, sans-serif;
  background: var(--navy);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ===== Alert banner ===== */
#alert-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--wind-bad);
}
#alert-banner.advisory { background: var(--amber); color: var(--navy); }
#alert-banner.hidden { display: none; }
#alert-banner-text { flex: 1; }
#alert-banner-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

h1, h2, h3, .section-title, .logo-text h1 {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  letter-spacing: 0.4px;
}

#app {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy-2);
  border-right: 1px solid var(--navy-3);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
}

#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--navy-3), var(--navy-2));
  border-bottom: 1px solid var(--navy-3);
  position: relative;
  overflow: hidden;
}

/* Soft glowing arc behind the logo, echoing the reference's hero glow. */
#app-header::before {
  content: "";
  position: absolute;
  top: -70%;
  left: 50%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
  opacity: 0.16;
  filter: blur(24px);
  transform: translateX(-50%);
  pointer-events: none;
}

.logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }

.logo-mark {
  font-size: 30px;
  color: var(--gold);
  line-height: 1;
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
}

.logo-text .location {
  font-size: 13px;
  color: var(--amber);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

#sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Current weather panel ===== */
#current-weather .section-title { margin-bottom: 6px; }

#current-weather .cw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#current-weather .cw-header .section-title { margin-bottom: 0; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-head .section-title { margin-bottom: 0; }

.wx-refresh {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  padding: 4px;
  margin: -4px -4px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  min-width: 32px;
  min-height: 32px;
  touch-action: manipulation;
}
.wx-refresh:hover { color: var(--text); }
.wx-refresh.refreshing { color: var(--text-dim); cursor: default; }
.wx-refresh.refreshing svg { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

#current-weather .wx-station {
  font-size: 12px;
  color: var(--text-dim);
  margin: -2px 0 6px;
  line-height: 1.2;
}

#current-weather-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: center;
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 10px 12px;
}

#current-weather-body .wx-stat { align-items: center; }

#current-weather-body .wx-barb {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Species filter chips ===== */
#species-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  background: var(--navy-3);
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  min-height: 32px;
  touch-action: manipulation;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover { color: var(--text); }

.chip.active {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

/* ===== Spot cards ===== */
#spot-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.empty-spots {
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
  text-align: center;
  padding: 14px 8px;
}

.spot-card {
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  border-left: 4px solid var(--text-dim);
  transition: transform 0.12s, background 0.12s;
}

.spot-card:hover { background: #333333; transform: translateX(2px); }
.spot-card.selected { outline: 2px solid var(--gold); }

.spot-card.rating-hot  { border-left-color: var(--hot); }
.spot-card.rating-good { border-left-color: var(--good); }
.spot-card.rating-fair { border-left-color: var(--fair); }

.spot-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.spot-card-name {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 17px;
  font-weight: 600;
}

.rating-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--navy);
  white-space: nowrap;
}

.rating-badge.rating-hot  { background: var(--hot); }
.rating-badge.rating-good { background: var(--good); }
.rating-badge.rating-fair { background: var(--fair); }

.spot-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.score-pill {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--navy);
}
.score-pill.rating-hot  { color: var(--hot); }
.score-pill.rating-good { color: var(--good); }
.score-pill.rating-fair { color: var(--fair); }

.spot-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 5px;
}

.species-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.species-tag {
  font-size: 11px;
  background: var(--navy);
  color: var(--teal);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ===== Tide chart ===== */
.section-title {
  font-size: 15px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 8px;
}

#tide-chart {
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 12px 10px 6px;
}

.tide-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 90px;
  position: relative;
}

.tide-bar {
  flex: 1;
  background: var(--teal-dim);
  border-radius: 2px 2px 0 0;
  min-height: 3px;
  transition: background 0.15s;
}

.tide-bar.now { background: var(--teal); }

.tide-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  padding-left: 40px;
}

.loading { color: var(--text-dim); font-size: 13px; }

/* ===== Tide controls (date + station) ===== */
#tide-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-row label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  flex: 0 0 52px;
}

.date-nav { display: flex; flex: 1; align-items: center; gap: 4px; }
.date-nav #tide-date { flex: 1; }

.date-arrow {
  flex: 0 0 auto;
  background: var(--navy-3);
  color: var(--teal);
  border: 1px solid var(--teal-dim);
  border-radius: 6px;
  min-width: 32px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.date-arrow:hover { border-color: var(--gold); color: var(--text); }
.date-arrow:disabled { opacity: 0.35; cursor: default; color: var(--text-dim); }

#station-select,
#tide-date {
  flex: 1;
  min-width: 0;
  background: var(--navy-3);
  color: var(--text);
  border: 1px solid var(--teal-dim);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: "Barlow", sans-serif;
  font-size: 13px;
  min-height: 36px;
  cursor: pointer;
  color-scheme: dark;
}

#station-select {
  cursor: text;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%2300b4a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 6 6 11 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-color: var(--navy-3);
  padding-right: 28px;
}
#station-select::-webkit-calendar-picker-indicator { opacity: 0; }

#station-select:focus,
#tide-date:focus {
  outline: none;
  border-color: var(--gold);
}

/* ===== Moon + solunar ===== */
#moon-solunar { margin-top: 10px; }

#moon-info {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 10px 12px;
}

#moon-disc { width: 46px; height: 46px; flex: 0 0 46px; }

#moon-text { display: flex; flex-direction: column; }

#moon-name {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 18px;
  font-weight: 600;
}

#moon-illum { font-size: 12px; color: var(--text-dim); }

#solunar {
  margin-top: 8px;
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.solunar-group { display: flex; gap: 8px; padding: 3px 0; }

.solunar-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 4px;
  height: fit-content;
  color: var(--navy);
}
.solunar-tag.major { background: var(--amber); }
.solunar-tag.minor { background: var(--teal); }

.solunar-times { font-size: 13px; line-height: 1.5; }
.solunar-period.active { color: var(--amber); font-weight: 600; }

/* ===== Fishing-location filter ===== */
#loc-search {
  width: 100%;
  background: var(--navy-3);
  color: var(--text);
  border: 1px solid var(--teal-dim);
  border-radius: 6px;
  padding: 6px 9px;
  font-family: "Barlow", sans-serif;
  font-size: 13px;
  margin-bottom: 7px;
}
#loc-search:focus { outline: none; border-color: var(--gold); }
#loc-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Marine weather ===== */
.wx-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 12px 0 6px;
}

.wx-stat { display: flex; flex-direction: column; }
.wx-stat .wx-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.wx-stat .wx-value {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 19px;
  font-weight: 600;
}
.wx-barb-dir { font-size: 11px; font-weight: 600; color: var(--teal); }

.wind-icon svg { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.85)); }

/* Hourly forecast — 24 cells in a horizontal scrolling strip */
#day-forecast {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--teal-dim) transparent;
  padding-bottom: 4px;
}
#day-forecast::-webkit-scrollbar { height: 6px; }
#day-forecast::-webkit-scrollbar-track { background: transparent; }
#day-forecast::-webkit-scrollbar-thumb {
  background: var(--teal-dim);
  border-radius: 3px;
}
.day-card {
  flex: 0 0 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 6px 4px;
  text-align: center;
}
.day-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.day-cond { font-size: 10px; color: var(--text-dim); }
.day-temp { font-size: 12px; color: var(--text-dim); }
.day-temp b {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 15px;
  color: var(--text);
}
.day-pop {
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  line-height: 1;
  color: var(--text-dim);
}
.day-pop.pop-mid  { color: #5fb6e8; }
.day-pop.pop-high { color: var(--amber); font-weight: 600; }

/* Chart y-axis scale + summary (tide & pressure graphs) */
.chart-body { display: flex; gap: 6px; }
.chart-body .tide-bars,
.chart-body .pressure-bars { flex: 1; min-width: 0; }

.chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 34px;
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
  padding: 2px 0;
}
.chart-summary {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text);
}

#pressure-chart {
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 10px 10px 6px;
}
.pressure-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 70px;
  position: relative;
}
.pressure-bar {
  flex: 1;
  background: var(--teal-dim);
  border-radius: 2px 2px 0 0;
  min-height: 3px;
}
.pressure-bar.now { background: var(--teal); }

/* Sunrise / sunset markers (overlay on all four hourly charts) */
.strip-inner {
  display: flex;
  gap: 6px;
  position: relative;
  flex: 0 0 auto;
}
.sun-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sun-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed var(--amber);
  opacity: 0.85;
  transform: translateX(-0.75px);
}
.sun-marker .sun-icon {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1px;
  pointer-events: auto;
}
.sun-marker .sun-arrow {
  font-size: 9px;
  color: var(--amber);
  line-height: 1;
  margin-left: -1px;
}
/* On the horizontal strip charts the parent has overflow:auto which clips
   anything above the strip, so the sun icon sits *inside* the strip on a
   small contrast pill instead of floating above it. */
.sun-overlay-cells .sun-marker .sun-icon {
  top: 1px;
  background: var(--navy);
  border-radius: 6px;
  padding: 1px 3px;
}
.pressure-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  padding-left: 40px;
}
#pressure-trend { text-transform: none; letter-spacing: 0; font-weight: 600; }
#pressure-trend.falling { color: var(--good); }
#pressure-trend.rising { color: var(--amber); }

#wind-timeline {
  display: flex;
  gap: 6px;
  background: var(--navy-3);
  border-radius: var(--radius);
  padding: 10px 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--teal-dim) transparent;
}
#wind-timeline::-webkit-scrollbar { height: 6px; }
#wind-timeline::-webkit-scrollbar-track { background: transparent; }
#wind-timeline::-webkit-scrollbar-thumb {
  background: var(--teal-dim);
  border-radius: 3px;
}
.wind-cell {
  flex: 0 0 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.wind-cell .wind-time { font-size: 10px; color: var(--text-dim); }
.wind-cell .wind-dir { font-size: 10px; font-weight: 600; color: var(--teal); }
.wind-cell .wind-spd { font-size: 10px; color: var(--text-dim); }
.wind-cell .wind-gust { color: var(--amber); font-weight: 600; }

#alert-list .alert-item {
  background: var(--navy-3);
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}
#alert-list .alert-item.warning { border-left-color: var(--wind-bad); }
#alert-list .alert-event { font-weight: 700; }
#alert-list .alert-desc {
  display: none;
  margin-top: 5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  cursor: default;
}
#alert-list .alert-item.open .alert-desc { display: block; }
#alert-list .none { color: var(--text-dim); font-size: 12px; }

/* Radar animation control */
.radar-control {
  background: rgba(13, 31, 45, 0.9);
  border: 1px solid var(--navy-3);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.radar-control button {
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 12px;
  flex: 0 0 auto;
}
.radar-slider {
  width: 96px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Right-click GPS coordinate popup */
.coord-popup .leaflet-popup-content {
  font-family: "Barlow", monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* ===== Map ===== */
#map-wrap { position: relative; flex: 1; }
#map { position: absolute; inset: 0; background: var(--navy); }

/* Custom rating markers */
.spot-marker {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.spot-marker.rating-hot  { background: var(--hot); }
.spot-marker.rating-good { background: var(--good); }
.spot-marker.rating-fair { background: var(--fair); }

/* Tide-station markers */
.station-marker {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--navy);
  box-shadow: 0 0 0 1px var(--teal), 0 1px 4px rgba(0,0,0,0.6);
  opacity: 0.9;
}
.station-marker.subordinate {
  background: var(--navy-2);
}
.station-marker.selected {
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--amber), 0 1px 6px rgba(0,0,0,0.7);
  opacity: 1;
}

/* Named fishing-location markers (GNIS) */
.poi-marker {
  width: 11px;
  height: 11px;
  background: #d8f4ff;
  border: 1.5px solid var(--navy);
  transform: rotate(45deg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Boat-ramp markers */
.ramp-marker {
  width: 11px;
  height: 11px;
  background: #4a90d9;
  border: 1.5px solid var(--navy);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Curated fishing-pier markers */
.pier-marker {
  width: 5px;
  height: 14px;
  background: var(--amber);
  border: 1px solid var(--navy);
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* NOAA channel-marker (aid to navigation) markers */
.channel-marker {
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 1.5px solid var(--navy);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.channel-marker.red   { background: #d92b2b; }
.channel-marker.green { background: #2fa84f; }

/* Habitat legend */
.habitat-legend {
  background: rgba(13, 31, 45, 0.88);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.7;
  border: 1px solid var(--navy-3);
}
.habitat-legend .sw {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}
.habitat-legend .sw.seagrass { background: #2e8b57; }
.habitat-legend .sw.oyster   { background: #c8a064; }
.habitat-legend .sw.manatee  { background: #b06fd8; }
.habitat-legend .sw.location { background: #d8f4ff; transform: rotate(45deg); }
.habitat-legend .sw.ramp    { background: #4a90d9; }
.habitat-legend .sw.pier    { background: var(--amber); border: 1px solid var(--navy); width: 4px; }
.habitat-legend .sw.channel       { background: #ffffff; border: 1px solid var(--navy); }
.habitat-legend .sw.channel-red   { background: #d92b2b; border: 1px solid var(--navy); }
.habitat-legend .sw.channel-green { background: #2fa84f; border: 1px solid var(--navy); }

/* ===== Detail panel ===== */
#detail-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  border-top: 2px solid var(--teal);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
  padding: 18px 22px 22px;
  max-height: 60%;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.3s ease;
  z-index: 1000;
}

#detail-panel.hidden { transform: translateY(100%); }

#detail-close {
  position: absolute;
  top: 10px; right: 14px;
  background: var(--navy-3);
  border: none;
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
#detail-close:hover { background: var(--gold); color: var(--navy); }

.detail-name {
  font-size: 24px;
  font-weight: 700;
  padding-right: 36px;
}

.detail-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
}
.detail-row strong { color: var(--text); font-weight: 600; }

.detail-breakdown {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

.detail-desc {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.detail-subtitle {
  margin-top: 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.detail-station {
  font-size: 12px;
  color: var(--teal);
  margin-top: 4px;
}

.tide-window {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  margin-top: 8px;
}

.tide-window .loading { font-size: 12px; }

.tw-bar {
  flex: 1;
  background: var(--navy-3);
  border-radius: 2px 2px 0 0;
}
.tw-bar.best { background: var(--amber); }
.tw-bar.now {
  outline: 1px solid var(--teal);
  outline-offset: -1px;
}

.tw-axis {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}
.tw-axis span { justify-self: center; }
.tw-axis span:first-child { justify-self: start; }
.tw-axis span:last-child { justify-self: end; }


/* ===== Distance measure tool ===== */
.measure-toggle {
  background: var(--navy-2);
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  overflow: hidden;
}
.measure-toggle button {
  width: 32px;
  height: 32px;
  background: var(--navy-2);
  color: var(--gold);
  border: none;
  display: block;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}
.measure-toggle button:hover { background: var(--navy-3); }
.measure-toggle button.active {
  background: var(--gold);
  color: var(--navy);
}

#map.measuring { cursor: crosshair; }

.measure-readout {
  background: rgba(13, 13, 13, 0.92);
  color: var(--text);
  padding: 6px 12px;
  border: 1px solid var(--teal-dim);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  margin: 8px;
}
.measure-readout.hidden { display: none; }
.measure-readout span { color: var(--gold); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  #app { flex-direction: column; }

  #sidebar {
    width: 100%;
    flex-basis: auto;
    max-height: 60vh;
  }

  #sidebar.collapsed { max-height: none; flex: 0 0 auto; }
  #sidebar.collapsed #sidebar-body { display: none; }

  #app-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--navy-2);
    padding: 10px 14px;
  }
  #sidebar-toggle { display: block; padding: 4px 8px; }

  #map-wrap { flex: 1; min-height: 0; }

  #detail-panel {
    max-height: 75vh;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    padding: 16px 16px 20px;
  }

  .habitat-legend { font-size: 10px; padding: 5px 7px; line-height: 1.5; }

  .leaflet-control-layers-expanded {
    max-height: 60vh;
    overflow-y: auto;
  }

  #tide-chart { min-height: 140px; }
}

@media (max-width: 480px) {
  #sidebar { max-height: 65vh; }
  .logo-text h1 { font-size: 18px; }
  .section-title { font-size: 14px; }
  #current-weather-body { font-size: 12px; }
  #species-filter { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip { font-size: 12px; padding: 5px 10px; min-height: 30px; }
}
