    body { margin: 0; padding: 0; }

    /* Contenedor del mapa */
#map {
  width: 100%;
  height: 85vh;
}

    .mapboxgl-ctrl-geocoder {
      min-width: 240px !important;
      width: 240px;
      margin: 0 !important;
      box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
      border-radius: 7.5px !important;
    }
    #geocoder {
      display: flex;
      align-self: flex-end;
      margin: 0;
    }

    /* ── Contenedor del popup ── */
    .mapboxgl-popup {
      max-width: 260px;
    }
    .mapboxgl-popup-content {
      width: 260px;
      padding: 12px 14px 10px;
      box-sizing: border-box;
      font-family: 'Petrona', Georgia, serif;
      font-size: 11px;
      line-height: 1.3;
      border-radius: 4px;
      box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    }

    /* ── Cabecera ── */
    .popup-municipio {
      font-family: 'Petrona', Georgia, serif;
      font-size: 15px;
      font-weight: 700;
      line-height: 1.1;
      color: #111;
      display: inline;
      margin-right: 4px;
    }
    .popup-seccion {
      font-family: 'Petrona', Georgia, serif;
      font-size: 10px;
      font-weight: 400;
      color: #888;
      display: inline;
    }
    .popup-provincia {
      font-family: 'Open Sans', sans-serif;
      font-size: 8.5px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #999;
      margin-top: 2px;
      margin-bottom: 8px;
    }

    /* ── Barra proporcional ── */
    .popup-bar {
      display: flex;
      height: 5px;
      border-radius: 3px;
      overflow: visible;
      margin-bottom: 10px;
      position: relative;
    }
    .popup-bar::after {
      content: '';
      position: absolute;
      left: 50%;
      top: -2px;
      bottom: -2px;
      width: 1.5px;
      background: rgba(0,0,0,0.25);
      pointer-events: none;
    }
    .popup-bar-segment {
      height: 100%;
      transition: width 0.3s;
    }

    /* ── Tabla de partidos ── */
    .popup-table {
      width: 100%;
      border-collapse: collapse;
    }
    .popup-table thead th {
      font-size: 8px;
      font-weight: 600;
      font-family: 'Open Sans', sans-serif;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: #aaa;
      padding-bottom: 4px;
      text-align: right;
    }
    .popup-table thead th:first-child {
      text-align: left;
    }
    .popup-table tbody tr {
      border-top: 1px solid #ebebeb;
    }
    .popup-table tbody td {
      padding: 4px 5px;
      color: #333;
      text-align: right;
    }
    .popup-table tbody td:first-child {
      text-align: left;
    }
    .party-cell {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .party-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .party-name {
      font-weight: 600;
      color: #444;
      font-family: 'Petrona', Georgia, serif;
      font-size: 11px;
    }
    .td-votos {
      font-family: 'Open Sans', sans-serif;
      font-variant-numeric: tabular-nums;
      font-size: 11px;
      color: #555;
    }
    .td-pct {
      font-family: 'Open Sans', sans-serif;
      font-weight: 600;
      font-size: 11px;
      color: #222;
      font-variant-numeric: tabular-nums;
    }

.mapa {
  width: 100%;
  position: relative;
  overflow: hidden;
      height: 85vh;
}
.map-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 60px;
  pointer-events: none;
}
.map-loading-overlay > span {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.map-loading-letter {
  display: inline-block;
  animation: map-letter-wave 1.6s infinite ease-in-out both;
}
@keyframes map-letter-wave {
  0%, 100% { opacity: 0.1; }
  50%       { opacity: 1;   }
}
.tooltip-close {
  display: none;
}

.map-mobile-overlay {
  display: none;
}

@media (max-width: 900px) {
  .map-mobile-overlay {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .map-mobile-overlay.hidden {
    display: none;
  }
  .map-mobile-overlay > span {
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    pointer-events: none;
  }
  .map-mobile-exit {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    color: white;
    font-size: 3rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .map-mobile-exit.visible {
    display: flex;
  }
}

@media (max-width: 900px) {
  .tooltip-close {
    display: block;
    position: absolute;
    top: -3px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2.9rem;
    line-height: 1;
    color: #bebebe;
    cursor: pointer;
    padding: 0;
    pointer-events: auto;
  }
}

.fixed-tooltip {
  position: absolute;
  right: 20px;
  bottom: 20px;

  width: 260px;
  z-index: 10;

  background: white;
  padding: 12px 14px 10px;
  box-sizing: border-box;

  font-family: 'Petrona', Georgia, serif;
  font-size: 11px;
  line-height: 1.3;

  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);

  pointer-events: none;
}
.mapboxgl-control-container {
  display: none;
}
.mapboxgl-marker svg path {
  fill: #111 !important;
}
.map-gesture-hint {
  position: absolute;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  transition: opacity 0.3s;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-gesture-hint span {
  font-family: 'Open Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.map-gesture-hint.hidden {
  opacity: 0;
}

.map-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  padding: 1rem 0 1.75rem 0;
  width: fit-content;
  margin: auto;
}
@media (max-width: 900px) {
  .map-gesture-hint {
    display: none;
  }
  .fixed-tooltip {
    pointer-events: auto;
  }
  .map-filters-bar {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    box-sizing: border-box;
  }
  .map-right-controls {
    order: -1;
    width: 100%;
    margin-left: 0;
  }
  .mapboxgl-ctrl-geocoder {
    min-width: 100% !important;
    width: 100% !important;
  }
  #geocoder {
    width: 100%;
  }
  .map-zoom-btns {
    top: 0.8rem;
    left: auto;
    right: 0.8rem;
    bottom: auto;
  }
  .map-zoom-btn {
    height: 2rem;
    width: 2rem;
  }
  .map-zoom-btn svg {
    height: 1rem;
  }
  .fixed-tooltip {
    right: 10px;
    left: 10px;
    bottom: 0.2rem;
    width: auto;
  }
}

@media (max-width: 480px) {
  .map-filter-title {
    display: none;
  }
  .map-filter-btn {
    padding: 0.28rem 0.45rem;
    font-size: 0.65rem;
  }
}
.map-filter-group { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.map-filter-title {
  font-size: 0.7rem; font-weight: 700; color: #898989;
  text-transform: uppercase; letter-spacing: 0.05em;
  font-family: "Open Sans", sans-serif;
}
.map-filter-btns { display: flex; width: 100%; }
.map-filter-btn {
  flex: 1;
  display: inline-block;
  border: 2px solid #e5e5e5; background: white; color: #555;
  padding: 0.3rem 0.4rem; font-size: 0.68rem; cursor: pointer;
  font-family: "Open Sans", sans-serif;
  border-radius: 0; margin-left: -2px;
  transition: background 0.15s, color 0.15s; white-space: nowrap;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.map-filter-btn:first-child { border-radius: 7.5px 0 0 7.5px; margin-left: 0; }
.map-filter-btn:last-child { border-radius: 0 7.5px 7.5px 0; }
.map-filter-btn:hover:not(.active) { background: #f5f5f5; color: #222; }
.map-filter-btn.active { background: black; color: white; }

.map-right-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.map-zoom-btns {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 9998;
  pointer-events: none;
}
.map-zoom-btn {
  pointer-events: auto;
}
.map-zoom-btn {
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #e5e5e5; background: white;
  height: 1.4rem; width: 1.4rem; color: gray; cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.map-zoom-btn:first-child { border-radius: 5px 5px 0 0; }
.map-zoom-btn:nth-child(2) { border-top: none; border-radius: 0 0 5px 5px; background: #f8f8f8; }
.map-zoom-btn svg { height: 0.8rem; stroke: gray; fill: none; }
.map-center-btn {
  margin-top: 6px;
  border-radius: 5px !important;
  border-top: 2px solid #e5e5e5 !important;
  background: white !important;
}
.map-center-btn img {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
}