:root {
  --bg-card: #ffffff;
  --bg-soft: #eef4f7;
  --bg-soft-hover: #e3edf2;
  --text-main: #173241;
  --text-muted: #556b78;
  --border: #c9d7df;
  --accent: #0f5f79;
  --accent-dark: #0a4558;
  --focus: #0b63ce;
  --shadow: 0 8px 24px rgba(16, 40, 56, 0.10);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

.bluesky-page {
  color: var(--text-main);
}

.fire-marker-highlight {
  filter: drop-shadow(0 0 8px rgba(255,140,0,0.9))
          drop-shadow(0 0 14px rgba(255,80,0,0.75));
}

.smoke-colorbar-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0.5rem 0 0.85rem;
  padding: 0.25rem;
  border: 1px solid #d8dee6;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
  overflow: visible !important;
}

.smoke-colorbar {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  box-sizing: border-box;
}

@keyframes firePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.smoke-preview-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d8dee6;
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(16, 40, 56, 0.18);
  padding: 16px 16px 14px;
  backdrop-filter: blur(4px);
}

.smoke-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.smoke-preview-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  margin: 0;
}

.smoke-preview-time {
  color: #5f6b7a;
  font-size: 0.92rem;
  line-height: 1.35;
  word-break: break-word;
}

.smoke-colorbar-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0.5rem 0 0.85rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #d8dee6;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
  overflow: hidden;
}

.smoke-colorbar {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  box-sizing: border-box;
}

.smoke-preview-controls {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px 12px;
}

.smoke-preview-controls .form-label {
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

#smoke-preview-play {
  min-width: 76px;
  border-radius: 10px;
  font-weight: 600;
}

#smoke-preview-close {
  border-radius: 10px;
  font-weight: 600;
}


.smoke-preview-panel.d-none {
  display: none;
}

.smoke-preview-image {
  mix-blend-mode: multiply;
}

/* Tablet */
@media (max-width: 900px) {
  .smoke-preview-panel {
    right: 16px;
    bottom: 16px;
    width: min(340px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    padding: 14px;
  }

  .smoke-preview-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .smoke-preview-controls .form-label {
    white-space: normal;
  }

  #smoke-preview-play,
  #smoke-preview-close {
    width: 100%;
  }
}

/* Phone */
@media (max-width: 767.98px) {
  .smoke-preview-panel {
    overflow-y: visible;   /* 🔥 key fix */
    max-height: none;      /* 🔥 key fix */	  
  }

  .smoke-preview-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .smoke-preview-title {
    font-size: 1rem;
  }

  .smoke-preview-time {
    font-size: 0.88rem;
  }

  .smoke-preview-controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #smoke-preview-play,
  #smoke-preview-close {
    width: 100%;
  }

  #map {
    min-height: 420px;
    height: 52vh;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  .smoke-preview-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: 46vh;
    padding: 10px;
  }

  .smoke-preview-title {
    font-size: 0.96rem;
  }

  .smoke-preview-time {
    font-size: 0.84rem;
  }

  #map {
    min-height: 380px;
    height: 50vh;
  }
}

/* Cards */
.map-card,
.forecast-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.map-card {
  padding: 0.75rem;
}

.map-card-header {
  padding: 0.25rem 0.25rem 0.85rem;
}

.page-title {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.map-help {
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Map */
#map {
  width: 100%;
  height: 70vh;
  border: 1px solid #d7e1e7;
  border-radius: 12px;
  background: #f8fbfc;
}

/* Forecast card */
.forecast-card .card-body {
  padding: 1rem;
}

.forecast-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.forecast-help {
  margin: 0 0 1rem;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Total */
.forecast-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.85rem;
}

.forecast-total-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.forecast-total-count {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-dark);
  white-space: nowrap;
}

/* Rows */
.forecast-list {
  display: grid;
  gap: 0.75rem;
}

.forecast-row {
  margin: 0;
}

.forecast-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.forecast-toggle:hover {
  background: var(--bg-soft-hover);
  border-color: #bdd0d9;
}

.forecast-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.legend-icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
}

.forecast-text {
  flex: 1 1 auto;
  min-width: 0;
}

.forecast-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.forecast-day {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

.forecast-count {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--accent-dark);
  white-space: nowrap;
}

.forecast-date {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Focus states */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.forecast-toggle:focus-within,
.leaflet-control a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.leaflet-popup-content {
  margin: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  min-width: 220px;
  color: var(--text-main);
}

.popup-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.65rem;
  border-bottom: 2px solid #cfe0e8;
  padding-bottom: 0.4rem;
}

.popup-row {
  margin: 0.45rem 0;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.popup-label {
  font-weight: 700;
  color: var(--text-main);
}

.popup-value {
  color: var(--text-muted);
  text-align: right;
}

/* Loading */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  color: var(--text-main);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 2000;
}

.loading::after {
  content: "Loading map data...";
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

/* Responsive */
@media (max-width: 991.98px) {
  #map {
    min-height: 560px;
    height: 65vh;
  }
}

@media (max-width: 767.98px) {
  #map {
    min-height: 460px;
    height: 58vh;
  }

  .forecast-toggle {
    padding: 0.8rem;
  }
}

@media (max-width: 575.98px) {
  #map {
    min-height: 400px;
    height: 52vh;
  }

  .forecast-topline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .forecast-toggle {
    align-items: flex-start;
  }

  .forecast-total {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}


.smoke-preview-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.smoke-preview-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.smoke-preview-time {
  color: #5f6b7a;
  font-size: 0.95rem;
}

.smoke-preview-controls {
  display: grid;
  grid-template-columns: auto auto auto minmax(180px, 1fr) auto minmax(120px, 180px);
  align-items: center;
  gap: 10px;
}

@media (max-width: 900px) {
  .smoke-preview-controls {
    grid-template-columns: 1fr;
  }
}

.map-card {
  position: relative;
}


.smoke-preview-panel.d-none {
  display: none;
}

.smoke-preview-image {
  mix-blend-mode: multiply;
}
