/* Vista unificada Explorar (/explorar). Usa los tokens de tds_home.css. */


body.ex-page { overflow: hidden; height: 100vh; }

/* ---------- nav ---------- */

/* ---------- cuerpo ---------- */
.ex { height: calc(100vh - 72px); height: calc(100dvh - 72px); display: flex; flex-direction: column; }
@media (max-width: 639px) { .ex { height: calc(100vh - 60px); height: calc(100dvh - 60px); } }
.ex-bar { flex: none; min-height: 68px; display: flex; flex-wrap: nowrap; row-gap: 8px; align-items: center; gap: 10px; padding: 8px 24px; border-bottom: 1px solid var(--ink); background: var(--bg); position: relative; z-index: 50; }
.ex-main { flex: 1; min-height: 0; display: flex; }

/* ---------- barra de filtros ---------- */
.ex-search { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 6px; flex: 0 1 260px; min-width: 120px; }
.ex-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15px; font-family: inherit; color: var(--ink); }
.ex-search:focus-within { box-shadow: 0 0 0 2px var(--moss-100); }
.ex-pills { display: flex; gap: 6px; align-items: center; }
.ex-sep { width: 1px; height: 28px; background: var(--line); flex: none; }
.tdsh .ex-tg { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; flex: none; font-family: inherit; }
.tdsh .ex-tg:hover { border-color: var(--ink); }
.tdsh .ex-tg.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tdsh .ex-tg.has { border-color: var(--ink); font-weight: 600; }
.tdsh .ex-tg small { font-family: var(--font-mono); font-size: 10px; opacity: .55; }
.tdsh .ex-tg small:empty { display: none; }
.ex-pills > .ex-tg small { display: none; }
.tdsh .ex-card.sel { border-color: var(--ink); background: var(--bg); }
.ex-filters-btn { border-color: var(--ink) !important; font-weight: 600 !important; }
.ex-badge { min-width: 18px; height: 18px; border-radius: 999px; background: var(--moss); color: #fff; font-family: var(--font-mono); font-size: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.ex-seg { margin-left: auto; display: flex; border: 1px solid var(--ink); border-radius: 4px; padding: 3px; gap: 3px; flex: none; }
.ex-seg button { height: 34px; padding: 0 10px; border: 0; border-radius: 2px; background: transparent; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.ex-seg button.on { background: var(--ink); color: #fff; }
.ex-seg button:not(.on):hover { background: var(--panel); }

.ex-pop-wrap { position: relative; flex: none; }
.ex-pop { position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; background: var(--bg); border: 1px solid var(--ink); border-radius: 8px; padding: 6px; z-index: 70; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 12px 32px rgba(14,14,12,.14); }
.ex-pop[hidden] { display: none; }
.ex-opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; font-size: 14px; font-family: inherit; color: var(--ink); text-align: left; width: 100%; }
.ex-opt:hover { background: var(--panel); }
.ex-opt.on { background: var(--moss-100); color: var(--moss-ink); font-weight: 600; }
.ex-opt small { font-family: var(--font-mono); font-size: 10px; opacity: .6; }
.ex-opt small:empty { display: none; }
.ex-range { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; padding: 10px 12px 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.ex-range input, .ex-pop select { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; font-size: 14px; background: var(--bg); width: 100%; }
.ex-pop-wide { min-width: 280px; padding: 14px; gap: 8px; right: 0; left: auto; }
.ex-pop-wide .btn { margin-top: 6px; }

/* ---------- lista ---------- */
.ex-list { width: 600px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--ink); position: relative; background: var(--bg); }
/* el encabezado va dentro de la lista: se desplaza con ella */
.ex-head { flex: none; padding: 16px 0 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.ex-count { font-size: 26px; margin: 0; }
.ex-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.tdsh .ex-sort { height: 34px; font-size: 13px; font-weight: 600; }
.ex-scroll { flex: 1; overflow-y: auto; padding: 0 32px 40px; scroll-behavior: smooth; }
.ex-month { display: flex; align-items: center; gap: 14px; padding: 12px 0 10px; }
.ex-month i { flex: 1; height: 1px; background: var(--ink); }
.ex-card { position: relative; display: grid; grid-template-columns: 56px 72px minmax(0, 1fr) 40px; gap: 14px; align-items: center; padding: 14px 14px 14px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 8px; transition: background .15s, border-color .15s; }
.ex-card.hl, .ex-card:hover { border-color: var(--ink); background: var(--bg); }
.ex-card .dt { display: flex; flex-direction: column; gap: 2px; }
.ex-card .dow { font-size: 9px; }
.ex-card .dd { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ex-card.no-ph { grid-template-columns: 56px minmax(0, 1fr) 40px; }
.ex-card .ph { width: 72px; height: 72px; background: var(--map-land); border: 1px solid var(--line); overflow: hidden; display: block; flex: none; }
.ex-card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.15); transition: filter .2s; }
.ex-card:hover .ph img, .ex-card.hl .ph img, .ex-card.sel .ph img { filter: none; }
.ex-card .bd { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ex-card .nm { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.tdsh .ex-card .nm a { color: var(--ink); }
.ex-card .nm a::after { content: ''; position: absolute; inset: 0; border-radius: 16px; }
.ex-card .mt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.ex-card .rg { display: inline-flex; align-items: center; gap: 4px; }
.ex-card .rg svg { width: 12px; height: 12px; }
.ex-card .ds { display: flex; gap: 5px; flex-wrap: wrap; }
.ex-sp { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--moss-100); color: var(--moss-ink); font-size: 11px; font-weight: 600; white-space: nowrap; }
.ex-dk { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border: 1px solid var(--ink); border-radius: 999px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; white-space: nowrap; }
.ex-dk.q { border-style: dashed; color: var(--muted); font-family: var(--font-text); font-size: 11px; font-weight: 600; }
.ex-flag { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; background: var(--moss); color: #fff; }
.ex-flag.dest { background: var(--ink); }
.ex-flag.warn { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.ex-noloc { font-style: italic; }
.ex-heart { position: relative; z-index: 2; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ex-heart:hover { border-color: var(--ink); }
.ex-heart[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ex-heart[aria-pressed="true"] svg { fill: currentColor; }
.ex-sponsor { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; margin: 4px 0 12px; border: 1.5px dashed var(--moss); border-radius: 16px; background: var(--sponsor-bg); }
.ex-sponsor .lbl { color: var(--moss); }
.ex-sponsor b { font-size: 15px; font-weight: 600; flex: 1; }
.ex-sponsor .go { font-size: 13px; font-weight: 600; white-space: nowrap; }
.ex-more { padding: 20px 0 8px; text-align: center; }
.ex-more[hidden] { display: none; }
.ex-more .lbl { color: var(--ink); }
.ex-skel { height: 96px; border-radius: 16px; background: linear-gradient(90deg, var(--panel) 25%, #fff 50%, var(--panel) 75%); background-size: 200% 100%; animation: ex-sk 1.2s infinite linear; margin-bottom: 8px; border: 1px solid var(--line); }
@keyframes ex-sk { to { background-position: -200% 0; } }
.ex-state { padding: 48px 8px; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.ex-state b { font-size: 18px; }
.ex-state p { color: var(--muted); font-size: 15px; margin: 0; max-width: 320px; }
.ex-state .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ex-noscript { padding: 16px 32px; }

/* ---------- mapa ---------- */
.ex-map { flex: 1; position: relative; min-width: 0; background: #F7F8F6; overflow: hidden; }
#ex-map { position: absolute; inset: 0; background: #F7F8F6; z-index: 1; }
#ex-map .leaflet-tile-pane { filter: grayscale(1) contrast(.85) brightness(1.08); opacity: .8; }
.ex-live { position: absolute; left: 20px; top: 20px; z-index: 5; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; background: var(--bg); border: 1px solid var(--ink); border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; }
.ex-live input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.ex-search-zone { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); z-index: 5; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; font-family: inherit; box-shadow: 0 8px 24px rgba(14,14,12,.3); }
.ex-search-zone[hidden] { display: none; }
.ex-locate { position: absolute; right: 20px; top: 156px; z-index: 5; width: 40px; height: 40px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 0; }
.ex-legend { position: absolute; left: 20px; bottom: 20px; z-index: 5; display: flex; gap: 20px; align-items: center; padding: 0 16px; height: 40px; background: var(--bg); border: 1px solid var(--ink); font-size: 13px; font-weight: 600; }
.ex-legend span { display: flex; align-items: center; gap: 8px; }
.ex-legend .d { width: 12px; height: 12px; border-radius: 999px; background: var(--moss); display: inline-block; }
.ex-legend .c { width: 22px; height: 22px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--font-mono); font-size: 10px; font-style: normal; display: inline-flex; align-items: center; justify-content: center; }
.ex-note { position: absolute; right: 8px; bottom: 6px; z-index: 5; font-size: 10px; color: var(--muted); background: rgba(255,255,255,.75); padding: 1px 6px; }
.ex-map .leaflet-control-zoom { border: 1px solid var(--ink); border-radius: 0; margin: 20px 20px 0 0; }
.ex-map .leaflet-control-zoom a { width: 40px; height: 40px; line-height: 38px; color: var(--ink); border-radius: 0; font-size: 18px; }
.ex-map .leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.75); margin-bottom: 26px; }

.ex-dot { width: 14px; height: 14px; border-radius: 999px; background: var(--moss); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(74,90,43,.4); transition: transform .12s; }
.ex-dot-wrap.hl .ex-dot, .ex-dot-wrap.sel .ex-dot { transform: scale(1.6); background: var(--ink); box-shadow: 0 0 0 4px rgba(14,14,12,.18); }
.ex-dot-wrap { background: none; border: 0; }
.ex-cluster { display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--font-mono); font-weight: 700; box-shadow: 0 0 0 5px rgba(14,14,12,.15); }
.ex-cluster-wrap { background: none; border: 0; }
.ex-popup .leaflet-popup-content-wrapper { border-radius: 0; border: 1px solid var(--ink); box-shadow: 0 12px 32px rgba(14,14,12,.18); padding: 0; }
.ex-popup .leaflet-popup-content { margin: 0; width: 280px !important; font-family: var(--font-text); }
.ex-popup .leaflet-popup-tip { border: 1px solid var(--ink); }
.ex-pu { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ex-pu .head { display: flex; gap: 12px; align-items: flex-start; }
.ex-pu .pth { width: 64px; height: 64px; object-fit: cover; flex: none; border: 1px solid var(--line); background: var(--map-land); display: block; }
.ex-pu .ht { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.ex-pu .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ex-pu b { font-size: 18px; line-height: 1.15; letter-spacing: -0.02em; }
.ex-pu .rg { font-size: 13px; color: var(--muted); }
.ex-pu .ds { display: flex; gap: 5px; flex-wrap: wrap; }
.tdsh .ex-pu a.go { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
.ex-popup a.leaflet-popup-close-button { color: var(--ink); }

/* ---------- vistas ---------- */
.ex[data-vista="lista"] .ex-map { display: none; }
.ex[data-vista="lista"] .ex-list { width: 100%; max-width: 900px; margin: 0 auto; border-right: 0; }
.ex[data-vista="mapa"] .ex-list { display: none; }

@media (max-width: 1380px) {
  .ex-bar { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; }
}
/* El botón de fecha con rango largo no empuja al resto de la barra. */
.tdsh .ex-bar #ex-date-btn { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1279px) {
  .ex-list { width: 480px; }
  .ex-search { flex-basis: 220px; }
}
@media (max-width: 1023px) {
  .ex-bar { overflow-x: auto; padding: 10px 16px; }
  .ex-map { display: none; }
  .ex-list { width: 100%; border-right: 0; }
  .ex-scroll { padding-left: 16px; padding-right: 16px; }
  .ex-seg { display: none; }
}

@media (max-width: 639px) {
}

@media (max-width: 639px) {
  .ex-card { grid-template-columns: 44px 56px minmax(0, 1fr) 36px; gap: 10px; padding: 12px 10px 12px 14px; }
  .ex-card.no-ph { grid-template-columns: 44px minmax(0, 1fr) 36px; }
  .ex-card .ph { width: 56px; height: 56px; }
  .ex-card .dd { font-size: 22px; }
  .ex-heart { width: 36px; height: 36px; }
}

/* ---------- filtros contextuales de la disciplina (debajo de la barra) ---------- */
.ex-subbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: relative; z-index: 40; }
.ex-subbar[hidden] { display: none; }
.ex-subgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ex-subgroup .lbl { color: var(--ink); margin-right: 4px; }
.tdsh .ex-subbar .ex-tg { height: 32px; font-size: 13px; padding: 0 12px; }
@media (max-width: 1023px) { .ex-subbar { padding: 10px 16px; } }

/* ---------- listas de casillas (varias regiones a la vez) ---------- */
.ex-checks { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px 0; background: var(--bg); }
.ex-check { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 14px; cursor: pointer; }
.ex-check:hover { background: var(--panel); }
.ex-check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; flex: none; }
.ex-check span { flex: 1; }
.ex-check small { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.ex-check small:empty { display: none; }

@media (max-width: 639px) { .ex-head { flex-wrap: wrap; align-items: flex-start; } .tdsh .ex-sort { margin-left: auto; } }

.ex-kids { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ex-kids input { width: 18px; height: 18px; accent-color: var(--moss); }

/* Aviso del corazón: qué hace (agrega la carrera a Mi temporada). Con mouse, un globo al pasar o enfocar; en pantallas táctiles, una línea fija. */
.ex-heart::after { content: "Agregar a Mi temporada"; position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--ink); color: #fff; font: 600 12px/1 var(--font-text); padding: 8px 11px; border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 6; }
.ex-heart[aria-pressed="true"]::after { content: "En tu Mi temporada · clic para quitar"; }
.ex-heart:hover::after, .ex-heart:focus-visible::after { opacity: 1; }
.ex-hint { display: none; margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.ex-hint svg { vertical-align: -3px; margin-right: 2px; }
@media (hover: none) { .ex-heart::after { display: none; } .ex-hint { display: block; } }

.ex-head { flex-wrap: wrap; }
.ex-head-r { order: 3; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; align-items: center; }
.tdsh .ex-head-r .ex-sort { margin-left: 0; }

/* ===== Explorar en celular y tablet: más espacio para la lista ===== */
.ex-chips { display: contents; }            /* en escritorio no cambia nada */
@media (max-width: 1023px) {
  .ex-bar { overflow: visible; flex-wrap: wrap; min-height: 0; padding: 8px 12px; gap: 8px; }
  .ex-search { order: 1; flex: 1 1 0; min-width: 0; height: 40px; }
  .ex-bar > .ex-pop-wrap { order: 2; }                       /* Filtros, junto al buscador */
  .ex-chips { order: 3; flex: 0 0 100%; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; width: calc(100% + 24px); -webkit-overflow-scrolling: touch; }
  .ex-chips::-webkit-scrollbar { display: none; }
  .ex-chips .ex-sep { display: none; }
  .tdsh .ex-bar .ex-tg { height: 34px; padding: 0 13px; font-size: 14px; }
  .ex-seg { display: none; }
  /* los menús se abren como una hoja desde abajo (dentro de una fila con scroll se cortarían) */
  .ex-pop, .ex-pop-wide { position: fixed; left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; min-width: 0; max-height: 70vh; overflow-y: auto; z-index: 90; box-shadow: 0 -8px 40px rgba(0,0,0,.25); }
}
@media (max-width: 1023px) {
  .ex-head { padding-top: 10px; padding-bottom: 6px; gap: 8px; align-items: center; }
  .ex-head > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
  .ex-count { font-size: 20px; }
  .ex-sub { display: none; }
  .ex-hint { margin: 0; font-size: 12px; }
  .ex-head-r { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .ex-head-r::-webkit-scrollbar { display: none; }
  .tdsh .ex-head-r .ex-tg { height: 30px; font-size: 13px; padding: 0 12px; flex: none; }
  /* al bajar por la lista se esconde la barra de filtros; al subir, vuelve */
  /* se pliegan con una transición: así la lista sube suave y no de golpe al quitarse ese espacio */
  .ex-bar, .ex-subbar { max-height: 160px; transition: max-height .25s ease, padding .25s ease, border-width .25s ease, opacity .18s ease; }
  .ex.ex-collapsed .ex-bar, .ex.ex-collapsed .ex-subbar { max-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; opacity: 0; overflow: hidden; pointer-events: none; }
}

/* ===== Mapa en celular y tablet: botón flotante Lista / Mapa y mapa a pantalla completa ===== */
.ex-fab { display: none; }
@media (max-width: 1023px) {
  .ex-fab { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 80; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font: 600 14px var(--font-text); box-shadow: 0 8px 24px rgba(0,0,0,.28); }
  .ex[data-vista="split"] .ex-map, .ex[data-vista="lista"] .ex-map { display: none; }
  .ex[data-vista="mapa"] .ex-map { display: block; flex: 1; }
  .ex[data-vista="mapa"] .ex-scroll { display: none; }
  .ex-scroll { padding-bottom: 88px; }   /* el botón flotante no tapa la última carrera */
  .ex-live { left: 10px; top: 10px; height: 36px; padding: 0 12px; font-size: 13px; }
  .ex-live input { width: 16px; height: 16px; }
  .ex-search-zone { top: 56px; }
  .ex-locate { top: auto; bottom: 76px; right: 12px; }
  .ex-map .leaflet-control-zoom { margin: 10px 10px 0 0; }
  .ex-legend, .ex-note { display: none; }
}

/* ===== Pantallas táctiles: tocar una carrera no debe estorbar el scroll de la lista ===== */
@media (hover: none), (max-width: 1023px) {
  .ex-scroll { scroll-behavior: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
  .ex-card, .ex-card a, .ex-card .ph img { touch-action: pan-y; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
  .ex-card .ph img { pointer-events: none; }
  .ex-card { transition: none; }
}
@media (hover: none) {
  .ex-card:hover { border-color: var(--line); background: var(--panel); }
  .ex-card:hover .ph img { filter: grayscale(1) contrast(1.15); }
}

.ex-pu .top .sps { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
