/* Timeline 3D (partido/js/timeline.js): la misma pantalla que el mapa de noticias de Tribuna, con partidos.
   Los marcadores y fichas los crea MapLibre: todo cuelga de .mapa-partidos o lleva nombres propios del mapa. */
.mapa-partidos {
  --azul: #1d3fb8; --cian: #19b4e6; --tinta: #0b1046;
  --serif: "Playfair Display", Garamond, "Times New Roman", serif;
  --inter: "Inter Tight", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: fixed; z-index: 40; top: var(--arriba, 64px); left: 0; right: 0; bottom: 0;
  overflow: hidden; background: #e9e5dc; color: var(--tinta); font-family: var(--body, inherit); color-scheme: light;
}
.mapa-partidos .mapa-lienzo { position: absolute; inset: 0 }
.mapa-partidos button { font-family: inherit }

/* ---------------- Panel lateral ---------------- */
.mapa-partidos .mapa-panel {
  position: absolute; z-index: 2; top: 16px; left: 16px; bottom: 16px; width: 360px;
  display: flex; flex-direction: column; border-radius: 18px; background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 50px rgba(11, 16, 70, .22); overflow: hidden;
}
.mapa-partidos .mapa-panel::before { content: ""; display: block; height: 4px; flex: none; background: linear-gradient(90deg, var(--cian), var(--azul)) }
.mapa-partidos .mapa-cabecera { padding: 16px 18px 12px; border-bottom: 1px solid #e6ebf3 }
.mapa-partidos .mapa-antetitulo { display: block; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--azul) }
.mapa-partidos .mapa-titulo { margin: 4px 0 2px; font-family: var(--serif); font-size: 1.65rem; font-weight: 800; line-height: 1.1; color: var(--tinta); text-transform: none; letter-spacing: 0 }
.mapa-partidos .mapa-fecha { display: block; font-size: .85rem; color: #5b6180 }
.mapa-partidos .mapa-fecha::first-letter { text-transform: uppercase }
.mapa-partidos .mapa-fila-periodo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px }

