/* ========================================================= */
/* MAPA INTERACTIVO MULTI-FASE - Estilos completos */
/* ========================================================= */
/* ========================================================= */
/* LAYOUT BASE */
/* ========================================================= */
#overlay-layer {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

body.overlays-ready #overlay-layer {
  opacity: 1;
}

.novela.full-bleed {
  position: relative;
  overflow: hidden;
  background: #000;
  transform: scale(var(--fill-scale));
  transform-origin: top center;
  will-change: transform;
  width: 100%;
  height: 100%;
}

#mapa-canvas-wrapper {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  /* border: 8px solid blue; */
}

/* ========================================================= */
/* TOGGLES DE APLICACIÓN */
/* ========================================================= */
/* Overlays OFF de forma segura (no quita nodos) */
[data-overlays="0"] #overlay-layer,
[data-overlays="0"] .overlay-layer {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Silenciar tags que interfieren con hotspots cuando mute=1 */
[data-mute="1"] a,
[data-mute="1"] button,
[data-mute="1"] .ui,
[data-mute="1"] .floating,
[data-mute="1"] .debug-controls {
  pointer-events: none !important;
}

/* Si también quieres silenciar clics sobre la capa overlay cuando mute=1 */
[data-mute="1"] #overlay-layer,
[data-mute="1"] .overlay-layer {
  pointer-events: none !important;
}

#mapa-canvas {
  display: block;
}

/* ========================================================= */
/* FUENTES LOCALES */
/* ========================================================= */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-v20-latin-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/inter-v20-latin-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/inter-v20-latin-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/inter-v20-latin-700.woff2') format('woff2');
}

[hidden] {
  display: none !important;
}

:root {
  --phase-color: #1BC6EB;
  --phase-color-rgb: 27, 198, 235;

  /* 🆕 Control de llenado vertical (1 = 100%, 0.98 = 98%, 1.01 = 101%) */
  --fill-scale: 1;
  /* 🆕 Posiciones por defecto de navegación en mobile */
  --nav-prev-left-mobile: 16px;
  /* distancia al borde izquierdo */
  --nav-prev-top-mobile: 50%;
  /* altura: 50% = centro vertical */
  --nav-next-right-mobile: 16px;
  /* distancia al borde derecho */
  --nav-next-top-mobile: 50%;
  /* altura del botón siguiente */
  --nav-progress-bottom-mobile: 94%;
  --top-bar-h: 68px;
  /* altura del .top-bar en mobile — sincronizar si cambia padding */
  /* altura de la barrita de progreso */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
  background: #000;
  /* fondo negro para el espacio restante */
}

/* Utilitaria para bloquear scroll si decides permitir overflow en body */
.overflow-lock {
  overflow: hidden !important;
}

/* === Base de viewport/fondo — seguro === */
html,
body {
  height: 100%;
  background: #000;
  /* aire negro cuando no es 100% */
}

#main-content {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  padding-bottom: 120px;
}

/* ── Botones de fase: mover de arriba a abajo ────────────────── */
.top-bar {
  position: fixed;
  top: auto;
  bottom: 0px;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgb(0 0 0 / 0%);
  min-height: 46px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0px 0px 0px 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* El contenedor del canvas: lo dimensionaremos por JS */
#mapa-canvas-wrapper {
  position: relative;
  margin: 0 auto;
  display: block;
  /* border: 12px solid rgb(255, 233, 35); */
  /* JS ajusta width/height en cada resize */
}


/* ========= CONTENEDOR PRINCIPAL ========= */
.novela {
  position: relative;
  width: 100vw;
  height: 100svh;
  height: 100dvh;
  margin: 0;
  background: #000;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 900px) {

  /* Card 16:9 (modo clásico) */
  .novela {
    width: min(100vw, 1280px);
    height: auto;
    aspect-ratio: 16/9;
    margin: auto;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
  }

  /* 🆕 Modo de control por código: full-bleed + escala editable */
  .novela.full-bleed {
    width: 100vw;
    height: 100dvh;
    transform: scale(var(--fill-scale));
    transform-origin: top center;
    will-change: transform;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

}

/* Asegura que el overlay del editor también cubre todo */
#editor-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#mapa-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  /* Fallback si JS demora (mejora LCP) */
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  display: block;
  touch-action: none;
}

/* ========= FILTRO DE FASES (Desktop y Mobile) ========= */
.phase-filter {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex: 1;
  z-index: 35;
}

/* Espejo del home-btn para centrado óptico real */
.top-bar__end-spacer {
  flex-shrink: 0;
  width: 46px;
}

@media (max-width: 520px) {
  .top-bar__end-spacer {
    width: 36px;
  }
}



.phase-btn {
  width: 300px;
  flex: 0 0 auto;
  padding: 12px 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.25s ease;
  position: relative;
  overflow: hidden;
}

@media (max-width: 899px) {
  .phase-btn {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  :root {
    --top-bar-h: 57px;
    /* botones más chicos = top-bar más bajo */
  }

  .phase-btn {
    padding: 8px 8px;
    font-size: 11px;
    border-radius: 35px;
  }
}

/* ========= HOME BUTTON ========= */
.home-btn {
  align-self: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(20, 20, 20, 0.85);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0px 31px 14px 0px;
}

.home-btn:hover {
  background: rgba(40, 40, 40, 0.95);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  transform: translateY(-1px);
}

.home-btn:active {
  transform: scale(0.95);
}

@media (max-width: 520px) {
  .home-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .home-btn svg {
    width: 16px;
    height: 16px;
  }
}

.phase-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--phase-color, #1BC6EB);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.phase-btn span {
  position: relative;
  z-index: 1;
}

.phase-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.phase-btn.active {
  border-color: var(--phase-color);
  background: var(--phase-color);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(var(--phase-color-rgb), 0.5);
}

.phase-btn.active::before {
  opacity: 1;
}

/* ========= BOTÓN SOBRE ESTA RECONSTRUCCIÓN (Mobile) ========= */
.about-btn {
  position: fixed;
  bottom: 120px;
  right: 16px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.2s ease, opacity 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  transform: scale(1.05);
}

.about-btn:active {
  transform: scale(0.95);
}

@media (max-width: 899px) {
  .about-btn--desktop {
    display: none !important;
  }
}

@media (min-width: 900px) {
  .about-btn:not(.about-btn--desktop):not(.suspects-btn) {
    display: none;
  }
}

body.popup-open .about-btn,
body.brief-open .about-btn,
body:has(.drawer--open) .about-btn,
body.popup-open .suspects-btn,
body.brief-open .suspects-btn,
body:has(.drawer--open) .suspects-btn {
  opacity: 0;
  pointer-events: none;
}

/* ========= BOTÓN SOSPECHOSOS ========= */
.suspects-btn {
  bottom: calc(120px + 48px + 12px);
}

/* Ocultar el botón cuando el panel está abierto */
body.suspects-open .suspects-btn {
  opacity: 0;
  pointer-events: none;
}

