:root {
  --bg: rgba(18, 22, 30, .88);
  --fg: #e8ecf2;
  --accent: #3da5ff;
  --muted: #8791a3;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0b0e14; color: var(--fg);
  font: 14px/1.4 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }

#map { position: absolute; inset: 0; background: #0b0e14; }
#wind-canvas { position: absolute; inset: 0; z-index: 450; pointer-events: none; }

#install { background: var(--accent); color: #04121f; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 600; cursor: pointer; }
#install[hidden] { display: none; }

.brand { position: absolute; top: 12px; left: 12px; z-index: 1000; padding: 8px 14px;
  background: var(--bg); border-radius: 10px; font-weight: 600; backdrop-filter: blur(8px); }
.brand span { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 12px; }

.panel { position: absolute; z-index: 1000; background: var(--bg); border-radius: 12px;
  backdrop-filter: blur(8px); box-shadow: 0 4px 20px rgba(0,0,0,.4); }

.layers { top: 12px; right: 12px; display: flex; flex-direction: column; padding: 6px; gap: 4px; }
.layers button { background: transparent; color: var(--fg); border: 0; padding: 9px 14px;
  border-radius: 8px; text-align: left; cursor: pointer; font-size: 14px; }
.layers button:hover { background: rgba(255,255,255,.08); }
.layers button.active { background: var(--accent); color: #04121f; font-weight: 600; }

.toggles { top: 12px; right: 170px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; max-width: 230px; }
.note { color: var(--muted); font-size: 11px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch span { width: 36px; height: 20px; background: #444c5c; border-radius: 20px; position: relative; transition: .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

.timebar { bottom: 22px; left: 50%; transform: translateX(-50%); width: min(620px, 92vw);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.timebar.hidden { display: none; }
.timebar button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent);
  color: #04121f; font-size: 16px; cursor: pointer; flex: none; }
.timebar input[type=range] { flex: 1; accent-color: var(--accent); }
#time-label { min-width: 120px; text-align: right; font-variant-numeric: tabular-nums; }

.legend { position: absolute; z-index: 1000; left: 12px; bottom: 22px; display: none; }
.legend.show { display: block; }
.legend .bar { height: 10px; width: 180px; border-radius: 5px; }
.legend small { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; width: 180px; }

/* Icono de rayo */
.bolt { filter: drop-shadow(0 0 2px rgba(180,77,255,.8)); animation: flash .9s ease-out; }
@keyframes flash { 0% { transform: scale(2.4); } 100% { transform: scale(1); } }

.leaflet-control-attribution { background: rgba(0,0,0,.5) !important; color: #aaa !important; }
.leaflet-control-attribution a { color: #8cc; }

@media (max-width: 640px) {
  .toggles { top: auto; bottom: 90px; right: 12px; }
  .brand { font-size: 12px; }
}

.base-tiles { filter: brightness(1.7) contrast(1.1); }  /* tierra/mar más legibles bajo el satélite */

/* Alertas de tormenta */
.alerts { position: absolute; z-index: 1100; left: 12px; top: 62px; width: min(360px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--bg);
  border-left: 4px solid #ffb02e; box-shadow: 0 6px 24px rgba(0,0,0,.5); backdrop-filter: blur(8px); animation: slidein .25s ease-out; }
.alert.warn { border-left-color: #ff4d4d; }
.alert.info { border-left-color: #3da5ff; }
.alert .a-ico { font-size: 24px; line-height: 1; }
.alert .a-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert b { font-size: 14px; }
.alert span { font-size: 12.5px; color: #c7cfdb; }
.alert small { font-size: 11px; color: var(--muted); }
.alert button { background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.alert button:hover { color: #fff; background: rgba(255,255,255,.1); }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

#notif { background: rgba(255,255,255,.1); color: var(--fg); border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 500; cursor: pointer; text-align: left; }
#notif:hover:not(:disabled) { background: rgba(255,255,255,.18); }
#notif:disabled { cursor: default; opacity: .8; }

/* Controles que se ocultan solos tras unos segundos sin tocar la pantalla (como Windy) */
.brand, .panel, .legend, .leaflet-control-zoom { transition: opacity .35s ease; }
body.ui-idle .brand, body.ui-idle .panel, body.ui-idle .legend, body.ui-idle .leaflet-control-zoom { opacity: 0; pointer-events: none; }

/* Botón de actualizar */
#refresh { background: transparent; border: 0; color: var(--fg); font-size: 20px; line-height: 1; cursor: pointer; margin-left: 8px; padding: 0 4px; border-radius: 6px; vertical-align: middle; }
#refresh:hover { background: rgba(255,255,255,.12); }
#refresh.spin { animation: spin .8s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
#updated { display: block; font-size: 11px; color: var(--muted); margin: 2px 0 0 0 !important; }
