html {
  font-size: 112.5%;  /* 16px → 18px */
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
}

/* Global spacing variables */
:root {
  --app-gutter: 10px;   /* horizontal margin from edges */
  --app-bottom: 10px;   /* distance from bottom */
  --app-gap: 8px;       /* gap between UI elements */
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

/* ---------------- Menu button ---------------- */
#togglePanel {
  position: absolute;
  bottom: var(--app-bottom);
  left: var(--app-gutter);
  z-index: 11;
  min-width: 90px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  border: 1px solid rgba(148,163,184,0.6);
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  padding: 0 12px;
}

#togglePanel span.icon {
  font-size: 18px;
  line-height: 1;
}

#togglePanel:hover {
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}

/* ---------------- Left main controls panel ---------------- */
#controls {
  position: absolute;
  bottom: calc(var(--app-bottom) + 46px); /* sits above menu/timebar */
  left: var(--app-gutter);
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  color: #fff;
  padding: 12px 16px;
  border-radius: 16px;
  z-index: 1000;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* min-width: 400px;
  max-width: 440px; */
  width: clamp(260px, 20vw, 440px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148,163,184,0.6);
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

#controls.collapsed {
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

.controls-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bfdbfe;
  margin-bottom: 2px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-row + .control-row {
  margin-top: 2px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #cbd5f5;
  opacity: 0.9;
  margin-top: 2px;
}

#timeLabel {
  font-weight: 600;
  min-width: 65px;        /* Slightly wider to accommodate longer strings like "T+144h" */
  text-align: left;       /* Changed to left so it grows away from the slider */
  flex-shrink: 0;         /* Prevents the label from wrapping its own text */
  white-space: nowrap;
}

#timeHint {
  font-size: 11px;
  color: #e5e7eb;
  opacity: 0.8;
  width: 100%;
  display: none !important;  /* always hidden now */
}

#saveImageBtn .map-ctrl-label {
  font-size: 16px;
}

/* ---------------- Bottom-center time bar (desktop / tablet) ---------------- */
#timebar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--app-bottom) + 8px);
  transform: translateX(-50%);
  z-index: 9;
  padding: 12px 16px 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  border: 1px solid rgba(148,163,184,0.7);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

#timebar .control-row {
  display: flex;
  flex-wrap: nowrap;      /* CRITICAL: Prevents the label from dropping down */
  align-items: center;
  justify-content: center; /* Keeps the group centered */
  gap: 8px;
  width: 100%;
}

#timebar .section-label {
  margin-top: 0;
  font-size: 14px !important;;
  opacity: 0.8;
}

#timebar #timeSlider {
  width: 260px;
  flex-shrink: 0;         /* Prevents the slider itself from being squashed */
}

/* ===== Ticks & small datetime labels under time slider ===== */

/* container aligns with slider width (260px on desktop) */
.time-ticks-container {
  align-self: center;
  position: relative;
  width: 260px;      /* match #timebar #timeSlider width */
  height: 22px;
  margin-top: -8px;
  margin-bottom: 2px;
}

/* base tick element */
.time-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* vertical line */
.time-tick-line {
  width: 1px;
  height: 8px;
  background: rgba(148,163,184,0.9);
}

/* major ticks (we’ll use for midnight labels) */
.time-tick-major .time-tick-line {
  height: 11px;
  background: #facc15;
}

/* text like "11 Dec 00" */
.time-tick-label {
  margin-top: 2px;
  font-size: 10px;
  color: #e5e7eb;
  white-space: nowrap;
  opacity: 0.9;
}

/* highlight the tick of the current slider step */
.time-tick.active .time-tick-line {
  height: 13px;
  background: #fb923c;
}

.time-tick.active .time-tick-label {
  color: #fb923c;
  font-weight: 600;
}

/* On small screens the bar is very tight, so hide ticks to keep it clean */
@media (max-width: 768px) {
  #timebar .time-ticks-container {
    display: none;
  }
}


/* ---------------- Valid time label inside menu ---------------- */
#validTime {
  font-size: 12px;
  color: #e5e7eb;
  opacity: 0.95;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.5);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#validTime span.label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #a5b4fc;
}

