:root {
  --verde: #1f5c35;
  --verde-claro: #2e8b50;
  --tinta: #16231b;
  --papel: #f7f5ef;
  --borde: rgba(22, 35, 27, .14);
  --sombra: 0 6px 24px rgba(22, 35, 27, .18);
  --barra: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  background: var(--papel);
  overscroll-behavior: none;
}

/* ---------- barra superior ---------- */

.barra {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--barra);
  padding: 0 12px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--verde);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  z-index: 1000;
}

.titulo h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .2px;
}

.titulo p {
  margin: 0;
  font-size: 11.5px;
  opacity: .82;
}

.acciones { display: flex; gap: 8px; flex: none; }

.acciones button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.acciones button:hover { background: rgba(255, 255, 255, .22); }
.acciones button:active { transform: translateY(1px); }
#btn-idioma { min-width: 46px; font-weight: 600; }

/* ---------- mapa ---------- */

#mapa {
  position: fixed;
  inset: var(--barra) 0 0 0;
  background: #243b2a;
}

.leaflet-container { background: #243b2a; font: inherit; }

.icono-poi {
  /* un solo tamano para todos; app.js define --icono */
  width: var(--icono, 34px);
  height: var(--icono, 34px);
  overflow: hidden;          /* red de seguridad: nada puede desbordar el circulo */
  background: #fff;
  border: 2px solid var(--verde-claro);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  display: grid;
  place-items: center;
  transition: transform .12s ease;
}

/* Leaflet trae `.leaflet-container .leaflet-marker-pane img { width: auto }`,
   que por especificidad (0,2,1) le gana a `.icono-poi img` (0,1,1) y devolvia
   la imagen a su tamano nativo (271x292, algunas 897x834). Encima, al ser el
   contenedor un grid, la fila se auto-dimensionaba al contenido desbordado y
   el porcentaje pasaba a medirse contra la imagen en vez del circulo. Por eso
   va en pixeles y con !important: no alcanza con subir la especificidad si el
   valor sigue siendo relativo. */
.leaflet-container .leaflet-marker-pane .icono-poi img,
.icono-poi img {
  width: calc(var(--icono, 34px) * 0.74) !important;
  height: calc(var(--icono, 34px) * 0.74) !important;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.icono-poi.activo {
  border-color: #e4572e;
  transform: scale(1.22);
  z-index: 500 !important;
}

.punto-yo {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2f7df6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(47, 125, 246, .3);
}

/* ---------- panel de detalle ---------- */

.panel {
  position: fixed;
  z-index: 1100;
  background: var(--papel);
  box-shadow: var(--sombra);
  overflow-y: auto;
  transition: transform .22s ease;
}

.panel.oculto { transform: translateY(102%); }

#panel-cerrar {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#panel-foto {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #d9d5c9;
}

.panel-cuerpo { padding: 14px 16px 22px; }

.panel-tipo {
  margin: 0 0 2px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--verde-claro);
  font-weight: 650;
}

.panel-cuerpo h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

#panel-desc { margin: 0; white-space: pre-line; }

.panel-meta {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #5d6b61;
}

/* ---------- leyenda / listado ---------- */

.leyenda {
  position: fixed;
  z-index: 1050;
  left: 12px;
  bottom: 12px;
  width: 220px;
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: 12px;
  box-shadow: var(--sombra);
  overflow: hidden;
}

#leyenda-toggle {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.chevron { transition: transform .18s ease; }
#leyenda-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

#leyenda-lista {
  margin: 0;
  padding: 0 0 6px;
  list-style: none;
  max-height: 46vh;
  overflow-y: auto;
  display: none;
  border-top: 1px solid var(--borde);
}

#leyenda-lista.abierta { display: block; }

#leyenda-lista li button {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
}

#leyenda-lista li button:hover { background: rgba(46, 139, 80, .1); }
#leyenda-lista img { width: 20px; height: 20px; object-fit: contain; flex: none; }
#leyenda-lista .n { color: #8b968e; font-variant-numeric: tabular-nums; flex: none; }

.aviso { padding: 80px 20px; text-align: center; }

/* ---------- escritorio ---------- */

@media (min-width: 760px) {
  .panel {
    top: var(--barra);
    right: 0;
    bottom: 0;
    width: 380px;
    border-left: 1px solid var(--borde);
  }
  .panel.oculto { transform: translateX(102%); }
}

@media (max-width: 759px) {
  .panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 62vh;
    border-radius: 16px 16px 0 0;
  }
  .leyenda { width: 164px; bottom: 10px; left: 10px; }
  #leyenda-lista { max-height: 38vh; }
}
