:root {
  --bg: #0a0a0a; --panel: #161616; --panel2: #1f1f1f; --line: #2a2a2a;
  --txt: #f4f4f0; --muted: #9a9a95; --ink: #0d0d0d;
  --lima: #d4f25a; --turquesa: #4fd8c4; --coral: #f47a5c; --amarillo: #f6d24a; --celeste: #8fbdf7; --rojo: #ef4b4b; --verde: #7fe08a;
  --r: 26px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:is(.logo, .icon-btn, .badge-ic, .bottom-nav) svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 560px; margin: 0 auto; padding: 18px 16px 110px; }
@media (min-width: 900px) { .app { max-width: 920px; } }

/* Header */
.top { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.logo { width: 50px; height: 50px; border-radius: 16px; flex: none; display: block; }
.top-txt { flex: 1; }
h1 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.top-txt p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--txt); display: grid; place-items: center; cursor: pointer; }
.icon-btn.girando svg { animation: gira .8s linear; }
@keyframes gira { to { transform: rotate(360deg); } }

section { margin-bottom: 26px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
h2 { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
h3 { margin: 22px 0 10px; font-size: 1rem; font-weight: 700; }
h3 small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.nota { color: var(--muted); font-size: .88rem; margin: 4px 0 14px; }
.nota b { color: var(--txt); }
.fuente { color: var(--muted); font-size: .75rem; margin: 10px 4px 0; }
.fuente a { color: #c9c9c4; }
select { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 600; }

/* Badge icon (círculo negro) */
.badge-ic { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; font-size: 1.1rem; }
.badge-ic svg { width: 20px; height: 20px; }

/* Hero alerta oficial */
.hero { border-radius: var(--r); padding: 20px; color: var(--ink); background: var(--panel2); min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; transition: background .3s; }
.hero.cargando, .hero.error { color: var(--txt); background: var(--panel2); }
.hero.cargando .badge-ic, .hero.error .badge-ic { background: #333; }
.hero.verde { background: var(--lima); }
.hero.amarillo { background: var(--amarillo); }
.hero.naranja { background: var(--coral); }
.hero.rojo { background: var(--rojo); color: #fff; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-tag { font-size: .78rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.12); }
.hero.cargando .hero-tag, .hero.error .hero-tag { background: #2c2c2c; }
.hero-big { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.08; }
.hero-sub { font-size: .9rem; font-weight: 500; opacity: .8; }
.hero a { color: inherit; font-weight: 700; }

/* Alertas detalle */
.alerta { margin-top: 10px; border-radius: 22px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); }
.alerta .al-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.alerta h4 { margin: 0; font-size: 1rem; font-weight: 700; }
.nivel-pill { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; color: var(--ink); background: var(--amarillo); }
.nivel-pill.naranja { background: var(--coral); } .nivel-pill.rojo { background: var(--rojo); color: #fff; }
.alerta p { margin: 6px 0; font-size: .9rem; }
.alerta .meta { color: var(--muted); font-size: .8rem; }

/* Tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { border-radius: var(--r) var(--r) var(--r) 10px; padding: 16px; color: var(--ink); min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.tile::after { content: ""; position: absolute; top: 0; right: 0; width: 38%; height: 26px; background: var(--bg); border-bottom-left-radius: 18px; }
.tile .t-num { font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin-top: 16px; }
.tile .t-num small { font-size: .9rem; font-weight: 700; margin-left: 2px; }
.tile .t-lbl { font-size: .85rem; font-weight: 600; }
.tile .t-sub { font-size: .72rem; font-weight: 500; opacity: .7; }
.lima { background: var(--lima); } .turquesa { background: var(--turquesa); } .coral { background: var(--coral); } .celeste { background: var(--celeste); } .amarillo { background: var(--amarillo); }

/* Resumen */
.resumen { margin: 14px 0; border-radius: 20px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.resumen::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.resumen.verde::before { background: var(--verde); } .resumen.amarillo::before { background: var(--amarillo); } .resumen.naranja::before { background: var(--coral); } .resumen.rojo::before { background: var(--rojo); }
.resumen.cargando, .resumen.error { font-weight: 400; color: var(--muted); }

/* Tarjetas oscuras */
.card-dark { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.map-card { padding: 8px; }
#mapa { height: 320px; border-radius: 20px; overflow: hidden; }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: .75rem; color: var(--muted); padding: 10px 8px 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.verde { background: var(--verde); } .dot.amarillo { background: var(--amarillo); } .dot.naranja { background: var(--coral); } .dot.rojo { background: var(--rojo); }

/* Localidades */
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 900px) { .grid { grid-template-columns: 1fr 1fr; } }
.loc-card { border-radius: 22px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.loc-card.amarillo { background: var(--amarillo); } .loc-card.naranja { background: var(--coral); } .loc-card.rojo { background: var(--rojo); }
.loc-card.amarillo, .loc-card.naranja, .loc-card.rojo { color: var(--ink); border-color: transparent; }
.loc-card.rojo { color: #fff; }
.loc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.loc-n { font-weight: 700; font-size: 1rem; }
.loc-p { font-size: .75rem; opacity: .7; }
.pill { font-size: .72rem; font-weight: 800; padding: 5px 10px; border-radius: 999px; white-space: nowrap; background: var(--ink); color: #fff; }
.loc-card.verde .pill { background: #263a28; color: var(--verde); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; font-weight: 600; background: rgba(0,0,0,.12); border-radius: 999px; padding: 4px 10px; }
.loc-card.rojo .chip { background: rgba(0,0,0,.2); }
.small { font-size: .78rem; opacity: .8; }
.grid-nota { color: var(--muted); font-size: .8rem; margin: 0 0 10px; }

.como { margin-top: 16px; font-size: .88rem; color: var(--muted); }
.como summary { cursor: pointer; color: var(--txt); font-weight: 700; }
.como b { color: var(--txt); }

/* Tarjetas de color con contenido */
.card-color { border-radius: var(--r); padding: 12px; color: var(--ink); }
.card-note { font-size: .82rem; font-weight: 500; margin: 10px 6px 4px; }
.seg { display: inline-flex; background: var(--ink); border-radius: 999px; padding: 4px; margin: 2px 0 10px; gap: 2px; }
.tab { background: transparent; color: #cfcfca; border: 0; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.tab.activo { background: #fff; color: var(--ink); }
#sat-img { width: 100%; border-radius: 18px; display: block; background: #000; min-height: 220px; }
iframe#windy { width: 100%; height: 400px; border: 0; border-radius: 18px; display: block; background: #000; }

.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.link-card { border-radius: 22px; padding: 14px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .92rem; }
.link-card small { display: block; font-weight: 500; font-size: .75rem; opacity: .7; }
.link-card .arrow { margin-left: auto; font-size: 1.1rem; }

.aviso h2 { margin-bottom: 8px; }
.aviso p { font-size: .9rem; color: #d6d6d1; }
.aviso a { color: var(--lima); }

/* Navegación inferior */
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(92vw, 420px); background: rgba(28,28,28,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 999px; display: flex; justify-content: space-around; align-items: center; padding: 8px 10px; z-index: 1000; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px) * .3); }
.bottom-nav a { color: var(--muted); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .65rem; font-weight: 600; padding: 4px 6px; }
.bottom-nav a.activo { color: var(--lima); }
.bottom-nav a.centro { width: 54px; height: 54px; border-radius: 50%; background: var(--lima); color: var(--ink); justify-content: center; margin-top: -26px; border: 5px solid var(--bg); box-sizing: content-box; }

.leaflet-container { background: #111; font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 16px; }

.desc { margin: 12px 4px 2px; font-size: .86rem; line-height: 1.45; }
.desc b { display: block; font-size: .95rem; font-weight: 800; margin-bottom: 4px; }
.desc p { margin: 0; font-weight: 500; }

.tiles-oscuros { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }

.credito { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: -6px 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; color: var(--muted); text-decoration: none; background: var(--panel); }
.credito b { color: var(--txt); font-weight: 700; }
.credito .sep { color: var(--lima); }
.aviso .mt { margin-top: 18px; }

.frase { font-weight: 600; font-size: .9rem; }
.guia { margin-top: 18px; }
.guia h3 { margin-top: 0; }
.guia p { font-size: .9rem; color: #d6d6d1; }
.modelos-lista { margin: 6px 0 10px; padding-left: 18px; font-size: .88rem; color: #d6d6d1; }
.modelos-lista li { margin: 4px 0; }
.niveles { display: grid; gap: 8px; margin: 12px 0; }
.nivel { display: flex; gap: 10px; align-items: center; font-size: .86rem; color: #d6d6d1; }
.pill-demo { flex: none; min-width: 112px; text-align: center; font-size: .76rem; font-weight: 800; padding: 6px 10px; border-radius: 999px; color: var(--ink); }
.pill-demo.verde { background: var(--verde); } .pill-demo.amarillo { background: var(--amarillo); } .pill-demo.naranja { background: var(--coral); } .pill-demo.rojo { background: var(--rojo); color: #fff; }
.nota a { color: var(--lima); }
