.mapa-tiempo {
  --mt-bg: #f4f7fb;
  --mt-panel: rgba(255, 255, 255, 0.94);
  --mt-line: rgba(15, 23, 42, 0.12);
  --mt-text: #0f172a;
  --mt-muted: #64748b;
  --mt-accent: #0284c7;
  --mt-warm: #c2410c;
  --mt-danger: #be123c;
  --mt-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
  --mt-radius: 22px;
  --mt-font: "Figtree", system-ui, sans-serif;
  --mt-display: "Outfit", "Figtree", system-ui, sans-serif;
  --mt-height: 70vh;

  box-sizing: border-box;
  position: relative;
  display: block;
  width: 100%;
  height: var(--mt-height);
  min-height: 440px;
  max-height: 860px;
  margin: 1.25rem 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--mt-line);
  isolation: isolate;
  background: var(--mt-bg);
  color: var(--mt-text);
  font-family: var(--mt-font);
  line-height: 1.4;
}

.mapa-tiempo *,
.mapa-tiempo *::before,
.mapa-tiempo *::after {
  box-sizing: border-box;
}

.mapa-tiempo a {
  color: var(--mt-accent);
}

.mapa-tiempo--fullscreen {
  height: 100dvh;
  min-height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 0;
  border: 0;
}

html.mapa-tiempo-html,
html.mapa-tiempo-html body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--mt-bg, #f4f7fb);
}

.mapa-tiempo-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dbe4ee;
}

.mapa-tiempo .leaflet-container {
  font-family: var(--mt-font);
  background: #dbe4ee;
  height: 100%;
  width: 100%;
}

/* WordPress themes often force img { max-width:100% } and break tiles */
.mapa-tiempo .leaflet-container img,
.mapa-tiempo img.leaflet-marker-icon,
.mapa-tiempo img.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  height: auto !important;
  width: auto;
  box-shadow: none !important;
  background: none !important;
}

.mapa-tiempo .leaflet-control-zoom {
  margin-top: 78px !important;
  margin-left: 8px !important;
}

.mapa-tiempo .leaflet-control-zoom a {
  background: #ffffff !important;
  color: var(--mt-text) !important;
  border-color: var(--mt-line) !important;
}

.mapa-tiempo .leaflet-bar {
  border: 1px solid var(--mt-line) !important;
  box-shadow: var(--mt-shadow);
}

.mapa-tiempo .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.82) !important;
  color: var(--mt-muted) !important;
  max-width: min(70%, 28rem);
}

.mapa-tiempo .leaflet-control-attribution a {
  color: var(--mt-accent) !important;
}

.mapa-tiempo .chrome-top,
.mapa-tiempo .chrome-bottom,
.mapa-tiempo .hint,
.mapa-tiempo .banner,
.mapa-tiempo .panel {
  z-index: 500;
}

.mapa-tiempo .chrome-top {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.mapa-tiempo .brand,
.mapa-tiempo .status,
.mapa-tiempo .banner,
.mapa-tiempo .hint,
.mapa-tiempo .chrome-bottom,
.mapa-tiempo .panel {
  pointer-events: auto;
}

.mapa-tiempo .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--mt-panel);
  border: 1px solid var(--mt-line);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  box-shadow: var(--mt-shadow);
}

.mapa-tiempo .brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, #fde68a, #f59e0b 42%, #0ea5e9 78%);
  color: #0b1220;
  font-weight: 800;
}

.mapa-tiempo .brand h1,
.mapa-tiempo .panel h2,
.mapa-tiempo .hero-temp {
  font-family: var(--mt-display);
  margin: 0;
  color: var(--mt-text);
}

.mapa-tiempo .brand h1 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.mapa-tiempo .brand p,
.mapa-tiempo .place-admin,
.mapa-tiempo .hint,
.mapa-tiempo .status,
.mapa-tiempo .chrome-bottom,
.mapa-tiempo .panel-kicker {
  margin: 0;
  color: var(--mt-muted);
}

.mapa-tiempo .brand p {
  font-size: 0.78rem;
}