/* ========= POPUP DE IMPLICADOS ========= */
.suspects-popup {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(399px, 100vw);
  z-index: 20001;
  background: rgba(15, 15, 15, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.35s;
  visibility: hidden;
  overflow: hidden;
}

.suspects-popup.is-open {
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
  visibility: visible;
}

/* Backdrop */
.suspects-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 20000;
}

/* Ocultar top-bar y UI cuando el panel está abierto */
body.suspects-open .top-bar,
body.suspects-open .phase-filter {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

body.suspects-open .hamburger,
body.suspects-open .mosca-btn {
  opacity: 0;
  pointer-events: none;
}

.suspects-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.suspects-popup__title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--phase-color, #1BC6EB);
  margin: 0;
}

.suspects-popup__close {
  width: 55px;
  height: 55px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 38px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.suspects-popup__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.suspects-popup__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suspects-popup__footer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 38px;
  color: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.suspects-popup__footer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.suspects-popup__footer-close:active {
  transform: scale(0.98);
}

/* ========= TARJETA DE SOSPECHOSO ========= */
.suspect-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suspect-card__header {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: start;
  gap: 0 10px;
  margin-bottom: 6px;
}

.suspect-card__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  grid-column: 1;
}

.suspect-card__avatar--placeholder {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suspect-card__name {
  grid-column: 2;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  line-height: 1.35;
  align-self: center;
}

.suspect-card__name em {
  font-style: normal;
  color: rgba(255, 255, 255, 0.4);
}

.suspect-card__status {
  grid-column: 3;
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}

.suspect-card__status--detenido {
  background: rgba(255, 107, 107, 0.15);
  color: #FF6B6B;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.suspect-card__status--profugo {
  background: rgba(255, 165, 0, 0.15);
  color: #FFA500;
  border: 1px solid rgba(255, 165, 0, 0.3);
}

.suspect-card__status--imputado {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.suspect-card__status--libre {
  background: rgba(78, 205, 196, 0.12);
  color: #4ECDC4;
  border: 1px solid rgba(78, 205, 196, 0.25);
}

.suspect-card__role {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--phase-color, #1BC6EB);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.suspect-card__age {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  margin: 0;
}

.suspect-card__detail {
  font-size: 0.79rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin: 4px 0 0;
}

/* ── Suspect card: timeline expandible ── */
.suspect-card {
  cursor: pointer;
}

.suspect-card.is-expanded {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

.suspect-card__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.80rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  user-select: none;
}

.suspect-card__toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  font-style: normal;
}

.suspect-card.is-expanded .suspect-card__toggle-icon {
  transform: rotate(180deg);
}

.suspect-card__timeline {
  display: none;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.suspect-card.is-expanded .suspect-card__timeline {
  display: flex;
}

.suspect-card__tl-item {
  position: relative;
  padding-left: 18px;
  padding-bottom: 14px;
}

.suspect-card__tl-item:last-child {
  padding-bottom: 0;
}

.suspect-card__tl-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.suspect-card__tl-item::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 13px;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.07);
}

.suspect-card__tl-item:last-child::after {
  display: none;
}

.suspect-card__tl-phase {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 2px;
  margin-top: 6px;
}

.suspect-card__tl-item:first-child .suspect-card__tl-phase {
  margin-top: 0;
}

.suspect-card__tl-datetime {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 3px;
}

.suspect-card__tl-desc {
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.suspect-card__tl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.suspect-card__tl-nav {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  padding: 0;
}

.suspect-card__tl-nav:hover {
  background: #FF6B35;
  border-color: #FF6B35;
  color: #fff;
  transform: scale(1.1);
}

.suspect-card__tl-nav:active {
  transform: scale(0.95);
}

/* ── Fases colapsables en timeline ── */
.suspect-card__tl-phase-section {
  margin-bottom: 4px;
}

.suspect-card__tl-phase-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 5px;
  cursor: pointer;
  user-select: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.suspect-card__tl-phase-section:first-child .suspect-card__tl-phase-header {
  border-top: none;
  padding-top: 0;
}

.suspect-card__tl-phase-header span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

.suspect-card__tl-phase-header:hover span {
  color: rgba(255, 255, 255, 0.55);
}

.suspect-card__tl-phase-icon {
  display: inline-block;
  font-style: normal;
  font-size: 0.91rem;
  color: rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease;
  line-height: 1;
}

.suspect-card__tl-phase-section.is-collapsed .suspect-card__tl-phase-icon {
  transform: rotate(-90deg);
}

.suspect-card__tl-phase-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
}

.suspect-card__tl-phase-section.is-collapsed .suspect-card__tl-phase-body {
  max-height: 0;
  opacity: 0;
}