/* ---------------- External forecast datetime pill ---------------- */
#validDayBubble {
  position: absolute;
  top: var(--app-gutter);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  max-width: 350px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  color: #f9fafb;
  border: 1px solid rgba(148,163,184,0.7);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);

  white-space: nowrap;      /* keep everything one line */
  overflow: hidden;         /* optional: prevent spill */
  text-overflow: ellipsis;  /* optional: add "…" if too narrow */
}

#validDayBubble .label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: #93c5fd;
}

#validDayText {
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-weight: 500;
}

/* ---------------- Form elements ---------------- */
select {
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  outline: none;
}

select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56,189,248,0.6);
}

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.6);
  padding: 3px 10px;
  font-size: 11px;
  background: rgba(15,23,42,0.88);
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.15s ease-out;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pill:hover {
  border-color: #38bdf8;
  background: rgba(30,64,175,0.95);
}

.pill.active {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  border-color: transparent;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.8);
}

.pill .sub {
  font-size: 10px;
  opacity: 0.85;
}

.row-label {
  min-width: 44px;
  font-size: 12px;
  color: #e5e7eb;
  opacity: 0.85;
}

.spacer {
  flex: 1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-row input[type="checkbox"] {
  accent-color: #38bdf8;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.checkbox-row label {
  cursor: pointer;
  font-size: 13px;
}

/* ---------------- MapLibre nav controls ---------------- */
.maplibregl-ctrl-top-right {
  top: calc(var(--app-gutter) + 52px);  /* leave space for info button */
  right: var(--app-gutter);
}

.maplibregl-ctrl-bottom-right {
  bottom: var(--app-bottom);
  right: var(--app-gutter);
}

.maplibregl-ctrl-top-right .maplibregl-ctrl-group {
  border-radius: 999px;
  background: linear-gradient(180deg, #020617, #1d4ed8) !important;
  border: 1px solid rgba(15,23,42,0.9);
  box-shadow: 0 4px 14px rgba(15,23,42,0.55) !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  background: transparent !important;
  color: #ffffff !important;
  border-radius: 0;
  border: none;
  width: 32px;
  height: 32px;
  font-weight: 700;
  cursor: pointer;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(100%) brightness(200%) !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid rgba(255,255,255,0.25) !important;
}

.maplibregl-ctrl-group button:hover {
  background: rgba(96,165,250,0.85) !important;
}

.maplibregl-ctrl-group button:hover .maplibregl-ctrl-icon {
  filter: invert(100%) brightness(200%) !important;
}
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---------------- Attribution styling (Option 2) ---------------- */
.maplibregl-ctrl-attrib {
  font-size: 10px !important;       /* Smaller font */
  line-height: 12px !important;     /* Tighter line height */
  padding: 2px 4px !important;      /* Less padding */
  background-color: rgba(255, 255, 255, 0.75) !important; /* Semi-transparent background */
  border-radius: 4px;
  color: #333 !important;
}

.maplibregl-ctrl-attrib a {
  font-size: 10px !important;
  color: #0078A8 !important;        /* Standard Map link color */
  margin: 0 !important;
  text-decoration: none;
}

.maplibregl-ctrl-attrib a:hover {
  text-decoration: underline;
}

/* Prevent overlap on Desktop */
@media (min-width: 768px) {
  .maplibregl-ctrl-bottom-right {
    max-width: 35vw; /* Prevent it from stretching to the center timebar */
    display: flex;
    justify-content: flex-end;
  }
  
  .maplibregl-ctrl-attrib {
    /* If text is too long, wrap it or cut it off */
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 768px) {
  .maplibregl-ctrl-attrib {
    display: none !important;
  }
}

/* --- PILL STYLE (matches app pills) --- */
.loading-pill {
  padding: 6px 16px;
  background: #0ea5e9;                 /* cyan-500 */
  color: white;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.5); /* glow */
}

/* --- Spinner --- */
.loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 4px solid rgba(148, 163, 184, 0.45);
  border-top-color: #38bdf8; /* cyan accent */
  animation: spin 0.75s linear infinite;
}

.last-update-text {
  margin-top: 15px;
  padding-top: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  font-weight: 300;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: left;
  line-height: 1.3;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------- Info button (top-right) ------- */
body .info-button,
body #infoButton {
  position: fixed;                   /* <── was absolute */
  top: var(--app-gutter);
  right: var(--app-gutter);
  z-index: 1200;                     /* above panels */

  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  border: 1.5px solid rgba(255,255,255,0.45);
  color: #e5e7eb;
  font-size: 20px;
  font-weight: 700;

  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  box-shadow: 0 4px 14px rgba(0,0,0,0.45);

  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}


.info-button:hover {
  border-color: #38bdf8;
  box-shadow: 0 6px 18px rgba(15,23,42,0.7);
}

/* ------- Info modal ------- */
.info-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.70);
  backdrop-filter: blur(6px);
  display: none;                 /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 1100;

  /* NEW: allow scrolling if content is taller than viewport */
  overflow-y: auto;
  padding: 16px 10px;  /* small padding so content isn't glued to edges */
}

