:root {
  --fondo: #0b1220;
  --tarjeta: rgba(15, 23, 42, 0.88);
  --texto: #e2e8f0;
  --suave: #94a3b8;
  --acento: #38bdf8;
  --seco: #22c55e;
  --llega: #f59e0b;
  --lloviendo: #3b82f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); color: var(--texto);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#mapa { position: fixed; inset: 0; background: var(--fondo); }
#lluvia { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 500; pointer-events: none; }
/* El color del radar queda como un tinte suave; la intensidad la cuentan las gotas. */
.radar { filter: blur(3px); transition: opacity .35s; }  /* solo sin animación */

.tarjeta { position: fixed; left: 12px; right: 12px; z-index: 1000; max-width: 520px; margin: 0 auto;
  background: var(--tarjeta); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 16px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
#aviso { top: calc(12px + env(safe-area-inset-top)); border-left: 6px solid var(--suave); }
#aviso[data-estado="seco"] { border-left-color: var(--seco); }
#aviso[data-estado="llega"] { border-left-color: var(--llega); }
#aviso[data-estado="lloviendo"] { border-left-color: var(--lloviendo); }
#panel { bottom: calc(12px + env(safe-area-inset-bottom)); }

.fila { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
#comuna { font-size: 13px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
#mensaje { font-size: 20px; font-weight: 650; margin-top: 2px; }
#demo { margin-top: 8px; font-size: 12px; color: #fbbf24; }

.boton { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: #1e293b; color: var(--texto); font-size: 18px; }
.boton:active { transform: scale(.95); }
.linea { flex: 1; min-width: 0; }
input[type=range] { width: 100%; accent-color: var(--acento); margin: 6px 0 2px; }
.marcas { display: flex; justify-content: space-between; font-size: 11px; color: var(--suave); }
.marcas span:nth-child(2) { position: relative; left: -10%; }
.pie { margin-top: 8px; font-size: 13px; }
#etiqueta { font-weight: 600; white-space: nowrap; }
#etiqueta.pronostico { color: var(--llega); }
.leyenda { display: flex; align-items: center; gap: 3px; color: var(--suave); font-size: 11px; }
.leyenda i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }

.leaflet-control-attribution { font-size: 9px; background: rgba(15,23,42,.7) !important; color: var(--suave); }
.leaflet-control-attribution a { color: var(--suave); }
.punto { width: 16px; height: 16px; border-radius: 50%; background: var(--acento);
  border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(56,189,248,.3); }
/* OSM en modo oscuro para que resalte la lluvia. */
.base-oscura { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.4); }

/* Pronóstico de modelos (Open-Meteo) */
.resumen { display: flex; width: 100%; justify-content: space-between; align-items: center; margin-top: 10px;
  padding: 8px 10px; border: 0; border-radius: 10px; background: #1e293b; color: var(--texto);
  font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.resumen .chevron { transition: transform .2s; color: var(--suave); }
.resumen[aria-expanded="true"] .chevron { transform: rotate(180deg); }
#pronostico { margin-top: 10px; max-height: 52vh; overflow-y: auto; }
.titulo-seccion { font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 6px; }
.horas { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.hora { flex: none; width: 52px; scroll-snap-align: start; text-align: center; background: #1e293b;
  border-radius: 10px; padding: 6px 2px; font-size: 12px; }
.hora .h { color: var(--suave); }
.hora .e { font-size: 18px; margin: 2px 0; }
.hora .p { font-weight: 650; }
.hora .barra { height: 4px; border-radius: 2px; background: #334155; margin: 4px 6px 2px; overflow: hidden; }
.hora .barra i { display: block; height: 100%; background: var(--acento); }
.hora .mm { color: var(--suave); font-size: 11px; min-height: 13px; }
.dias { display: grid; gap: 4px; }
.dia { display: grid; grid-template-columns: 64px 26px 1fr auto; align-items: center; gap: 8px;
  font-size: 14px; padding: 4px 2px; border-bottom: 1px solid #1e293b; }
.dia .n { color: var(--suave); }
.dia .e { font-size: 18px; text-align: center; }
.dia .ll { color: var(--acento); font-size: 13px; }
.dia .t { font-variant-numeric: tabular-nums; }
.dia .t .min { color: var(--suave); }
.fuente { margin-top: 8px; font-size: 11px; color: var(--suave); }
.fuente a { color: var(--suave); }

/* Satélite */
#capas-ctrl { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); z-index: 1000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#btn-sat { box-shadow: 0 4px 16px rgba(0,0,0,.4); background: var(--tarjeta); }
#btn-sat[aria-pressed="true"] { background: var(--acento); }
#sat-hora { font-size: 11px; background: var(--tarjeta); color: var(--texto); padding: 3px 7px; border-radius: 8px; }
.sat img { image-rendering: auto; }

/* Avisos DMC */
.aviso-dmc { display: block; width: 100%; margin-top: 10px; padding: 8px 10px; border: 0; border-radius: 10px;
  font: inherit; font-size: 13px; text-align: left; cursor: pointer; color: #1a1205; background: #facc15; }
.aviso-dmc[data-gravedad="2"] { background: #fb923c; }
.aviso-dmc[data-gravedad="3"] { background: #ef4444; color: #fff; }
.aviso-dmc b { text-transform: uppercase; letter-spacing: .03em; }
#avisos-detalle { margin-top: 8px; font-size: 13px; max-height: 40vh; overflow-y: auto; }
.aviso-item { padding: 8px 0; border-bottom: 1px solid #1e293b; }
.aviso-item .t { font-weight: 650; }
.aviso-item .m { color: var(--suave); font-size: 12px; margin-top: 2px; }

/* Estaciones DMC en el mapa */
.estacion { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; transform: translate(-50%, -50%);
  font: 600 11px system-ui, sans-serif; color: #e0f2fe; background: rgba(15, 23, 42, .85);
  border: 1px solid #38bdf8; border-radius: 10px; padding: 1px 6px; }
.estacion.seca { color: var(--suave); border-color: #475569; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0f172a; color: var(--texto); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; line-height: 1.4; }
.leaflet-popup-content .m { color: var(--suave); font-size: 12px; }
