/* =====================================================================
   Estilo "Tótem de gasolinera" — ver diseno-visual.md
   ===================================================================== */

/* Letras alojadas en la propia web (no se cargan desde Google) */
@font-face { font-family: "Archivo"; src: url("../fonts/archivo-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("../fonts/archivo-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo Narrow"; src: url("../fonts/archivo-narrow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo Narrow"; src: url("../fonts/archivo-narrow-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Doto"; src: url("../fonts/doto-latin-900-normal.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }

:root {
  /* Alturas: 0 = fondo del mapa … 3 = elementos flotantes */
  --n0: #0A0B0D;
  --n1: #111317;
  --n2: #181B20;
  --n3: #20242A;
  --borde1: #1F2227;
  --borde2: #2B2F35;
  --borde3: #343940;
  --texto: #EDEBE6;
  --texto2: #B4B7BC;
  --texto3: #9A9EA5;
  --texto4: #8C9198;
  --pantalla: #040506;
  /* Escala de precios (accesible por defecto) */
  --barata: #5CC8FF;
  --media: #E6E1D6;
  --cara: #FF9F43;
  --estrecha: "Archivo Narrow", "Arial Narrow", system-ui, sans-serif;
  /* Escala de espacios (múltiplos de 4 px): se usa en toda la ficha */
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 24px; --e6: 32px;
  /* Alto de la hoja plegada (móvil) desde el primer momento: así la leyenda y
     los botones del mapa no saltan cuando llegan los precios. app.js lo ajusta. */
  --alto-hoja: calc(31px + env(safe-area-inset-bottom));
}
/* Con "mi gasolinera" guardada, la hoja plegada enseña su fila desde el principio */
.con-favorita { --alto-hoja: calc(99px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { :root, .con-favorita { --alto-hoja: 0px; } }
:root[data-escala="semaforo"] {
  --barata: #3EE08F;
  --media: #F2CE4B;
  --cara: #FF6B5E;
}

html, body { margin: 0; height: 100%; background: var(--n0); color: var(--texto); font-family: "Archivo", system-ui, sans-serif; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

button:focus-visible, a:focus-visible { outline: 2px solid var(--barata); outline-offset: 2px; }

/* ---------- Controles flotantes de arriba ----------
   Móvil:      [botón combustible]            [nombre]
               [barra de combustible a todo el ancho]   (solo si está abierta)
               [hora de los precios]
               [aviso]
   Escritorio: [barra siempre visible]        [nombre]
               [hora] / [aviso]                                         */
.superior {
  position: absolute; z-index: 3;
  top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "boton marca" "barra barra" "chip chip" "aviso aviso";
  gap: 6px 10px; align-items: start; justify-items: start;
  pointer-events: none;
}
.superior > * { pointer-events: auto; }

.boton-combustible {
  grid-area: boton;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 12px 6px 10px; box-sizing: border-box;
  background: var(--n3); color: var(--texto);
  border: 1px solid var(--borde3); border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  cursor: pointer; text-align: left;
}
.boton-combustible .textos { display: flex; flex-direction: column; gap: 1px; }
.boton-combustible .caption { font-family: var(--estrecha); font-weight: 600; font-size: 10px; letter-spacing: 0.16em; color: var(--texto3); }
.boton-combustible .valor { font-family: var(--estrecha); font-weight: 700; font-size: 16px; letter-spacing: 0.08em; white-space: nowrap; }
.icono-surtidor, .icono-flecha { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icono-surtidor { color: var(--texto3); }
.icono-flecha { color: var(--texto3); }
.boton-combustible[aria-expanded="true"] .icono-flecha { transform: rotate(180deg); }
.boton-combustible .nota { font-family: var(--estrecha); font-weight: 600; font-size: 10px; letter-spacing: 0.14em; color: var(--media); }
.boton-combustible .nota[hidden] { display: none; }

.marca-mini {
  grid-area: marca; justify-self: end;
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 9px;
  background: rgba(17, 19, 23, 0.85); border: 1px solid var(--borde2); border-radius: 4px;
  font-family: var(--estrecha); font-weight: 700; font-size: 13px; letter-spacing: 0.14em;
}
.marca-mini span { font-weight: 600; font-size: 9px; letter-spacing: 0.16em; color: var(--texto4); }

/* ---------- Barra de combustible ---------- */
.barra-comb {
  grid-area: barra; justify-self: stretch;
  display: flex; align-items: center; gap: 3px;
  min-height: 52px; padding: 4px; box-sizing: border-box;
  background: var(--n3); border: 1px solid var(--borde3); border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.barra-comb[hidden] { display: none; }
.familia { display: flex; align-items: center; gap: 3px; border-radius: 6px; }
.familia + .familia { border-left: 1px solid var(--borde3); padding-left: 3px; }
.familia.abierta { background: #2C3138; padding: 3px 3px 3px 6px; }
.familia + .familia.abierta { border-left-color: transparent; }
.familia.abierta + .familia { border-left-color: transparent; }
.fam-nombre { font-family: var(--estrecha); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; color: var(--texto); padding-right: 2px; }

/* Familia plegada (o GLP): un botón */
.fam-boton {
  height: 44px; padding: 0 8px;
  background: transparent; color: var(--texto3);
  border: 1.5px solid transparent; border-radius: 6px;
  font-family: var(--estrecha); font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  cursor: pointer; white-space: nowrap;
}
/* La familia que contiene el combustible elegido se distingue, sin parecer "seleccionada" */
.fam-boton.contiene { color: var(--texto); border-color: #6A7079; }
/* GLP elegido: relleno blanco, como cualquier opción elegida */
.fam-boton[aria-pressed="true"] { background: var(--texto); color: var(--n0); border-color: var(--texto); box-shadow: 0 0 0 3px rgba(237, 235, 230, 0.2); }

/* Variantes: sin elegir = solo contorno; elegida = relleno blanco, bien visible */
.variante {
  height: 40px; min-width: 38px; padding: 0 8px;
  background: transparent; color: var(--texto);
  border: 1.5px solid #5E646C; border-radius: 20px;
  font-family: var(--estrecha); font-weight: 700; font-size: 14px; letter-spacing: 0.04em;
  cursor: pointer; white-space: nowrap;
}
.variante:hover, .fam-boton:hover { border-color: #8C9198; }
.variante[aria-pressed="true"] {
  background: var(--texto); color: var(--n0); border-color: var(--texto);
  box-shadow: 0 0 0 3px rgba(237, 235, 230, 0.2);
}

/* Móviles estrechos: un poco más compacto para que todo quepa sin deslizar */
@media (max-width: 419px) {
  .barra-comb, .familia { gap: 2px; }
  .familia + .familia { padding-left: 2px; }
  .fam-nombre, .fam-boton { font-size: 12px; letter-spacing: 0; }
  .fam-boton { padding: 0 4px; }
  .familia.abierta { padding-left: 4px; }
  .variante { min-width: 32px; padding: 0 5px; font-size: 13px; letter-spacing: 0; }
}
@media (max-width: 339px) { .barra-comb { flex-wrap: wrap; } }

/* "MÁS": el resto de combustibles, agrupados, en un panel bajo la fila de familias */
.barra-comb.con-mas { flex-wrap: wrap; }
.fam-boton.mas.abierto { color: var(--texto); background: #2C3138; }
.mas-panel { flex: 1 1 100%; display: flex; flex-direction: column; gap: var(--e2); padding: var(--e2) var(--e1) var(--e1); border-top: 1px solid var(--borde3); margin-top: 2px; }
.mas-grupo { display: flex; align-items: flex-start; gap: var(--e2); }
.mas-nombre { flex: none; width: 76px; padding-top: 12px; font-family: var(--estrecha); font-weight: 700; font-size: 12px; letter-spacing: 0.06em; color: var(--texto3); }
.mas-opciones { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
@media (min-width: 900px) { .barra-comb.con-mas { max-width: 560px; } }

/* Escritorio: barra siempre visible con todo desplegado, sin botón */
@media (min-width: 900px) {
  .superior {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "barra marca" "chip ." "aviso .";
  }
  .superior .boton-combustible { display: none; }
  .barra-comb[hidden] { display: flex; }
  .barra-comb { justify-self: start; }
  .aviso { max-width: 520px; }
}

/* ---------- Mapa ---------- */
.zona-mapa { flex: 1; position: relative; min-height: 0; }
#mapa { position: absolute; inset: 0; background: var(--n0); }

.leyenda {
  position: absolute; left: 12px; bottom: calc(var(--alto-hoja, 0px) + max(12px, env(safe-area-inset-bottom))); z-index: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 9px;
  background: var(--n3); border: 1px solid var(--borde3); border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  font-family: var(--estrecha); font-weight: 600; font-size: 11px; letter-spacing: 0.1em;
  pointer-events: none;
}
.leyenda span { display: flex; align-items: center; gap: 5px; }
.leyenda span::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.t0 { color: var(--barata); }
.t1 { color: var(--media); }
.t2 { color: var(--cara); }


.aviso {
  grid-area: aviso; justify-self: stretch; box-sizing: border-box;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 8px;
  padding: 12px 6px 12px 14px;
  background: var(--n3); border: 1px solid var(--borde3); border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 14px; line-height: 1.4;
}
.aviso[hidden] { display: none; }
.aviso #aviso-texto { flex: 1 1 200px; padding-top: 2px; }
.aviso-cerrar {
  flex: none; order: 2; width: 36px; height: 36px; margin: -6px 0;
  background: transparent; border: 0; border-radius: 4px; color: var(--texto3);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.aviso-accion {
  order: 3; flex: 1 1 100%; height: 44px; margin-right: 8px;
  background: var(--texto); color: var(--n0); border: 0; border-radius: 4px;
  font-family: var(--estrecha); font-weight: 700; font-size: 14px; letter-spacing: 0.1em; cursor: pointer;
}
.aviso-accion[hidden] { display: none; }

/* Etiqueta con la hora de los precios */
.chip {
  grid-area: chip;
  height: 28px; padding: 0 10px;
  background: var(--n3); color: var(--texto3);
  border: 1px solid var(--borde3); border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  font-family: var(--estrecha); font-weight: 600; font-size: 11px; letter-spacing: 0.12em;
  cursor: default;
}
.chip[hidden] { display: none; }
.chip.antiguo { color: var(--cara); }

/* Marca de "tu ubicación" */
/* Distinta de las gasolineras (que son puntos rellenos de color):
   un aro blanco hueco con centro, como una diana, y una onda suave. */
.yo {
  position: relative;
  width: 24px; height: 24px; box-sizing: border-box; border-radius: 50%;
  border: 3px solid var(--texto);
  background: rgba(10, 11, 13, 0.75);
  box-shadow: 0 0 0 1.5px var(--n0), 0 3px 10px rgba(0, 0, 0, 0.7);
}
.yo::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--texto);
}
.yo::before {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid rgba(237, 235, 230, 0.55);
  animation: onda 2.2s ease-out infinite;
}
@keyframes onda { from { transform: scale(0.55); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .yo::before { animation: none; opacity: 0.4; } }

/* ---------- Controles del mapa ---------- */
/* En móvil quedan justo encima de la hoja plegada */
.maplibregl-ctrl-bottom-right { bottom: var(--alto-hoja, 0px); }
.maplibregl-ctrl-group { background: var(--n3); border: 1px solid var(--borde3); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important; }
.maplibregl-ctrl-group button { width: 44px; height: 44px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--borde3); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.92); }
.maplibregl-ctrl-attrib { background: rgba(17, 19, 23, 0.85) !important; color: var(--texto4); }
.maplibregl-ctrl-attrib a { color: var(--texto3); }
.maplibregl-ctrl-attrib-button { filter: invert(0.85); }
.boton-ubicacion { display: flex; align-items: center; justify-content: center; color: var(--texto); }
.boton-ubicacion svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.boton-ubicacion.buscando svg { animation: latido 1s ease-in-out infinite; color: var(--barata); }
@keyframes latido { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .boton-ubicacion.buscando svg { animation: none; } }

/* ---------- Ficha de una gasolinera (dentro de la hoja) ----------
   Escala de letra: 24 nombre · 16 frases · 14 texto · 13 notas · 12 títulos de
   apartado (mayúsculas, estrecha) · Doto 28 para precios y cifras.
   Espacios: 4-8 dentro de un grupo · 16 entre grupos cercanos · 24 entre apartados. */
.ficha { padding-bottom: var(--e4); }
.ficha-cab {
  display: flex; align-items: center; justify-content: space-between; gap: var(--e2); padding: var(--e1) 0;
  position: sticky; top: 0; z-index: 1; background: var(--n2);   /* nombre y cerrar, siempre a la vista */
}
.ficha-nombre { margin: 0; font-family: var(--estrecha); font-weight: 700; font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.15; overflow-wrap: anywhere; }
.ficha-cerrar {
  flex: none; width: 44px; height: 44px;
  background: transparent; border: 0; border-radius: 4px; color: var(--texto3);
  font-size: 28px; line-height: 1; cursor: pointer;
}
.ficha-cerrar:hover { background: #2A2F36; color: var(--texto); }
.ficha-titulo { margin: 0 0 var(--e2); font-family: var(--estrecha); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; color: var(--texto3); }

/* Identidad */
.ficha-dir { margin: 2px 0 0; min-height: 1.4em; font-size: 14px; line-height: 1.4; color: var(--texto2); }
.ficha-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e1) var(--e3); margin: var(--e2) 0 0; font-family: var(--estrecha); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--texto3); }
.ficha-meta:empty, .hueco-estado:empty { display: none; }
.ficha .estado { display: inline-flex; align-items: center; gap: 6px; }
.ficha .estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; }
.ficha .estado.abierta { color: var(--texto); font-weight: 700; }
.ficha .estado.abierta::before { background: var(--texto); }
.ficha .estado.cerrada::before { border: 1.5px solid var(--texto3); }
.ficha-aviso { margin: var(--e2) 0 0; font-size: 13px; line-height: 1.4; color: var(--texto2); }
.ficha-aviso.cara { color: var(--cara); }

/* Precios */
.ficha-precios { margin-top: var(--e5); }
.precios-cab { display: flex; justify-content: space-between; margin-bottom: var(--e2); font-family: var(--estrecha); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; color: var(--texto3); }
.ficha .pantalla { background: var(--pantalla); border: 1px solid #000; border-radius: 4px; box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.05); }
.ficha .fila { display: flex; align-items: center; justify-content: space-between; gap: var(--e4); min-height: 56px; padding: var(--e2) var(--e4); box-sizing: border-box; border-bottom: 1px solid #15171A; }
.ficha .fila:last-child { border-bottom: 0; }
.ficha .comb { display: flex; flex-direction: column; gap: 2px; font-family: var(--estrecha); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; }
.ficha .comb-nota { font-weight: 600; font-size: 11px; letter-spacing: 0.14em; color: var(--texto3); }
.ficha .led { font-family: "Doto", ui-monospace, monospace; font-weight: 900; font-size: 28px; line-height: 1; color: var(--texto); }
/* El combustible elegido: mismo tamaño que los demás, enmarcado */
.ficha .fila.elegido { box-shadow: inset 0 0 0 1.5px #6A7079; border-radius: 4px; border-bottom-color: transparent; }
.ficha .led.t0 { color: var(--barata); }
.ficha .led.t1 { color: var(--media); }
.ficha .led.t2 { color: var(--cara); }
.ficha .led.sin { font-family: var(--estrecha); font-weight: 600; font-size: 12px; letter-spacing: 0.12em; color: var(--texto4); }
.ficha .no-vende { margin: var(--e2) 0 0; font-size: 13px; color: var(--texto3); }
/* Altura baja: solo la fila del combustible elegido */
.hoja[data-altura="baja"] .precios-cab,
.hoja[data-altura="baja"] .ficha .fila:not(.elegido),
.hoja[data-altura="baja"] .ficha .no-vende,
.hoja[data-altura="baja"] .acciones-app { display: none; }
.hoja[data-altura="baja"] .ficha-precios { margin-top: var(--e4); }

/* Acciones: "Cómo llegar" (principal) y "Guardar" */
.ficha-acciones { margin-top: var(--e4); }
.acciones { display: grid; grid-template-columns: 1fr auto; gap: var(--e2); }
.boton-principal, .boton-secundario {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; box-sizing: border-box;
  border-radius: 4px; font-family: var(--estrecha); font-weight: 700; font-size: 15px; letter-spacing: 0.1em;
  text-decoration: none; cursor: pointer;
}
.boton-principal { background: var(--texto); color: var(--n0); border: 0; }
.boton-principal:hover { background: #FFFFFF; }
.boton-secundario { padding: 0 var(--e4); background: transparent; color: var(--texto); border: 1.5px solid #5E646C; }
.boton-secundario:hover { border-color: #8C9198; }
.boton-secundario[aria-pressed="true"] { border-color: var(--texto); }
.boton-secundario[aria-pressed="true"] .icono path { fill: currentColor; }
.ficha .icono { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.acciones-app { margin: var(--e2) 0 0; font-size: 13px; color: var(--texto3); }
.enlace { padding: 6px 2px; background: none; border: 0; color: var(--texto2); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ficha .rutas { display: flex; gap: var(--e2); margin-top: var(--e1); }
.ficha .rutas[hidden] { display: none; }
.ficha .ruta {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center; height: 44px; padding: 0 var(--e3);
  background: #2A2F36; color: var(--texto); border: 1px solid #3A3F46; border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-decoration: none; white-space: nowrap; font-family: var(--estrecha); font-weight: 700; font-size: 14px; letter-spacing: 0.02em;
}
.ficha .ruta:hover { background: #333941; }

/* Estadísticas: dos cifras frente a la media y dos tarjetas (evolución, mejor hora) */
.estadisticas { margin-top: var(--e5); }
.estadisticas:empty { display: none; }
.est-cifras { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e3); }
.est-cifras.una { grid-template-columns: 1fr; }
.est-cifra, .est-tarjeta {
  background: #1D2026; border: 1px solid var(--borde2); border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.est-cifra { display: flex; flex-direction: column; gap: var(--e2); padding: var(--e4); min-width: 0; }
.est-led { font-family: "Doto", ui-monospace, monospace; font-weight: 900; font-size: 28px; line-height: 1; color: var(--texto); white-space: nowrap; }
.est-led.t0, .est-frase .t0 { color: var(--barata); }
.est-led.t2, .est-frase .t2 { color: var(--cara); }
.est-pie { margin: 0; font-size: 13px; line-height: 1.4; color: var(--texto3); }
.est-zona { margin: var(--e2) 0 0; font-size: 13px; color: var(--texto4); }
.est-tarjeta { margin-top: var(--e3); padding: var(--e4); }
.est-frase { margin: 0 0 var(--e3); font-size: 16px; line-height: 1.4; color: var(--texto); }
.est-frase span { font-weight: 600; }

.grafica { position: relative; margin: 0 0 var(--e3); padding-right: 46px; }
.grafica svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafica .guia { stroke: #2B2F35; stroke-width: 1; stroke-dasharray: 3 4; }
.grafica .area { fill: rgba(237, 235, 230, 0.07); }
.grafica .linea { fill: none; stroke: var(--texto); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafica .punto { fill: var(--texto); stroke: #1D2026; stroke-width: 2; }
.grafica-ejes { position: absolute; top: 0; right: 0; bottom: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.grafica-ejes span, .grafica-fechas span, .barras-marcas span { font-family: var(--estrecha); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; color: var(--texto4); }
.grafica-fechas { display: flex; justify-content: space-between; margin-top: var(--e1); }

.barras-horas { margin: 0 0 var(--e3); }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.barra { flex: 1 1 0; border-radius: 1px; }
.barra.barata { background: var(--barata); }
.barra.cara { background: var(--cara); }
.barra.media1 { background: #6A7079; }
.barra.media2 { background: #4A4F56; }
.barra.vacia { background: #2B2F35; }
.barras-marcas { display: flex; justify-content: space-between; margin-top: var(--e2); }

/* Horario y fuente */
.ficha-horario { margin-top: var(--e5); }
.ficha-horario:empty { display: none; }
.horario-texto { margin: 0; font-size: 14px; line-height: 1.5; color: var(--texto2); white-space: pre-line; }
.ficha-fuente { margin: var(--e5) 0 0; padding-top: var(--e4); border-top: 1px solid var(--borde1); font-size: 13px; line-height: 1.4; color: var(--texto4); }

/* Solo para lectores de pantalla */
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hoja "Más baratas" (nivel 2) ----------
   Móvil: pegada abajo, plegada = asa + una fila; abierta = lista con scroll.
   Escritorio: panel a la izquierda, siempre abierto, sin asa.            */
.hoja {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
  box-sizing: border-box; display: flex; flex-direction: column;
  padding: 0 var(--e4) env(safe-area-inset-bottom); overflow: hidden;
  background: var(--n2); border-top: 1px solid var(--borde2); border-radius: 12px 12px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.hoja[hidden] { display: none; }
.hoja-asa {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 100%; height: 22px; padding: 0;
  background: transparent; border: 0; cursor: pointer;
}
.asa-raya { width: 40px; height: 4px; border-radius: 2px; background: #4A4F56; }
.hoja-contenido {
  flex: 1 1 auto; min-height: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding-bottom: 8px;
  /* Barra de desplazamiento fina y oscura (en lugar de la del navegador) */
  scrollbar-width: thin; scrollbar-color: #3A3F46 transparent;
}
.hoja-contenido::-webkit-scrollbar { width: 6px; height: 0; }
.hoja-contenido::-webkit-scrollbar-track { background: transparent; }
.hoja-contenido::-webkit-scrollbar-thumb { background: #3A3F46; border-radius: 3px; }
.hoja-contenido::-webkit-scrollbar-thumb:hover { background: #4A4F56; }
/* En pantallas táctiles no hace falta barra: se desplaza con el dedo */
@media (hover: none) {
  .hoja-contenido { scrollbar-width: none; }
  .hoja-contenido::-webkit-scrollbar { display: none; }
}
.hoja-asa { touch-action: none; }
/* Mientras se arrastra con el dedo, la hoja sigue al dedo y deja ver todo su contenido */
.hoja[data-arrastrando] .ficha-mas { display: block; }
.hoja[data-arrastrando] .hoja-contenido { height: auto; max-height: none; overflow: hidden; }
.hoja[data-altura="abierta"] .hoja-contenido { max-height: min(60dvh, 520px); }
/* Ficha: baja = lo esencial; media = todo, con desplazamiento; alta = casi pantalla completa */
.hoja[data-altura="baja"] .ficha-mas { display: none; }
.hoja[data-altura="media"] .hoja-contenido { max-height: min(62dvh, 560px); }
.hoja[data-altura="alta"] .hoja-contenido { height: calc(100dvh - var(--techo, 72px) - 8px - 22px - env(safe-area-inset-bottom)); }
/* Con la ficha casi a pantalla completa, la etiqueta de la hora se aparta */
.hoja-alta .chip { display: none; }

.hoja-cabecera { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hoja-titulo { margin: 6px 0 4px; font-family: var(--estrecha); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; color: var(--texto3); }
.hoja-comb { font-family: var(--estrecha); font-weight: 600; font-size: 11px; letter-spacing: 0.12em; color: var(--texto4); }
.hoja-lista { list-style: none; margin: 0; padding: 0; }
.hoja-lista li + li { border-top: 1px solid var(--borde1); }
.hoja-nota { margin: 6px 0 0; font-size: 12px; color: var(--texto4); }
.hoja-vacio { margin: 4px 0 6px; padding: 10px 0; font-size: 14px; color: var(--texto2); }

.fila-hoja {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 56px; padding: 8px 2px; box-sizing: border-box;
  background: transparent; color: var(--texto); border: 0; border-radius: 4px;
  text-align: left; cursor: pointer; font: inherit;
}
.fila-hoja:hover { background: #1F2329; }
.fila-hoja .textos { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fila-hoja .etiqueta { font-family: var(--estrecha); font-weight: 600; font-size: 10px; letter-spacing: 0.16em; color: var(--texto3); }
.fila-hoja .nombre { font-family: var(--estrecha); font-weight: 700; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-hoja .detalle { font-size: 12px; color: var(--texto2); }
.led-hoja {
  flex: none; padding: 4px 8px;
  background: var(--pantalla); border: 1px solid #000; border-radius: 3px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9);
  font-family: "Doto", ui-monospace, monospace; font-weight: 900; font-size: 26px; line-height: 1; color: var(--texto);
}
.led-hoja.t0 { color: var(--barata); }
.led-hoja.t1 { color: var(--media); }
.led-hoja.t2 { color: var(--cara); }
.led-hoja.sin { font-family: var(--estrecha); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; color: var(--texto4); padding: 8px; }
.fila-aviso { cursor: default; }
/* Fila provisional "Cargando precios…": mismo alto que la fila definitiva */
.fila-carga { display: none; min-height: 68px; cursor: default; }
.con-favorita .fila-carga { display: flex; }
/* Hoja plegada con un mensaje ("Acerca el mapa…"): mismo alto que con una gasolinera */
.hoja[data-altura="plegada"] .hoja-vacio { display: flex; align-items: center; box-sizing: border-box; min-height: 68px; margin: 0; padding: 0; }
.fila-carga:hover { background: transparent; }
.fila-aviso:hover { background: transparent; }
.quitar {
  flex: none; height: 40px; padding: 0 12px;
  background: transparent; color: var(--texto); border: 1.5px solid #5E646C; border-radius: 4px;
  font-family: var(--estrecha); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; cursor: pointer;
}

@media (min-width: 900px) {
  .hoja {
    /* Colgado bajo los controles de arriba y sin pasar de la leyenda de abajo */
    left: 12px; right: auto; top: calc(var(--techo, 104px) + 8px); bottom: auto; width: 420px;
    max-height: calc(100% - var(--techo, 104px) - 8px - 52px);
    padding: var(--e2) 0 var(--e2) var(--e4);   /* sin margen a la derecha: la barra de desplazamiento va pegada al borde */
    border: 1px solid var(--borde2); border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  .hoja-asa { display: none; }
  .hoja .hoja-contenido { max-height: none !important; height: auto !important; padding-right: var(--e4); }
  .hoja .ficha-mas { display: block !important; }
}

/* Aro sobre la gasolinera abierta en la ficha */
.elegida {
  width: 30px; height: 30px; box-sizing: border-box; border-radius: 50%;
  border: 3px solid var(--texto);
  box-shadow: 0 0 0 2px var(--n0), 0 3px 10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* ---------- Móvil: mapa limpio ----------
   Sobre el mapa solo quedan el botón de combustible, el botón "i" y "mi ubicación".
   La hora de los precios va en la franja de la hoja; la leyenda, la fuente y los
   créditos, en el panel "i" (la leyenda flotante solo con el mapa alejado). */
/* Botón (i): un control más del mapa, debajo de "mi ubicación" */
.boton-info { display: flex; align-items: center; justify-content: center; color: var(--texto); }
.boton-info svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.boton-info[aria-expanded="true"] { background: var(--texto) !important; color: var(--n0); }
.boton-info[aria-expanded="true"] svg { filter: none; }
.panel-info {
  /* A la izquierda de la columna de botones (ubicación e "i" siguen a la vista) */
  position: absolute; z-index: 4; left: 12px; right: 66px; bottom: calc(var(--alto-hoja, 0px) + 10px);
  box-sizing: border-box;
  max-height: calc(100dvh - var(--techo, 72px) - var(--alto-hoja, 0px) - 24px); overflow-y: auto;
  padding: var(--e3) var(--e4) var(--e4);
  background: var(--n3); border: 1px solid var(--borde3); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.panel-info[hidden] { display: none; }
.panel-cab { display: flex; align-items: center; justify-content: space-between; }
.panel-titulo { margin: 0; font-family: var(--estrecha); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; color: var(--texto); }
.panel-cerrar { width: 44px; height: 44px; margin-right: -12px; background: transparent; border: 0; color: var(--texto3); font-size: 26px; line-height: 1; cursor: pointer; }
.panel-sub { margin: var(--e3) 0 var(--e1); font-family: var(--estrecha); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; color: var(--texto3); }
.panel-texto { margin: 0; font-size: 14px; line-height: 1.45; color: var(--texto2); }
.panel-texto a { color: var(--texto2); text-underline-offset: 2px; }
.panel-leyenda { display: flex; flex-wrap: wrap; gap: var(--e1) var(--e4); margin-bottom: var(--e2); font-family: var(--estrecha); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; }
.panel-leyenda span { display: flex; align-items: center; gap: 6px; }
.panel-leyenda span::before { content: ""; width: 10px; height: 10px; background: currentColor; }
.hoja-fuente {
  position: absolute; left: var(--e4); top: 5px; pointer-events: none;
  font-family: var(--estrecha); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; color: var(--texto4);
}
.hoja-fuente.antiguo { color: var(--cara); }
.hoja { position: absolute; }   /* referencia para la franja de la fuente */

@media (max-width: 899px) {
  .marca-mini, .chip, .control-zoom, .maplibregl-ctrl-attrib { display: none !important; }
  /* Leyenda flotante: con el mapa alejado (desaparece al acercar o al abrir una ficha) */
  .leyenda { display: none; }
  .leyenda-visible .leyenda { display: flex; }
}
@media (min-width: 900px) {
  .hoja-fuente, .panel-info, .control-info { display: none !important; }
}