.info-close-x {
  position: absolute;
  top: 12px;     /* Distance from top of the blue box */
  right: 12px;   /* Distance from right of the blue box */
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.info-close-x:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.info-modal.open {
  display: flex;
}

.info-modal-content {
  position: relative; /* <--- THIS IS CRITICAL */
  max-width: 520px;
  width: min(520px, 90vw);
  background: linear-gradient(135deg, rgba(15,23,42,0.98), rgba(30,64,175,0.98));
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.8);
  box-shadow: 0 20px 40px rgba(0,0,0,0.55);
  padding: 24px 24px 20px; 
  color: #e5e7eb;
  max-height: 80vh;
  overflow-y: auto;
}

.info-modal-title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #bfdbfe;
  margin-bottom: 4px;
}

.info-modal-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 10px;
}

.info-modal-text {
  font-size: 13px;
  line-height: 1.5;
  color: #e5e7eb;
  opacity: 0.95;
  margin-bottom: 14px;
}

/* Links inside the info modal */
.info-modal-content a {
  color: #ffffff;
  text-decoration: underline;
}

.info-modal-content a:hover {
  opacity: 0.8;
}

.info-close-pill {
  margin-top: 4px;
  padding-inline: 14px;
  font-size: 12px;
}



/* ---------------- Snow tag (single sampling flag) ---------------- */
.snow-tag-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.snow-tag {
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  color: #e5e7eb;
  font-size: 12px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.45);
  white-space: nowrap;
  cursor: pointer;
}

/* Tag bubble */
.snow-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.snow-tag-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: #bfdbfe;
}

.snow-tag-value {
  font-weight: 800;
  font-size: 12px;
  min-width: 50px;
  text-align: right;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.snow-tag-stem {
  width: 3px;
  height: 75px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
}

/* Dot at the point */
.snow-tag-dot {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 0 0 rgba(56,189,248,0.9);
  animation: snowPointPulse 1.4s infinite;
}

/* --- NEW --- Close “×” button inside tag */
.snow-tag-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  background: #ffffff;
  color: #1e3a8a;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.snow-tag:hover {
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  transform: translateY(-2px);
  transition: all 0.2s ease;
}

.snow-tag-close:hover {
  background: #ff0000;
}

@keyframes snowPointPulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(56,189,248,0.9);
    opacity: 1;
  }
  70% {
    transform: scale(1.6);
    box-shadow: 0 0 0 8px rgba(56,189,248,0);
    opacity: 0;
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(56,189,248,0);
    opacity: 1;
  }
}

/* -------- Mobile quick filters (model/run/param) -------- */
#mobileQuickFilters {
  position: absolute;
  right: var(--app-gutter);
  bottom: 268px;
  z-index: 10;

  display: none;              /* 👈 hidden by default */
  flex-direction: column;
  gap: 6px;
}

#mobileQuickFilters select {
  width: 60px;
  height: 30px;                 /* ← exact same height as before */
  font-size: 10px;              /* readable but compact */
  line-height: 30px;            /* centers text vertically */
  padding: 0 28px 0 10px;       /* text fits, arrow has space */

  color: #f1f5f9;
  background: #141d36;

  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.45);
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);

  appearance: none;
  backdrop-filter: blur(4px);

  background-image: url("data:image/svg+xml,%3Csvg fill='white' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7l5 5 5-5H5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 12px;
  background-position: right 8px center;
}



/* --- Legend container --- */
#legendContainer {
  position: absolute;
  bottom: 55px;
  right: 12px;

  /* SAME background as toggle menu */
  background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);

  padding: 12px 14px;
  border-radius: 12px;

  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}


