/* ===========================
   MESOFLOW MIAMI MCF v2
   Marine Channels Forecast Style
   =========================== */

:root {
  --primary-blue: #003366;
  --secondary-blue: #005785;
  --accent-blue: #0099cc;
  --light-blue: #e6f3ff;
  --noaa-blue: #003087;

  --pin-ports: #ff6600;
  --pin-water-level: #ffcc00;
  --pin-ndbc: #3399ff;
  --pin-mcf: #cc0000;

  --channel-green: #00aa44;
  --channel-red: #cc0000;

  --text-dark: #1a1a1a;
  --text-light: #666666;
  --bg-light: #f5f7fa;
  --bg-white: #ffffff;
  --border-color: #ddd;

  --shadow: 0 2px 8px rgba(0, 51, 102, 0.15);
  --shadow-lg: 0 4px 16px rgba(0, 51, 102, 0.2);
}

/* ===== PROTOTYPE BANNER ===== */
.prototype-banner {
  position: relative;
  z-index: 1;
  background: rgba(204, 0, 0, 0.9);
  color: var(--light-blue);
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 4px;
}

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

html,
body {
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
}

/* ===== MESOFLOW HEADER ===== */
.mesoflow-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100px;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d5a7b 50%, #1a4a6e 100%);
  overflow: hidden;
}

.header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 50, 100, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 50, 100, 0.3) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.5;
}

/* ===== HEADER CURRENTS ANIMATION ===== */
.header-currents {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.header-currents svg {
  width: 100%;
  height: 100%;
}

.stream {
  fill: none;
  stroke-linecap: round;
}

/* SMIL animateMotion handles particle animation — no CSS keyframes needed */

/* Reduce motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
  .header-currents { display: none; }
}
}



.header-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 40px;
}

.header-right {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 40px;
}

.header-title {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #a0c4e8;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
}

.mesoflow-title-link {
  text-decoration: none;
}

.mesoflow-title-link:hover .mesoflow-title {
  opacity: 0.8;
}

.mesoflow-title {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 48px;
  font-style: italic;
  font-weight: normal;
  color: #4a90c2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 2px;
}

.header-subtitle {
  font-size: 16px;
  color: #a0c4e8;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
  display: flex;
  height: calc(100vh - 100px - 60px); /* header + footer */
  overflow: hidden;
}

/* ===== MAP PANEL (60%) ===== */
.map-panel {
  width: 60%;
  position: relative;
  border-right: 2px solid var(--border-color);
}

.map-container {
  width: 100%;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Legend inside map */
.map-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  font-size: 10px;
  max-width: 150px;
}

.map-legend h4 {
  font-size: 11px;
  color: var(--primary-blue);
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 3px;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 10px;
}

.legend-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.pin-ports {
  background-color: var(--pin-ports);
}
.pin-water-level {
  background-color: var(--pin-water-level);
}
.pin-ndbc {
  background-color: var(--pin-ndbc);
}
.pin-mcf {
  background-color: var(--pin-mcf);
}

.legend-line {
  width: 20px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--channel-green) 50%,
    var(--channel-red) 50%
  );
  border-radius: 2px;
}

.legend-ship {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid;
  display: inline-block;
  flex-shrink: 0;
}

