/* ==========================================================================
   TRANSMEDIA CARTOGRAPHY & GLYPH TRANSLATOR OVERLAY (css/transmedia.css)
   Fase 3: Mapa Vectorial de La Plata & Sintonizador de Glifos en Modal Overlay
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CONTENEDOR PRINCIPAL: PANTALLA TRANSMEDIA (SIN SCROLLING VERTICAL)
   -------------------------------------------------------------------------- */

#view-transmedia {
  overflow: hidden !important;
}

#view-transmedia.active .transmedia-screen,
#view-transmedia.active .map-hud-header,
#view-transmedia.active .map-hud-header *,
#view-transmedia.active .map-stage,
#view-transmedia.active .city-map-wrapper,
#view-transmedia.active .city-map-svg,
#view-transmedia.active .tree-marker-interactive,
#view-transmedia.active .tree-marker-interactive *,
#view-transmedia.active .map-hud-footer,
#view-transmedia.active .map-hud-footer *,
#view-transmedia.active .glyph-modal-overlay:not(.hidden),
#view-transmedia.active .glyph-modal-overlay:not(.hidden) * {
  pointer-events: auto;
}

.transmedia-screen {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-top: max(12px, var(--sat));
  padding-bottom: calc(var(--nav-height) + max(20px, var(--sab)));
  padding-left: 14px;
  padding-right: 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  user-select: none;
}

/* --------------------------------------------------------------------------
   2. CABECERA HUD DEL MAPA: TRADUCTOR DE GLIFOS
   -------------------------------------------------------------------------- */

.map-hud-header {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
  flex-shrink: 0;
}

.btn-glyph-header-full {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  --br-x1: 22%;
  --br-x2: 28%;
  --br-y1: 68%;
  --br-y2: 62%;
  border-radius: var(--br-x1) var(--br-x2) / var(--br-y1) var(--br-y2);
  background: var(--primary-bg);
  color: #FFFFFF;
  border: 1.5px solid rgba(32, 32, 32, 0.5);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(24, 24, 24, 0.45);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

.btn-glyph-header-full:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 6px 20px rgba(24, 24, 24, 0.45);
  border-color: var(--navy-dark);
}

.btn-glyph-header-full:active {
  transform: scale(0.98);
}

.glyph-header-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 0;
  line-height: 1.2;
}

.glyph-btn-dot {
  color: var(--navy-dark);
  font-size: 1rem;
  display: inline-block;
  line-height: 1;
  animation: glyph-dot-pulse 2.2s infinite ease-in-out;
}

@keyframes glyph-dot-pulse {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.85);
  }

  50% {
    opacity: 1;
    transform: scale(1.3);
    filter: drop-shadow(0 0 6px #080529);
  }
}

.map-counter-pill {
  background: rgba(17, 33, 66, 0.08);
  color: var(--navy-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(17, 33, 66, 0.12);
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   3. ESCENARIO DEL MAPA CARTOGRÁFICO DE LA PLATA
   -------------------------------------------------------------------------- */

.map-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
  overflow: visible;
}

.city-map-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 356 / 478;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
  filter: drop-shadow(0 12px 28px rgba(17, 33, 66, 0.14));
}

.map-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.city-map-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
}

/* Elementos Cartográficos de La Plata */
.map-city-bounds {
  fill: rgba(17, 33, 66, 0.035);
  stroke: rgba(17, 33, 66, 0.4);
  stroke-width: 3.5;
  stroke-dasharray: 6 3;
}

.map-grid-streets line {
  stroke: rgba(17, 33, 66, 0.1);
  stroke-width: 1;
}

.map-diagonals .map-diag-line {
  stroke: rgba(66, 46, 143, 0.38);
  stroke-width: 2.8;
}

.map-diagonals .map-diag-sec {
  stroke: rgba(66, 46, 143, 0.22);
  stroke-width: 1.8;
}

.map-main-avenues .map-civic-axis {
  stroke: rgba(17, 33, 66, 0.45);
  stroke-width: 2.5;
}

.map-main-avenues .map-ave-7 {
  stroke: rgba(17, 33, 66, 0.45);
  stroke-width: 2.5;
}

.map-main-avenues .map-ave-sec {
  stroke: rgba(17, 33, 66, 0.25);
  stroke-width: 1.8;
}

.map-park-bosque {
  fill: rgba(107, 201, 217, 0.3);
  stroke: rgba(107, 201, 217, 0.7);
  stroke-width: 2;
}

.map-plaza-center {
  fill: rgba(66, 46, 143, 0.28);
  stroke: var(--purple-accent);
  stroke-width: 2;
}

.map-plaza-item {
  fill: rgba(107, 201, 217, 0.25);
  stroke: rgba(107, 201, 217, 0.6);
  stroke-width: 1.5;
}

.map-plaza-circle {
  fill: rgba(66, 46, 143, 0.22);
  stroke: rgba(66, 46, 143, 0.6);
  stroke-width: 1.5;
}