/* Title */
#legendTitle {
  font-size: 12px;
  color: #fff;
  margin-bottom: 18px;
  letter-spacing: 0.3px;
}

/* Bar itself */
#legendBar {
  width: 16px;
  height: 200px;   /* adjust as you want */
  border-radius: 9px;
  background: linear-gradient(
    to top,
    #3f3b97,
    #434ebb,
    #4667de,
    #4681f7,
    #26bfe9,
    #18ddc2,
    #46f884,
    #9dfe40,
    #b7f735,
    #d5e735,
    #ead439,
    #fea732,
    #f56918,
    #e14109

  );
  border: 2px solid rgb(95, 95, 95);
}

/* Tick labels */
/* Arrange bar + ticks horizontally */
#legendRow {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;         /* space between bar and ticks */
}

/* Make ticks stack vertically on the right */
#legendTicks {
  display: flex;
  flex-direction: column;
  align-items: flex-start;   /* numbers align left */
  justify-content: space-between; /* distribute evenly */
  height: 195px;             /* SAME height as legendBar */
  color: white;
  font-size: 10px;
  line-height: 13px;
}

#legendTicks div {
  transform: translateY(-3px); /* micro-adjust if needed */
}
/* -------- Custom vertical control panel (top-right) -------- */
/* -------- Custom vertical control panel (top-right) -------- */
.map-control-panel {
  position: absolute;
  top: calc(var(--app-gutter) + 52px);
  right: var(--app-gutter);
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Generic hidden helper if you don't already have one */
.hidden {
  display: none !important;
}

/* Basemap zoom warning (under basemap select) */
#basemapWarning {
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;

  /* Same glassy panel vibe */
  background: rgba(15,23,42,0.92);
  border: 1px solid rgba(248, 250, 252, 0.18);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);

  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-size: 11px;
  line-height: 1.3;
  color: #fed7aa; /* warm amber text */

  text-transform: none;  /* keep it readable, not shouty */
}

/* Small exclamation icon chip */
#basemapWarning .icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 11px;
  font-weight: 700;
  background: #f97316;         /* amber-500 */
  color: #0f172a;              /* slate-900 */
}

/* Text part – slightly dimmer than icon */
#basemapWarning .text {
  opacity: 0.95;
}


/* Outer block (each “tile” in your screenshot) */
.map-ctrl-group {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #020617, #1d4ed8);
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.8);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
  overflow: hidden;
}

/* Single-button blocks ( ! and bearing ) */
.map-ctrl-single {
  padding: 0;
}

/* Inner buttons ( +, -, 2D, 3D ) */
.map-ctrl-btn,
.map-ctrl-single .map-ctrl-label {
  width: 32px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

/* Make the text element inside .map-ctrl-single clickable */
.map-ctrl-single {
  cursor: pointer;
}
.map-ctrl-single .map-ctrl-label {
  font-size: 18px;
}

/* Thin white lines between stacked buttons ( + / −, 2D / 3D ) */
.map-ctrl-group .map-ctrl-btn + .map-ctrl-btn {
  border-top: 1px solid rgba(255,255,255,0.25);
}

/* 2D / 3D specific tweaks */
.map-ctrl-group-2d3d .map-ctrl-btn {
  font-size: 12px;
}

/* Use existing pill active styling for selected (blue) look */
.map-ctrl-group-2d3d .pill {
  border-radius: 0;  /* flat inside the group */
  border: none;
}
.map-ctrl-group-2d3d .pill:first-child {
  border-bottom: 1px solid rgba(255,255,255,0.25);
}
.map-ctrl-group-2d3d .pill.active {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #0f172a;
  font-weight: 700;
}


/* hover cities */
.city-hover-popup {
  font-size: 11px;
  line-height: 1.3;
}

.city-hover-popup strong {
  font-size: 12px;
}

/* Optional hover */
/* ----- HOVER: identical to the app menu buttons ----- */
.map-ctrl-group,
.map-ctrl-btn,
.map-ctrl-single {
  transition: 
    box-shadow 0.2s ease,
    filter 0.2s ease,
    border-color 0.2s ease;
}

/* Apply hover effect to groups and buttons */
.map-ctrl-group:hover,
.map-ctrl-btn:hover,
.map-ctrl-single:hover {
  border-color: #38bdf8;
  box-shadow: 0 6px 18px rgba(15,23,42,0.7);
  filter: brightness(1.15);
}

.compass-img {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
  transition: transform 0.2s linear;
}
/* ---------------- Highcharts panel ---------------- */
#chartPanel {
  position: absolute;
  top: var(--app-gutter);
  left: var(--app-gutter);
  transform: none;
  z-index: 40;

  width: clamp(270px, 35vw, 600px);
  max-width: 96vw;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  height: auto;

  background: linear-gradient(135deg, rgba(15,23,42,0.97), rgba(30,64,175,0.97));
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.7);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
}

#chartPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  color: #e5e7eb;
  font-size: 13px;
}

/* Header becomes sticky ONLY when this class is added via JS */
#chartPanelHeader.chart-header-fixed {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, rgba(15,23,42,0.97), rgba(30,64,175,0.97));
  border-bottom: 1px solid rgba(148,163,184,0.45);
}

/* --- Chart-specific loading overlay (inside the diagram box) --- */
#chartPanel {
  position: absolute; /* you already have this; just make sure it's not static */
  /* ... your existing chartPanel styles ... */
}

/* Overlay that sits *inside* the chart panel, above #chartContainer but below header */
#chartLoadingOverlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  /* leave header visible: ~ header height (8px padding + ~24px line-height) */
  top: 36px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: radial-gradient(circle at top, rgba(15,23,42,0.85), rgba(15,23,42,0.97));
  backdrop-filter: blur(6px);

  z-index: 5;
  pointer-events: none; /* so you can still close the panel while it loads */
}

/* hidden state (JS will toggle this class) */
#chartLoadingOverlay.hidden {
  display: none;
}

/* Spinner matches app style but slightly smaller */
.chart-loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(148,163,184,0.45);
  border-top-color: #38bdf8; /* cyan accent like global loader */
  animation: chartSpin 0.8s linear infinite;
  margin-bottom: 6px;
}

/* Fullscreen overlay for chart loading */
.chart-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.65);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(3px);
  z-index: 999;
}

/* Hide when not needed */
.chart-loading-overlay.hidden {
  display: none;
}

/* Logo size */
.chart-loading-logo {
  width: 160px;
  height: 160px;
  margin-bottom: 12px;
  display: block;
  transform: translateY(-30px);
}

/* Draw animation */
.chart-loading-stroke {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: chartLogoDrawErase 2s ease-in-out infinite;
}

@keyframes chartLogoDrawErase {
  0%   { stroke-dashoffset: 900; }
  50%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 900; }
}

/* Loading text style (same as main loader) */
.chart-loading-text {
  font-size: 14px;
  font-weight: 600;
  color: #e5e7eb;
  letter-spacing: 0.3px;
  transform: translateY(-60px);
}


/* Text below spinner – small, subtle */
.chart-loading-text {
  font-size: 11px;
  color: #e5e7eb;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

/* Play / pause button next to time slider */
.time-play-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Previous / Next navigation buttons */
.time-nav-btn {
  width: 26px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

/* On mobile, keep it compact */
@media (max-width: 768px) {
  .time-nav-btn {
    width: 20px !important; 
    height: 24px !important;
    padding: 0 !important;
  }

  .time-play-btn {
    width: 26px !important;
    height: 26px !important;
  }
}

/* Reuse global vibe but separate keyframes name */
@keyframes chartSpin {
  to {
    transform: rotate(360deg);
  }
}

#chartTitle {
  font-weight: 500;
  color: #bfdbfe;
}

#chartClose {
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 16px;
  cursor: pointer;
}

#chartClose:hover {
  color: #f97316;
}

#chartContainer {
  flex: 1;
  min-height: 310px;
  padding: 4px 10px 0px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;   /* vertical center */
  justify-content: center; /* horizontal center */
  z-index: 9999;
  backdrop-filter: blur(3px);
}

.loading-overlay.hidden {
  display: none;
}

/* center logo + pill together */
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;   /* ensures vertical centering */
  gap: 4px;                  /* small distance between logo and pill */
}
/* small space between logo and pill */
.loading-logo {
  margin: 0 0 6px 0;
  padding: 0;
}

