/* Silica Networks · Mapa de red LATAM
   Tokens de la identidad del tótem (reference/_mapa_interactivo_totem_SILICA.html),
   ajustados según reference/preview-mapa-silica.html. Los nombres --sm-* se
   conservan; su rol figura en cada comentario. */
:root {
  /* Red */
  --sm-green: #98d82b;                  /* red actual, anillo de POP internacional, botones */
  --sm-projected: #b7e768;              /* red proyectada */
  --sm-green-dim: rgba(152,216,43,.18); /* verde tenue */
  /* Marcadores */
  --sm-lime: #d9ce35;                   /* POPs y referencias (el nombre viene del .ai) */
  --sm-pop: var(--sm-lime);
  /* Texto */
  --sm-ink: #eef4f8;                    /* texto fuerte, nombres de POP */
  --sm-text: #9daab6;                   /* texto secundario, localidades */
  --sm-muted: #9daab6;
  --sm-accent: #dce98a;
  --sm-kicker: #d6e9a2;                 /* títulos de bloque */
  --sm-active: #e4f6a4;                 /* estado activo */
  /* Etiquetas de tipo */
  --sm-tag-pop: #98d82b;
  --sm-tag-intl: #7ec8e3;
  --sm-tag-sub: #e8c468;
  /* Mapa */
  --sm-land: #18222c;                   /* territorio (al 95 %) */
  --sm-line: rgba(207,214,219,.16);     /* límites provinciales */
  --sm-line-country: rgba(207,214,219,.42); /* límites entre países */
  --sm-country: rgba(207,214,219,.35);  /* nombres de países */
  /* Fondo y paneles */
  --sm-bg: #071019;
  --sm-bg-2: #0a121b;
  --sm-bg-gradient: radial-gradient(circle at 20% 20%, rgba(152,216,43,.07), transparent 22%),
                    linear-gradient(180deg, #061019 0%, #08131b 100%);
  --sm-panel: rgba(10,18,27,.88);
  --sm-panel-head: rgba(8,14,21,.96);   /* panel fuerte / modal */
  --sm-border: rgba(255,255,255,.08);
  --sm-blur: 10px;
  --sm-shadow: 0 18px 60px rgba(0,0,0,.45);
  /* Radios */
  --sm-radius: 22px;                    /* tarjetas */
  --sm-radius-modal: 28px;
  --sm-radius-btn: 16px;
  --sm-radius-stat: 12px;
  --sm-radius-pill: 6px;
  --sm-safe: 24px;                      /* margen de los paneles al borde (12px en móvil) */
  --sm-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.sm-root {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sm-bg-gradient);
  background-color: var(--sm-bg);
  font-family: var(--sm-font);
  color: var(--sm-ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* Gestos cooperativos (visor): el scroll vertical con un dedo pasa a la página
   de Framer; el pan horizontal y la pinza los maneja map-core.js */
.sm-root.is-cooperative { touch-action: pan-y; }
/* ?bg=transparent: sin degradado ni color de fondo; el resto del tema se mantiene */
.sm-root.is-transparent { background: transparent; }
.sm-root *, .sm-root *::before, .sm-root *::after { box-sizing: border-box; }

.sm-viewport { position: absolute; inset: 0; cursor: grab; }
.sm-viewport.is-panning { cursor: grabbing; }

/* Tres SVG apilados (map-core.js): abajo las capas hasta la traza, en el medio
   los destellos, arriba el resto de las capas y los marcadores. .sm-stage los
   mueve juntos durante un gesto. */
.sm-stage { position: absolute; inset: 0; transform-origin: 0 0; }
.sm-map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: hidden; }
.sm-map-top { pointer-events: none; }
/* Destellos en su propia capa compuesta: la animación repinta solo esta capa */
.sm-glow-svg { pointer-events: none; will-change: transform; }
/* Pulsos de los anclajes de los diferenciales: ídem, por encima de todo */
.sm-fx-svg { pointer-events: none; will-change: transform; }
/* Animaciones en pausa: mapa fuera de pantalla o pestaña oculta (.is-paused,
   map-core.js) y durante un gesto (.is-gesturing) */
.sm-root.is-paused :is(.sm-route-glow, .sm-cord-glow, .sm-pulse, .sm-dif-pulse),
.sm-viewport.is-gesturing :is(.sm-route-glow, .sm-cord-glow, .sm-pulse, .sm-dif-pulse) { animation-play-state: paused !important; }
/* Durante un gesto el SVG se desplaza con transform (GPU): se dibuja también
   lo que queda fuera del viewBox para que no aparezcan bordes vacíos */
.sm-viewport.is-gesturing .sm-map { overflow: visible; }
.sm-viewport.is-gesturing .sm-stage { will-change: transform; }
.sm-layers, .sm-layer { pointer-events: none; }

/* ---------- Capas del .ai recoloreadas ----------
   Selectores por atributo sobre los colores originales (los .svg no se editan).
   .is-themed la pone map-core.js en todas las capas salvo las guías del editor;
   .sm-route y .sm-name-pop también vienen de map-core.js (ver themeLayer). */
.sm-layer[data-layer="base"], .sm-layer[data-layer="evaluar-brasil"] { opacity: .9; }
.sm-layer[data-layer="traza"] { opacity: .9; }

/* Territorio y límites */
.is-themed [fill="#D8D9D5"] { fill: var(--sm-land); fill-opacity: .95; }
.is-themed [stroke="#AEB0AF"], .is-themed [stroke="#AEB0AE"], .is-themed [stroke="#ABADAC"] {
  stroke: var(--sm-line); stroke-width: 1.1px; vector-effect: non-scaling-stroke;
}
/* Límites entre países (clase de map-core.js): más visibles que los provinciales */
.is-themed .sm-border-country { stroke: var(--sm-line-country); stroke-width: 1.4px; }
.sm-layer[data-layer="base"] [fill="#FFF"] { fill: rgba(255,255,255,.03); }

/* Red: grosor en px de pantalla */
.sm-route { fill: none; stroke-width: 1.3px; vector-effect: non-scaling-stroke; stroke-opacity: .72; opacity: .72; }
.sm-route.is-actual { stroke: var(--sm-green); }
.sm-route.is-projected { stroke: var(--sm-projected); }
/* Destello que recorre la red actual (aspecto del preview y de e49f83e). El
   desenfoque va una sola vez en el grupo del SVG superpuesto (.sm-glows), no
   en cada trazo; la mezcla screen con la red, en el SVG entero. */
.sm-glow-svg { mix-blend-mode: screen; }
.sm-glows { filter: blur(3.5px); }
.sm-route-glow {
  fill: none; stroke: rgba(196,255,116,1); stroke-width: 1.7px; vector-effect: non-scaling-stroke;
  stroke-dasharray: 34 1100; stroke-linecap: round; opacity: .9;
  animation: sm-route-flow 4.8s linear infinite;
}
@media (max-width: 560px) { .sm-route-glow.is-minor { display: none; } }
@keyframes sm-route-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -2418; } }