.map-tag-center {
  font-family: var(--font-epilogue);
  font-size: 9px;
  font-weight: 700;
  fill: var(--purple-accent);
  text-anchor: middle;
}

.map-tag-landmark {
  font-family: var(--font-epilogue);
  font-size: 8.5px;
  font-weight: 600;
  fill: var(--navy-dark);
  text-anchor: middle;
  opacity: 0.85;
}

.map-tag-diag {
  font-family: var(--font-epilogue);
  font-size: 7.5px;
  font-weight: 600;
  fill: rgba(66, 46, 143, 0.65);
}

/* Marcadores Reactivos de Árboles - ESTÁTICOS AL TOCAR (SIN SALTO) */
.tree-marker-interactive {
  cursor: pointer;
  transform: none !important;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.tree-marker-interactive:hover,
.tree-marker-interactive:active,
.tree-marker-interactive:focus {
  transform: none !important;
  filter: drop-shadow(0 0 8px rgba(107, 201, 217, 0.8));
}

.marker-core-captured {
  fill: #27AE60;
  stroke: #FFFFFF;
  stroke-width: 2.5;
}

.marker-code-captured {
  font-family: var(--font-epilogue);
  font-size: 13px;
  font-weight: 800;
  fill: #FFFFFF;
  text-anchor: middle;
}

.marker-core-revealed {
  fill: #422E8F;
  stroke: #6BC9D9;
  stroke-width: 2.5;
}

.marker-code-revealed {
  font-family: var(--font-epilogue);
  font-size: 13px;
  font-weight: 800;
  fill: #FFFFFF;
  text-anchor: middle;
}

.marker-bubble-bg {
  fill: rgba(17, 33, 66, 0.94);
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 1.5;
}

.marker-bubble-bg.beacon {
  fill: rgba(42, 27, 107, 0.95);
  stroke: #6BC9D9;
  stroke-width: 1.5;
  filter: drop-shadow(0 3px 8px rgba(17, 33, 66, 0.35));
}

.marker-bubble-bg.event-beacon {
  fill: rgba(28, 18, 68, 0.96);
  stroke: #FFE600;
  stroke-width: 1.8;
  filter: drop-shadow(0 4px 14px rgba(255, 230, 0, 0.4));
}

.marker-bubble-text {
  font-family: var(--font-epilogue);
  font-size: 12.5px;
  font-weight: 700;
  fill: #FFFFFF;
  text-anchor: middle;
  letter-spacing: 0.3px;
}

.marker-bubble-text.event-beacon {
  fill: #FFF8D6;
  font-weight: 800;
}

.marker-core-event {
  fill: #E5B824;
  stroke: #FFFFFF;
  stroke-width: 2.5;
}

.marker-code-event {
  font-family: var(--font-epilogue);
  font-size: 14px;
  font-weight: 800;
  fill: #FFFFFF;
  text-anchor: middle;
}

.radar-ping-animation {
  fill: none;
  stroke: #6BC9D9;
  stroke-width: 2.2;
  animation: radar-pulse 2.2s infinite ease-out;
}

.event-radar-ping {
  fill: none;
  stroke: #FFE600;
  stroke-width: 2.5;
  animation: event-radar-pulse 2s infinite ease-out;
}

.marker-pulse-ring {
  animation: captured-pulse 2.5s infinite ease-in-out;
}

@keyframes radar-pulse {
  0% {
    r: 10;
    opacity: 0.95;
  }

  100% {
    r: 28;
    opacity: 0;
  }
}

@keyframes event-radar-pulse {
  0% {
    r: 12;
    opacity: 1;
  }

  100% {
    r: 32;
    opacity: 0;
  }
}

@keyframes captured-pulse {

  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}



/* Popup de Detalles de Árbol en el Mapa */
.map-tree-details-popup {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 25;
}

.map-tree-details-popup.hidden {
  display: none !important;
}

.tree-details-card {
  position: relative;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--purple-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(17, 33, 66, 0.22);
}

.btn-close-popup {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-dark);
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
}

.btn-close-popup:hover {
  opacity: 1;
}

.popup-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 20px;
}

.tree-badge-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  width: fit-content;
}

.tree-badge-status.status-captured {
  background: #E8F8F0;
  color: #1E8449;
  border: 1px solid #A9DFBF;
}

.tree-badge-status.status-revealed {
  background: #EBF5FB;
  color: #2471A3;
  border: 1px solid #AED6F1;
}

.popup-header h3 {
  font-family: var(--font-epilogue);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 2px 0 0 0;
}

.tree-coords-minimal {
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--purple-accent);
  letter-spacing: 0.5px;
}

.tree-desc-short {
  font-size: 0.78rem;
  font-style: italic;
  color: rgba(17, 33, 66, 0.85);
  line-height: 1.35;
  margin: 0;
}

.tree-popup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(17, 33, 66, 0.08);
}

.tree-address-minimal {
  font-size: 0.72rem;
  color: rgba(17, 33, 66, 0.7);
  font-weight: 500;
}

.tree-badge-texture {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1E8449;
  background: #E8F8F0;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid #A9DFBF;
}

