:root {
  --bg: #101827;
  --panel: #1e293b;
  --panel-2: #263449;
  --panel-3: #334155;
  --text: #f8fafc;
  --muted: #9fb0c7;
  --blue: #38bdf8;
  --blue-strong: #0284c7;
  --green: #4ade80;
  --border: rgba(148, 163, 184, .17);
  --shadow: 0 12px 30px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid var(--border);
  background: rgba(16, 24, 39, .96);
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.brand span { color: var(--blue); }

.brand .version-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 3px 6px;
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: 7px;
  color: #bae6fd;
  background: rgba(56, 189, 248, .10);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2px;
  vertical-align: middle;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(22, 60, 54, .8);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 22px clamp(12px, 2.5vw, 30px) 42px; }
.intro { margin-bottom: 20px; }
h1 { margin: 0; font-size: clamp(23px, 3vw, 31px); letter-spacing: -.6px; }
h2 { margin: 0; font-size: 18px; }
h3 { margin: 0; font-size: 15px; }
p { margin: 0; }
.subtitle { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.section { margin-top: 25px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.panel, .notice, .search-box, .map-toolbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.panel { padding: 17px; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.55; }
.tiny { font-size: 11px; line-height: 1.5; color: var(--muted); }
.accent { color: var(--blue); }
.success { color: var(--green); }
.warning { color: #fbbf24; }

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  color: white;
  background: var(--blue-strong);
  font-weight: 750;
  font-size: 13px;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--panel-3); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.small-btn { padding: 8px 11px; font-size: 12px; }
.field {
  width: 100%;
  min-width: 0;
  border: 1px solid #3b4a60;
  border-radius: 11px;
  padding: 12px 13px;
  color: white;
  background: #101827;
  outline: none;
}
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(56, 189, 248, .13); }
label { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
label .field { margin-top: 7px; }

.notice {
  padding: 15px 17px;
  margin: 16px 0;
  border-left: 3px solid var(--blue);
}
.notice strong { display: block; margin-bottom: 5px; }
.notice[hidden], [hidden] { display: none !important; }

.map-head { align-items: end; }
.source-select-wrap { display: flex; align-items: center; gap: 9px; }
.source-select-wrap label { white-space: nowrap; }
.source-select {
  min-width: 185px;
  border: 1px solid #3b4a60;
  border-radius: 10px;
  padding: 9px 11px;
  color: white;
  background: var(--panel);
}
.map-shell {
  position: relative;
  height: clamp(390px, 60vh, 620px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 17px;
  background: #dce4e7;
}
#map { width: 100%; height: 100%; }
.map-chip {
  position: absolute;
  z-index: 5;
  top: 13px;
  left: 13px;
  max-width: calc(100% - 26px);
  padding: 9px 12px;
  border-radius: 10px;
  color: white;
  background: rgba(16, 24, 39, .92);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  pointer-events: none;
}
.map-top-actions {
  position: absolute;
  z-index: 20;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: calc(100% - 24px);
  pointer-events: auto;
}
.map-expand-toggle {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 9px 12px;
  color: white;
  background: rgba(16,24,39,.94);
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.map-layer-control {
  position: relative;
  top: auto;
  right: auto;
  width: min(340px, calc(100vw - 190px));
  color: var(--text);
  pointer-events: auto;
}
.map-layer-toggle {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-left: auto;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 9px 12px;
  color: white;
  background: rgba(16,24,39,.94);
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  font-size: 12px;
  font-weight: 800;
}
.map-layer-panel {
  max-height: min(52vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  background: rgba(16,24,39,.98);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  backdrop-filter: blur(8px);
  touch-action: pan-y;
}
.map-layer-panel[hidden] { display: none !important; }
.map-layer-panel label { display: block; margin-top: 12px; color: #dbe7f5; font-size: 12px; }
.map-layer-panel .source-select { width: 100%; min-width: 0; min-height: 44px; margin-top: 6px; font-size: 13px; }
.map-layer-panel .layer-check { min-height: 42px; display: flex !important; align-items: center; gap: 9px; }
.map-layer-panel .layer-check span { font-size: 12px; line-height: 1.4; }
.layer-check input { flex: 0 0 18px; accent-color: var(--blue); width: 18px; height: 18px; }
.layer-hint { margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.map-layer-panel-head {
  position: sticky;
  z-index: 2;
  top: -12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -12px -12px 8px;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  border-radius: 12px 12px 0 0;
  background: #101827;
}
.map-layer-panel-head strong { font-size: 13px; }
.map-layer-close {
  flex: 0 0 auto;
  min-width: 66px;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  color: #fff;
  background: #334155;
  font-size: 12px;
  font-weight: 700;
}
.imn-map-card {
  position: absolute;
  z-index: 15;
  left: 12px;
  bottom: 42px;
  width: min(310px, calc(100% - 24px));
  padding: 9px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  color: white;
  background: rgba(16,24,39,.96);
  box-shadow: 0 8px 24px rgba(0,0,0,.32);
  pointer-events: auto;
}
.imn-map-card[hidden] { display: none !important; }
.imn-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; font-size: 12px; }
.imn-card-close { border: 0; border-radius: 7px; padding: 3px 8px; color: white; background: #334155; font-size: 16px; }
.imn-map-card img { display: block; width: 100%; max-height: 190px; object-fit: contain; border-radius: 7px; background: #05070b; }
.imn-map-card img[hidden] { display: none !important; }
.imn-card-status { margin-top: 6px; color: #cbd5e1; font-size: 10px; line-height: 1.4; }
.imn-card-note { margin-top: 5px; color: #94a3b8; font-size: 9px; line-height: 1.4; }
.imn-card-link { display: inline-block; margin-top: 5px; color: var(--blue); font-size: 10px; }
.camera-marker {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 2px solid white;
  border-radius: 50%;
  color: #fff;
  background: #7c3aed;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
  font-size: 15px;
  cursor: pointer;
}
.camera-marker.rain { background: #dc2626; }
.camera-marker.possible, .camera-marker.mixed { background: #d97706; }
.camera-marker.clear { background: #7c3aed; }
.camera-marker.offline { background: #475569; }
.camera-marker.stale { background: #64748b; }
.camera-marker.delayed { background: #b45309; }
.camera-marker.low_visibility, .camera-marker.weather_uncertain { background: #64748b; }
.camera-marker.scene_uncertain { background: #64748b; }
.camera-marker.not_weather_view { background: #475569; }
.camera-marker.pending { background: #0f766e; }
.camera-marker.station-marker { border-radius: 9px; background: #0e7490; }
.camera-marker.station-marker.rain { background: #dc2626; }

.camera-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255,255,255,.96);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #8b5cf6, #5b21b6);
  box-shadow: 0 3px 12px rgba(0,0,0,.42), 0 0 0 1px rgba(15,23,42,.28);
  font-size: 15px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.camera-marker:active { transform: scale(.94); }
.camera-marker.is-active {
  transform: scale(1.14);
  box-shadow: 0 0 0 5px rgba(56,189,248,.24), 0 4px 15px rgba(0,0,0,.48);
}
.camera-marker.rain { background: linear-gradient(145deg, #fb7185, #be123c); }
.camera-marker.possible, .camera-marker.mixed { background: linear-gradient(145deg, #fbbf24, #b45309); }
.camera-marker.clear { background: linear-gradient(145deg, #8b5cf6, #5b21b6); }
.camera-marker.offline { background: linear-gradient(145deg, #64748b, #334155); }
.camera-marker.stale, .camera-marker.delayed { background: linear-gradient(145deg, #94a3b8, #475569); }
.camera-marker.low_visibility, .camera-marker.weather_uncertain,
.camera-marker.scene_uncertain { background: linear-gradient(145deg, #94a3b8, #475569); }
.camera-marker.not_weather_view { background: linear-gradient(145deg, #64748b, #334155); }
.camera-marker.online { background: linear-gradient(145deg, #34d399, #0f766e); }
.camera-marker.skyline-marker { border-radius: 11px; background: linear-gradient(145deg, #2dd4bf, #0f766e); }
.camera-marker.skyline-marker.offline { background: linear-gradient(145deg, #94a3b8, #475569); }
.camera-marker.skyline-marker.mixed { background: linear-gradient(145deg, #fbbf24, #b45309); }
.camera-marker.pending { background: linear-gradient(145deg, #2dd4bf, #0f766e); }
.camera-marker.station-marker { border-radius: 11px; background: linear-gradient(145deg, #22d3ee, #0e7490); }

.map-detail-sheet {
  position: absolute;
  z-index: 30;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100% - 28px));
  max-height: min(74%, 560px);
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 19px;
  color: #f8fafc;
  background: linear-gradient(155deg, rgba(25,37,57,.98), rgba(10,17,30,.98));
  box-shadow: 0 18px 46px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.07);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(14px) scale(.985);
  transition: opacity .2s ease, transform .22s cubic-bezier(.2,.8,.2,1);
  pointer-events: auto;
  touch-action: pan-y;
}
.map-detail-sheet[hidden] { display: none !important; }
.map-detail-sheet.is-open { opacity: 1; transform: translateY(0) scale(1); }
.map-detail-grabber {
  display: none;
  width: 38px;
  height: 4px;
  flex: 0 0 auto;
  margin: 8px auto 0;
  border-radius: 99px;
  background: rgba(203,213,225,.48);
}
.map-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 15px 12px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(110deg, rgba(30,64,91,.36), rgba(15,23,42,.1));
}
.map-detail-heading { min-width: 0; }
.map-detail-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #7dd3fc;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.map-detail-title {
  display: block;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.22;
  overflow-wrap: anywhere;
}
.map-detail-subtitle {
  display: block;
  margin-top: 4px;
  color: #a9bad0;
  font-size: 10px;
  line-height: 1.4;
}
.map-detail-close {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  margin: -2px -2px 0 0;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 11px;
  color: #f8fafc;
  background: rgba(255,255,255,.08);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}
.map-detail-close:active { background: rgba(255,255,255,.17); }
.map-detail-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 12px 14px 14px;
}
.map-shell.has-map-detail .camera-alert-stack { display: none; }

.camera-popup {
  width: 100%;
  min-width: 0;
  color: #e5edf7;
  font: 12px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.camera-popup-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.camera-popup-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 5px 8px;
  border: 1px solid rgba(148,163,184,.17);
  border-radius: 99px;
  color: #dbeafe;
  background: rgba(148,163,184,.10);
  font-size: 10px;
  font-weight: 750;
}
.camera-popup .camera-popup-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px 11px;
  border: 1px solid rgba(56,189,248,.17);
  border-radius: 12px;
  color: #dbeafe;
  background: rgba(14,116,144,.15);
  font-size: 11px;
  line-height: 1.45;
  font-weight: 550;
}
.camera-popup .camera-popup-status::before {
  content: "ⓘ";
  flex: 0 0 auto;
  color: #7dd3fc;
  font-size: 14px;
  line-height: 1.1;
}
.camera-popup .camera-popup-list {
  display: grid;
  gap: 0;
  max-height: min(31svh, 230px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-top: 1px solid rgba(148,163,184,.16);
}
.camera-popup .camera-popup-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 5px 10px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(148,163,184,.13);
  font-size: 11px;
}
.camera-popup-row-main { min-width: 0; }
.camera-popup-row-title {
  display: block;
  margin: 0 !important;
  overflow-wrap: anywhere;
  color: #f1f5f9;
  font-size: 11px !important;
  font-weight: 750;
  line-height: 1.3;
}
.camera-popup-row-detail {
  display: block;
  margin-top: 3px;
  color: #91a4bb;
  font-size: 9px;
  font-weight: 450;
}
.camera-popup-row-preview-wrap {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 7px;
}
.camera-popup-row-preview {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 11px;
  background: #0b1220;
}
.camera-popup-row-preview-offline {
  display: block;
  padding: 11px;
  border: 1px dashed rgba(148,163,184,.24);
  border-radius: 10px;
  color: #a9bad0;
  background: rgba(148,163,184,.06);
  font-size: 10px;
  line-height: 1.45;
}
.camera-popup-row-state {
  justify-self: end;
  max-width: 150px;
  padding: 5px 8px;
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 99px;
  color: #dbeafe;
  background: rgba(148,163,184,.12);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}
.camera-popup-row-state.online { color: #bbf7d0; background: rgba(22,163,74,.15); border-color: rgba(74,222,128,.16); }
.camera-popup-row-state.offline { color: #fecaca; background: rgba(220,38,38,.15); border-color: rgba(248,113,113,.16); }
.camera-popup-row-state.delayed, .camera-popup-row-state.stale,
.camera-popup-row-state.low_visibility, .camera-popup-row-state.weather_uncertain {
  color: #fde68a; background: rgba(217,119,6,.15); border-color: rgba(251,191,36,.16);
}
.camera-popup .camera-popup-row a,
.camera-popup .camera-popup-site-link,
.camera-popup .camera-popup-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 30px;
  margin-top: 5px;
  padding: 6px 9px;
  border: 1px solid rgba(56,189,248,.2);
  border-radius: 9px;
  color: #7dd3fc;
  background: rgba(14,116,144,.13);
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
}
.camera-popup .camera-popup-note,
.camera-popup .camera-popup-meta {
  display: block;
  margin-top: 10px;
  color: #91a4bb;
  font-size: 9px;
  line-height: 1.45;
}
.station-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
  margin-top: 10px;
}
.station-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(148,163,184,.15);
  border-radius: 12px;
  background: rgba(148,163,184,.07);
}
.station-metric span {
  display: block;
  color: #9fb0c5;
  font-size: 9px;
  line-height: 1.3;
}
.station-metric strong {
  display: block;
  margin-top: 5px;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.camera-popup .weatherlink-frame {
  display: block;
  width: 100%;
  height: 220px;
  margin-top: 10px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 12px;
  background: #0b1220;
}
.camera-popup-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
@media (max-width: 650px) {
  .map-detail-sheet {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(59svh, 455px);
    border-radius: 18px;
  }
  .map-detail-grabber { display: block; }
  .map-detail-head { padding: 10px 13px 10px; }
  .map-detail-title { font-size: 15px; }
  .map-detail-content { padding: 10px 13px calc(12px + env(safe-area-inset-bottom)); }
  .camera-popup .camera-popup-list { max-height: min(26svh, 190px); }
  .camera-popup .camera-popup-row { padding: 10px 1px; }
  .station-metric { padding: 9px; }
  .station-metric strong { font-size: 15px; }
}
.camera-alert-stack {
  position: absolute;
  z-index: 18;
  left: 12px;
  bottom: 12px;
  display: grid;
  gap: 7px;
  width: min(340px, calc(100% - 24px));
  pointer-events: none;
}
.camera-alert-stack[hidden] { display: none !important; }
.camera-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 11px;
  color: #fff;
  background: rgba(16,24,39,.96);
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  pointer-events: auto;
  font-size: 11px;
  line-height: 1.45;
  backdrop-filter: blur(7px);
}
.camera-alert-item.rain { border-left: 4px solid #ef4444; }
.camera-alert-item.possible { border-left: 4px solid #f59e0b; }
.camera-alert-item .camera-alert-icon { flex: 0 0 auto; font-size: 18px; line-height: 1; }
.camera-alert-content { flex: 1 1 auto; min-width: 0; }
.camera-alert-item strong { display: block; font-size: 11px; }
.camera-alert-item small { display: block; margin-top: 3px; color: #cbd5e1; font-size: 10px; }
.camera-alert-item a { display: inline-block; margin-top: 4px; color: #7dd3fc; font-weight: 750; text-decoration: none; }
.camera-alert-close {
  display: grid; flex: 0 0 28px; place-items: center;
  width: 28px; height: 28px; margin: -4px -5px 0 0; padding: 0;
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px;
  color: #fff; background: rgba(255,255,255,.09);
  font-size: 20px; line-height: 1;
}
.camera-alert-close:active { background: rgba(255,255,255,.2); }
.camera-monitor-note {
  margin-top: 8px;
  padding: 8px 9px;
  border-radius: 9px;
  color: #cbd5e1;
  background: rgba(56,189,248,.08);
  font-size: 10px;
  line-height: 1.45;
}
.map-status-chip {
  position: absolute;
  z-index: 5;
  right: 13px;
  bottom: 13px;
  max-width: min(78%, 420px);
  padding: 8px 10px;
  border-radius: 9px;
  color: white;
  background: rgba(16, 24, 39, .9);
  font-size: 11px;
  line-height: 1.45;
  pointer-events: none;
}
.map-toolbar { margin-top: 10px; padding: 12px 14px; }

.route-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(56,189,248,.22);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(30,41,59,.98), rgba(15,23,42,.98));
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}
.route-panel > *, .route-mode-section > *, .route-result > *, .route-edit > * { min-width: 0; }
.route-panel[hidden], .route-mode-section[hidden], .route-result[hidden], .route-edit[hidden],
.route-pick-hint[hidden], .route-actions .btn[hidden] { display: none !important; }
.route-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.route-panel-head strong { font-size: 16px; letter-spacing: -.1px; }
.route-mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border-radius: 13px; background: rgba(2,6,23,.45); border: 1px solid var(--border);
}
.route-mode-btn {
  border: 0; border-radius: 10px; padding: 10px 6px; color: #94a3b8;
  background: transparent; font-size: 13px; font-weight: 700;
}
.route-mode-btn.active { color: #e0f2fe; background: rgba(2,132,199,.38); box-shadow: inset 0 0 0 1px rgba(56,189,248,.5); }
.route-mode-section { display: grid; gap: 10px; }
.route-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.route-chip {
  flex: 1 1 auto; border: 1px solid var(--border); border-radius: 999px; padding: 9px 12px;
  color: #cbd5e1; background: rgba(38,52,73,.7); font-size: 12.5px; font-weight: 700; text-align: center;
}
.route-chip.active { color: #e0f2fe; border-color: rgba(56,189,248,.65); background: rgba(2,132,199,.3); }
#routeDirectionChips { display: grid; grid-template-columns: 1fr 1fr; }
.route-place {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: rgba(56,189,248,.07); color: #dbeafe; font-size: 13px;
}
.route-place-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-place-name b { color: #f8fafc; }
.route-link { flex: 0 0 auto; border: 0; background: none; color: #38bdf8; font-size: 13px; font-weight: 800; padding: 4px 2px; }
.route-edit { display: grid; gap: 8px; }
.route-search-row { display: flex; gap: 8px; align-items: stretch; }
.route-search-row .field { flex: 1; min-width: 0; }
.route-wide { width: 100%; }
.route-search-results { display: grid; gap: 6px; }
.route-search-results:empty { display: none; }
.route-search-result {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 10px 11px; border: 1px solid var(--border); border-radius: 11px;
  color: var(--text); background: #263449; text-align: left; font-size: 13px;
}
.route-search-result small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.route-pick-hint {
  padding: 10px 12px; border: 1px dashed rgba(56,189,248,.55); border-radius: 12px;
  color: #bae6fd; background: rgba(2,132,199,.12); font-size: 12px; line-height: 1.5;
}
.route-depart { display: flex; align-items: center; gap: 10px; }
.route-depart > span { flex: 0 0 auto; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.route-depart .route-chips { flex: 1; flex-wrap: nowrap; gap: 5px; }
.route-depart .route-chip { padding: 8px 4px; font-size: 12px; white-space: nowrap; }
.route-actions { display: grid; gap: 8px; }
.route-actions .btn { width: 100%; padding: 13px 14px; font-size: 15px; font-weight: 800; }
#routeClearBtn { padding: 10px; font-size: 13px; font-weight: 700; }
.route-result { display: grid; gap: 11px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Veredicto: un vistazo y ya sabes si te mojas */
.route-verdict {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 15px;
  border: 1px solid var(--vc, #475569); background: color-mix(in srgb, var(--vc, #475569) 16%, transparent);
}
.route-verdict.clear { --vc: #22c55e; }
.route-verdict.possible { --vc: #f59e0b; }
.route-verdict.rain { --vc: #ef4444; }
.route-verdict.storm { --vc: #a855f7; }
.route-verdict.unknown { --vc: #94a3b8; }
.route-verdict-icon { font-size: 30px; line-height: 1; }
.route-verdict strong { display: block; font-size: 17px; color: #f8fafc; }
.route-verdict small { display: block; margin-top: 3px; color: #cbd5e1; font-size: 12px; }
.route-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.route-facts div { padding: 9px 4px; border-radius: 12px; background: rgba(38,52,73,.75); text-align: center; }
.route-facts b { display: block; font-size: 15px; color: #f1f5f9; font-variant-numeric: tabular-nums; }
.route-facts span { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.route-strip { display: flex; gap: 3px; height: 14px; }
.route-seg {
  flex: 1; display: grid; place-items: center; border-radius: 4px; font-size: 9px; font-weight: 900; color: rgba(255,255,255,.95);
}
.route-seg.unknown { background: #64748b; } .route-seg.clear { background: #22c55e; }
.route-seg.possible { background: #f59e0b; } .route-seg.rain { background: #ef4444; } .route-seg.storm { background: #a855f7; }
.route-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.route-issues li { padding: 9px 11px; border-radius: 11px; background: rgba(15,23,42,.55); border: 1px solid var(--border); font-size: 12.5px; color: #e2e8f0; }
.route-issues li span { display: block; margin-top: 2px; color: #cbd5e1; font-size: 12px; }
.route-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.route-details { border: 1px solid var(--border); border-radius: 12px; background: rgba(15,23,42,.4); }
.route-details summary { cursor: pointer; padding: 10px 12px; color: #93c5fd; font-size: 13px; font-weight: 700; list-style: none; }
.route-details summary::-webkit-details-marker { display: none; }
.route-details summary::after { content: " ▾"; }
.route-details[open] summary::after { content: " ▴"; }
.route-row { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: #e2e8f0; }
.route-row > div { flex: 1; min-width: 0; }
.route-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.route-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #64748b; }
.route-dot.clear { background: #22c55e; } .route-dot.possible { background: #f59e0b; }
.route-dot.rain { background: #ef4444; } .route-dot.storm { background: #a855f7; }
.route-pill { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-style: normal; font-weight: 800; color: #e2e8f0; background: rgba(100,116,139,.35); }
.route-pill.clear { background: rgba(34,197,94,.22); color: #bbf7d0; } .route-pill.possible { background: rgba(245,158,11,.25); color: #fde68a; }
.route-pill.rain { background: rgba(239,68,68,.28); color: #fecaca; } .route-pill.storm { background: rgba(168,85,247,.3); color: #e9d5ff; }
.route-map-marker {
  display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid white; border-radius: 50%;
  color: white; font-size: 12px; font-weight: 900; box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.route-map-marker.start { background: #16a34a; }
.route-map-marker.end { background: #dc2626; }

.radar-toolbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.radar-time { color: var(--muted); font-size: 12px; }
.timeline-row {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
input[type="range"] { width: 100%; accent-color: var(--blue); }
.timeline-label { min-width: 85px; text-align: right; font-size: 12px; color: var(--muted); }
.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 11px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-gradient {
  width: 130px;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, #36bae5, #00a3e0, #00b66a, #ffee00, #ff8b00, #e62800, #ff81ff);
}
.source-note { margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.source-note a, footer a { color: var(--blue); }

.search-box { padding: 16px; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.search-results { display: grid; gap: 7px; margin-top: 10px; }
.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--panel-2);
  text-align: left;
}
.search-result:hover { border-color: var(--blue); }
.search-result small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.weather-grid, .solar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.weather-card { min-height: 175px; }
.weather-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.place-name { font-size: 17px; font-weight: 800; }
.place-subtitle { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.current-main { display: flex; align-items: center; gap: 14px; margin: 18px 0 15px; }
.weather-emoji { font-size: 42px; line-height: 1; }
.current-temp { font-size: 36px; line-height: 1; font-weight: 800; letter-spacing: -1.4px; }
.current-desc { margin-top: 5px; font-size: 13px; font-weight: 700; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric { border-radius: 10px; padding: 10px 8px; background: var(--panel-2); text-align: center; }
.metric strong { display: block; font-size: 14px; }
.metric span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.forecast-summary {
  border-radius: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.summary-title { font-weight: 800; font-size: 14px; }
.summary-line { margin-top: 9px; font-size: 13px; line-height: 1.6; }
.rain-window {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.rain-window:last-child { border-bottom: 0; padding-bottom: 0; }
.rain-window strong { color: var(--blue); }
.rain-window span { text-align: right; color: #dbe7f5; }
.hourly-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.hour-card {
  min-width: 0;
  border-radius: 13px;
  padding: 13px 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  text-align: center;
}
.hour-time { font-size: 12px; font-weight: 800; }
.hour-icon { margin: 9px 0; font-size: 25px; }
.hour-prob { color: var(--blue); font-size: 15px; font-weight: 800; }
.hour-detail { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.hour-temp { margin-top: 5px; font-size: 11px; }
.disclaimer { margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.solar-card { padding: 16px; }
.solar-place { font-weight: 800; font-size: 14px; }
.solar-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.solar-time {
  border-radius: 11px;
  padding: 12px 9px;
  background: var(--panel-2);
  text-align: center;
}
.solar-time .symbol { font-size: 23px; }
.solar-time strong { display: block; margin-top: 5px; font-size: 18px; }
.solar-time span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.day-length { margin-top: 10px; padding: 10px; border-radius: 10px; background: rgba(56,189,248,.08); color: #cfeeff; font-size: 12px; text-align: center; }

.settings-panel { margin-top: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.privacy-note { margin-top: 11px; color: var(--muted); font-size: 11px; line-height: 1.55; }

footer { margin-top: 30px; padding: 17px 4px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; line-height: 1.7; }
.error-text { color: #fca5a5; }
.loading { color: var(--blue); }
.maplibregl-ctrl-group { border-radius: 10px !important; overflow: hidden; }
.maplibregl-ctrl-attrib { font-size: 10px !important; }

@media (max-width: 900px) {
  .hourly-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  main { padding: 17px 12px 30px; }
  .topbar { padding: 14px 13px; }
  .brand { font-size: 19px; }
  .map-shell { height: clamp(430px, 68svh, 600px); border-radius: 14px; }
  .map-layer-control { left: 12px; right: 12px; width: calc(100% - 24px); }
  .map-layer-panel { max-height: min(64svh, 350px); padding: 14px; }
  .map-layer-panel-head { top: -14px; margin: -14px -14px 9px; padding: 12px 14px; }
  .map-layer-panel .source-select { min-height: 46px; font-size: 14px; }
  .map-layer-panel .layer-check { min-height: 46px; }
  .map-layer-close { min-height: 40px; }
  .imn-map-card { width: min(260px, calc(100% - 24px)); bottom: 42px; }
  .imn-map-card img { max-height: 125px; }
  .weather-grid, .solar-grid { grid-template-columns: 1fr; }
  .hourly-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-select-wrap { width: 100%; justify-content: space-between; }
  .source-select { flex: 1; min-width: 0; }
  .search-form { grid-template-columns: 1fr; }
  .search-form .btn { width: 100%; }
  .timeline-row { grid-template-columns: auto minmax(60px, 1fr); }
  .timeline-label { grid-column: 1 / -1; text-align: left; }
  .metrics { gap: 6px; }
  .metric { padding: 9px 5px; }
  .rain-window { align-items: start; flex-direction: column; gap: 4px; }
  .rain-window span { text-align: left; }
}

/* Vista de mapa ampliado: conserva solo el mapa y sus controles. */
body.map-focus { overflow: hidden; }
body.map-focus .topbar,
body.map-focus main > :not(#precipitationSection) { display: none !important; }
body.map-focus main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
body.map-focus #precipitationSection { display: block; margin: 0; }
body.map-focus #precipitationSection > .section-head { display: none !important; }
body.map-focus #mapShell {
  position: fixed;
  z-index: 9998;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
}
body.map-focus .map-top-actions {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
}
body.map-focus .map-chip { top: calc(12px + env(safe-area-inset-top, 0px)); }
body.map-focus .map-toolbar {
  position: fixed;
  z-index: 10000;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-height: min(36dvh, 250px);
  overflow-y: auto;
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(16,24,39,.94);
  backdrop-filter: blur(10px);
}
body.map-focus #mapStatusChip {
  bottom: calc(min(36dvh, 250px) + 24px + env(safe-area-inset-bottom, 0px));
  max-width: min(68%, 420px);
}
body.map-focus .maplibregl-ctrl-bottom-left,
body.map-focus .maplibregl-ctrl-bottom-right {
  bottom: calc(min(36dvh, 250px) + 18px + env(safe-area-inset-bottom, 0px));
}
body.map-focus .maplibregl-ctrl-top-right {
  top: calc(60px + env(safe-area-inset-top, 0px));
}
body.map-focus .route-panel { max-height: 22dvh; overflow-y: auto; }

@media (max-width: 650px) {
  .map-top-actions {
    top: 12px;
    right: 12px;
    left: 12px;
    justify-content: flex-end;
    gap: 7px;
  }
  .map-expand-toggle { padding: 9px 10px; font-size: 11px; }
  .map-layer-control {
    left: auto;
    right: auto;
    width: min(230px, calc(100vw - 150px));
  }
  .map-chip {
    max-width: min(40%, 190px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.map-focus .map-top-actions { left: 12px; right: 12px; }
  body.map-focus .map-toolbar { max-height: min(39dvh, 280px); }
  body.map-focus #mapStatusChip {
    bottom: calc(min(39dvh, 280px) + 24px + env(safe-area-inset-bottom, 0px));
  }
}

/* Panel de capas: grupos y interruptores */
.layer-group { margin-top: 12px; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.04); }
.layer-group-title { font-size: 12px; font-weight: 800; letter-spacing: .02em; color: #9fd3ff; margin-bottom: 6px; }
.map-layer-panel .layer-group .layer-check { min-height: 52px; padding: 6px 2px; margin-top: 0; cursor: pointer; justify-content: space-between; flex-direction: row-reverse; }
.layer-label { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.layer-label strong { font-size: 13px; color: #fff; }
.layer-label small { font-size: 11px; color: var(--muted); line-height: 1.35; }
.layer-group .layer-check input { appearance: none; -webkit-appearance: none; flex: 0 0 46px; width: 46px; height: 26px; border-radius: 13px; background: #3b475c; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.layer-group .layer-check input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.layer-group .layer-check input:checked { background: #2fb36d; }
.layer-group .layer-check input:checked::after { transform: translateX(20px); }
.layer-group .layer-check input:focus-visible { outline: 2px solid #9fd3ff; outline-offset: 2px; }
.layer-group .layer-check + .layer-check { border-top: 1px solid rgba(255,255,255,.08); }

/* Avisos de lluvia: rótulo que se desplaza hacia la derecha, discreto */
.camera-alert-stack { top: 66px; bottom: auto; left: 12px; right: 12px; width: auto; }
.rain-ticker { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 10px; border: 1px solid rgba(125,211,252,.35); border-radius: 16px; background: rgba(16,24,39,.82); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); backdrop-filter: blur(6px); pointer-events: auto; font-size: 12px; }
.rain-ticker-label { flex: 0 0 auto; font-weight: 800; font-size: 11px; color: #7dd3fc; white-space: nowrap; }
.rain-ticker-window { flex: 1 1 auto; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.rain-ticker-track { display: flex; width: max-content; animation: rain-ticker-move linear infinite; }
.rain-ticker-window:active .rain-ticker-track { animation-play-state: paused; }
.rain-ticker-set { display: flex; gap: 22px; padding-right: 22px; white-space: nowrap; }
.rain-chip { color: #fff; text-decoration: none; }
.rain-chip b { font-weight: 750; }
.rain-ticker-close { flex: 0 0 26px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; color: #cbd5e1; background: rgba(255,255,255,.1); font-size: 16px; line-height: 1; }
@keyframes rain-ticker-move { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .rain-ticker-track { animation: none; } .rain-ticker-set[aria-hidden] { display: none; } .rain-ticker-window { overflow-x: auto; } }

/* Mapa ampliado: pantalla limpia (solo lo esencial sobre el mapa) */
body.map-focus #mapLocationChip,
body.map-focus #mapStatusChip,
body.map-focus .maplibregl-ctrl-top-right,
body.map-focus .maplibregl-ctrl-attrib,
body.map-focus #radarStatus,
body.map-focus .map-toolbar .legend { display: none !important; }
body.map-focus .map-top-actions { left: auto; right: 12px; gap: 8px; }
body.map-focus .map-expand-toggle,
body.map-focus .map-layer-toggle { min-height: 38px; padding: 7px 12px; border-radius: 19px; background: rgba(16,24,39,.8); backdrop-filter: blur(8px); }
body.map-focus .map-layer-control { width: auto; }
body.map-focus .map-layer-panel { position: absolute; right: 0; width: min(320px, calc(100vw - 24px)); }
body.map-focus .camera-alert-stack { top: calc(60px + env(safe-area-inset-top, 0px)); }
body.map-focus .map-toolbar {
  max-height: 22dvh;
  padding: 8px 10px;
  border-radius: 20px;
  background: rgba(16,24,39,.8);
}
body.map-focus .map-toolbar:has(#routePanel:not([hidden])) { max-height: 46dvh; }
body.map-focus .radar-toolbar-top { margin: 0 0 6px; align-items: center; }
body.map-focus .radar-time { font-size: 11px; }
body.map-focus .map-toolbar .btn.small-btn { padding: 6px 10px; font-size: 12px; min-height: 34px; }
body.map-focus .maplibregl-ctrl-bottom-left,
body.map-focus .maplibregl-ctrl-bottom-right { bottom: calc(22dvh + 20px + env(safe-area-inset-bottom, 0px)); }
.camera-alert-stack { display: block; }
.rain-ticker { min-width: 0; max-width: 100%; box-sizing: border-box; overflow: hidden; }

.camera-marker.station-marker.temp { min-width: 40px; width: auto; padding: 0 7px; border: 2px solid #fff; border-radius: 16px; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: -.02em; }
.camera-marker.station-marker.temp.rainy { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56,189,248,.45), 0 2px 10px rgba(0,0,0,.4); }
.temp-legend { display: flex; gap: 4px; margin: 2px 0 8px; }
.temp-legend span { flex: 1; padding: 3px 0; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 800; text-align: center; }
.camera-marker.station-marker.temp.extreme-hi { border-color: #fecaca; box-shadow: 0 0 0 4px rgba(239,68,68,.55), 0 2px 10px rgba(0,0,0,.4); z-index: 3; }
.camera-marker.station-marker.temp.extreme-lo { border-color: #bfdbfe; box-shadow: 0 0 0 4px rgba(59,130,246,.55), 0 2px 10px rgba(0,0,0,.4); z-index: 3; }
.rain-chip.temp-chip b { color: #fde68a; }
/* Ampliado: la ficha de detalle ocupa el lugar de la barra inferior (sin encimarse) */
body.map-focus:has(.map-shell.has-map-detail) .map-toolbar { display: none !important; }
body.map-focus:has(.map-shell.has-map-detail) .maplibregl-ctrl-bottom-left,
body.map-focus:has(.map-shell.has-map-detail) .maplibregl-ctrl-bottom-right { display: none; }
body.map-focus .map-detail-sheet { z-index: 10001; bottom: 0; max-height: 62dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Ambiente animado */
body { position: relative; }
.amb-rain { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.amb-sky { position: absolute; left: 0; right: 0; height: 0; z-index: 1; pointer-events: none; }
.amb-sky[hidden] { display: none; }
.amb-body { position: absolute; right: 16px; top: 0; opacity: .92; }
.amb-moon.dim { opacity: .55; }
.amb-rays { transform-origin: 36px 36px; animation: amb-spin 90s linear infinite; }
.amb-cloud { position: absolute; opacity: .16; animation: amb-drift 70s linear infinite alternate; }
.amb-cloud.dark { opacity: .22; }
.amb-cloud.c1 { right: 70px; top: 6px; }
.amb-cloud.c2 { right: 8px; top: 46px; transform: scale(.75); animation-duration: 95s; }
.amb-stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.amb-star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #e6eeff; opacity: .5; animation: amb-twinkle 4s ease-in-out infinite; }
.ambient-toggle { margin-left: 6px; padding: 2px 7px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; color: #fde68a; background: rgba(255,255,255,.06); font-size: 13px; line-height: 1.4; }
body.map-focus .amb-sky, body.map-focus .amb-rain, body.map-focus .amb-stars { display: none; }
@keyframes amb-spin { to { transform: rotate(360deg); } }
@keyframes amb-drift { from { transform: translateX(-26px); } to { transform: translateX(26px); } }
@keyframes amb-twinkle { 0%,100% { opacity: .15; } 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .amb-rays, .amb-cloud, .amb-star { animation: none; } }
.amb-sky, .amb-stars { z-index: -1; }
.amb-body { right: 10px; opacity: .8; }
.amb-body svg { width: 58px; height: 58px; }

/* Volcanes e íconos del mapa */
.landmark { display: grid; place-items: center; border: 0; padding: 0; background: transparent; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.landmark.volcano { width: 34px; height: 34px; font-size: 24px; }
.landmark.volcano.rest { opacity: .8; font-size: 21px; }
.vol-icon { display: block; animation: vol-sway 4s ease-in-out infinite; }
.vol-smoke { position: absolute; top: 1px; left: 50%; width: 9px; height: 9px; margin-left: -4px; border-radius: 50%; background: rgba(226,232,240,.8); filter: blur(1.5px); animation: vol-smoke 3.2s ease-out infinite; pointer-events: none; }
.landmark.emblem { width: 30px; height: 30px; border-radius: 50%; font-size: 17px; background: rgba(255,255,255,.88); border: 2px solid rgba(16,24,39,.75); }
.landmark.emblem.major { width: 36px; height: 36px; font-size: 20px; border-color: #0e7490; }
#map.zoom-low .landmark.emblem.minor { display: none; }
.landmark.is-active { transform: scale(1.18); }
@keyframes vol-sway { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes vol-smoke { 0% { transform: translateY(2px) scale(.6); opacity: .85; } 100% { transform: translateY(-16px) scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vol-icon, .vol-smoke { animation: none; } }

/* Zoom alejado: marcadores más pequeños y solo los esenciales */
#map.zoom-low .landmark.low-hide { display: none; }
#map.zoom-low .landmark.volcano { width: 24px; height: 24px; font-size: 17px; }
#map.zoom-low .landmark.volcano.rest { font-size: 15px; }
#map.zoom-low .landmark.emblem.major { width: 26px; height: 26px; font-size: 14px; border-width: 1.5px; }
#map.zoom-low .vol-smoke { width: 6px; height: 6px; margin-left: -3px; }

.own-rain-canvas { position: absolute; inset: 0; z-index: 4; pointer-events: none; }

/* Mapa oscuro */
.map-shell.map-dark { background: #0b111c; }
.map-shell.map-dark .maplibregl-ctrl-scale { background: rgba(16,24,39,.8); color: #cbd5e1; border-color: #64748b; }
.map-shell.map-dark .maplibregl-ctrl-attrib { background: rgba(16,24,39,.7); color: #94a3b8; }
.map-shell.map-dark .maplibregl-ctrl-attrib a { color: #cbd5e1; }
.map-shell.map-dark .landmark.emblem { background: rgba(16,24,39,.85); border-color: rgba(255,255,255,.75); }
.map-shell.map-dark .landmark.emblem.major { border-color: #38bdf8; }

/* Volcanes ilustrados */
.landmark.volcano { width: 44px; height: 40px; font-size: 0; }
.landmark.volcano .vol-icon { width: 100%; height: 100%; }
.landmark.volcano .vol-icon svg { width: 100%; height: 100%; overflow: visible; }
.landmark.volcano.rest { opacity: .92; }
.vol-smoke { position: absolute; left: var(--top-x, 50%); top: var(--top-y, 20%); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: radial-gradient(circle, rgba(241,245,249,.95), rgba(203,213,225,.55)); filter: blur(1.2px); opacity: 0; animation: vol-puff 4.2s ease-out infinite; pointer-events: none; }
.vol-smoke.s2 { animation-delay: 1.4s; }
.vol-smoke.s3 { animation-delay: 2.8s; }
.vol-smoke.ash { background: radial-gradient(circle, rgba(148,163,184,.95), rgba(71,85,105,.55)); }
@keyframes vol-puff { 0% { transform: translate(0,0) scale(.5); opacity: 0; } 15% { opacity: .9; } 100% { transform: translate(7px,-26px) scale(2.1); opacity: 0; } }
#map.zoom-low .landmark.volcano { width: 30px; height: 27px; }
#map.zoom-low .vol-smoke { width: 7px; height: 7px; margin: -3px 0 0 -3px; }
@media (prefers-reduced-motion: reduce) { .vol-smoke { animation: none; } .vol-smoke.s2, .vol-smoke.s3 { display: none; } .vol-smoke { opacity: .6; } }
/* Volcanes: tamaños, humo por intensidad y foto en la ficha */
.landmark.volcano { width: 48px; height: 44px; }
.vol-smoke.soft { width: 7px; height: 7px; margin: -3px 0 0 -3px; }
.vol-smoke.strong { width: 12px; height: 12px; margin: -6px 0 0 -6px; animation-duration: 3.6s; }
.vol-smoke.ash { width: 14px; height: 14px; margin: -7px 0 0 -7px; animation-duration: 3.4s; }
.vol-smoke.soft.s2, .vol-smoke.strong.s2, .vol-smoke.ash.s2 { animation-delay: 1.5s; }
.vol-smoke.strong.s3, .vol-smoke.ash.s3 { animation-delay: 2.7s; }
.vol-photo { display: block; width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; margin-bottom: 10px; background: #1b2438; }
#map.zoom-low .landmark.volcano { width: 32px; height: 29px; }

.lm-photo { margin: 0 0 10px; }
.lm-photo .vol-photo { margin-bottom: 4px; min-height: 90px; }
.lm-photo figcaption { font-size: 11px; opacity: .7; }
.lm-photo figcaption a { color: inherit; text-decoration: underline; }

/* Barra inferior del mapa rediseñada */
.map-toolbar { padding: 14px 16px; }
.radar-heading { min-width: 0; flex: 1 1 220px; }
.radar-title { font-size: 16px; font-weight: 800; color: var(--text, #e8eefc); letter-spacing: .1px; line-height: 1.25; }
.radar-title.loading { color: var(--blue); }
.radar-title.error-text { color: #fca5a5; }
.radar-time { margin-top: 3px; font-size: 12.5px; line-height: 1.35; }
.radar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 0 1 auto; }
.radar-actions .btn { white-space: nowrap; justify-content: center; border-radius: 999px; padding: 9px 14px; }
@media (max-width: 650px) {
  .radar-actions { flex: 1 1 100%; }
}
.own-rain-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.own-rain-stats .orc { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; font-size: 12px; color: var(--muted); background: rgba(148,163,184,.1); border: 1px solid rgba(148,163,184,.16); }
.own-rain-stats .orc b { font-size: 14px; color: #e8eefc; }
.own-rain-stats .orc.on { background: rgba(56,130,246,.14); border-color: rgba(56,130,246,.4); }
.own-rain-stats .orc.storm { background: rgba(124,92,246,.18); border-color: rgba(124,92,246,.5); }
.own-rain-stats .orc.hint { background: none; border-color: transparent; padding-left: 2px; font-size: 11.5px; opacity: .75; }
.map-toolbar.own-rain-mode .timeline-row { display: none; }
body.map-focus .own-rain-stats { margin-top: 8px; }
body.map-focus .radar-title { font-size: 14px; }

.radar-time.warn { color: #fbbf24; }

/* Los globos de texto del mapa tienen fondo blanco: el texto debe ser oscuro aunque la página use tema oscuro. */
.maplibregl-popup-content { color: #0f172a; font-size: 14px; line-height: 1.4; max-width: 260px; }

/* Temblores y terremotos */
.quake-alert-stack { position: absolute; z-index: 19; left: 12px; right: 12px; top: 66px; display: grid; gap: 6px; pointer-events: none; }
.quake-alert-stack[hidden] { display: none !important; }
.camera-alert-stack:not([hidden]) ~ .quake-alert-stack { top: 104px; }
.quake-banner { display: flex; align-items: stretch; min-height: 32px; border: 1px solid rgba(147,197,253,.4); border-radius: 16px; background: rgba(16,24,39,.86); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.28); backdrop-filter: blur(6px); pointer-events: auto; font-size: 12px; overflow: hidden; }
.quake-banner-main { flex: 1 1 auto; min-width: 0; padding: 6px 6px 6px 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; line-height: 1.3; cursor: pointer; }
.quake-banner-label { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: #93c5fd; }
.quake-banner-close { flex: 0 0 34px; border: 0; background: rgba(255,255,255,.08); color: #e2e8f0; font-size: 18px; cursor: pointer; }
.quake-banner.cr { border: 2px solid #fecaca; background: linear-gradient(135deg, rgba(185,28,28,.96), rgba(127,29,29,.96)); box-shadow: 0 0 0 0 rgba(239,68,68,.6), 0 6px 20px rgba(185,28,28,.5); font-size: 13.5px; animation: quake-glow 1.6s ease-in-out infinite; }
.quake-banner.cr .quake-banner-label { color: #fee2e2; font-size: 12px; }
@keyframes quake-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.55), 0 6px 20px rgba(185,28,28,.5); } 50% { box-shadow: 0 0 0 7px rgba(239,68,68,0), 0 6px 20px rgba(185,28,28,.5); } }

.quake-marker { display: flex; align-items: center; justify-content: center; padding: 0; border: 2px solid #fff; border-radius: 50%; color: #fff; font-weight: 800; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.55); box-shadow: 0 2px 8px rgba(0,0,0,.45); cursor: pointer; }
.quake-marker.cr { border-color: #fecaca; }
.quake-marker.fresh { animation: quake-pulse 1.5s ease-out infinite; }
@keyframes quake-pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.75), 0 2px 8px rgba(0,0,0,.45); } 100% { box-shadow: 0 0 0 16px rgba(239,68,68,0), 0 2px 8px rgba(0,0,0,.45); } }
.quake-popup { font-size: 13px; line-height: 1.45; }
.quake-popup small { color: #475569; }

.quake-list { display: grid; gap: 7px; margin-top: 10px; }
.quake-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.04); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.quake-row.cr { border-color: rgba(248,113,113,.45); background: rgba(185,28,28,.12); }
.quake-row.big { box-shadow: inset 4px 0 0 #ef4444; }
.quake-row-mag { flex: 0 0 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #f97316; color: #fff; font-weight: 800; font-size: 15px; }
.quake-row.cr .quake-row-mag { background: #dc2626; }
.quake-row-body { display: grid; gap: 2px; min-width: 0; }
.quake-row-body small { opacity: .75; }
.quake-more { justify-self: center; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .quake-banner.cr, .quake-marker.fresh { animation: none; } }

/* Móvil: los botones de arriba ocupan todo el ancho; la etiqueta de lugar y los botones +/- quedaban tapados. */
@media (max-width: 650px) {
  #mapLocationChip,
  .maplibregl-ctrl-top-right { display: none !important; }
}

/* Secciones plegables: franjas tipo tarjeta con flecha, en vez de botones sueltos. */
.fold-head {
  flex-wrap: nowrap;
  gap: 14px;
  padding: 14px 14px 14px 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, .13), rgba(15, 23, 42, 0) 60%), var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.fold-head:hover { border-color: rgba(125, 211, 252, .45); }
.fold-head > div, .fold-head > h2 { min-width: 0; flex: 1 1 auto; }
.fold-head h2 { font-size: 17px; line-height: 1.3; letter-spacing: -.2px; }
.fold-head .subtitle { margin-top: 4px; font-size: 12.5px; }
.fold-head.is-open { margin-bottom: 10px; border-color: rgba(125, 211, 252, .4); }
.fold-head > .btn { flex: 0 0 auto; white-space: nowrap; }
.fold-btn {
  flex: 0 0 auto;
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  transition: background .2s ease, transform .25s ease;
}
.fold-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -7px 0 0 -4.5px;
  border-right: 2.5px solid #7dd3fc;
  border-bottom: 2.5px solid #7dd3fc;
  transform: rotate(45deg);
  transition: transform .25s ease, margin .25s ease;
}
.fold-btn[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: -2px; }
.fold-btn:hover { background: rgba(125, 211, 252, .16); }
@media (prefers-reduced-motion: reduce) { .fold-btn, .fold-btn::after, .fold-head { transition: none; } }

/* ===== Resumen de arriba: temperatura y estado ahora (sobre la animación de luna, sol y nubes) ===== */
.system-status { padding: 9px; }
.system-status .status-text { display: none; }
.status-dot { width: 10px; height: 10px; box-shadow: 0 0 0 4px rgba(74, 222, 128, .18); }
.weather-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  min-height: 118px;
  margin: 2px 0 14px;
  padding-right: 64px;           /* deja espacio a la luna o el sol animados */
}
.hero-temp {
  margin: 0;
  font-size: 78px;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -3px;
  font-variant-numeric: tabular-nums;
}
.hero-side { display: grid; gap: 5px; min-width: 0; padding-top: 4px; }
.hero-cond { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hero-icon { font-size: 26px; line-height: 1; }
.hero-icon:empty { display: none; }
.hero-text { white-space: nowrap; font-size: 20px; font-weight: 650; letter-spacing: -.3px; line-height: 1.15; }
.hero-feel { color: var(--muted); font-size: 13.5px; }
.hero-place {
  flex: 0 0 100%;
  margin-bottom: -6px;
  overflow: hidden;
  color: #cbd5e1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.1px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.hero-place b { color: #f1f5f9; font-weight: 700; }
.hero-place-sep { margin: 0 7px; color: #64748b; }
.hero-place-area { color: #94a3b8; font-weight: 500; }
.weather-hero.is-rain .hero-text { color: #7dd3fc; }
.weather-hero.is-loading .hero-temp,
.weather-hero.is-loading .hero-text { opacity: .35; }
@media (max-width: 380px) { .hero-temp { font-size: 66px; } .hero-text { font-size: 18px; } .weather-hero { padding-right: 40px; } }
/* El clima de mi ubicación va arriba; la tarjeta grande ya no se muestra. */
#homeWeatherCard { display: none !important; }
#conditionsSection .weather-grid { grid-template-columns: 1fr; }

/* Nombre de la fase debajo de la luna (solo cuando se muestra la luna). */
.amb-moon { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.amb-moon-label { color: #aebbd0; font-size: 10.5px; line-height: 1.25; text-align: right; white-space: nowrap; }
.amb-moon-label b { color: #dbe5f5; font-weight: 700; }

/* ===== Franja de amanecer y atardecer ===== */
.sunbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 9px 14px;
  background: linear-gradient(90deg, rgba(251, 191, 36, .10), rgba(15, 23, 42, 0) 35%, rgba(15, 23, 42, 0) 65%, rgba(244, 114, 94, .10)), var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.sunbar[hidden] { display: none; }
.sunbar-time { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: #cbd5e1; white-space: nowrap; }
.sunbar-time i { font-style: normal; font-size: 17px; line-height: 1; }
.sunbar-time b { font-size: 14px; font-weight: 700; color: #f1f5f9; font-variant-numeric: tabular-nums; }
.sunbar-mid { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
.sunbar-mid small { color: var(--muted); font-size: 10.5px; text-align: center; letter-spacing: .1px; }
.sunbar-track { position: relative; height: 5px; margin: 4px 7px 0; border-radius: 3px; background: rgba(148, 163, 184, .22); }
.sunbar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, #fbbf24, #fb923c); }
.sunbar-dot {
  position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: #fde68a; border: 2px solid #f59e0b;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, .2), 0 0 12px rgba(251, 191, 36, .55);
}
.sunbar.is-night .sunbar-fill { background: rgba(148, 163, 184, .45); }
.sunbar.is-night .sunbar-dot { display: none; }
body.map-focus .sunbar { display: none !important; }

/* Aviones y aeropuertos */
.aircraft-marker { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.aircraft-marker svg { display: block; pointer-events: none; }
.airport-marker { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid rgba(226,232,240,.55); border-radius: 50%; background: rgba(15,23,42,.82); box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: pointer; }
.airport-marker svg { display: block; pointer-events: none; }
.aircraft-detail { color: #e5edf7; font: 12px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.aircraft-photo { margin: 0 0 10px; min-height: 40px; }
.aircraft-photo img { display: block; width: 100%; max-height: 190px; object-fit: cover; border: 1px solid rgba(148,163,184,.18); border-radius: 11px; background: #0b1220; }
.aircraft-photo-credit { margin-top: 4px; color: #91a4bb; font-size: 10px; }
.aircraft-photo-credit a { color: #93c5fd; }
.aircraft-photo-empty { padding: 11px; border: 1px dashed rgba(148,163,184,.24); border-radius: 10px; color: #a9bad0; background: rgba(148,163,184,.06); font-size: 11px; text-align: center; }
.aircraft-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(148,163,184,.12); }
.aircraft-row span { color: #91a4bb; }
.aircraft-row strong { text-align: right; font-weight: 700; }
.aircraft-note { margin: 9px 0 0; color: #91a4bb; font-size: 10px; }