.mapa-tiempo .status {
  padding: 8px 12px;
  background: var(--mt-panel);
  border: 1px solid var(--mt-line);
  border-radius: 999px;
  font-size: 0.82rem;
  backdrop-filter: blur(16px);
  max-width: min(52%, 26rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapa-tiempo .status.is-loading::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  border: 2px solid var(--mt-accent);
  border-right-color: transparent;
  animation: mt-spin 0.8s linear infinite;
  vertical-align: -1px;
}

.mapa-tiempo .banner {
  position: absolute;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 42rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  background: #fff1f2;
  border: 1px solid rgba(190, 18, 60, 0.28);
  color: #9f1239;
  border-radius: 14px;
  box-shadow: var(--mt-shadow);
}

.mapa-tiempo .banner[hidden],
.mapa-tiempo .panel[hidden],
.mapa-tiempo .panel-loading[hidden],
.mapa-tiempo .panel-error[hidden] {
  display: none !important;
}

.mapa-tiempo .banner button,
.mapa-tiempo .icon-btn {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.mapa-tiempo .banner button {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
}

.mapa-tiempo .hint {
  position: absolute;
  left: 12px;
  bottom: max(46px, calc(env(safe-area-inset-bottom) + 36px));
  max-width: min(calc(100% - 24px), 28rem);
  padding: 8px 12px;
  background: var(--mt-panel);
  border: 1px solid var(--mt-line);
  border-radius: 12px;
  font-size: 0.8rem;
  backdrop-filter: blur(16px);
}

.mapa-tiempo .chrome-bottom {
  position: absolute;
  right: 8px;
  bottom: 0;
  font-size: 0.7rem;
  padding: 4px 8px 6px;
}

.mapa-tiempo .chrome-bottom p {
  margin: 0;
}

.mapa-tiempo .panel {
  position: absolute;
  top: 96px;
  right: 12px;
  width: min(calc(100% - 24px), 380px);
  max-height: calc(100% - 120px);
  overflow: auto;
  padding: 18px 18px 22px;
  background: var(--mt-panel);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  backdrop-filter: blur(22px);
  box-shadow: var(--mt-shadow);
}

.mapa-tiempo .panel-handle {
  display: none;
}

.mapa-tiempo .panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.mapa-tiempo .panel-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.mapa-tiempo .panel h2 {
  font-size: 1.55rem;
  line-height: 1.15;
  margin: 2px 0 4px;
}

.mapa-tiempo .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 1.4rem;
  line-height: 1;
}

.mapa-tiempo .panel-loading,
.mapa-tiempo .panel-error {
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
}

.mapa-tiempo .panel-error {
  color: var(--mt-danger);
  background: #fff1f2;
}

.mapa-tiempo .hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 8px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.14), rgba(251, 191, 36, 0.16));
  border: 1px solid var(--mt-line);
}

.mapa-tiempo .hero-icon {
  font-size: 2.4rem;
  line-height: 1;
  width: 3.2rem;
  text-align: center;
}

.mapa-tiempo .hero-temp {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--mt-warm);
}

.mapa-tiempo .hero-cond {
  margin: 0;
  color: var(--mt-text);
}

.mapa-tiempo .metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 0;
}

.mapa-tiempo .metrics div {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--mt-line);
}

.mapa-tiempo .metrics dt {
  font-size: 0.72rem;
  color: var(--mt-muted);
  margin-bottom: 4px;
}

.mapa-tiempo .metrics dd {
  margin: 0;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--mt-text);
}

.mapa-tiempo .wx-wrap {
  background: transparent !important;
  border: 0 !important;
}

.mapa-tiempo .wx-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 96px;
  height: 58px;
  cursor: pointer;
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.18));
}

.mapa-tiempo .wx-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 6px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: var(--mt-text);
  font-weight: 750;
  font-size: 0.82rem;
  white-space: nowrap;
}

.mapa-tiempo .wx-chip .wx-icon {
  font-size: 0.95rem;
}

.mapa-tiempo .wx-name {
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  font-size: 0.68rem;
  font-weight: 650;
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapa-tiempo .wx-marker.is-selected .wx-chip {
  border-color: var(--mt-warm);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

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

@media (max-width: 720px) {
  .mapa-tiempo {
    --mt-height: 75vh;
    min-height: 480px;
  }

  .mapa-tiempo .chrome-top {
    flex-direction: column;
    align-items: stretch;
  }

  .mapa-tiempo .status {
    max-width: none;
    align-self: flex-start;
  }

  .mapa-tiempo .hint {
    display: none;
  }

  .mapa-tiempo .panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: min(72%, 560px);
    border-radius: 22px 22px 0 0;
    padding-top: 10px;
  }

  .mapa-tiempo .panel-handle {
    display: block;
    width: 42px;
    height: 4px;
    margin: 0 auto 10px;
    border-radius: 99px;
    background: rgba(15, 23, 42, 0.18);
  }

  .mapa-tiempo .chrome-bottom {
    display: none;
  }

  .mapa-tiempo .leaflet-control-zoom {
    margin-top: 132px !important;
    margin-bottom: 18px !important;
  }
}

@media (min-width: 721px) {
  .mapa-tiempo.is-panel-open .hint {
    right: 410px;
    max-width: min(calc(100% - 430px), 28rem);
  }
}

.mapa-tiempo-editor {
  padding: 18px;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
  border: 1px dashed rgba(2, 132, 199, 0.45);
  font-family: system-ui, sans-serif;
}

.mapa-tiempo-editor strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}