.loading-logo-svg {
  width: 260px;    /* adjust size as you like */
  height: 260px;
  display: block;
}

/* pill (same style as before) */
.loading-pill {
  padding: 6px 16px;
  background: #0ea5e9;
  color: white;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.5);
}

.loading-logo-svg {
  transform: translateY(-120px); /* move slightly up, or +10px for down */
}


/* draw / erase animation */
.logo-stroke {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: logoDrawErase 2s ease-in-out infinite;
}

@keyframes logoDrawErase {
  0%   { stroke-dashoffset: 900; }
  50%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 900; }
}




/* ---------------- MOBILE: Menu + compact timebar + responsive panels ---------------- */
@media (max-width: 768px) {
  body.show-mobile-quick-menu #mobileQuickFilters {
    display: flex;            /* 👈 show only with this class */
  }

  /* Ensure the bar stays within the viewport edges */
  #timebar {
    position: absolute;
    bottom: var(--app-bottom);
    left: calc(var(--app-gutter) + 96px + var(--app-gap));
    right: var(--app-gutter);
    height: 34px;
    padding: 0 8px; /* Slightly tighter padding */
    border-radius: 12px;
    display: flex;
    align-items: center;
    transform: none;
    overflow: hidden; /* Prevent any internal spill */
  }

  /* Menu button */
  #togglePanel {
    position: absolute;
    bottom: var(--app-bottom);
    left: var(--app-gutter);
    width: 96px;
    min-width: 96px;
    height: 36px;
    padding: 0 10px;
    z-index: 11;
  }

  /* Timebar: same height, right next to menu */
  #timebar {
    position: absolute;
    bottom: var(--app-bottom);
    left: calc(var(--app-gutter) + 96px + var(--app-gap));
    right: var(--app-gutter);
    height: 34px;
    padding: 0 10px;
    border-radius: 12px;

    display: flex;
    align-items: center;
    transform: none;
  }

  /* Hide title and tick labels completely */
  #timebar .section-label,
  #timeHint {
    display: none !important;
  }

  /* Single row inside bar: [ slider ][ label ] */
  #timebar .control-row {
    display: flex;
    flex: 1;
    width: 100%;       /* Force it to take the bar's width */
    align-items: center;
    gap: 4px;          
    min-width: 0;      
    flex-wrap: nowrap; 
  }


  /* Slider fills the bar */
  #timebar #timeSlider {
    flex: 1 1 auto;    /* Grow and shrink as needed */
    min-width: 50px;   /* Allow it to become very small before breaking */
    width: 100%;
    margin: 0;
  }

  /* Only this label is shown: lead time (0h, 3h, 6h, …) */
  #timeLabel {
    display: block;
    font-size: 11px;   /* Slightly smaller for mobile */
    min-width: 42px;   /* Just enough for "T+144h" */
    text-align: right;
    flex-shrink: 0;    /* Label MUST not shrink */
    white-space: nowrap;
  }

  /* Controls panel spans between gutters */
  #controls {
    /* left: var(--app-gutter);
    right: var(--app-gutter);
    min-width: 0;
    max-width: none;
    width: auto;
    bottom: calc(var(--app-bottom) + 46px); */
    left: var(--app-gutter);
    right: auto; /* avoid full-width stretch */
    width: clamp(220px, 60vw, 340px);
  }

  /* Chart panel also respects gutters */
  #chartPanel {
    top: var(--app-gutter);
    left: var(--app-gutter);
    right: var(--app-gutter);
    width: auto;
    max-width: none;
  }

  #chartContainer {
    flex: 1;
    min-height: 250px;
    padding: 4px 10px 0px;
  }

  /* Slightly constrain the top bubble text */
  #validDayBubble {
    max-width: calc(200vw - 2 * var(--app-gutter));
    font-size: 12px;
    padding: 5px 10px;
  }

  #legendContainer {
    bottom: 55x;          /* tweak position if needed */
    right: 8px;
    transform: scale(0.8); /* 80% of original size */
    transform-origin: bottom right;
  }

}