/* «Powered by TOOOLS» discreto, a la derecha del selector de día */
.mapa-partidos .firma-toools { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; color: #9aa0b6; text-decoration: none; line-height: 1; transition: color .25s ease }
.mapa-partidos .firma-toools-texto { font-family: var(--inter); font-size: 8px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase }
.mapa-partidos .firma-toools-logo { display: block; width: 58px; height: auto }
.mapa-partidos .firma-toools:hover, .mapa-partidos .firma-toools:focus-visible { color: var(--azul) }

.mapa-partidos .mapa-pista { margin: 6px 0 0; font-size: .75rem; color: #8a8fa3 }
.mapa-partidos .mapa-periodo { display: inline-flex; padding: 3px; border-radius: 999px; background: #eef1f8 }
.mapa-partidos .mapa-periodo button { border: 0; padding: 6px 14px; border-radius: 999px; background: transparent; color: #3d4260; font-size: .85rem; font-weight: 700; cursor: pointer }
.mapa-partidos .mapa-periodo button.activo { background: #fff; color: var(--azul); box-shadow: 0 2px 8px rgba(11, 16, 70, .14) }
.mapa-partidos .mapa-contadores { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font-size: .85rem; color: #5b6180 }
.mapa-partidos .mapa-contadores:empty { display: none }
.mapa-partidos .mapa-contadores strong { font-family: var(--serif); font-size: 1.25rem; color: var(--tinta) }
.mapa-partidos .mapa-contadores .vivo strong { color: #e0453a }

.mapa-partidos .mapa-secciones { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px; border-bottom: 1px solid #e6ebf3 }
.mapa-partidos .mapa-secciones[hidden] { display: none }
.mapa-partidos .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #dde3f0; border-radius: 999px; background: #fff; color: #3d4260; font-size: .78rem; font-weight: 600; cursor: pointer; transition: all .2s ease }
.mapa-partidos .chip .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--color) }
.mapa-partidos .chip small { color: #8a8fa3; font-weight: 700; font-size: inherit }
.mapa-partidos .chip.activo { background: var(--color); border-color: var(--color); color: #fff }
.mapa-partidos .chip.activo .punto { background: #fff }
.mapa-partidos .chip.activo small { color: rgba(255, 255, 255, .8) }

.mapa-partidos .mapa-lista { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 10px 12px }
.mapa-partidos .mapa-aviso { margin: 16px 8px; color: #5b6180; font-size: .9rem }

.mapa-partidos .item-partido { display: flex; width: 100%; gap: 12px; align-items: flex-start; padding: 10px 8px; border: 0; border-left: 3px solid transparent; border-radius: 10px; background: transparent; color: inherit; text-align: left; cursor: pointer; transition: background .2s ease }
.mapa-partidos .item-partido:hover { background: #f2f5fb }
.mapa-partidos .item-partido.activo { background: #eef2fd; border-left-color: var(--color) }
/* En lugar de la foto de la noticia, los dos escudos */
.mapa-partidos .item-escudos { flex: none; position: relative; width: 74px; aspect-ratio: 4 / 3; border-radius: 8px; background: #f3f5fa; box-shadow: inset 0 0 0 2px var(--color) }
.mapa-partidos .item-escudo { position: absolute; box-sizing: border-box; width: 32px; height: 32px; padding: 3px; border-radius: 50%; background: #fff; object-fit: contain; box-shadow: 0 2px 6px rgba(11, 16, 70, .18) }
.mapa-partidos .item-escudo:first-child { left: 7px; top: 7px }
.mapa-partidos .item-escudo:last-child { right: 7px; bottom: 7px }
.mapa-partidos .item-textos { display: flex; flex-direction: column; gap: 3px; min-width: 0 }
.mapa-partidos .item-meta { font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: var(--color, #5b6180) }
.mapa-partidos .item-vivo { font-weight: 800; text-transform: uppercase }
.mapa-partidos .item-titulo { font-family: var(--serif); font-size: .92rem; font-weight: 700; line-height: 1.25; color: #121212; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden }
.mapa-partidos .item-titulo em { font-style: normal; font-family: var(--inter); font-weight: 900; color: var(--color); white-space: nowrap }
.mapa-partidos .item-lugar { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: #5b6180 }

/* ---------------- Botones sobre el mapa ---------------- */
.mapa-partidos .mapa-acciones { position: absolute; z-index: 2; top: 16px; right: 16px; display: flex; gap: 8px }
.mapa-partidos .accion { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .94); color: var(--tinta); font-size: .85rem; font-weight: 700; box-shadow: 0 8px 22px rgba(11, 16, 70, .18); cursor: pointer; transition: all .2s ease }
.mapa-partidos .accion:hover:not([disabled]) { transform: translateY(-1px) }
.mapa-partidos .accion.accion-principal { background: linear-gradient(135deg, var(--cian), var(--azul)); color: #fff }
/* «Recorrer los partidos» vibra cada pocos segundos para invitar a pulsarlo (quieto mientras recorre) */
.mapa-partidos .accion.accion-principal:not(.activo):not([disabled]) { animation: tl3d-llama 3.2s ease-in-out 1.5s infinite }
.mapa-partidos .accion.accion-principal.activo { background: var(--tinta) }
.mapa-partidos .accion.accion-icono { width: 38px; height: 38px; padding: 0; justify-content: center }
.mapa-partidos .accion.accion-cerrar { background: var(--tinta); color: #fff }
/* Mando del recorrido: anterior, pausa / seguir y siguiente. El relleno del de pausa se llena mientras llega el siguiente partido */
.mapa-partidos .mando-recorrido { display: inline-flex; gap: 8px }
.mapa-partidos .mando-recorrido[hidden] { display: none }
.mapa-partidos .accion.accion-pausa { position: relative; overflow: hidden }
.mapa-partidos .accion-pausa .icono-pausa { position: relative; display: inline-flex }
.mapa-partidos .relleno-recorrido { position: absolute; inset: 0; background: rgba(25, 180, 230, .25); transform-origin: left; transform: scaleX(0); animation: tl3d-relleno 6500ms linear forwards }
.mapa-partidos .relleno-recorrido.parado { animation-play-state: paused }
@keyframes tl3d-relleno { from { transform: scaleX(0) } to { transform: scaleX(1) } }
.mapa-partidos .accion[disabled] { opacity: .5; cursor: default }
.mapa-partidos .maplibregl-ctrl-bottom-right { margin: 0 6px 10px 0 }

/* Página a pantalla completa: sin desplazamiento ni botón flotante */
html.pagina-mapa, html.pagina-mapa body { overflow: hidden }
html.pagina-mapa .boton-timeline { display: none }

@keyframes tl3d-onda { from { transform: scale(1); opacity: .8 } to { transform: scale(1.8); opacity: 0 } }
@keyframes tl3d-llama {
  0%, 72%, 100% { transform: none }
  75% { transform: rotate(-3deg) scale(1.04) }
  78% { transform: rotate(3deg) scale(1.06) }
  81% { transform: rotate(-3deg) scale(1.06) }
  84% { transform: rotate(2deg) scale(1.04) }
  88% { transform: none }
}

/* ---------------- Firma «Powered by TOOOLS» sobre el mapa ---------------- */
.mapa-partidos .firma-toools-mapa {
  position: absolute; z-index: 2; bottom: 22px; left: calc(50% + 196px); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 12px; padding: 11px 22px 11px 20px; border-radius: 999px;
  background: linear-gradient(rgba(11, 16, 70, .94), rgba(11, 16, 70, .94)) padding-box, linear-gradient(120deg, var(--cian), var(--azul) 55%, #7b3fb8) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 14px 34px rgba(11, 16, 70, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: #fff; text-decoration: none; line-height: 1; transition: transform .3s ease, box-shadow .3s ease;
}
.mapa-partidos .firma-mapa-texto { font-family: var(--inter); font-size: 10px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: rgba(255, 255, 255, .7) }
.mapa-partidos .firma-mapa-logo { display: block; width: 96px; height: auto; filter: drop-shadow(0 0 10px rgba(25, 180, 230, .35)) }
.mapa-partidos .firma-toools-mapa:hover, .mapa-partidos .firma-toools-mapa:focus-visible { transform: translateX(-50%) translateY(-2px); box-shadow: 0 18px 40px rgba(11, 16, 70, .45), 0 0 0 4px rgba(25, 180, 230, .18) }

/* ---------------- De lejos: burbujas por federación en vez de marcadores ---------------- */
/* MapLibre escribe opacity en línea en cada marcador: hace falta !important y visibility */
.mapa-lienzo.lejos .marcador-partido, .mapa-lienzo:not(.lejos) .burbuja-provincia { opacity: 0 !important; visibility: hidden; pointer-events: none }
/* Cada marcador y burbuja en su propia capa: al mover el mapa solo se recolocan, no se repintan (sombras, escudos) */
.burbuja-provincia { padding: 0; border: 0; background: none; cursor: pointer; transition: opacity .35s ease; will-change: transform }
.burbuja-provincia .burbuja-cuerpo { display: flex; flex-direction: column; align-items: center; gap: 5px; transition: transform .25s ease }
.burbuja-provincia .burbuja-foto { position: relative; display: block; width: 62px; height: 62px; padding: 0; cursor: pointer; border: 3px solid #fff; border-radius: 50%; background: #fff center / 72% no-repeat; box-shadow: 0 0 0 3px #1d3fb8, 0 12px 26px rgba(11, 16, 70, .4); transition: transform .25s ease }
.burbuja-provincia .burbuja-total { position: absolute; top: -6px; right: -10px; min-width: 26px; height: 26px; padding: 0 6px; box-sizing: border-box; border: 2px solid #fff; border-radius: 999px; background: linear-gradient(135deg, #19b4e6, #1d3fb8); color: #fff; font: 800 12px/22px "Inter Tight", Roboto, Arial, sans-serif; text-align: center }
/* «▶ Federación»: recorrido por sus partidos */
.burbuja-provincia .burbuja-nombre { display: inline-flex; align-items: center; gap: 8px; padding: 4px 15px 4px 4px; border: 1.5px solid transparent; border-radius: 999px; background: linear-gradient(#0b1046, #0b1046) padding-box, linear-gradient(120deg, #19b4e6, #1d3fb8 55%, #7b3fb8) border-box; color: #fff; font: 700 14px "Playfair Display", Garamond, serif; white-space: nowrap; cursor: pointer; box-shadow: 0 8px 22px rgba(11, 16, 70, .38); position: relative; transition: transform .2s ease }
.burbuja-provincia .burbuja-nombre::before { content: ""; position: absolute; inset: -6px; z-index: -1; border-radius: 999px; background: rgba(25, 180, 230, .24); opacity: 0; animation: tl3d-respira 3.6s ease-in-out var(--retraso, 0s) infinite }
.burbuja-provincia .burbuja-nombre:hover { transform: translateY(-2px) }
.burbuja-provincia .burbuja-play { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding-left: 2px; box-sizing: border-box; border-radius: 50%; background: #fff; color: #0b1046 }
/* La etiqueta «▶ Federación» (diseño «Marino TOOOLS»): el borde de la firma y un brillo cian que respira, cada burbuja a su ritmo */
@keyframes tl3d-respira { 0%, 100% { opacity: 0 } 50% { opacity: 1 } }
.burbuja-provincia.propia .burbuja-foto { box-shadow: 0 0 0 3px #19b4e6, 0 12px 26px rgba(11, 16, 70, .4) }
.burbuja-provincia .burbuja-foto:hover { transform: scale(1.08) }

/* ---------------- Marcadores ---------------- */
/* El botón lo posiciona MapLibre (position absolute + transform en línea): aquí no se toca ni position ni transform */
.marcador-partido { padding: 0; border: 0; background: none; cursor: pointer; transition: opacity .3s ease; will-change: transform }
/* Mientras el mapa se mueve, las animaciones (ondas, brillos) se paran: todo el trabajo para el mapa */
.mapa-lienzo.moviendo .marcador-partido *, .mapa-lienzo.moviendo .marcador-partido *::after, .mapa-lienzo.moviendo .burbuja-provincia *, .mapa-lienzo.moviendo .burbuja-provincia *::before { animation-play-state: paused !important }
.marcador-partido .marcador-cuerpo { display: flex; flex-direction: column; align-items: center; animation: tl3d-cae .6s cubic-bezier(.2, 1.4, .4, 1) both }
.marcador-partido .marcador-foto { position: relative; display: block; width: 52px; height: 52px; border: 3px solid #fff; border-radius: 50%; background: #fff center / 78% no-repeat; box-shadow: 0 0 0 3px var(--color), 0 10px 22px rgba(11, 16, 70, .35); transition: transform .25s ease; transform-origin: 50% 100% }
/* Escudo del visitante, pequeño, abajo a la derecha */
.marcador-partido .marcador-rival { position: absolute; right: -12px; bottom: -6px; width: 26px; height: 26px; border: 2px solid #fff; border-radius: 50%; background: #fff center / 78% no-repeat; box-shadow: 0 0 0 2px var(--color), 0 4px 10px rgba(11, 16, 70, .3) }
.marcador-partido .marcador-hora { margin-top: 6px; padding: 1px 7px; border-radius: 999px; background: var(--color); color: #fff; font: 800 11px/16px "Inter Tight", Roboto, Arial, sans-serif; white-space: nowrap; box-shadow: 0 3px 8px rgba(11, 16, 70, .25) }
.marcador-partido .marcador-punta { width: 3px; height: 16px; background: linear-gradient(var(--color), rgba(0, 0, 0, 0)) }
.marcador-partido:hover, .marcador-partido.activo { z-index: 5 }
.marcador-partido:hover .marcador-foto, .marcador-partido.activo .marcador-foto { transform: scale(1.25) }
.marcador-partido.activo .marcador-foto { box-shadow: 0 0 0 3px var(--color), 0 0 0 9px rgba(255, 255, 255, .6), 0 14px 28px rgba(11, 16, 70, .4) }
/* En directo: onda roja alrededor */
.marcador-partido.live .marcador-foto::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--color); animation: tl3d-onda 1.8s ease-out infinite }
.marcador-partido.oculto { opacity: 0; pointer-events: none }
@keyframes tl3d-cae { from { opacity: 0; transform: translateY(-40px) scale(.6) } }
.marcador-partido.visto .marcador-cuerpo { animation: none }

/* ---------------- Ficha del partido ---------------- */
.popup-noticia .maplibregl-popup-content { padding: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 18px 44px rgba(11, 16, 70, .3) }
.popup-noticia .maplibregl-popup-close-button { top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .92); font-size: 18px; line-height: 24px; color: #0b1046 }
.ficha-partido { width: 280px; font-family: var(--body, inherit); color: #121212 }
/* En lugar de la foto: los dos escudos y el resultado sobre el color de la categoría */
.ficha-partido .ficha-foto { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; height: 150px; padding: 18px 12px 12px; box-sizing: border-box; background: radial-gradient(circle at 50% 0, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, #0b1046, var(--color)); border-bottom: 4px solid var(--color); color: #fff }
.ficha-partido .ficha-equipo { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center }
.ficha-partido .ficha-equipo b { font-size: .72rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.ficha-partido .ficha-escudo { width: 54px; height: 54px; border-radius: 50%; background: #fff center / 78% no-repeat; box-shadow: 0 6px 16px rgba(0, 0, 0, .3) }
.ficha-partido .ficha-resultado { display: flex; flex-direction: column; align-items: center; font: 900 1.6rem/1 "Inter Tight", Roboto, Arial, sans-serif; white-space: nowrap }
.ficha-partido .ficha-resultado small { margin-top: 5px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase }
.ficha-partido.live .ficha-resultado small { background: #e0453a }
.ficha-partido .ficha-cuerpo { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px }
.ficha-partido .ficha-seccion { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--color) }
.ficha-partido .ficha-titulo { margin: 0; font-family: "Playfair Display", Garamond, serif; font-size: 1.05rem; line-height: 1.25; color: #121212; text-transform: none; letter-spacing: 0 }
.ficha-partido .ficha-titulo small { font-size: .8em; color: #5b6180; font-weight: 700 }
.ficha-partido .ficha-lugar { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: #5b6180 }
.ficha-partido .ficha-leer { align-self: flex-start; margin-top: 4px; padding: 7px 14px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #19b4e6, #1d3fb8); color: #fff; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer }

/* ---------------- Botón flotante «Timeline 3D» (todas las pantallas) ---------------- */
.boton-timeline {
  position: fixed; z-index: 35; left: 20px; bottom: 20px;
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 999px;
  background: linear-gradient(135deg, #0b1046, #16206e); border: 1px solid rgba(255, 255, 255, .14); color: #fff; text-decoration: none;
  box-shadow: 0 14px 30px rgba(11, 16, 70, .45), inset 0 1px 0 rgba(255, 255, 255, .1); transition: transform .25s ease, box-shadow .25s ease;
}
.boton-timeline[hidden] { display: none }
.boton-timeline:hover, .boton-timeline:focus-visible { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(11, 16, 70, .55), 0 0 0 4px rgba(25, 180, 230, .22) }
.boton-timeline .icono { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #19b4e6, #1d3fb8) }
/* Onda que sale del icono para llamar la atención */
.boton-timeline .icono::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #19b4e6; animation: tl3d-onda 2.4s ease-out infinite }
.boton-timeline .texto { font-family: "Inter Tight", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap }
.boton-timeline .texto strong { font-weight: 900; background: linear-gradient(90deg, #5fd3f5, #9fb4ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent }

@media (prefers-reduced-motion: reduce) {
  .mapa-partidos .accion.accion-principal, .boton-timeline .icono::after, .burbuja-provincia .burbuja-nombre::before, .marcador-partido.live .marcador-foto::after { animation: none !important }
}

/* ---------------- Móvil ---------------- */
@media (max-width: 768px) {
  .mapa-partidos .mapa-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 42% }
  .mapa-partidos .mapa-cabecera { padding: 10px 14px 8px }
  .mapa-partidos .mapa-titulo { font-size: 1.25rem }
  .mapa-partidos .mapa-acciones { top: 10px; right: 10px; left: 10px; flex-wrap: wrap }
  .mapa-partidos .accion { padding: 7px 11px; font-size: .78rem }
  .mapa-partidos .maplibregl-ctrl-bottom-right { display: none }
  .mapa-partidos .firma-toools-mapa { top: 56px; bottom: auto; left: 50%; padding: 7px 14px; gap: 8px }
  .mapa-partidos .firma-mapa-texto { font-size: 8px }
  .mapa-partidos .firma-mapa-logo { width: 64px }
  /* Por encima de la barra de secciones del pie */
  .boton-timeline { left: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); padding: 6px 14px 6px 6px }
  .boton-timeline .icono { width: 30px; height: 30px }
  .boton-timeline .texto { font-size: 11px }
}