/* Traza cordillera: tramos que cruzan la cordillera (capa apagada por defecto).
   Trazo #dce98a de 2,2 px y un destello propio más lento que el de la red (7,2 s). */
.sm-cord, .sm-cord-glow { display: none; }
.sm-cord.is-on { display: inline; fill: none; stroke: var(--sm-accent); stroke-width: 2.2px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.sm-cord-glow.is-on {
  display: inline; fill: none; stroke: rgba(246,252,214,1); stroke-width: 2.8px; vector-effect: non-scaling-stroke;
  stroke-dasharray: 26 520; stroke-linecap: round; filter: blur(3px); mix-blend-mode: screen; opacity: .95;
  animation: sm-cord-flow 7.2s linear infinite;
}
@keyframes sm-cord-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -546; } }

/* Nombres duplicados en la exportación del .ai (LAYER_FIXES en map-core.js) */
.sm-dup { display: none; }

/* Nombres que aparecen solo con zoom (lista en map-core.js, hoy vacía) */
.sm-zoom-only { opacity: 0; transition: opacity .45s ease; }
.sm-viewport.zoom-in .sm-zoom-only { opacity: 1; }

/* Contornos blancos del .ai (halo de puntos y cruces) → oscuros */
.is-themed [stroke="#FFF"] { stroke: var(--sm-bg-2); stroke-opacity: .8; stroke-width: 3px; vector-effect: non-scaling-stroke; }