/* MOBILE + LANDSCAPE LAYOUT */
@media (max-width: 768px) and (orientation: landscape) {
  /* Hide side / floating stuff */
  #mobileQuickFilters,
  #legendContainer,
  #chartPanel,
  #basemapWarning {
    display: none !important;
  }

  /* Top-right custom panel: hide everything by default... */
  .map-control-panel .map-ctrl-group {
    display: none;
  }

  /* ...except: zoom group and 2D/3D group */
  .map-control-panel .map-ctrl-group-zoom,
  .map-control-panel .map-ctrl-group-view {
    display: flex;
  }

  /* Main menu: resize to FIT screen and scroll if needed */
  #controls {
    left: var(--app-gutter);
    right: var(--app-gutter);
    width: auto;

    top: var(--app-gutter);
    bottom: auto;

    max-height: calc(72vh - var(--app-gutter) - var(--app-bottom));
    overflow-y: auto;

    opacity: 1;
    transform: none;       /* ignore .collapsed translateX */
    pointer-events: auto;  /* just in case */
  }

  /* Optional: hide toggle button in landscape (panel always visible) */

}

/* Hide SEO intro text by making it same color as background */
#seoIntro,
#seoIntro h2,
#seoIntro p {
  color: #020617;          /* same as body background */
}

/* Optional: also hide links inside, just in case you add any later */
#seoIntro a {
  color: #020617;
}

/* ---------- Top header with logo ---------- */
#topHeader {
  position: absolute;
  top: var(--app-gutter);
  left: 50%;
  z-index: 9;

  display: flex;
  align-items: center;
  justify-content: center;
}

#appLogo {
  height: 34px;        /* adjust as needed */
  width: auto;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45));
}

/* Logo at top-left */
/* Logo at top-left */
#logoBubble {
  position: absolute;
  top: 6px;        /* closer to top-left on desktop */
  left: 6px;
  z-index: 12;

  padding: 2px 6px; /* less padding so it hugs the corner more */
  border-radius: 999px;
  background: rgba(15,23,42,0.0); /* still transparent */
}

#logoBubble img {
  height: 78px;        /* smaller on desktop */
  width: auto;
  filter:
    /* depth shadow */
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.65))
    /* very subtle brand glow */
    drop-shadow(0 0 8px rgba(56, 189, 248, 0.25));
}


/* --- Mobile tweaks for logo --- */
/* Logo: smaller & tighter in the corner on mobile */
@media (max-width: 768px) {
  #logoBubble {
    top: 4px;
    left: 4px;
    padding: 0 4px;
  }

  #logoBubble img {
    height: 58px;   /* smaller on mobile */
  }
}

/* ---------------- Cookie Consent Bar ---------------- */
/* ---------------- Cookie Consent Bar (Responsive Fix) ---------------- */
#cookieConsentBar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0; /* Ensures it stretches full width properly */
  z-index: 20000; /* Higher than everything else */
  
  /* Visuals */
  background-color: #0f172a; /* Solid deep blue (Slate-900) */
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  
  /* Spacing: Add safe area to bottom padding so it clears the iPhone home bar */
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  
  /* Reset Box Model */
  box-sizing: border-box;
  
  /* Animation */
  transform: translateY(0);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Hidden State (Slide down) */
#cookieConsentBar.hidden {
  transform: translateY(100%);
}

/* Container: Center items together on desktop */
.cookie-content {
  width: 100%;
  max-width: 900px;
  margin: 0 auto; 
  
  display: flex;
  align-items: center;
  justify-content: center; /* <--- This keeps them close together in the middle */
  gap: 24px;               /* Adds a nice breathing room between text and button */
}

/* Text: Remove flex:1 so it doesn't push the button away */
.cookie-text {
  font-size: 13px;
  color: #f1f5f9;
  line-height: 1.4;
  flex: 0 1 auto;          /* Only take up necessary space */
}

#cookieAcceptBtn {
  background: #38bdf8; 
  color: #0f172a;
  border: none;
  border-radius: 8px; /* Slightly less rounded looks better when stacked */
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0; /* Prevents button from getting squashed */
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.2);
}

/* --- MOBILE TWEAKS --- */
@media (max-width: 600px) {
  #cookieConsentBar {
    /* Add extra padding on bottom for mobile specifically */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .cookie-content {
    flex-direction: column; 
    align-items: flex-start; /* Revert to left align for stacking */
    gap: 15px;
  }
  
  .cookie-text {
    width: 100%;
    text-align: left;
  }
  
  #cookieAcceptBtn {
    width: 100%; /* Make button full width for easier tapping */
    text-align: center;
    padding: 12px;
    border-radius: 12px;
  }
}

