:root {
  --ink: #eef3f8;
  --sheet: #ffffff;
  --sand: #0f172a;
  --sand-dim: rgba(15, 23, 42, 0.62);
  --aqua: #0f766e;
  --agua: #0284c7;
  --luz: #ca8a04;
  --ambos: #c2410c;
  --line: rgba(15, 23, 42, 0.12);
  --card: #f8fafc;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--sand);
  overflow-x: hidden;
}
body { font-family: Manrope, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }

.app {
  min-height: 100dvh;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.map-pane {
  position: relative;
  flex: 0 0 52dvh;
  min-height: 300px;
  max-height: 58dvh;
  background: #dbe4ee;
  overflow: hidden;
}

.map { width: 100%; height: 100%; z-index: 1; }
.maplibregl-map {
  width: 100%;
  height: 100%;
  background: #e6eef0;
  font-family: Manrope, system-ui, sans-serif;
}
.map-fallback {
  height: 100%; display: grid; place-items: center; padding: 24px; text-align: center;
  color: var(--sand-dim); font-size: 13px; background: #e6eef0;
}
/* Atribución compacta, por encima de la hoja inferior (que se monta 20 px sobre el mapa) */
.maplibregl-ctrl-bottom-right { bottom: 22px; }
.maplibregl-ctrl-attrib { font-size: 9px; background: rgba(255,255,255,0.9) !important; }
.maplibregl-ctrl-attrib a { color: var(--aqua); }

/* Tooltip (solo escritorio) */
.sefue-tip .maplibregl-popup-content {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--sand);
  box-shadow: 0 10px 28px rgba(15,23,42,0.18);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}
.sefue-tip .maplibregl-popup-tip { display: none; }

.topbar {
  position: absolute; z-index: 500; top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.topbar a, .topbar .ghost { pointer-events: auto; }
.brand strong {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 28px;
  line-height: 1;
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}
.brand span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #0f766e;
  font-weight: 700;
}

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--sand);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(15,23,42,0.08);
  transition: background 0.2s, border-color 0.2s;
}
.ghost:hover {
  background: #fff;
  border-color: rgba(15,23,42,0.2);
}