/* Flechas indicadoras */
.is-themed [stroke="#787C7E"] { stroke: #58626b; vector-effect: non-scaling-stroke; }
.is-themed [fill="#787C7E"] { fill: #58626b; }

/* Puntos dibujados en el .ai: los reemplazan los marcadores del motor */
.sm-layer[data-layer="traza"] [fill="#A8BE1C"],
.sm-layer[data-layer="traza"] [fill="#4C4F55"], .sm-layer[data-layer="traza"] [stroke="#4C4F55"],
.is-names [fill="#A8BE1C"] { display: none; }

/* Nombres (glifos): localidades regulares, POPs en negrita, países */
.is-themed [fill="#6C6A6A"] { fill: var(--sm-text); }
.is-themed .sm-name-pop, .is-themed .sm-name-pop use { fill: var(--sm-ink); }
.is-themed [fill="#898C8C"], .is-themed [fill="#898C8C"] use { fill: var(--sm-country); fill-opacity: 1; }
/* Halo de los nombres: trazo oscuro debajo del relleno (paint-order), en lugar
   de filter: drop-shadow, que obligaba a recalcular el filtro de toda la capa en
   cada cuadro de un gesto. stroke-width y paint-order se heredan a los glifos de
   cada <use>; vector-effect no, por eso va en los glifos de defs. */
.is-names use { stroke: rgba(7,16,25,.55); stroke-width: 2px; paint-order: stroke; stroke-linejoin: round; }
.is-names defs path { vector-effect: non-scaling-stroke; }

/* Capa técnica de proveedores (oculta por defecto): textos claros, fondos oscuros */
.sm-layer[data-layer="es-proveedores-tecnico"] [fill="#343336"],
.sm-layer[data-layer="es-proveedores-tecnico"] [fill="#4C4F55"],
.sm-layer[data-layer="es-proveedores-tecnico"] [fill="#161717"] { fill: #cfd6db; }
.sm-layer[data-layer="es-proveedores-tecnico"] [stroke="#4C4F55"],
.sm-layer[data-layer="es-proveedores-tecnico"] [stroke="#180F0D"] { stroke: #cfd6db; }
.sm-layer[data-layer="es-proveedores-tecnico"] [fill="#F6F5F6"],
.sm-layer[data-layer="es-proveedores-tecnico"] [fill="#FFF"] { fill: var(--sm-bg-2); }

/* ---------- Marcadores y diferenciales ----------
   Medidas en px de pantalla (map-core.js los contraescala con el zoom). */
.sm-el { pointer-events: auto; }
.sm-el.is-static { pointer-events: none; }
.sm-el.is-clickable { cursor: pointer; }
.sm-hit { fill: transparent; }
.sm-el .sm-mark { transform-box: fill-box; transform-origin: center; transition: transform .2s ease; }
.sm-el.is-clickable:hover .sm-mark,
.sm-el.is-selected .sm-mark { transform: scale(1.35); }
/* Se probó quitar este drop-shadow (paso c de rendimiento): no mejoró, se mantiene */
.sm-glow { filter: drop-shadow(0 0 5px rgba(217,206,53,.35)); }
.sm-el:focus { outline: none; }
.sm-el:focus-visible .sm-focus { opacity: 1; }
.sm-focus { opacity: 0; fill: none; stroke: var(--sm-ink); stroke-width: 1; stroke-dasharray: 2 2; }
.sm-dif .sm-focus { stroke-width: 1.5px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }

/* Pulso de selección (color POP) */
.sm-pulse { opacity: 0; fill: none; stroke: var(--sm-pop); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; }
.sm-el.is-selected .sm-pulse { animation: sm-pulse 1.8s ease-out infinite; }
@keyframes sm-pulse { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }

/* Cruces limítrofes: anillo ocre (paleta de la pill submarine) con halo al pasar el mouse */
.sm-cruce-ring { fill: rgba(7,16,25,.55); stroke: var(--sm-tag-sub); stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.sm-cruce-dot { fill: var(--sm-tag-sub); }
.sm-cruce-halo { fill: rgba(232,196,104,.16); opacity: 0; transition: opacity .2s ease; }
.sm-el.is-clickable:hover .sm-cruce-halo, .sm-el.is-selected .sm-cruce-halo, .sm-el:focus-visible .sm-cruce-halo { opacity: 1; }
.sm-pulse-cruce { stroke: var(--sm-tag-sub); }
/* Cruce sobre un POP (a menos de 6 pt): solo el anillo, alrededor del rombo */
.sm-cruce-on-pop .sm-cruce-ring { fill: none; }

/* Diferenciales: tarjeta con foto, línea guía y anclaje con pulso */
.sm-dif-line { stroke-width: 1.4px; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.sm-dif-card { filter: drop-shadow(0 8px 16px rgba(0,0,0,.5)); transition: transform .25s cubic-bezier(.22,1,.36,1); transform-box: fill-box; transform-origin: center; }
.sm-dif-border { stroke: rgba(255,255,255,.18); stroke-width: 1px; vector-effect: non-scaling-stroke; transition: stroke .2s ease; }
.sm-dif .sm-dif-photo { transition: filter .2s ease; }
.sm-dif.is-clickable:hover .sm-dif-card, .sm-dif:focus-visible .sm-dif-card { transform: translateY(-3px) scale(1.04); }
.sm-dif.is-clickable:hover .sm-dif-photo { filter: brightness(1.1); }
.sm-dif.is-clickable:hover .sm-dif-border, .sm-dif:focus-visible .sm-dif-border { stroke: rgba(152,216,43,.7); }
.sm-dif.is-active .sm-dif-border { stroke: var(--sm-green); stroke-width: 2px; }
.sm-dif-pulse { fill: none; stroke: var(--sm-green); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: sm-dif-pulse 2.4s ease-out infinite; }
@keyframes sm-dif-pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(3.2); opacity: 0; } }

/* ---------- HUD del visor (.card, .controls, .legend, .badge del preview) ---------- */
.sm-hud-card {
  position: absolute; z-index: 4;
  background: var(--sm-panel); border: 1px solid var(--sm-border);
  -webkit-backdrop-filter: blur(var(--sm-blur)); backdrop-filter: blur(var(--sm-blur));
  border-radius: var(--sm-radius); box-shadow: var(--sm-shadow);
}
/* Controles: − ⌂ + | ES EN, arriba a la derecha */
.sm-controls { top: var(--sm-safe); right: var(--sm-safe); display: flex; gap: 10px; padding: 10px; align-items: center; }
.sm-ctrl-btn, .sm-chip {
  appearance: none; border: none; background: rgba(255,255,255,.05); color: var(--sm-ink);
  border-radius: var(--sm-radius-btn); cursor: pointer; font-family: inherit;
}
.sm-ctrl-btn { width: 52px; height: 52px; font-size: 22px; line-height: 1; }
.sm-ctrl-btn:hover, .sm-chip:hover { background: rgba(255,255,255,.09); }
.sm-sep { width: 1px; align-self: stretch; background: rgba(255,255,255,.08); margin: 4px 2px; }
.sm-chip { padding: 0 14px; height: 52px; font-size: 14px; font-weight: 700; border: 1px solid rgba(255,255,255,.08); }
/* Idioma activo translúcido, no verde sólido */
.sm-chip[aria-pressed="true"] { background: rgba(152,216,43,.14); border-color: rgba(152,216,43,.26); color: var(--sm-active); }
.sm-ctrl-btn:focus-visible, .sm-chip:focus-visible, .sm-legend-toggle:focus-visible { outline: 2px solid var(--sm-green); outline-offset: 2px; }

/* Leyenda: abajo a la derecha; en móvil, plegada detrás de un botón */
.sm-kicker { margin: 0 0 10px; font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--sm-kicker); font-weight: 600; }
.sm-legend { right: var(--sm-safe); bottom: var(--sm-safe); width: min(320px, 27vw); padding: 18px 20px; }
.sm-legend-grid { display: grid; gap: 10px; }
.sm-legend-item { display: flex; align-items: center; gap: 12px; color: var(--sm-muted); font-size: 14px; }
.sm-sw { flex: none; width: 32px; display: flex; justify-content: center; }
.sm-sw-line { width: 32px; height: 3px; opacity: .75; border-radius: 999px; background: var(--sm-green); }
.sm-sw-dash { width: 32px; height: 0; border-top: 2px dashed var(--sm-projected); opacity: .75; }
.sm-sw-pop { width: 10px; height: 10px; transform: rotate(45deg); background: var(--sm-pop); border: 1px solid rgba(255,255,255,.6); border-radius: 2px;
  box-shadow: 0 0 0 5px rgba(217,206,53,.06), 0 0 10px rgba(217,206,53,.18); }
.sm-sw-ref { width: 8px; height: 8px; border-radius: 50%; background: var(--sm-pop); opacity: .7; }
.sm-sw-cruce { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid var(--sm-tag-sub); background: radial-gradient(circle, var(--sm-tag-sub) 0 2.5px, transparent 3px); }
.sm-legend-item[hidden] { display: none; }
.sm-legend-toggle { display: none; }

/* Encabezado: pill arriba a la izquierda. Solo admite <b> (settings.headline) */
.sm-headline {
  position: absolute; top: var(--sm-safe); left: var(--sm-safe); z-index: 4;
  font-size: 13px; color: var(--sm-muted); padding: 9px 14px; border-radius: 999px;
  background: rgba(10,18,27,.7); border: 1px solid rgba(255,255,255,.08);
  -webkit-backdrop-filter: blur(var(--sm-blur)); backdrop-filter: blur(var(--sm-blur));
}
.sm-headline[hidden] { display: none; }
.sm-headline b { color: var(--sm-accent); font-weight: 700; }

/* Aviso de rueda / dos dedos (.hint del preview) */
.sm-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--sm-panel-head); border: 1px solid rgba(255,255,255,.1); color: var(--sm-ink);
  font: 600 14px/1.3 var(--sm-font); padding: 12px 18px; border-radius: 999px; white-space: nowrap;
  opacity: 0; transition: opacity .25s ease; pointer-events: none; z-index: 8;
}
.sm-hint.is-visible { opacity: 1; }

/* ?fps=1: arriba a la izquierda, debajo del encabezado */
.sm-fps {
  position: absolute; left: var(--sm-safe); top: calc(var(--sm-safe) + 44px); z-index: 30; pointer-events: none;
  font: 600 13px/1 ui-monospace, Menlo, Consolas, monospace; color: var(--sm-accent);
  background: rgba(0,0,0,.5); padding: 6px 8px; border-radius: 8px;
}

/* ---------- Tarjeta de información (.pop-info del tótem) ---------- */
.sm-card {
  position: absolute;
  width: min(420px, calc(100% - 32px));
  padding: 20px 22px;
  background: var(--sm-panel);
  border: 1px solid var(--sm-border);
  -webkit-backdrop-filter: blur(var(--sm-blur)); backdrop-filter: blur(var(--sm-blur));
  border-radius: var(--sm-radius);
  box-shadow: var(--sm-shadow);
  color: var(--sm-ink);
  z-index: 5;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  user-select: text; -webkit-user-select: text;
}
.sm-card.is-open { opacity: 1; transform: none; pointer-events: auto; }
/* Refresco al cambiar de punto. Sin fill-mode forwards y solo con .is-open:
   con forwards la animación dejaba opacity:1 al cerrar y la cruz parecía no andar. */
.sm-card.is-open.is-refreshing { animation: sm-card-refresh .32s cubic-bezier(.22,1,.36,1); }
@keyframes sm-card-refresh { 0% { opacity: .4; transform: translateY(6px); } 100% { opacity: 1; transform: translateY(0); } }

.sm-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sm-card-title { margin: 0 0 2px; font: 700 clamp(22px, 1.5vw, 30px)/1.1 var(--sm-font); letter-spacing: -.02em; }
.sm-card-region { font-size: 12px; color: var(--sm-muted); letter-spacing: .04em; }
.sm-card-name { min-width: 0; }
/* Referencia geográfica: tarjeta compacta, pill gris junto a la región, sin stats */
.sm-card.is-ref { width: min(340px, calc(100% - 32px)); padding: 16px 18px; }
.sm-card.is-ref .sm-card-head { margin-bottom: 8px; }
.sm-card.is-ref .sm-card-title { font-size: clamp(20px, 1.3vw, 24px); }
.sm-card.is-ref .sm-card-desc { margin: 0; }
.sm-card.is-ref .sm-card-region { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.sm-card.is-ref .sm-card-region .sm-pill { margin: 0; padding: 3px 7px; font-size: 10px; }
/* POP con un cruce limítrofe en el mismo lugar (San Sebastián): pill ocre y descripción del cruce */
.sm-card-cruce { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-size: 12.5px; line-height: 1.45; color: var(--sm-muted); }
.sm-card-cruce .sm-pill { margin: 0; padding: 3px 7px; font-size: 10px; }
.sm-card-side { display: flex; gap: 8px; align-items: flex-start; flex: none; }
.sm-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  color: var(--sm-tag-pop); background: rgba(152,216,43,.12); border: 1px solid rgba(152,216,43,.25);
  border-radius: var(--sm-radius-pill); padding: 4px 9px; margin-top: 3px;
}
.sm-pill.is-international { color: var(--sm-tag-intl); background: rgba(126,200,227,.1); border-color: rgba(126,200,227,.25); }
.sm-pill.is-submarine { color: var(--sm-tag-sub); background: rgba(232,196,104,.1); border-color: rgba(232,196,104,.25); }
.sm-pill.is-ref { color: var(--sm-muted); background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
.sm-card-close {
  appearance: none; border: 0; background: rgba(255,255,255,.06); color: var(--sm-ink);
  width: 32px; height: 32px; border-radius: 10px; font: 400 18px/1 var(--sm-font); cursor: pointer; flex: none;
}
.sm-card-close:hover { background: rgba(255,255,255,.12); }
.sm-card-close:focus-visible, .sm-card-link:focus-visible { outline: 2px solid var(--sm-green); outline-offset: 2px; }
.sm-card-photo { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 14px; margin: 0 0 14px; }
.sm-card-desc { margin: 0 0 14px; font-size: clamp(13px, .9vw, 15px); line-height: 1.55; color: var(--sm-muted); }
.sm-card-desc:empty { display: none; }
/* Sin datos destacados visibles (ni enlace) la tarjeta termina en la descripción */
.sm-card-desc:last-child { margin-bottom: 0; }
.sm-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.sm-card-stats:empty { display: none; }
/* Un solo dato visible (el resto oculto con hidden): ocupa el ancho de la grilla */
.sm-stat:only-child { grid-column: 1 / -1; }
.sm-stat { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: var(--sm-radius-stat); padding: 10px 12px; }
.sm-stat dt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: rgba(152,216,43,.7); margin-bottom: 4px; }
.sm-stat dd { margin: 0; font-size: clamp(13px, .85vw, 15px); font-weight: 600; line-height: 1.2; color: var(--sm-ink); }
.sm-card-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  background: var(--sm-green); color: var(--sm-bg); text-decoration: none;
  font: 600 14px/1 var(--sm-font); padding: 10px 14px; border-radius: var(--sm-radius-stat);
}
.sm-card-link:hover { background: var(--sm-projected); }