.btn-mini-go-camera {
  padding: 6px 14px;
  font-size: 0.75rem;
  border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   4. PIE HUD Y ENLACE DE REDES (Dentro del Traductor de Glifos)
   -------------------------------------------------------------------------- */

.map-hud-footer {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 2px 2px 2px;
  border-top: 1px solid rgba(17, 33, 66, 0.08);
  box-sizing: border-box;
  flex-shrink: 0;
  margin-top: 4px;
}

.map-lore-quote {
  font-size: 0.74rem;
  line-height: 1.35;
  font-style: italic;
  color: rgba(17, 33, 66, 0.78);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: 0.15px;
  flex: 1;
}

.link-instagram-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(17, 33, 66, 0.15);
  color: var(--navy-dark);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.link-instagram-pill:hover {
  background: rgba(255, 255, 255, 0.75);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   5. OVERLAY MODAL: SINTONIZADOR DE GLIFOS
   -------------------------------------------------------------------------- */

.glyph-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
}

.glyph-modal-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

.glyph-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 42, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fadeInModalBackdrop 0.25s ease;
}

@keyframes fadeInModalBackdrop {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.glyph-modal-dialog {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(230, 233, 244, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid rgba(255, 255, 255, 0.88);
  border-top-color: rgba(255, 255, 255, 0.98);
  border-left-color: rgba(255, 255, 255, 0.95);
  /* blob */
  --br-x1: 18%;
  --br-x2: 12%;
  --br-y1: 14%;
  --br-y2: 10%;
  border-radius: var(--br-x1) var(--br-x2) / var(--br-y1) var(--br-y2);
  box-shadow:
    0 24px 60px -12px rgba(17, 33, 66, 0.35),
    inset 1px 1px 2px 0 rgba(255, 255, 255, 0.95),
    inset -1px -1px 3px 0 rgba(17, 33, 66, 0.08);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
  animation: popInModal 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes popInModal {
  from {
    transform: scale(0.9) translateY(12px);
    opacity: 0;
  }

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

.glyph-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(17, 33, 66, 0.09);
}

.glyph-modal-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--purple-accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.glyph-modal-title {
  font-family: var(--font-epilogue);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin: 1px 0 0 0;
}

.btn-close-glyph-modal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: var(--navy-dark);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(17, 33, 66, 0.08);
}

.btn-close-glyph-modal:hover {
  background: var(--navy-dark);
  color: #FFFFFF;
}

.glyph-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Display de Secuencia de Glifos */
.glyph-display-wrapper {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 72px;
  box-shadow: inset 0 2px 6px rgba(17, 33, 66, 0.06);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glyph-sequence-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.glyph-empty-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 12px;
  border: 1.5px dashed rgba(66, 46, 143, 0.35);
  border-radius: 16px;
  color: rgba(17, 33, 66, 0.55);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
}

.glyph-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--purple-accent);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(66, 46, 143, 0.16);
}

.glyph-slot:hover {
  transform: translateY(-2px) scale(1.05);
}

.glyph-slot-img {
  width: 32px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
}

.glyph-display-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-glyph-action {
  background: rgba(17, 33, 66, 0.08);
  border: 1px solid rgba(17, 33, 66, 0.15);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--navy-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-glyph-action:hover {
  background: var(--navy-dark);
  color: #FFFFFF;
}

/* Mensajes de Estado */
.glyph-status-message {
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 600;
  min-height: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.glyph-status-message.success {
  color: #1B7A52;
}

.glyph-status-message.error {
  color: #C0392B;
}

.glyph-status-message.info {
  color: var(--purple-accent);
}

/* Botón Decodificar */
.btn-decode-pill {
  width: 100%;
  padding: 12px 18px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-decode-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Teclado de 12 Glifos */
.glyph-keypad-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.glyph-keypad-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

@media (max-width: 380px) {
  .glyph-keypad-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
}

.glyph-key-btn {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(17, 33, 66, 0.06);
}

.glyph-key-btn:hover {
  transform: translateY(-2px) scale(1.06);
  background: #FFFFFF;
  border-color: var(--purple-accent);
  box-shadow: 0 6px 14px rgba(66, 46, 143, 0.2);
}

.glyph-key-btn:active {
  transform: scale(0.92);
}

.glyph-icon-box {
  width: 36px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glyph-svg-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(17, 33, 66, 0.2));
}


/* --------------------------------------------------------------------------
   7. MICRO-ANIMACIONES
   -------------------------------------------------------------------------- */

.pop-in {
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.shake-error {
  animation: shakeError 0.45s ease-in-out;
}

.flash-success {
  animation: flashSuccess 0.8s ease-out;
}

@keyframes popIn {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shakeError {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

@keyframes flashSuccess {
  0% {
    border-color: #27AE60;
    box-shadow: 0 0 18px rgba(39, 174, 96, 0.45);
  }

  100% {
    border-color: rgba(255, 255, 255, 0.85);
    box-shadow: none;
  }
}