/* Fase activa: header más visible */
.suspect-card__tl-phase-section:not(.is-collapsed) .suspect-card__tl-phase-header span {
  color: var(--phase-color, #1BC6EB);
}

.suspect-card__tl-phase-section:not(.is-collapsed) .suspect-card__tl-phase-icon {
  color: var(--phase-color, #1BC6EB);
}

/* ── Divisores de sección en suspects popup ── */
.suspects-popup__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 8px;
}

.suspects-popup__divider::before,
.suspects-popup__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.suspects-popup__divider span {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--phase-color, #1BC6EB);
  white-space: nowrap;
}

.suspects-popup__divider--others span {
  color: rgba(255, 255, 255, 0.25);
}

/* ── Echo activo (waypoint actual) ── */
.suspect-card__tl-item {
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

.suspect-card__tl-item.is-active {
  opacity: 1;
}

.suspect-card__tl-item.is-active .suspect-card__tl-datetime {
  color: var(--phase-color, #1BC6EB);
}

.suspect-card__tl-item.is-active::before {
  background: var(--phase-color, #1BC6EB);
}

/* ========= HAMBURGUESA (Mobile) ========= */
.hamburger {
  position: fixed;
  bottom: 59px;
  right: 16px;
  z-index: 10000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: none;
  color: #fff;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  transition: transform 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}



.hamburger:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

.hamburger:active {
  transform: scale(0.95);
}

/* ========= BOTÓN MOSCA (logo flotante) ========= */
.mosca-btn {
  position: fixed;
  bottom: 59px;
  left: 16px;
  z-index: 10000;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mosca-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

.mosca-btn:active {
  transform: scale(0.95);
}

.mosca-btn__img {
  width: 28px;
  height: auto;
  display: block;
  pointer-events: none;
}

/* ========= SELECTOR DE MAPAS ========= */
.map-selector-wrapper {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 34;
  min-width: 200px;
}

@media (max-width: 899px) {
  .map-selector-wrapper {
    top: 80px;
  }

}

@media (max-width: 520px) {
  .map-selector-wrapper {
    top: 75px;
    min-width: 160px;
  }
}

.map-select {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.25s ease;
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23fff' d='M6 8L0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.map-select:hover {
  border-color: var(--phase-color);
  background: rgba(20, 20, 20, 0.95);
}

.map-select:focus {
  border-color: var(--phase-color);
  box-shadow: 0 0 0 3px rgba(var(--phase-color-rgb), 0.3);
}

.map-select option {
  background: #1a1a1a;
  color: #fff;
}




/* ========================================================= */
/* ELEMENTOS FIJOS (ej. Minimap) */
/* ========================================================= */
#minimap {
  display: none !important;
  position: fixed;
  /* Fijo en la pantalla, no se mueve con scroll */
  bottom: 20px;
  top: 80%;
  /* Distancia desde abajo */
  left: 20px;
  /* Distancia desde izquierda */
  width: 200px;
  /* Ancho base (ajustable) */
  height: 120px;
  /* Alto base */
  z-index: 100;
  /* Por encima de canvas/overlays, pero debajo de popups (ajusta si necesitas) */
  border: 1px solid rgba(255, 255, 255, 0.2);
  /* Borde sutil para profesionalismo */
  background: rgba(0, 0, 0, 0.5);
  /* Fondo semi-transparente para no obstruir */
  border-radius: 8px;
  /* Esquinas redondeadas */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Sombra suave para profundidad */
  transition: all 0.3s ease;
  /* Transición suave en resize */
}

/* Responsive: Ajustes para móvil (basado en tus breakpoints ~899px) */
@media (max-width: 899px) {
  #minimap {
    display: none;
  }
}

/* Opcional: Hover para interacción (solo desktop) */
@media (hover: hover) {
  #minimap:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    /* Efecto de elevación al hover */
    transform: scale(1.05);
    /* Ligeramente más grande */
  }
}





/* ========= DRAWER/MENU ========= */
.drawer {
  position: fixed;
  top: 80px;
  right: -100%;
  width: min(85vw, 380px);
  height: calc(100dvh - 80px);
  background: rgba(15, 15, 15, 0.98);
  backdrop-filter: blur(20px);
  z-index: 45;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.drawer--open {
  right: 0;
}

.drawer__head {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.4);
}

.drawer__head strong {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

.drawer__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 38px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.drawer__list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  align-items: stretch;
}

.drawer__list li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
}

.drawer__list button {
  width: 100%;
  min-height: 80px;
  padding: 16px 18px;
  border: none;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.drawer__list li:nth-child(odd) {
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer__list button:hover {
  background: rgba(var(--phase-color-rgb, 27, 198, 235), 0.15);
}

.drawer__list button span {
  font-size: 15px;
  font-weight: 500;
}

.drawer__list button small {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* ========= DRAWER SHARE (solo mobile) ========= */
.drawer__share {
  display: none;
}

@media (max-width: 899px) {
  .drawer__share {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
  }

  .drawer__share-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .drawer__share-links {
    display: flex;
    gap: 8px;
    flex: 1;
  }

  .drawer__share-link {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    padding: 10px;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    justify-content: center;
    max-width: 43px;
  }

  .drawer__share-link:active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
  }

  .drawer__share-link span {
    display: none;
  }
}

.drawer__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.drawer__footer-logo {
  display: flex;
  align-items: center;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.drawer__footer-logo:hover {
  opacity: 0.8;
}

.drawer__footer-logo-img {
  height: 28px;
  width: auto;
}

.drawer__footer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 38px;
  color: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer__footer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.drawer__footer-close:active {
  transform: scale(0.98);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 44;
}

/* ========= CONTROLES UI (NAVEGACIÓN) ========= */
.ui {
  position: absolute;
  bottom: 51px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 6px 5px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  /* 🆕 Que parezca "player" compacto y se adapte al ancho */
  width: min(90vw, 440px);
}

/* Botones base */
.btn {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: var(--phase-color);
  border-color: var(--phase-color);
  color: #000;
  transform: scale(1.1);
}

.btn:active {
  transform: scale(0.95);
}

/* ========= PROGRESO (DOTS) ========= */
.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 🆕 reparte los dots en todo el ancho */
  flex: 1;
  /* 🆕 ocupa todo el espacio entre los botones */
  gap: 9px;
  /* el espacio lo maneja space-between */
}

.progress span {
  width: 11%;
  height: 20px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.3);
  transition: transform 0.2s ease, background 0.2s ease, width 0.2s ease, height 0.2s ease;
  cursor: pointer;
}

.progress span:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.progress span.active {
  background: var(--phase-color);
  width: 81px;
  height: 10px;
  box-shadow: 0 0 12px var(--phase-color);
}





/* ====== MOBILE: navegación flotante limpia ====== */
@media (max-width: 899px) {
  .phase-filter {
    z-index: 35;
    gap: 8px;
    background: none;
    backdrop-filter: none;
  }

  .ui {
    position: fixed;
    inset: 0;
    /* ocupa todo el viewport */
    z-index: 40;
    width: 100%;
    height: 100%;
    padding: 0;
    display: block;

    /* ✅ reset de estilos de desktop */
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    transform: none;
    /* <- quita el translateX(-50%) */
    backdrop-filter: none;
    /* <- quita el blur gigante */
    pointer-events: none;
    /* solo los hijos reciben clics */
  }

  .ui .btn {
    position: fixed;
    width: 63px;
    height: 560px;
    border-radius: 0px;
    background: none;
    border: none;
    box-shadow: none;
    pointer-events: auto;
    /* clicables otra vez */
    filter: opacity(0.5);
    font-size: 25px;
  }

  .ui .btn.prev {
    left: var(--nav-prev-left-mobile);
    left: 0px;
    top: var(--nav-prev-top-mobile);
    transform: translateY(-50%);
  }

  .ui .btn.next {
    right: var(--nav-next-right-mobile);
    right: 0px;
    top: var(--nav-next-top-mobile);
    transform: translateY(-50%);
  }

  .ui .progress {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 9px calc(2px + env(safe-area-inset-top));
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0) 100%);
    width: 100%;
    pointer-events: auto;
  }

  .ui .progress span {
    height: 4px;
    width: 100%;
    border-radius: 0px;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.2s ease, height 0.2s ease, width 0.2s ease;
  }

  .ui .progress span.active {
    background: var(--phase-color);
    height: 4px;
    width: 100%;
    box-shadow: 0 0 6px rgba(var(--phase-color-rgb), 0.8);
  }

  .hamburger {
    bottom: 84px;
  }

  .mosca-btn {
    bottom: 84px;
    left: 16px;
  }

  button#about-btn {
    bottom: 142px;
  }

  .suspects-btn {
    bottom: calc(142px + 48px + 12px);
  }
}



/* ========= LOADING OVERLAY ========= */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  gap: 16px;
  color: #fff;
}

.spinner-svg {
  width: 48px;
  height: 48px;
  animation: spin 0.8s linear infinite;
}

.spinner-svg .ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 4;
}

.spinner-svg .dot {
  fill: var(--phase-color);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

/* ========= ACCESIBILIDAD ========= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-live {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ========= SCROLLBAR PERSONALIZADO ========= */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========= EDITOR OVERLAY (solo desarrollo) ========= */
#editor-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 33;
}