/* ---------- Visor de diferenciales ---------- */
.sm-hl { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.sm-hl[hidden] { display: none; }
.sm-hl-backdrop { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4,9,14,0) 30%, rgba(4,9,14,.55) 100%); opacity: 0; transition: opacity .35s ease; }
.sm-hl.is-open { pointer-events: auto; }
.sm-hl.is-open .sm-hl-backdrop { opacity: 1; }
.sm-hl-panel {
  position: absolute; top: var(--sm-safe); right: var(--sm-safe); bottom: var(--sm-safe);
  width: min(480px, 40vw); height: max-content; max-height: calc(100% - 2 * var(--sm-safe)); margin: auto 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: #09111a; border: 1px solid var(--sm-border); border-radius: var(--sm-radius-modal); box-shadow: var(--sm-shadow);
  transform: translateX(24px); opacity: 0; transition: transform .45s cubic-bezier(.22,1,.36,1), opacity .3s ease;
  user-select: text; -webkit-user-select: text;
}
.sm-hl.is-open .sm-hl-panel { transform: none; opacity: 1; }
.sm-hl-media { position: relative; flex: none; aspect-ratio: 16/10; overflow: hidden; background: var(--sm-bg-2); touch-action: pan-y; }
.sm-hl-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity .5s ease, transform 1.2s cubic-bezier(.22,1,.36,1); }
.sm-hl-img.is-on { opacity: 1; transform: scale(1); }
.sm-hl-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,14,21,.55) 0%, rgba(8,14,21,0) 30%, rgba(8,14,21,0) 55%, rgba(8,14,21,.95) 100%); }
.sm-hl-progress { position: absolute; top: 16px; left: 18px; right: 64px; display: flex; gap: 6px; }
.sm-hl-progress button { appearance: none; border: 0; padding: 6px 0; background: transparent; flex: 1; cursor: pointer; }
.sm-hl-progress span { display: block; height: 3px; border-radius: 3px; background: rgba(255,255,255,.22); overflow: hidden; }
.sm-hl-progress span::after { content: ""; display: block; height: 100%; width: 0; background: var(--sm-green); transition: width .45s cubic-bezier(.22,1,.36,1); }
.sm-hl-progress button.is-done span::after, .sm-hl-progress button.is-current span::after { width: 100%; }
.sm-hl-progress button.is-current span::after { background: var(--sm-accent); }
.sm-hl-close {
  position: absolute; top: 10px; right: 12px; appearance: none; border: 1px solid rgba(255,255,255,.14);
  background: rgba(8,14,21,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--sm-ink); width: 40px; height: 40px; border-radius: 14px; font: 400 20px/1 var(--sm-font); cursor: pointer;
}
.sm-hl-close:hover { background: rgba(8,14,21,.8); }
.sm-hl-count { position: absolute; left: 22px; bottom: 14px; font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--sm-ink); }
.sm-hl-count small { font-size: 14px; font-weight: 600; letter-spacing: .02em; color: var(--sm-muted); margin-left: 6px; }
.sm-hl-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 18px 24px 18px; }
.sm-hl-kicker { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--sm-green); margin-bottom: 8px; }
.sm-hl-title { margin: 0 0 10px; font-size: clamp(24px, 2vw, 32px); line-height: 1.08; letter-spacing: -.02em; }
.sm-hl-desc { margin: 0; color: var(--sm-muted); font-size: 15px; line-height: 1.6; }
.sm-hl-swap { animation: sm-hl-in .42s cubic-bezier(.22,1,.36,1); }
.sm-hl-swap.is-back { animation-name: sm-hl-in-back; }
@keyframes sm-hl-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes sm-hl-in-back { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.sm-hl-foot { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.sm-hl-thumbs { display: flex; gap: 8px; flex: 1; min-width: 0; }
.sm-hl-thumb {
  appearance: none; position: relative; border: 1px solid rgba(255,255,255,.1); padding: 0; width: 56px; height: 56px;
  border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--sm-bg-2); flex: none; opacity: .55;
  transition: opacity .2s ease, border-color .2s ease, transform .2s ease;
}
.sm-hl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-hl-thumb b { position: absolute; left: 4px; bottom: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: #98d82b; color: #071019; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }
.sm-hl-thumb:hover { opacity: .85; }
.sm-hl-thumb[aria-current="true"] { opacity: 1; border-color: rgba(152,216,43,.7); transform: translateY(-2px); }
.sm-hl-nav { display: flex; gap: 8px; flex: none; }
.sm-hl-nav button {
  appearance: none; width: 48px; height: 48px; border-radius: var(--sm-radius-btn); border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05); color: var(--sm-ink); font: 400 18px/1 var(--sm-font); cursor: pointer;
}
.sm-hl-nav button:hover { background: rgba(152,216,43,.14); border-color: rgba(152,216,43,.3); }
.sm-hl-close:focus-visible, .sm-hl-nav button:focus-visible, .sm-hl-thumb:focus-visible, .sm-hl-progress button:focus-visible { outline: 2px solid var(--sm-green); outline-offset: 2px; }
/* Con el visor abierto se ocultan controles, leyenda y encabezado */
.sm-controls, .sm-legend, .sm-headline { transition: opacity .3s ease; }
.sm-root.is-hl-active .sm-controls, .sm-root.is-hl-active .sm-legend, .sm-root.is-hl-active .sm-headline { opacity: 0; pointer-events: none; }

/* Móvil: encabezado en fila propia, controles debajo, leyenda plegada y
   tarjeta anclada abajo, encima del botón de leyenda */
@media (max-width: 560px) {
  :root { --sm-safe: 12px; }
  /* Sin backdrop-filter en móvil: con el destello animado debajo, el desenfoque
     se recalculaba en cada cuadro. Fondo más opaco en su lugar. */
  .sm-card, .sm-hud-card, .sm-headline, .sm-hl-close { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10,18,27,.96); }
  .sm-controls { top: calc(var(--sm-safe) + 44px); padding: 6px; gap: 6px; }
  .sm-ctrl-btn { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }
  .sm-chip { height: 40px; padding: 0 10px; font-size: 13px; border-radius: 12px; }
  .sm-headline { font-size: 12px; padding: 8px 12px; max-width: calc(100% - 2 * var(--sm-safe));
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sm-legend { left: auto; width: auto; padding: 0; border-radius: 16px; }
  .sm-legend .sm-legend-body { display: none; padding: 14px 16px 16px; }
  .sm-legend.is-expanded { left: var(--sm-safe); }
  .sm-legend.is-expanded .sm-legend-body { display: block; }
  .sm-legend.is-expanded .sm-legend-grid { grid-template-columns: 1fr 1fr; }
  .sm-legend-toggle { display: block; appearance: none; border: 0; background: transparent; color: var(--sm-kicker);
    font: 600 12px/1 var(--sm-font); letter-spacing: .13em; text-transform: uppercase; padding: 12px 16px; cursor: pointer; width: 100%; text-align: left; }
  .sm-legend .sm-kicker { display: none; }
  /* Nunca tapa encabezado ni controles: alto máximo hasta debajo de los controles (44 + 54 + 8 px) */
  .sm-card { left: var(--sm-safe) !important; right: var(--sm-safe); top: auto !important;
             bottom: calc(var(--sm-safe) + 52px); width: auto; padding: 16px 18px; border-radius: 18px;
             max-height: calc(100% - 2 * var(--sm-safe) - 52px - 106px); overflow-y: auto; overscroll-behavior: contain; }
  .sm-card-title { font-size: 20px; }
  .sm-card.is-ref { width: auto; }
  .sm-card-desc { font-size: 13px; margin-bottom: 12px; }
  /* Visor: hoja inferior a todo el ancho */
  .sm-hl-backdrop { background: rgba(4,9,14,.55); }
  .sm-hl-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: auto; margin: 0; max-height: calc(100% - 16px); border-radius: 24px 24px 0 0; transform: translateY(40px); }
  /* 2:1 (el preview usa 16:9): a 390×600 la zona libre sobre el panel bajaba a
     125 px con los textos largos; así queda en 149 px o más */
  .sm-hl-media { aspect-ratio: 2/1; }
  .sm-hl-count { font-size: 34px; left: 18px; bottom: 10px; }
  .sm-hl-body { padding: 14px 18px 6px; }
  .sm-hl-title { font-size: 22px; }
  .sm-hl-desc { font-size: 14px; line-height: 1.55; }
  .sm-hl-foot { padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .sm-hl-thumb { width: 44px; height: 44px; border-radius: 12px; }
  .sm-hl-nav button { width: 44px; height: 44px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-route-glow, .sm-cord-glow.is-on { display: none; }
  .sm-zoom-only { transition: none; }
  .sm-controls, .sm-legend, .sm-headline, .sm-hl-backdrop, .sm-hint, .sm-hl-progress span::after, .sm-hl-thumb, .sm-dif-border, .sm-dif .sm-dif-photo { transition: none; }
  .sm-card, .sm-card.is-open.is-refreshing, .sm-el .sm-mark { transition: none; animation: none; }
  .sm-el.is-selected .sm-pulse { animation: none; opacity: .6; }
  .sm-cruce-halo { transition: none; }
  .sm-hl-panel, .sm-hl-img, .sm-hl-swap { transition: none !important; animation: none !important; }
  .sm-dif-pulse { animation: none; opacity: 0; }
  .sm-dif-card { transition: none; }
}