.channel-legend {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

/* Station Links inside map - REMOVED */
.station-links {
  display: none; /* Removed from UI */
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
  max-width: 180px;
  max-height: 200px;
  overflow-y: auto;
}

.station-links h4 {
  font-size: 13px;
  color: var(--primary-blue);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.station-links ul {
  list-style: none;
}

.station-links li {
  margin: 4px 0;
}

.station-links a {
  color: var(--secondary-blue);
  text-decoration: none;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  transition: color 0.2s;
}

.station-links a:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.station-links .station-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== DATA PANEL (40%) ===== */
.data-panel {
  width: 40%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-white);
}

/* Station Header */
.station-header {
  padding: 16px 20px;
  background: linear-gradient(
    135deg,
    var(--primary-blue) 0%,
    var(--secondary-blue) 100%
  );
  color: white;
  flex-shrink: 0;
}

.station-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.station-header p {
  font-size: 13px;
  opacity: 0.9;
}

/* Conditions Summary */
.conditions-summary {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 15px 20px;
  background: var(--light-blue);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.condition-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.condition-card-wide {
  padding: 10px 15px;
}

.current-combined {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.condition-label {
  font-size: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.condition-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-blue);
  line-height: 1.2;
}

.condition-unit {
  font-size: 10px;
  color: var(--text-light);
}

/* Current Meters Overview */
/* ===== MARINE FORECAST PANEL ===== */
.forecast-panel {
  border-top: 1px solid #e0e8f0;
}

.forecast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: #f0f6ff;
}

.forecast-header:hover { background: #e4effe; }

.forecast-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: #003087;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.forecast-office {
  font-size: 10px;
  font-weight: 400;
  color: #888;
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.forecast-toggle {
  background: none;
  border: none;
  color: #003087;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
}

.forecast-body {
  padding: 0 16px 14px;
  background: white;
}

.forecast-zone-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 0 8px;
}

.fz-tab {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #c8daf0;
  border-radius: 4px;
  background: white;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

.fz-tab:hover { background: #f0f6ff; color: #003087; }
.fz-tab.active { background: #003087; color: white; border-color: #003087; }

.forecast-warning {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.warn-red   { background: #fff0f0; color: #c0000a; border: 1px solid #ffb3b3; }
.warn-amber { background: #fff8e0; color: #8a5a00; border: 1px solid #ffd966; }

.forecast-text {
  font-size: 12px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}

.forecast-text strong {
  color: #003087;
  display: inline-block;
  margin-top: 8px;
}

.forecast-meta {
  font-size: 10px;
  color: #999;
  margin-top: 8px;
}

/* ===== NDBC STATION PANEL ===== */
.ndbc-panel {
  padding: 12px 16px;
  border-top: 1px solid #e0e8f0;
  background: #f0f6ff;
}

.ndbc-panel h3 {
  font-size: 13px;
  font-weight: 700;
  color: #003087;
  margin: 0 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ndbc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ndbc-card {
  background: white;
  border: 1px solid #c8daf0;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ndbc-card-time {
  grid-column: span 2;
}

.ndbc-label {
  font-size: 10px;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ndbc-value {
  font-size: 20px;
  font-weight: 700;
  color: #003087;
  line-height: 1;
}

.ndbc-unit {
  font-size: 11px;
  color: #888;
}

.ndbc-sub {
  font-size: 11px;
  color: #555;
  font-weight: 600;
}

.current-meters-overview {
  padding: 15px 20px;
  background: #fff8f0;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.current-meters-overview h3 {
  font-size: 14px;
  color: var(--pin-ports);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.meter-card {
  background: white;
  border: 2px solid var(--pin-ports);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.meter-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.meter-card.selected {
  background: #fff3e6;
  border-color: #cc5500;
}

.meter-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 6px;
}

.meter-data {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}

.meter-speed {
  font-size: 22px;
  font-weight: 700;
  color: var(--pin-ports);
}

.meter-unit {
  font-size: 11px;
  color: var(--text-light);
}

.meter-arrow {
  font-size: 18px;
  color: var(--pin-ports);
  transition: transform 0.3s;
}

.meter-dir {
  font-size: 11px;
  color: var(--text-light);
}

.meter-depth {
  font-size: 10px;
  color: var(--text-light);
}

/* Charts Section */
.charts-section {
  flex: 1;
  overflow-y: auto;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-container {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-blue);
}

.chart-subtitle {
  font-size: 11px;
  color: var(--text-light);
}

.chart-wrapper {
  height: 180px;
  position: relative;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend-inline {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-light);
}

.legend-observed {
  color: #cc0000; /* Red for observed */
}

.legend-predicted {
  color: #0066cc; /* Blue for predicted */
}

/* Unavailable meter card styling */
.meter-card.unavailable {
  background: #f5f5f5;
  border-color: #ccc;
  opacity: 0.7;
}

.meter-card.unavailable .meter-speed {
  color: #999;
}

.meter-card.unavailable .meter-arrow {
  color: #ccc;
}

/* Data Footer */
.data-footer {
  padding: 12px 20px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
}

.data-footer p {
  margin: 2px 0;
}

/* ===== PAGE FOOTER ===== */
.page-footer {
  height: 60px;
  background: var(--primary-blue);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  padding: 10px 20px;
  text-align: center;
}

.page-footer .disclaimer {
  font-size: 10px;
  opacity: 0.8;
  margin-top: 4px;
}

.page-footer .footer-copyright {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 6px;
}

/* ===== LEAFLET CUSTOMIZATIONS ===== */
.leaflet-popup-content-wrapper {
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
  font-size: 12px;
  margin: 10px 12px;
}

.station-popup h4 {
  color: var(--primary-blue);
  margin-bottom: 6px;
  font-size: 13px;
}

.station-popup p {
  margin: 3px 0;
  color: var(--text-light);
  font-size: 11px;
}

.station-popup .popup-value {
  font-weight: 600;
  color: var(--text-dark);
}

/* Custom marker styles */
.custom-pin {
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  font-size: 10px;
  font-weight: bold;
  color: white;
}

.custom-pin-inner {
  transform: rotate(45deg);
}

/* Station label on map */
.station-label {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary-blue);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Current data label for PORTS stations */
.current-data-label {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--pin-ports);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.current-data-label .label-name {
  font-weight: 700;
  color: var(--pin-ports);
  margin-right: 3px;
}

.current-data-label .label-speed {
  font-weight: 600;
  color: var(--text-dark);
}

.current-data-label .label-arrow {
  font-size: 14px;
  color: var(--pin-ports);
  transition: transform 0.3s ease;
  transform-origin: center;
  margin-left: 2px;
}

/* ===== LOADING STATE ===== */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  font-size: 13px;
}

/* ===== LEGEND COLLAPSIBLE ===== */
.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.legend-header h4 {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.legend-subhead {
  font-size: 11px;
  color: var(--primary-blue);
  margin: 8px 0 4px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 3px;
  font-weight: 600;
}

.legend-collapse-btn {
  display: none; /* shown only on mobile */
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
}

.legend-open-btn {
  display: none; /* shown only on mobile when legend is collapsed */
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-blue);
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ===== CAROUSEL ===== */

/* Desktop: carousel track is a normal scrollable column */
.carousel-controls {
  display: none; /* hidden on desktop */
}

.carousel-track {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.carousel-slide {
  /* no special desktop styling — behaves like a normal div */
}

.carousel-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 20px;
  color: var(--primary-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  line-height: 1;
}

.carousel-btn:hover { background: var(--light-blue); }

.carousel-btn:disabled {
  color: #ccc;
  border-color: #eee;
  cursor: default;
}

.carousel-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.carousel-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-blue);
  letter-spacing: 0.2px;
}

.carousel-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: #ccc;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot.active {
  background: var(--primary-blue);
  transform: scale(1.35);
}

/* ===== PEEK STRIP (mobile only) ===== */
#peek-strip {
  display: none; /* shown only on mobile */
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 26, 64, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 14px 14px 0 0;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.peek-handle-bar {
  width: 36px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin: 8px auto 5px;
}

.peek-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 12px;
  width: 100%;
}

.peek-meter {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex: 1;
  justify-content: center;
}

.peek-name {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.peek-speed {
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.peek-unit {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
}

.peek-arrow {
  font-size: 13px;
  color: var(--accent-blue);
}

.peek-divider {
  color: rgba(255, 255, 255, 0.18);
  font-size: 22px;
  font-weight: 100;
  line-height: 1;
}

.peek-cta {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== SHEET BACKDROP ===== */
#sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 15, 45, 0.5);
  z-index: 499;
}

#sheet-backdrop.visible { display: block; }

/* ===== SHEET HANDLE + CLOSE ===== */
.sheet-handle-bar {
  display: none; /* shown on mobile */
  width: 40px;
  height: 4px;
  background: rgba(0, 51, 102, 0.18);
  border-radius: 2px;
  margin: 10px auto 0;
  cursor: pointer;
  flex-shrink: 0;
}

.sheet-close-btn {
  display: none; /* shown on mobile */
  position: absolute;
  top: 10px;
  right: 14px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .conditions-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== TABLET (600–899px) ===== */
@media (max-width: 899px) {
  .main-container {
    flex-direction: column;
    height: calc(100vh - 100px); /* no page footer */
  }

  .map-panel {
    width: 100%;
    height: 40%;
    border-right: none;
    border-bottom: 2px solid var(--border-color);
  }

  .data-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .page-footer { display: none; }

  .conditions-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Horizontal scrolling meter strip */
  .meters-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .meters-grid::-webkit-scrollbar { display: none; }

  .meter-card {
    min-width: 130px;
    flex-shrink: 0;
  }

  /* Carousel active on tablet */
  .carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 4px;
    gap: 8px;
    flex-shrink: 0;
  }

  .charts-section {
    overflow: hidden;
    padding: 0;
  }

  .carousel-track {
    flex-direction: row;
    gap: 0;
    transition: transform 0.3s ease;
    will-change: transform;
  }

  .carousel-slide {
    min-width: 100%;
    padding: 10px 14px;
    box-sizing: border-box;
  }
}

/* ===== PHONE (< 600px) ===== */
@media (max-width: 599px) {
  .mesoflow-header {
    height: 60px;
  }

  .mesoflow-title {
    font-size: 26px;
  }

  .header-content {
    padding-left: 14px;
  }

  .header-title {
    font-size: 12px;
    letter-spacing: 0;
  }

  .header-right {
    padding-right: 14px;
  }

  /* Full-screen map */
  .main-container {
    height: calc(100vh - 60px);
    overflow: hidden;
    flex-direction: row; /* override tablet column */
  }

  .map-panel {
    width: 100%;
    height: 100%;
    border-bottom: none;
  }

  /* Bottom sheet */
  #dataPanel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 82vh;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 28px rgba(0, 15, 60, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
  }

  #dataPanel.sheet-open {
    transform: translateY(0);
  }

  .sheet-handle-bar {
    display: block;
  }

  .sheet-close-btn {
    display: flex;
  }

  .station-header {
    position: relative;
    padding-right: 48px; /* space for close btn */
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .station-header h2 {
    font-size: 17px;
  }

  .station-header p {
    font-size: 12px;
  }

  /* Peek strip */
  #peek-strip {
    display: flex;
  }

  /* Legend collapse controls */
  .legend-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .map-legend.collapsed {
    display: none;
  }

  .legend-open-btn {
    display: block;
  }

  /* Conditions — horizontal scroll */
  .conditions-summary {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 12px;
    scrollbar-width: none;
    flex-shrink: 0;
  }

  .conditions-summary::-webkit-scrollbar { display: none; }

  .condition-card {
    min-width: 88px;
    flex-shrink: 0;
  }

  .condition-card-wide {
    min-width: 148px;
  }

  .condition-value {
    font-size: 17px;
  }

  /* Current meters — horizontal scroll */
  .meters-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .meters-grid::-webkit-scrollbar { display: none; }

  .meter-card {
    min-width: 120px;
    flex-shrink: 0;
  }

  .current-meters-overview {
    flex-shrink: 0;
    padding: 10px 12px;
  }

  /* Carousel */
  .carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    gap: 8px;
    flex-shrink: 0;
  }

  .charts-section {
    overflow: hidden;
    padding: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .carousel-track {
    flex-direction: row;
    gap: 0;
    transition: transform 0.3s ease;
    will-change: transform;
    flex: 1;
    min-height: 0;
  }

  .carousel-slide {
    min-width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;
  }

  .chart-wrapper {
    height: 180px;
  }

  .data-footer {
    display: none; /* save space on phone */
  }

  .page-footer { display: none; }
}

/* ===== SCROLLBAR STYLING (desktop) ===== */
.charts-section::-webkit-scrollbar {
  width: 8px;
}

.charts-section::-webkit-scrollbar-track {
  background: var(--bg-light);
}

.charts-section::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.charts-section::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}