/* ===== OVERLAY STYLES ===== */
/* Ocultar overlayers por clase en <body> (opcional) */
body.overlays-hidden #overlay-layer {
  visibility: hidden !important;
  pointer-events: none !important;
}

.overlay-root {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Root doesn't intercept clicks; children do */
  z-index: 34;
  /* Above canvas but below editor/UI */
  touch-action: none;
}

.overlay-root .overlay-item {
  position: absolute;
  pointer-events: auto;
  will-change: transform;
  user-select: none;
  transition: none;
}

/* Overlay wrap for hotspots */
.overlay-wrap {
  position: absolute;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
  /* GPU acceleration */
  transition: none;
  /* Tactile feedback */
}

.overlay-item {
  pointer-events: none;
  /* wrapper handles the gesture */
  user-select: none;
  -webkit-user-drag: none;
}

/* Mobile UX: tactile feedback */
.overlay-wrap:active,
.overlay-wrap.is-pressed {
  /* ✨ No alteres transform aquí: lo controla JS para alinear sprite y hitbox.
     Cambia solo apariencia (feedback táctil) sin romper el área clicable. */
  filter: brightness(0.95);
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

/* Network optimization for slow connections */
body.net-slow .popup-backdrop,
body.net-slow .popup-simple,
body.net-slow .phase-filter,
body.net-slow .drawer {
  backdrop-filter: none !important;
  box-shadow: none !important;
  filter: none !important;
}

.overlay-item {
  /* For images inside (if used) */
  pointer-events: none;
  display: block;
}

/* ===== DEBUG HOTSPOT STYLES ===== */
/* Estilos mejorados para modo debug con mejor feedback visual en mobile */
.overlay-wrap.debug-hotspot {
  /* Vars con defaults (puedes sobreescribirlas desde JS) */
  --hs-border: rgba(255, 251, 0, 0.85);
  --hs-fill: rgba(255, 0, 0, .12);
  --hs-shadow: rgba(0, 0, 0, .35);

  border: 3px solid var(--hs-border);
  background: var(--hs-fill);
  box-shadow: 0 0 0 1px #fff, 0 0 0 2px var(--hs-shadow);
  border-radius: 8px;
  /* 50% si es círculo (lo controlamos con clase) */
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .12s ease;
  cursor: pointer;
}

/* Forma circular cuando el meta.shape === 'circle' */
.overlay-wrap.debug-hotspot.is-circle {
  border-radius: 50%;
}

/* HOVER: resalta color para inspección rápida del estado */
.overlay-wrap.debug-hotspot:hover {
  --hs-border: #00E1FF;
  --hs-fill: rgba(0, 225, 255, .12);
  --hs-shadow: rgba(0, 225, 255, .50);
}

/* PRESSED/ACTIVE: leve feedback táctil */
.overlay-wrap.debug-hotspot.is-active {
  transform: translate(-50%, -50%) scale(.98);
}

/* Hover feedback para desktop */
@media (hover: hover) {
  .overlay-wrap.debug-hotspot:hover {
    background: rgba(0, 255, 0, 0.2) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 0 0 2px white, 0 0 0 4px rgba(0, 255, 0, 0.6) !important;
  }
}

/* Tap feedback para mobile/touch devices */
@media (hover: none) {
  .overlay-wrap.debug-hotspot:active {
    background: rgba(0, 255, 0, 0.25) !important;
    transform: scale(1.08) !important;
    box-shadow: 0 0 0 2px white, 0 0 0 5px rgba(0, 255, 0, 0.7) !important;
  }
}

/* Debug label styles */
.hs-debug-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  pointer-events: none;
  margin-bottom: 6px;
  z-index: 1001;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile adjustments for debug labels */
@media (max-width: 768px) {
  .hs-debug-label {
    font-size: 10px;
    padding: 3px 6px;
    margin-bottom: 4px;
  }

}



/* Ensure minimum touch target size on mobile */
@media (hover: none) {
  .overlay-wrap.debug-hotspot {
    min-width: 44px;
    min-height: 44px;
  }
}

/* 🔧 MOBILE FIXES - TOUCH PROTECTION */
/* 🔧 MOBILE FIXES - TOUCH PROTECTION */

.overlay-wrap {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

#mapa-canvas {
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.overlay-wrap.debug-hotspot {
  pointer-events: auto !important;
}

.overlay-wrap[style*="display: none"],
.overlay-wrap[style*="pointer-events: none"] {
  pointer-events: none !important;
  visibility: hidden !important;
}

@media (max-width: 899px) {
  .overlay-wrap:active {
    opacity: 0.85;
    transition: opacity 0.1s ease;
  }
}

/* ========= 🔕 NON-INTERACTIVE OVERLAYS ========= */
.overlay-noninteractive {
  pointer-events: none !important;
  /* Optional debug styling - uncomment to visualize non-interactive elements */
  /* opacity: 0.9; */
  /* outline: 1px dashed rgba(255, 0, 0, 0.3); */
}

/* ========= 🔧 MOBILE FIXES - TOUCH PROTECTION ========= */

.overlay-wrap {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

#mapa-canvas {
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.overlay-wrap.debug-hotspot {
  pointer-events: auto !important;
}

.overlay-wrap[style*="display: none"],
.overlay-wrap[style*="pointer-events: none"] {
  pointer-events: none !important;
  visibility: hidden !important;
}

@media (max-width: 899px) {
  .overlay-wrap:active {
    opacity: 0.85;
    transition: opacity 0.1s ease;
  }


}

/* ========================================================= */
/* WAYPOINT INFO BOX — Flota encima del canvas, sin empujar  */
/* ========================================================= */
.waypoint-info-box {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  z-index: 39;
  pointer-events: none;
  cursor: default;
  font-family: 'Segoe UI', system-ui, sans-serif;

  background: rgba(10, 18, 26, 0.215);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 18px;

  display: flex;
  align-items: center;
  gap: 12px;

  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.waypoint-info-box__text {
  flex: 1;
  text-align: center;
  min-width: 0;
}

/* Actions: share + about — oculto en mobile, visible en desktop */
.waypoint-info-box__actions {
  display: none;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  pointer-events: auto;
  position: absolute;
  bottom: -42px;
  right: 210px;
}

@media (min-width: 900px) {
  .waypoint-info-box__actions {
    display: none;
  }
}

.wib-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: rgb(0 0 0 / 73%);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.wib-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.wib-action-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

/* Botón Ver más — reemplaza los share en el wib */
.wib-ver-mas-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgb(0 0 0 / 73%);
  color: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.wib-ver-mas-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.wib-ver-mas-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

/* Grupo share fijo izquierda — sobre la mosca, solo desktop */
.wib-share-group {
  position: fixed;
  bottom: 116px;
  left: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.wib-share-group:not([hidden]) {
  pointer-events: auto;
}

.wib-share-group.is-active {
  opacity: 1;
  transform: translateY(0);
}

.wib-share-group__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  position: absolute;
  transform: translateY(-50%) rotate(-90deg);
  right: 15px;
  bottom: 34px;
}

.wib-share-group__icons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Solo desktop */
@media (max-width: 899px) {
  .wib-share-group {
    display: none !important;
  }
}

.waypoint-info-box.visible {
  opacity: 1;
  transform: translateY(0);
}

.waypoint-info-box__title {
  margin: 0 0 4px;
  font-size: clamp(15px, 2vw, 95px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.waypoint-info-box__desc {
  margin: 0;
  font-size: clamp(12px, 1.2vw, 20px);
  color: rgba(255, 255, 255, 0.70);
  line-height: 1.5;
}

/* Fecha dinámica del hotspot — aparece arriba del título */
/* Wrapper: posiciona la pill debajo del info-box */
.waypoint-info-box__date-row {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -35px;
  display: flex;
  flex-direction: row;
  align-items: center;
}

.waypoint-info-box__date {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px 3px 10px;
  border-radius: 99px 0 0 99px;

  /* Color: celeste de fase como bg, texto oscuro */
  background: var(--phase-color, #1BC6EB);
  color: #0a121a;

  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;

  /* Sombra para separarlo del info-box */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Botón + mobile — mitad derecha de la pill partida */
.wib-ver-mas-mobile {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-content: center;
  padding: 3px 12px 3px 6px;
  border: none;
  border-radius: 0 99px 99px 0;
  background: color-mix(in srgb, var(--phase-color, #1BC6EB) 75%, #000 25%);
  color: #0a121a;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease;
}

.wib-ver-mas-mobile::after {
  content: 'ver más';
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  width: 83px;
  padding: 5px 0px;
}

.wib-ver-mas-mobile:hover {
  background: color-mix(in srgb, var(--phase-color, #1BC6EB) 65%, #000 35%);
}

@media (max-width: 899px) {
  .waypoint-info-box__date-row {
    bottom: -28px;
  }

  .waypoint-info-box__date {
    font-size: 12px;
    border-radius: 99px 0 0 99px;
  }
}

@media (min-width: 900px) {
  .wib-ver-mas-mobile {
    display: inline-flex;
  }
}

/* Tercer texto — descripción editorial, tamaño fijo 16px */
.waypoint-info-box__body {
  margin: 6px 0 0;
  font-size: clamp(11px, 1vw + 8px, 14px);
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.55;
  font-weight: 400;
}

/* Desktop: limitar ancho para no tapar todo el mapa */
@media (min-width: 900px) {
  .waypoint-info-box {
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: min(960px, 85%);
    border-bottom: none;
    border-radius: 0 0 12px 0;
    padding-right: 18px;
  }
}

/* Ocultar actions y share group con popup/brief/drawer abiertos */
body.popup-open .waypoint-info-box__actions,
body.brief-open .waypoint-info-box__actions,
body:has(.drawer--open) .waypoint-info-box__actions,
body.popup-open .wib-share-group,
body.brief-open .wib-share-group,
body:has(.drawer--open) .wib-share-group {
  opacity: 0;
  pointer-events: none;
}

/* ========================================================= */
/* POPUP OPEN — Ocultar chrome de navegación                */
/* ========================================================= */
.top-bar,
.phase-filter,
#waypoint-info-box {
  transition: opacity 0.2s ease;
}

body.popup-open .top-bar,
body.popup-open .phase-filter,
body.popup-open #waypoint-info-box,
body.popup-open .hamburger,
body.popup-open .mosca-btn {
  opacity: 0;
  pointer-events: none;
}

/* Drawer abierto → ocultar hamburger, mosca y botones de fases */
.hamburger[aria-expanded="true"],
.hamburger[aria-expanded="true"]+.mosca-btn {
  opacity: 0;
  pointer-events: none;
}

body:has(.drawer--open) .top-bar,
body:has(.drawer--open) .phase-filter {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ========================================================= */
/* BRIEF OPEN — Bloquear fases mientras el brief está activo */
/* ========================================================= */

body.brief-open .top-bar,
body.brief-open .phase-filter {
  pointer-events: none;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

body.brief-open #mapa-canvas,
body.brief-open #overlay-layer,
body.brief-open #editor-layer {
  pointer-events: none;
}

@media (max-width: 799px) {

  body.brief-open .top-bar,
  body.brief-open .phase-filter {
    opacity: 0;
    visibility: hidden;
  }
}

/* ========================================================= */
/* INTRO SCREEN                                              */
/* ========================================================= */

/* Mientras el intro es visible, ocultar el header de fases */
body:has(#story-intro:not([hidden])) .top-bar {
  visibility: hidden;
  pointer-events: none;
}

.story-intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding: 32px 24px 24px;
  transition: opacity 0.7s ease;
}

.story-intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
      rgba(0, 0, 0, 0.0) 50%,
      rgba(0, 0, 0, 0.65) 100%);
  z-index: 0;
  pointer-events: none;
}

.story-intro>* {
  position: relative;
  z-index: 1;
}

/* ---- Imágenes de layout mobile (solo ≤520px) ---- */
.story-intro__img-top {
  display: none;
}

.story-intro__img-bottom {
  display: none;
}

@media (max-width: 520px) {
  .story-intro__img-top {
    display: block;
    width: 184px;
    height: 212px;
    object-fit: cover;
    border-radius: 8px;
    margin: 0 auto 4px;
    flex-shrink: 0;
  }

  .story-intro__img-bottom {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    flex-shrink: 0;
  }
}

.story-intro.is-hiding {
  opacity: 0;
  pointer-events: none;
}

.story-intro__content {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 46px 0;
  max-width: 640px;
  width: 100%;
  min-height: 0;
}

/* --- Entradas escalonadas lentas --- */
.story-intro__subtitle,
.story-intro__credits,
.story-intro__btn {
  opacity: 0;
  transform: translateY(24px);
}

.story-intro__subtitle {
  animation: none;
}

.story-intro__credits {
  animation: none;
}

.story-intro__btn {
  animation: none;
}

/* Clase que JS agrega cuando es momento */
.story-intro__subtitle.is-visible {
  animation: intro-rise 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.story-intro__credits.is-visible {
  animation: intro-rise 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.story-intro__btn.is-visible {
  animation: intro-rise 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes intro-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Typewriter (solo desktop) --- */
.story-intro__title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-align: center;
  display: block;
  white-space: pre-line;
  overflow: hidden;
  opacity: 1;
  transform: none;
  animation: none;
}

/* cursor parpadeante — se agrega/quita por JS */
.story-intro__title::after {
  content: '|';
  display: inline;
  color: rgba(255, 255, 255, 0.7);
  animation: tw-cursor 0.65s step-end infinite;
  margin-left: 2px;
}

.story-intro__title.tw-done::after {
  display: none;
}

@keyframes tw-cursor {
  50% {
    opacity: 0;
  }
}

/* Mobile: revertir a fade-in normal */
@media (max-width: 520px) {
  .story-intro__title {
    white-space: normal;
    overflow: visible;
    border-right: none;
    width: auto;
    animation: intro-rise 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
    opacity: 0;
    transform: translateY(24px);
  }

  .story-intro {
    padding: 20px 20px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .story-intro::before {
    display: none;
  }

  .story-intro__logo-wrap {
    text-align: center;
    flex-shrink: 0;
  }

  .story-intro__content {
    padding: 16px 0;
    gap: 11px;
    flex: 1 0 auto;
    width: 100%;
    margin-top: -45px;
  }

  .story-intro__share {
    flex-shrink: 0;
    padding: 12px 0 4px;
    justify-content: center;
  }

  .story-intro__copyright {
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }
}

.story-intro__subtitle {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 400;
  color: rgb(255 255 255 / 69%);
  line-height: 1.6;
  max-width: 480px;
}

/* --- Créditos: autoría + fecha, entre el subtítulo y el botón --- */
.story-intro__credits {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.story-intro__credits-authors {
  display: block;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.story-intro__credits-date {
  display: block;
  font-size: clamp(0.95rem, 1.8vw, 0.99rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.35);
  padding-top: 12px;
}

/* --- Botón con haz de luz giratorio --- */
.story-intro__btn {
  position: relative;
  margin-top: 8px;
  padding: 15px 48px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 100px;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.06em;
  overflow: hidden;
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.15s ease;
}

/* Haz de luz — gradiente cónico giratorio sobre el borde */
.story-intro__btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 100px;
  background: conic-gradient(from 0deg,
      transparent 60%,
      rgba(255, 255, 255, 0.55) 75%,
      rgba(255, 255, 255, 0.9) 85%,
      rgba(255, 255, 255, 0.55) 95%,
      transparent 100%);
  animation: btn-sweep 2.8s linear 3.2s infinite;
  opacity: 0;
}

/* El haz aparece cuando el botón ya está visible */
.story-intro__btn.btn-ready::before {
  opacity: 1;
}

/* Máscara interna para que el haz solo afecte el borde */
.story-intro__btn::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  border-radius: 100px;
  background: #000;
  z-index: 0;
}

.story-intro__btn span {
  position: relative;
  z-index: 1;
}

@keyframes btn-sweep {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.story-intro__btn:hover {
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
  transform: translateY(-1px);
}

.story-intro__btn:active {
  transform: scale(0.97);
}

/* Logo */
.story-intro__logo-wrap {
  grid-row: 1;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-intro__logo-wrap.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.story-intro__logo-wrap a {
  display: flex;
  justify-content: center;
  line-height: 0;
}

.story-intro__logo {
  height: 32px;
  width: auto;
  display: block;
  transition: opacity 0.2s ease;
}

.story-intro__logo:hover {
  opacity: 0.7;
}

/* Compartir en redes */
.story-intro__share {
  grid-row: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-intro__share.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.story-intro__share-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.story-intro__share-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.story-intro__share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease;
}

.story-intro__share-link:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  transform: scale(1.08);
}

.story-intro__share-link svg {
  width: 24px;
  height: 24px;
}

.story-intro__share-link span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Copyright */
.story-intro__copyright {
  grid-row: 4;
  padding: 0;
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.6);
  white-space: normal;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-intro__copyright.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.story-intro__copyright a {
  color: rgb(95 150 233 / 97%);
  text-decoration: none;
  transition: color 0.2s ease;
}

.story-intro__copyright a:hover {
  color: rgb(164, 205, 255);
}

/* --- Accesibilidad --- */
@media (prefers-reduced-motion: reduce) {

  .story-intro__title,
  .story-intro__subtitle,
  .story-intro__btn,
  .story-intro__logo-wrap,
  .story-intro__share,
  .story-intro__copyright {
    animation: none;
    transition: none;
    opacity: 1;
    transform: none;
  }

  .story-intro__logo-wrap,
  .story-intro__copyright {
    opacity: 1;
    transform: none;
  }

  .story-intro__title {
    white-space: normal;
    overflow: visible;
    border-right: none;
    width: auto;
  }

  .story-intro {
    transition: none;
  }

  .story-intro__btn::before {
    animation: none;
  }
}

/* ========================================================= */
/* HOTSPOT CAPTION — Badge ⓘ + tooltip en hover             */
/* ========================================================= */

.hs-caption {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
}

/* 🔒 Oculto durante animación de entrada del waypoint */
.hs-caption--hidden .hs-caption__badge {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.hs-caption__badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(15, 20, 30, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.4s ease-out;
}

.hs-caption__tooltip {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translate(-50%, -4px);
  min-width: 180px;
  max-width: 240px;
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  white-space: normal;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.overlay-wrap:hover {
  outline: none;
}

.overlay-wrap:hover::before {
  content: '';
}

.overlay-wrap.has-caption {}

.overlay-wrap.has-caption::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.7) 0px, rgba(255, 255, 255, 0.7) 6px, transparent 6px, transparent 12px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0px, rgba(255, 255, 255, 0.7) 6px, transparent 6px, transparent 12px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.7) 0px, rgba(255, 255, 255, 0.7) 6px, transparent 6px, transparent 12px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0px, rgba(255, 255, 255, 0.7) 6px, transparent 6px, transparent 12px);
  background-size: 12px 2px, 2px 12px, 12px 2px, 2px 12px;
  background-position: 0 0, 100% 0, 0 100%, 0 0;
  background-repeat: repeat-x, repeat-y, repeat-x, repeat-y;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.overlay-wrap.has-caption:has(.hs-caption__badge:hover)::after {
  opacity: 1;
  animation: hs-dash-march 0.4s linear infinite;
}

.overlay-wrap.has-caption:has(.hs-caption__badge:hover) .hs-caption__tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes hs-dash-march {
  0% {
    background-position: 0 0, 100% 0, 0 100%, 0 0;
  }

  100% {
    background-position: 12px 0, 100% 12px, -12px 100%, 0 -12px;
  }
}

/* Announce: borde + tooltip al revelar badges */
.overlay-wrap.has-caption.hs-announcing::after {
  opacity: 1;
  animation: hs-dash-march 0.4s linear 10 forwards;
  /* 10 × 0.4s = 4s */
}

.overlay-wrap.has-caption.hs-announcing .hs-caption__tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (hover: none) {
  .hs-caption__tooltip {
    display: none;
  }

  .overlay-wrap.has-caption::after {
    display: none;
  }

  .hs-caption.is-open .hs-caption__tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
    display: block;
  }

  /* Mobile: borde + tooltip solo durante el announce */
  .overlay-wrap.has-caption.hs-announcing::after {
    display: block;
  }

  .overlay-wrap.has-caption.hs-announcing .hs-caption__tooltip {
    display: block;
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Hotspot tipo B — informativo, sin imagen visible */
.overlay-wrap.has-caption {
  overflow: visible;
  background: transparent !important;
  pointer-events: none;
}

.overlay-wrap.has-caption img.overlay-item {
  opacity: 0;
}

.overlay-wrap.has-caption .hs-caption__badge {
  pointer-events: auto;
  cursor: default;
}

/* ========= WAYPOINT INFO BOX — TIPOGRAFÍA ========= */

/* Mobile base */
.waypoint-info-box__title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.waypoint-info-box__desc {
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
}

/* short — iPhone SE, pantallas muy bajas */
@media (max-height: 600px) {
  .waypoint-info-box__title {
    font-size: 1.3rem;
  }

  .waypoint-info-box__desc {
    font-size: 0.8rem;
  }
}

/* medium — iPhone SE alto, Samsung S8+ */
@media (min-height: 601px) and (max-height: 740px) {
  .waypoint-info-box__title {
    font-size: 1.3rem;
  }

  .waypoint-info-box__desc {
    font-size: 0.80rem;
  }
}

/* tall — iPhone 12 Pro */
@media (min-height: 741px) and (max-height: 870px) {
  .waypoint-info-box__title {
    font-size: 1.7rem;
  }

  .waypoint-info-box__desc {
    font-size: 0.80rem;
    text-align: center;
  }
}

/* xtall — iPhone XR, 14 Pro Max, Pixel, S20 */
@media (min-height: 871px) and (max-width: 899px) {
  .waypoint-info-box__title {
    font-size: 1.7rem;
  }

  .waypoint-info-box__desc {
    font-size: 0.80rem;
    text-align: center;
  }
}

/* tablet — iPad Mini y similares (detección por ancho) */
@media (min-width: 600px) and (max-width: 899px) {
  .waypoint-info-box__title {
    font-size: 1.8rem;
  }

  .waypoint-info-box__desc {
    font-size: 0.80rem;
  }
}

/* desktop */
@media (min-width: 900px) {
  .waypoint-info-box__title {
    font-size: 1.85rem;
  }

  .waypoint-info-box__desc {
    font-size: 1rem;
  }
}

/* =========================================================
   WAYPOINT REVEAL MASK — radial dark → transparent
   DOM: #wp-reveal-mask dentro de #mapa-canvas-wrapper
   Vive solo en el primer waypoint del primer mapa.
   pointer-events: none siempre — nunca bloquea interacción.
   ========================================================= */
#wp-reveal-mask {
  position: absolute;
  inset: 0;
  z-index: 38;
  /* justo debajo del info-box (39) */
  pointer-events: auto;
  background: radial-gradient(ellipse 80% 70% at 50% 50%,
      rgba(0, 0, 0, 0.0) 0%,
      rgba(0, 0, 0, 0.55) 55%,
      rgba(0, 0, 0, 0.88) 100%);
  opacity: 1;
  transition: opacity 1.1s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

#wp-reveal-mask.is-fading {
  opacity: 0;
  pointer-events: none;
}

/* =========================================================
   WAYPOINT INFO BOX — animaciones de entrada por elemento
   Cada hijo entra por separado con slide-up + fade.
   ========================================================= */

/* Estado inicial de cada elemento animable */
.waypoint-info-box__title,
.waypoint-info-box__desc,
.waypoint-info-box__body {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

/* El date-row tiene translateX(-50%) base — combinar con translateY */
.waypoint-info-box__date-row {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

/* Clase que JS agrega con setTimeout para cada elemento */
.waypoint-info-box__title.wib-in,
.waypoint-info-box__desc.wib-in,
.waypoint-info-box__body.wib-in {
  opacity: 1;
  transform: translateY(0);
}

.waypoint-info-box__date-row.wib-in {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   HOTSPOT ENTRADA — fade en el wrap, scale en el img hijo.
   Separar capas evita el conflicto con el inline transform
   de posicionamiento que endFrame() escribe cada frame.
   JS asigna --hs-i como CSS var para el stagger por índice.
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {

  /* Fade en el contenedor (no toca el transform de posición) */
  .overlay-wrap.hs-entering {
    animation: hs-enter-fade 0.45s ease both;
    animation-delay: calc(var(--hs-i, 0) * 60ms);
  }

  /* Scale en la imagen hija (transform propio, no interfiere) */
  .overlay-wrap.hs-entering>img.overlay-item {
    animation: hs-enter-scale 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--hs-i, 0) * 60ms);
  }
}

@keyframes hs-enter-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes hs-enter-scale {
  from {
    transform: scale(0.78);
  }

  to {
    transform: scale(1);
  }
}

/* reduced-motion: sin animación, aparición instantánea */
@media (prefers-reduced-motion: reduce) {

  .waypoint-info-box__title,
  .waypoint-info-box__desc,
  .waypoint-info-box__body {
    opacity: 0;
    transform: none;
    transition: opacity 0.28s ease;
  }

  .waypoint-info-box__date-row {
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 0.15s ease;
  }

  .overlay-wrap.hs-entering,
  .overlay-wrap.hs-entering>img.overlay-item {
    animation: none;
  }
}

/* ========================================================= */
/* STORY BRIEF POPUP                                         */
/* ========================================================= */

.story-brief {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  /* centered — the panel is 90vh so it fills nicely */
  justify-content: center;
  padding: 5vh 5vw;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.story-brief:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.story-brief.is-hiding {
  opacity: 0;
  pointer-events: none;
}

.story-brief__backdrop {
  display: none;
}

.story-brief__panel {
  position: relative;
  z-index: 1;
  background: rgba(12, 14, 18, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  box-shadow:
    0 2px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.3);
  /* Default (no image): narrow single-column */
  width: min(600px, 100%);
  max-height: min(94vh, 700px);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  transform: translateY(-12px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-brief:not([hidden]) .story-brief__panel {
  transform: translateY(0);
}

/* ── Split layout (two-column) ── */
.story-brief__panel--split {
  width: min(90vw, 1200px);
  max-height: 90vh;
  height: 90vh;
}

/* Image column — left 35% */
.story-brief__image-col {
  display: none;
  /* hidden by default */
  flex: 0 0 35%;
  width: 35%;
  position: relative;
  overflow: hidden;
  border-radius: 18px 0 0 18px;
  background: rgba(0, 0, 0, 0.4);
}

.story-brief__panel--split .story-brief__image-col {
  display: flex;
  flex-direction: column;
}

.story-brief__image {
  width: 100%;
  flex: 1;
  object-fit: cover;
  object-position: center top;
  display: block;
  min-height: 0;
  transition: opacity 0.22s ease;
}

.story-brief__image.is-switching {
  opacity: 0;
}

@keyframes brief-img-enter {
  from {
    opacity: 0;
    transform: scale(1.03);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.story-brief__image.is-entering {
  animation: brief-img-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .story-brief__image {
    transition: none;
  }

  .story-brief__image.is-entering {
    animation: none;
  }
}

.story-brief__image-caption {
  flex-shrink: 0;
  padding: 10px 14px 12px;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-style: italic;
}

.story-brief__image-caption a {
  color: var(--phase-color, #1BC6EB);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.story-brief__image-caption a:hover {
  opacity: 0.8;
}

/* Content column — right 65% */
.story-brief__content-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.story-brief__heading {
  margin: 0;
  padding: 18px 24px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-brief__heading-text {
  font-size: clamp(0.78rem, 2vw, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.story-brief__heading-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.story-brief__heading-logo-img {
  height: 18px;
  width: auto;
  display: block;
}

@media (max-width: 520px) {
  .story-brief__heading-logo-img {
    content: url('/assets/mosca-r.webp');
    height: 14px;
  }
}

.story-brief__drag-handle {
  display: none;
  flex-shrink: 0;
}

.story-brief__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  transition: opacity 0.22s ease;
}

.story-brief__body.is-switching {
  opacity: 0;
}

@keyframes brief-body-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.story-brief__body.is-entering {
  animation: brief-body-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .story-brief__body {
    transition: none;
  }

  .story-brief__body.is-entering {
    animation: none;
  }
}

.story-brief__body::-webkit-scrollbar {
  width: 4px;
}

.story-brief__body::-webkit-scrollbar-track {
  background: transparent;
}

.story-brief__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

.story-brief__body h3 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 700;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.95);
}

.story-brief__body p {
  margin: 0 0 12px;
  font-size: clamp(0.875rem, 2.2vw, 0.95rem);
  line-height: 1.74;
  color: rgba(255, 255, 255, 0.80);
  font-weight: 400;
}

.story-brief__body p:last-child {
  margin-bottom: 0;
}

/* ── Brief scenes: timeline vertical ── */
.brief-scene {
  position: relative;
  padding-left: 22px;
  padding-bottom: 24px;
}

.brief-scene:last-child {
  padding-bottom: 0;
}

.brief-scene::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.brief-scene::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.brief-scene:last-child::after {
  display: none;
}

.brief-scene__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 5px;
  line-height: 1.3;
}

.story-brief__body .brief-scene p,
.brief-scene p {
  margin: 0;
  font-size: clamp(0.82rem, 2vw, 0.88rem);
  line-height: 1.72;
  color: rgba(255, 255, 255, 0.72);
}

.story-brief__body ul {
  margin: 0 0 12px;
  padding-left: 1.4em;
  color: rgba(255, 255, 255, 0.80);
  font-size: clamp(0.875rem, 2.2vw, 0.95rem);
  line-height: 1.74;
}

.story-brief__body ul li {
  margin-bottom: 6px;
}

.story-brief__body strong {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

.story-brief__body em {
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
}

.brief-tw::after {
  content: '|';
  display: inline;
  color: rgba(255, 255, 255, 0.5);
  animation: brief-cursor 0.6s step-end infinite;
  margin-left: 1px;
}

.brief-tw--done::after {
  display: none;
}

@keyframes brief-cursor {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brief-tw::after {
    display: none;
  }
}

.story-brief__footer {
  padding: 13px 24px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.story-brief__share {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.story-brief__share-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.story-brief__share-icons {
  display: flex;
  gap: 8px;
}

.story-brief__share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.2s ease, background 0.2s ease;
}

.story-brief__share-link svg {
  width: 20px;
  height: 20px;
}

.story-brief__share-link span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.story-brief__share-link:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
}

.story-brief__btn {
  padding: 10px 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

/* Variante secundaria — mismo tamaño, menor énfasis visual */
.story-brief__btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
}

.story-brief__btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.story-brief__btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.5);
}

.story-brief__btn:active {
  transform: scale(0.97);
}

@media (max-width: 520px) {
  .story-brief {
    padding: 0;
    align-items: stretch;
    justify-content: flex-end;
    /* panel sube desde abajo como sheet */
    background: rgba(0, 0, 0, 0.55);
  }

  .story-brief__panel {
    border-radius: 18px 18px 0 0;
    /* solo esquinas superiores */
    max-height: 100dvh;
    /* toda la pantalla */
    width: 100%;
    margin: 0;
    transform: translateY(24px);
    /* entra desde abajo */
    flex-direction: column;
  }

  /* On mobile, split collapses: hide image col, content col fills all */
  .story-brief__panel--split {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
  }

  .story-brief__panel--split .story-brief__image-col {
    display: none;
  }

  .story-brief__content-col {
    border-left: none;
  }

  .story-brief__drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 8px;
    touch-action: none;
    cursor: grab;
  }

  .story-brief__drag-handle::before {
    content: '';
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 999px;
  }

  .story-brief:not([hidden]) .story-brief__panel {
    transform: translateY(0);
  }

  .story-brief__heading {
    padding: 16px 18px 12px;
  }

  .story-brief__body {
    padding: 16px 18px;
  }

  .story-brief__footer {
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .story-brief__btn {
    text-align: center;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .story-brief__share-link {
    width: 36px;
    height: 36px;
  }
}

/* ========= PHASE TRANSITION OVERLAY ========= */
.phase-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  /* sobre canvas/overlays/minimap (100), bajo intro (200) y brief (210) */
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  will-change: opacity;
}

.phase-transition-overlay.is-entering {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .phase-transition-overlay {
    transition: none;
  }
}

/* ========= PHASE BUTTON PULSE (al llegar al último waypoint) ========= */
.phase-btn--next-available {
  animation: phase-btn-pulse 2s ease-in-out infinite !important;
  box-shadow: 0 0 25px rgba(var(--phase-color-rgb, 27, 198, 235), 0.6) !important;
  border-color: var(--phase-color, #1BC6EB) !important;
}

.phase-btn--next-available span {
  position: relative;
  z-index: 1;
}

.phase-btn--next-available::before {
  opacity: 0.15 !important;
}

@keyframes phase-btn-pulse {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(var(--phase-color-rgb, 27, 198, 235), 0.3);
    transform: translateY(0);
  }

  50% {
    box-shadow: 0 0 40px rgba(var(--phase-color-rgb, 27, 198, 235), 0.8);
    transform: translateY(-2px);
  }
}

@media (max-width: 899px) {
  .phase-btn--next-available {
    animation-duration: 1.6s !important;
  }

  .progress span:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .phase-btn--next-available {
    animation: none !important;
  }
}

/* ========= PHASE BUTTON HINT (sweep conic gradient) ========= */
.phase-btn.is-hinting {
  position: relative;
  overflow: hidden;
}

.phase-btn.is-hinting::after {
  content: '';
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg,
      transparent,
      rgba(var(--phase-color-rgb, 27, 198, 235), 0.12) 30%,
      rgba(var(--phase-color-rgb, 27, 198, 235), 0.25) 50%,
      rgba(var(--phase-color-rgb, 27, 198, 235), 0.12) 70%,
      transparent);
  animation: hint-sweep 2.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes hint-sweep {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .phase-btn.is-hinting::after {
    animation: none;
    opacity: 0.08;
  }
}