.search {
  position: absolute; z-index: 500; top: 72px; left: 16px; right: 16px;
}
.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 12px 18px;
  outline: none;
  font-size: 13px;
  color: var(--sand);
  box-shadow: 0 8px 24px rgba(15,23,42,0.1);
  transition: border-color 0.2s;
}
.search input:focus {
  border-color: rgba(2,132,199,0.45);
}
.search ul {
  list-style: none; margin: 8px 0 0; padding: 6px;
  border-radius: 18px; border: 1px solid var(--line);
  background: #fff; max-height: 260px; overflow: auto;
  box-shadow: 0 12px 30px rgba(15,23,42,0.12);
}
.search li button {
  width: 100%; background: none; border: 0; text-align: left;
  padding: 10px 12px; border-radius: 12px;
  display: flex; justify-content: space-between; gap: 12px;
  color: var(--sand);
}
.search li button:hover { background: #f1f5f9; }
.search small { color: var(--sand-dim); font-size: 11px; }

.legend {
  position: absolute; z-index: 500; left: 12px; right: 70px; bottom: 24px;
  display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none;
}
.legend span {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 10px; font-size: 11px;
  color: var(--sand); font-weight: 600;
  box-shadow: 0 4px 12px rgba(15,23,42,0.08);
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.agua { background: #0284c7; }
.dot.luz { background: #f59e0b; }
.dot.ambos { background: #c2410c; }
.dot.ok { background: #94a3b8; }

/* Las etiquetas y polígonos del mapa se dibujan en WebGL (MapLibre): ver app.js.
   Agua = azul que respira + borde que fluye; Luz = ámbar que parpadea; Ambos = azul con borde ámbar que late. */

/* Leyenda: muestras con la misma animación que el mapa */
.sw {
  width: 18px; height: 12px; border-radius: 4px; display: inline-block; flex-shrink: 0;
  box-sizing: border-box;
}
.sw.agua {
  border: 1.5px dashed #0284c7;
  background-color: rgba(14, 165, 233, 0.35);
  background-image: repeating-linear-gradient(90deg, rgba(224,242,254,0.95) 0 3px, transparent 3px 8px);
  background-size: 16px 100%;
  animation: swFlow 1.2s linear infinite;
}
.sw.luz {
  border: 1.5px solid #f59e0b;
  background: repeating-linear-gradient(45deg, #fde68a 0 3px, rgba(251,191,36,0.55) 3px 8px);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.9);
  animation: swFlicker 2.2s steps(1, end) infinite;
}
.sw.ambos {
  border: 2px solid #f59e0b;
  background-color: rgba(14, 165, 233, 0.35);
  background-image: repeating-linear-gradient(90deg, rgba(224,242,254,0.95) 0 3px, transparent 3px 8px);
  background-size: 16px 100%;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.9);
  animation: swFlow 1.2s linear infinite, swPulse 1.8s ease-in-out infinite;
}
.sw.ok { border: 1.4px solid rgba(15, 118, 110, 0.65); background: rgba(20, 184, 166, 0.16); }
.legend span.lg-ok { color: var(--sand-dim, #64748b); font-weight: 500; }
@keyframes swFlow { to { background-position: 16px 0; } }
@keyframes swFlicker {
  0%, 12%, 50%, 57%, 100% { opacity: 1; }
  8% { opacity: 0.45; }
  54% { opacity: 0.55; }
}
@keyframes swPulse {
  0%, 100% { border-color: #f59e0b; box-shadow: 0 0 7px rgba(245,158,11,0.95); }
  50% { border-color: rgba(245,158,11,0.45); box-shadow: 0 0 1px rgba(245,158,11,0.3); }
}

/* Movimiento reducido: estilos estáticos (patrón quieto, sin parpadeo) */
@media (prefers-reduced-motion: reduce) {
  .sw { animation: none !important; }
}

.zoom-btns {
  position: absolute; z-index: 500; right: 12px; bottom: 24px;
  display: flex; flex-direction: column; gap: 6px;
}
.zoom-btns button {
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
  color: var(--sand); font-size: 18px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.1);
}

.zoom-btns .mode-btn {
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
  color: #0f766e; background: rgba(240,253,250,0.96);
  border-color: rgba(15,118,110,0.3);
  margin-bottom: 4px;
}
.zoom-btns .mode-btn[aria-pressed="false"] { color: #fff; background: #0f766e; border-color: #0f766e; }

/* Panel Lateral (Sheet) */
.sheet {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  margin-top: -20px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  padding: 12px 16px 32px;
  box-shadow: 0 -16px 40px rgba(15,23,42,0.12);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: var(--sand);
}

.live-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--sand-dim);
  word-break: break-word;
}
.live-bar .ok { color: var(--aqua); }
.live-bar .stale { color: #ffd600; }
.handle {
  width: 48px; height: 6px; border-radius: 99px;
  background: rgba(15,23,42,0.15); margin: 0 auto 14px;
}
.kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--aqua);
}
.sheet h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: 32px; line-height: 0.95; margin: 4px 0 0; font-weight: 500;
  color: var(--sand);
}
.muted { color: var(--sand-dim); font-size: 14px; margin: 8px 0 0; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.stat {
  border-radius: 16px; padding: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}
.stat.agua { background: #e0f2fe; border-color: rgba(2,132,199,0.25); }
.stat.luz { background: #fef9c3; border-color: rgba(202,138,4,0.25); }
.stat b { display: block; font-family: Fraunces, Georgia, serif; font-size: 22px; font-weight: 500; margin-top: 4px; color: var(--sand); }
.stat > span { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }

.list { display: grid; gap: 10px; }
.card, .sponsor {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 12px 14px;
  text-align: left;
}
.card { width: 100%; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pill {
  flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; border-radius: 99px; padding: 4px 8px;
  background: #e2e8f0; color: #334155;
}
.pill.live { background: #fee2e2; color: #b91c1c; }
.pill.warn { background: #fef3c7; color: #a16207; }

.reason { color: var(--sand-dim); font-size: 12px; margin: 4px 0 0; }
.src {
  font-size: 11px;
  color: var(--sand-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.src-link {
  color: var(--aqua);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.src-link:hover { text-decoration: underline; }

.sponsor {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 12px;
  border-color: rgba(202,138,4,0.3);
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  text-decoration: none;
}
.sponsor .tag { font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #a16207; }
.sponsor h3 { font-family: Fraunces, Georgia, serif; font-size: 20px; margin: 4px 0; font-weight: 500; }
.sponsor p { margin: 0; color: var(--sand-dim); font-size: 14px; }
.sponsor .cta { color: #a16207; font-size: 14px; font-weight: 600; margin-top: 8px; }

/* Botones Originales SE FUE */
.primary, .secondary {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border-radius: 999px;
  padding: 13px;
  margin-top: 14px;
  border: 0;
  text-align: center;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 13px;
}
.primary { background: #0f172a; color: #fff; font-weight: 700; }
.primary:hover { opacity: 0.94; }
.secondary { background: transparent; border: 1px solid var(--line); color: var(--sand); }
.secondary:hover { background: #f1f5f9; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chips button {
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 12px;
  color: var(--sand);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chips button:hover { background: #f1f5f9; }
.fine { text-align: center; color: var(--sand-dim); font-size: 11px; margin: 18px 0 0; }

/* Sección Comunitaria (Diseño editorial coherente) */
.community-section {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.community-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.community-header h3 {
  font-family: Fraunces, Georgia, serif;
  font-size: 20px;
  margin: 0;
  font-weight: 500;
  color: var(--sand);
}
.vote-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.vote-action-btn {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  color: var(--sand);
  font-family: Manrope, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.vote-action-btn:hover {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.2);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 14px;
}
.comment-form textarea {
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 12px;
  color: var(--sand);
  resize: none;
  min-height: 52px;
  outline: none;
  transition: border-color 0.2s;
}
.comment-form textarea:focus {
  border-color: rgba(2, 132, 199, 0.45);
}
.comment-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.comment-form-row select {
  background: var(--sheet);
  border: 1px solid var(--line);
  color: var(--sand);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 11px;
  outline: none;
}
.comment-form-row .submit-comment-btn {
  padding: 8px 18px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}
.comment-form-row .submit-comment-btn:hover {
  opacity: 0.92;
}

.comments-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.comment-card {
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--sand-dim);
}
.comment-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.04em;
  background: #e2e8f0;
  color: #475569;
}
.comment-badge.queja {
  background: #fef3c7;
  color: #a16207;
}
.comment-badge.se_fue {
  background: #fee2e2;
  color: #b91c1c;
}
.comment-badge.ya_volvio {
  background: #ccfbf1;
  color: #0f766e;
}
.comment-text {
  color: var(--sand);
  line-height: 1.35;
  font-size: 12px;
}

/* Directorio Oficial */
.official-directory {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.dir-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.dir-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.dir-card:hover {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.2);
}
.dir-card strong {
  font-size: 12px;
  color: var(--sand);
}
.dir-card span {
  font-size: 11px;
  color: var(--aqua);
  font-weight: 600;
}
.dir-card small {
  font-size: 11px;
  color: var(--sand-dim);
}

/* Modal */
#modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.55);
  display: grid; place-items: end; padding: 12px;
}
#modal[hidden] { display: none !important; }
#modal .box {
  width: 100%; max-width: 420px; background: #fff;
  border: 1px solid var(--line); border-radius: 24px; padding: 20px;
  color: var(--sand);
}
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.choice button {
  border-radius: 16px; border: 1px solid var(--line);
  background: #fff; padding: 12px;
  color: var(--sand);
}
.choice button.on { background: #0f172a; color: #fff; border-color: #0f172a; }
.actions { display: flex; gap: 8px; }

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: 1fr;
    gap: 16px;
    padding: 16px;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .map-pane {
    flex: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
  }
  .sheet {
    flex: none;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 28px;
    overflow-y: auto;
  }
  .handle { display: none; }
  .search { right: 16px; }
  .legend { right: 70px; max-width: 60%; }
  #modal { place-items: center; }
}

@media (max-width: 899px) {
  .zoom-btns { bottom: 64px; }
  .legend { bottom: 16px; right: 56px; }
}

/* ---------- Clima / día-noche / lluvia ---------- */
.wx-chip {
  position: absolute; z-index: 520;
  top: 16px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 180px);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(15,23,42,0.1);
  font-size: 11px; font-weight: 700; color: var(--sand);
  pointer-events: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.wx-chip[hidden] { display: none !important; }
.wx-chip .wx-label { font-weight: 600; color: var(--sand-dim); max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .wx-chip { top: auto; bottom: 58px; left: 12px; transform: none; max-width: calc(100% - 80px); }
  .wx-chip .wx-label { display: none; }
}

.rain-banner {
  position: absolute; z-index: 540;
  top: 68px; left: 16px; right: 16px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(2,132,199,0.95), rgba(14,165,233,0.92));
  color: #fff;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 10px 28px rgba(2,132,199,0.35);
  animation: rainBannerIn 0.45s ease-out;
}
.rain-banner[hidden] { display: none !important; }
.rain-banner #rainBannerText { flex: 1; line-height: 1.3; }
.rain-banner button {
  flex: none; width: 28px; height: 28px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,0.22); color: #fff; font-size: 18px; line-height: 1;
}
@keyframes rainBannerIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .rain-banner { animation: none; }
}

.rain-canvas {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none; width: 100%; height: 100%;
}
.rain-canvas.is-on { opacity: 1; }
body.theme-night .rain-canvas { mix-blend-mode: screen; opacity: 0.85; }

/* Tema noche: UI alrededor del mapa */
body.theme-night {
  --ink: #0b1220;
  --sheet: #111827;
  --sand: #e2e8f0;
  --sand-dim: rgba(226, 232, 240, 0.62);
  --line: rgba(148, 163, 184, 0.18);
  --card: #1e293b;
  --aqua: #5eead4;
  background: #0b1220;
  color: #e2e8f0;
}
body.theme-night .map-pane { background: #0f172a; border-color: rgba(148,163,184,0.18); }
body.theme-night .maplibregl-map,
body.theme-night .map-fallback { background: #0f172a; color: #94a3b8; }
body.theme-night .brand strong {
  color: #f8fafc;
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}
body.theme-night .brand span { color: #5eead4; }
body.theme-night .ghost {
  background: rgba(15,23,42,0.78);
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
body.theme-night .ghost:hover { background: rgba(30,41,59,0.95); border-color: rgba(148,163,184,0.35); }
body.theme-night .wx-chip {
  background: rgba(15,23,42,0.85);
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
body.theme-night .wx-chip .wx-label { color: rgba(226,232,240,0.65); }
body.theme-night .legend { background: transparent; border: 0; box-shadow: none; color: #e2e8f0; }
body.theme-night .legend span {
  background: rgba(15,23,42,0.88);
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
body.theme-night .legend span.lg-ok { color: rgba(226,232,240,0.55); }
body.theme-night .search input {
  background: rgba(15,23,42,0.88);
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
body.theme-night .search input::placeholder { color: rgba(226,232,240,0.45); }
body.theme-night .search input:focus { border-color: rgba(94,234,212,0.45); }
body.theme-night .search ul {
  background: #1e293b;
  border-color: rgba(148,163,184,0.22);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}
body.theme-night .search li button { color: #e2e8f0; }
body.theme-night .search li button:hover { background: rgba(51,65,85,0.85); }
body.theme-night .search small { color: rgba(226,232,240,0.55); }
body.theme-night .sheet {
  background: var(--sheet);
  color: var(--sand);
  border-color: rgba(148,163,184,0.16);
  box-shadow: 0 -16px 40px rgba(0,0,0,0.45);
}
body.theme-night .handle { background: rgba(148,163,184,0.35); }
body.theme-night .maplibregl-ctrl-attrib {
  background: rgba(15,23,42,0.85) !important;
  color: #94a3b8;
}
body.theme-night .maplibregl-ctrl-attrib a { color: #5eead4; }
body.theme-night .zoom-btns button {
  background: rgba(15,23,42,0.88);
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
body.theme-night .mode-btn {
  color: #5eead4;
  background: rgba(15,23,42,0.9);
  border-color: rgba(94,234,212,0.35);
}
body.theme-night .zoom-btns .mode-btn[aria-pressed="false"] {
  color: #0b1220;
  background: #5eead4;
  border-color: #5eead4;
}
body.theme-night .stat {
  background: var(--card);
  border-color: rgba(148,163,184,0.18);
}
body.theme-night .stat.agua {
  background: rgba(2,132,199,0.18);
  border-color: rgba(56,189,248,0.35);
  color: #e0f2fe;
}
body.theme-night .stat.luz {
  background: rgba(202,138,4,0.18);
  border-color: rgba(250,204,21,0.35);
  color: #fef9c3;
}
body.theme-night .stat b { color: #f8fafc; }
body.theme-night .card,
body.theme-night .comment-card,
body.theme-night .dir-card,
body.theme-night .comment-form {
  background: var(--card);
  border-color: rgba(148,163,184,0.18);
  color: var(--sand);
}
body.theme-night .dir-card:hover {
  background: rgba(51,65,85,0.85);
  border-color: rgba(148,163,184,0.32);
}
body.theme-night .pill {
  background: rgba(51,65,85,0.9);
  color: #cbd5e1;
}
body.theme-night .pill.live {
  background: rgba(185,28,28,0.28);
  color: #fecaca;
}
body.theme-night .pill.warn {
  background: rgba(161,98,7,0.28);
  color: #fde68a;
}
body.theme-night .chips button,
body.theme-night .vote-action-btn,
body.theme-night .choice button {
  background: #1e293b;
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
}
body.theme-night .chips button:hover,
body.theme-night .vote-action-btn:hover,
body.theme-night .secondary:hover {
  background: rgba(51,65,85,0.9);
  border-color: rgba(148,163,184,0.35);
}
body.theme-night .secondary {
  border-color: rgba(148,163,184,0.28);
  color: #e2e8f0;
}
body.theme-night .primary,
body.theme-night .comment-form-row .submit-comment-btn {
  background: #5eead4;
  color: #0b1220;
}
body.theme-night .choice button.on {
  background: #5eead4;
  color: #0b1220;
  border-color: #5eead4;
}
body.theme-night .comment-form textarea {
  background: #0f172a;
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
}
body.theme-night .comment-form textarea:focus {
  border-color: rgba(94,234,212,0.45);
}
body.theme-night .comment-form-row select {
  background: #0f172a;
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
}
body.theme-night .comment-badge {
  background: rgba(51,65,85,0.9);
  color: #cbd5e1;
}
body.theme-night .comment-badge.queja {
  background: rgba(161,98,7,0.28);
  color: #fde68a;
}
body.theme-night .comment-badge.se_fue {
  background: rgba(185,28,28,0.28);
  color: #fecaca;
}
body.theme-night .comment-badge.ya_volvio {
  background: rgba(15,118,110,0.3);
  color: #99f6e4;
}
body.theme-night .sponsor {
  background: linear-gradient(135deg, rgba(120,53,15,0.35), rgba(161,98,7,0.22));
  border-color: rgba(250,204,21,0.28);
}
body.theme-night .sponsor .tag,
body.theme-night .sponsor .cta { color: #fbbf24; }
body.theme-night .sponsor h3 { color: #fef3c7; }
body.theme-night #modal .box {
  background: #1e293b;
  border-color: rgba(148,163,184,0.22);
  color: #e2e8f0;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
}
body.theme-night .sefue-tip .maplibregl-popup-content {
  background: #1e293b;
  border-color: rgba(148,163,184,0.25);
  color: #e2e8f0;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
body.theme-night .live-bar .stale { color: #fbbf24; }
body.theme-night .rain-banner {
  background: linear-gradient(135deg, rgba(7,89,133,0.95), rgba(3,105,161,0.92));
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}

/* Indicador estático de lluvia (reduced-motion) */
.rain-static-mark {
  position: absolute; z-index: 530; pointer-events: none;
  font-size: 18px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
  opacity: 0.9;
}