/* This ensures buttons keep their own width and align to the right */
#mapControlPanel {
  align-items: flex-end !important; 
}

/* 1. Compact 2-Button Pill */
.compass-group-pill {
  width: 30px !important;    /* 27px per button */
  height: 32px !important; 
  border-radius: 16px !important;
  
  /* Horizontal Row */
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  
  padding: 0 2px !important;
  
  background: linear-gradient(180deg, #020617, #1d4ed8);
  border: 1px solid rgba(148,163,184,0.8);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
}

/* 2. Buttons */
.dial-btn {
  background: transparent;
  border: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex: 1; /* Both buttons share space equally */
  padding: 0;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Separator line between the two buttons */
.dial-btn + .dial-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.dial-btn:active {
  background: rgba(255, 255, 255, 0.3);
}

@media (hover: hover) {
  .dial-btn:hover {
    background: rgba(255, 255, 255, 0.15);
  }
}

/* 3. Rotate Icon (Left Button) */
.arrow-btn svg {
  /* Change fixed pixels to percentage so it scales with the button */
  width: 50%;       
  height: 50%;
  color: rgba(255, 255, 255, 0.75); 
}

@media (hover: hover) {
  .arrow-btn:hover svg {
    color: #38bdf8;
  }
}

/* 4. Compass Icon (Right Button) */
.compass-img {
  /* Change fixed pixels to percentage/auto */
  width: auto;      
  height: 50%;      /* Fills 60% of the button's height */
  max-width: 100%;   /* Ensures it never touches the very edges */
  
  /* Standard styles */
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
  transition: transform 0.3s ease;
  pointer-events: none;
  display: block;   /* Removes ghost spacing */
}

/* Force the tooltip container to sit above the legend */
.highcharts-tooltip {
  z-index: 9999 !important;
}


/* Force the tooltip container to sit above the legend */
.highcharts-tooltip {
  z-index: 9999 !important;
}

.highcharts-tooltip > span {
  background-color: rgba(15, 23, 42, 0.96);
  border-radius: 6px;
  padding: 8px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  display: block;
}

/* Define default sizes at the root or scope level */
:root {
  --btn-size: 36px;  /* Default / Max size */
  --btn-gap: 8px;    /* Gap between groups */
}

/* 1. Update the Main Panel to use the gap variable */
.map-control-panel {
  gap: var(--btn-gap);
  transition: gap 0.1s linear; /* Smooth resizing */
}

/* 2. Update Info Button */
body .info-button,
body #infoButton {
  width: var(--btn-size);
  height: var(--btn-size);
  /* Scale font relative to button size (approx 45%) */
  font-size: calc(var(--btn-size) * 0.45); 
  transition: width 0.1s linear, height 0.1s linear, font-size 0.1s linear;
}

/* 3. Update Map Control Buttons (+, -, 2D, 3D, Screenshot) */
.map-ctrl-btn,
.map-ctrl-single .map-ctrl-label {
  width: var(--btn-size);
  height: var(--btn-size);
  font-size: calc(var(--btn-size) * 0.45); /* Scales text inside */
  transition: width 0.1s linear, height 0.1s linear, font-size 0.1s linear;
}

/* 4. Update Compass Pill */
.compass-group-pill {
  height: var(--btn-size) !important;
  /* Width needs to scale too, but keep it rectangular (e.g., slightly wider than height or just match) */
  width: var(--btn-size) !important; 
  transition: height 0.1s linear, width 0.1s linear;
}

/* Adjust the camera icon size specifically if needed */
#saveImageBtn .map-ctrl-label {
  font-size: calc(var(--btn-size) * 0.5);
}


body, #controls, #timebar, #togglePanel, #validDayBubble, #chartPanel, #chartPanelHeader, #chartPanelTitle, #chartContainer
select, .pill, .row-label, .section-label, .control-row, #timeLabel,#snow-tag, #legendContainer, #legendBar
.checkbox-row label {
    font-size: calc(1em - 0.8px) !important;
}

#timebar .time-nav-btn {
  font-size: 10px !important;
}