/* HUMANIDAD — Mundo como mapa a pantalla completa (móvil).
   El globo ocupa toda la pantalla entre la barra «Mapa · Muro» y la barra inferior. Las capas quedan
   arriba, los controles del globo a la derecha y el viaje en el tiempo abajo, siempre a mano.
   Lugares, conexiones, regiones y orígenes viven en una hoja que sube desde abajo.
   Todo cuelga de html.mmv-on, que agrega mundo-mapa-v1.js solo en pantallas de hasta 820 px.
   El modo Muro no cambia. */

html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) {
  --mmv-gap: 10px;
  --mmv-time-h: 168px;
  overflow: hidden !important;
}

/* El escenario queda fijo a la pantalla: no hay página que desplazar. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-stage {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  /* Alto y posición en píxeles medidos por mundo-mapa-v1.js. --mmv-shift compensa si un ancestro
     se vuelve el bloque contenedor del escenario (pasa en Safari de iPhone): así el mapa no depende
     de qué elemento resuelve «fixed». */
  top: calc(var(--mmv-top, 64px) + var(--mmv-shift, 0px)) !important;
  bottom: auto !important;
  width: auto !important;
  height: var(--mmv-h, calc(100vh - var(--mmv-top, 64px) - var(--hxn-bar-reserve, 74px))) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  display: block !important;
  z-index: 2;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-cosmos {
  position: absolute !important;
  inset: 0 !important;
}

/* Globo: todo el alto, desde arriba de la pantalla (debajo de «Mapa · Muro» y las capas, que flotan)
   hasta el viaje en el tiempo. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-globe-wrap {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  /* El centro del globo cae en el medio del espacio libre (entre las capas flotantes y el tiempo),
     no en el medio de la pantalla: el lienzo sigue hacia abajo, por detrás de la tarjeta del tiempo,
     tanto como ocupan arriba los controles flotantes (--mmv-free-top, medido). */
  bottom: calc(var(--mmv-time-h) + var(--mmv-gap) - var(--mmv-free-top, 110px)) !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
  touch-action: none;
}

/* Capas: una cápsula de vidrio centrada que flota sobre el globo, debajo de «Mapa · Muro».
   --mmv-float es la distancia desde el borde del mapa hasta el pie de «Mapa · Muro» (medida). */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-header {
  position: absolute !important;
  left: 12px !important;
  right: 12px !important;
  top: calc(var(--mmv-float, 58px) + 8px) !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 6 !important;
  display: flex !important;
  justify-content: center !important;
  pointer-events: none;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-header-copy { display: none !important; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-header .mp-layers {
  pointer-events: auto;
  display: inline-flex !important;
  align-self: center !important;
  gap: 2px !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 4px !important;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid rgba(146, 172, 214, .18) !important;
  border-radius: 999px !important;
  background: rgba(7, 15, 30, .46) !important;
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28) !important;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-header .mp-layers::-webkit-scrollbar { display: none; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-header .mp-layer-btn { border-radius: 999px !important; white-space: nowrap; }

/* «Mapa · Muro» flota sobre el globo: misma posición de siempre, ahora como vidrio sobre el mapa. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mpw-switch {
  z-index: 30 !important;
  border-color: rgba(146, 172, 214, .22) !important;
  background: rgba(9, 22, 44, .52) !important;
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .32);
}

/* Controles del globo: columna a la derecha, debajo de las capas. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-dock {
  position: absolute !important;
  right: 10px !important;
  left: auto !important;
  top: calc(var(--mmv-float, 58px) + 66px) !important;
  bottom: auto !important;
  transform: none !important;
  width: 46px !important;
  margin: 0 !important;
  padding: 6px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 2px !important;
  border-radius: 23px !important;
  z-index: 4;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-dock .mp-dock-sep { width: 22px !important; height: 1px !important; margin: 3px 0 !important; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-dock .mp-dock-zoom { display: none !important; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-dock .mp-dock-btn { width: 40px !important; height: 40px !important; min-width: 40px !important; }

/* Viaje en el tiempo: la tarjeta protagonista, siempre visible abajo. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline {
  position: absolute !important;
  left: var(--mmv-gap) !important;
  right: var(--mmv-gap) !important;
  bottom: var(--mmv-gap) !important;
  top: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 12px 14px 12px !important;
  box-sizing: border-box !important;
  z-index: 7 !important;
  border-radius: 22px !important;
  background: linear-gradient(180deg, rgba(14, 26, 46, .92), rgba(8, 15, 28, .96)) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35) !important;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline-top {
  display: flex !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  gap: 10px !important;
  margin: 0 0 4px !important;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline-top .humanity-product-eyebrow { display: none !important; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline-year {
  font-size: 34px !important;
  line-height: 1 !important;
  margin: 0 !important;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline-era {
  display: block !important;
  margin: 0 !important;
  text-align: right !important;
  font-size: 13px !important;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline-slider { margin: 4px 0 2px !important; width: 100% !important; }

/* Las marcas del tiempo son botones: un toque lleva a esa época. */
html.mmv-on #familyView .account-view[data-view="mundo"] .mp-timeline-marks .mmv-mark {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  padding: 8px 4px;
  margin: -6px -4px;
  min-height: 32px;
  cursor: pointer;
  border-radius: 10px;
}
html.mmv-on #familyView .account-view[data-view="mundo"] .mp-timeline-marks .mmv-mark[aria-pressed="true"] { color: #e8c46c; font-weight: 700; }

/* Fila de acciones dentro de la tarjeta del tiempo. */
.mmv-actions { display: none; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mmv-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mmv-actions #mundoPreviewFamilyEraBtn {
  flex: 1 1 auto;
  min-height: 44px !important;
  margin: 0 !important;
  width: auto !important;
}
.mmv-sheet-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(232, 196, 108, .35);
  background: rgba(232, 196, 108, .08);
  color: #f3e7c4;
  font: 600 14px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.mmv-sheet-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.mmv-sheet-toggle .mmv-count { color: #e8c46c; }

/* Hoja de exploración: lugares, conexiones, regiones, orígenes y ajustes. */
.mmv-sheet { display: none; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mmv-sheet {
  display: flex;
  flex-direction: column;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(78%, 640px);
  z-index: 8 !important;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #101d33, #0a1324);
  border-top: 1px solid rgba(204, 222, 245, .12);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .5);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mmv-sheet[data-open="true"] {
  transform: none;
  visibility: visible;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.mmv-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 8px;
  touch-action: none;
}
.mmv-sheet-grip {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  border-radius: 2px;
  background: rgba(204, 222, 245, .3);
}
.mmv-sheet-title { margin: 8px 0 0; color: #f3f0e9; font: 600 20px/1.15 "Playfair Display", Georgia, serif; }
.mmv-sheet-close {
  margin-top: 6px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgba(204, 222, 245, .16);
  background: rgba(255, 255, 255, .04);
  color: #dfe6f1;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.mmv-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 14px 24px;
}
.mmv-sheet-section + .mmv-sheet-section { margin-top: 18px; }
.mmv-sheet-kicker { margin: 0 0 8px; color: #e8c46c; font: 700 11px/1.2 Inter, system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase; }

/* Lo que se muda a la hoja pierde su posicionamiento de escritorio. */
html.mmv-on .mmv-sheet .mp-context,
html.mmv-on .mmv-sheet .mp-tools,
html.mmv-on .mmv-sheet .mp-fine,
html.mmv-on .mmv-sheet .mp-solar,
html.mmv-on .mmv-sheet .mp-region-explorer,
html.mmv-on .mmv-sheet #mundoOriginsEntry {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
}
html.mmv-on .mmv-sheet .mp-tools { display: flex !important; flex-direction: column; gap: 8px; }
html.mmv-on .mmv-sheet .mp-tools-head { display: none !important; }
html.mmv-on .mmv-sheet .mp-region-explorer { padding: 0 !important; }
html.mmv-on .mmv-sheet .mp-solar { display: flex !important; }

/* Ficha de un lugar o una ruta: por encima del tiempo y de la hoja. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-panel { z-index: 9 !important; }

/* Mientras la hoja está abierta, el mapa queda detrás, atenuado. */
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-stage.mmv-sheet-open .mp-globe-wrap,
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-stage.mmv-sheet-open .mp-timeline,
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-stage.mmv-sheet-open .mp-dock { filter: brightness(.55); }

@media (prefers-reduced-motion: reduce) {
  html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet { transition: none !important; }
}

/* Ajustes de tamaño (las reglas generales de títulos de la cuenta son más fuertes). */
html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet .mmv-sheet-title { font-size: 21px !important; line-height: 1.15 !important; margin: 8px 0 0 !important; letter-spacing: -.01em !important; }
html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet .mp-region-title { font-size: 19px !important; margin: 2px 0 4px !important; }
html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet .mp-region-head { margin: 0 0 10px !important; }
html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet .mp-tools .mp-tool-btn { width: 100% !important; max-width: none !important; min-height: 44px !important; margin: 0 !important; flex: none !important; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline .mp-timeline-top > div:first-child { flex: 0 0 auto !important; }
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .mp-timeline .mp-timeline-era { flex: 1 1 auto !important; max-width: none !important; width: auto !important; min-width: 0 !important; }
html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet .mp-tools { display: block !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; grid-template-columns: none !important; }
html.mmv-on #familyView .account-view[data-view="mundo"] .mmv-sheet .mp-tools .mp-tool-btn + * { margin-top: 10px !important; }

/* Con el mapa fijo, la vista llega exactamente hasta la barra inferior (alto medido) y un margen
   negativo (en línea, desde el JS) absorbe el relleno inferior del contenedor: no deja página que desplazar y, si Safari de iPhone recorta el escenario con el overflow de la vista
   (lo hace con elementos «fixed» dentro de #socialMain), el recorte cae donde termina el mapa.
   Antes la vista medía solo «Mapa · Muro» y su relleno, y el mapa quedaba en una franja. */
html.mmv-on #familyView .account-view.humanity-product-v1.active[data-view="mundo"]:not(.mpw-wall-active),
html.mmv-on body #familyView#familyView .account-view.humanity-product-v1.active[data-view="mundo"]:not(.mpw-wall-active) {
  min-height: 0 !important;
  height: var(--mmv-view-h, auto) !important;
  max-height: none !important;
  padding-bottom: 0 !important;
}
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .humanity-product-shell,
html.mmv-on #familyView .account-view[data-view="mundo"].active:not(.mpw-wall-active) .humanity-product-workspace.mp-workspace {
  min-height: 0 !important;
  height: auto !important;
  padding-bottom: 0 !important;
}
html.mmv-on #accountModal .hrc-account-content:has(.account-view[data-view="mundo"].active:not(.mpw-wall-active)) { min-height: 0 !important; padding-bottom: 0 !important; }

/* Sonda de mundo-mapa-v1.js: un punto fijo en 0,0 que revela si un ancestro desplaza los «fixed». */
#familyView .mmv-anchor { position: fixed !important; top: 0 !important; left: 0 !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; visibility: hidden !important; pointer-events: none !important; }

/* ───── «Orígenes humanos» como sala de museo, dentro de la hoja ───── */
#mundoOriginsEntry .mmv-oh { display: none !important; }
html.mmv-on body #accountModal #familyView#familyView .account-view[data-view="mundo"] #mundoMapaSheet #mundoOriginsEntry {
  position: relative !important;
  isolation: isolate;
  display: block !important;
  width: 100% !important;
  min-height: 214px;
  margin: 12px 0 0 !important;
  padding: 22px 20px 20px !important;
  overflow: hidden !important;
  text-align: left !important;
  border: 1px solid rgba(230, 191, 106, .4) !important;
  border-radius: 22px !important;
  background:
    radial-gradient(120% 90% at 92% 8%, rgba(214, 140, 66, .34), transparent 52%),
    radial-gradient(90% 70% at 0% 100%, rgba(52, 86, 140, .22), transparent 60%),
    linear-gradient(158deg, #1d1813 0%, #121624 58%, #0b1020 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 241, 214, .08), 0 18px 40px rgba(0, 0, 0, .36) !important;
  color: #f6efe1 !important;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh { display: block !important; }
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh-art {
  position: absolute !important; right: -46px; top: -40px; width: 210px; height: 210px; z-index: -1; opacity: .95; pointer-events: none;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh-art svg { width: 100%; height: 100%; display: block; }
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh-eyebrow {
  margin: 0 0 12px !important; color: #e6bf6a !important; font: 700 11px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif !important; letter-spacing: .18em; text-transform: uppercase;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry > strong {
  display: block !important; max-width: 78%; margin: 0 !important; color: #f8f1e3 !important;
  font: 500 31px/1.04 "Playfair Display", Georgia, serif !important; letter-spacing: -.015em;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry > strong + span {
  display: block !important; max-width: 74%; margin: 10px 0 0 !important; color: rgba(238, 230, 214, .78) !important;
  font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif !important;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh-chips {
  display: flex !important; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 58px); margin: 18px 0 0 !important;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh-chip {
  display: inline-block !important; margin: 0 !important; padding: 5px 10px; border: 1px solid rgba(230, 191, 106, .28); border-radius: 999px;
  background: rgba(10, 14, 24, .38); color: #e9dcc0 !important; font: 500 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif !important;
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry .mmv-oh-go {
  position: absolute !important; right: 18px; bottom: 18px; width: 44px; height: 44px; margin: 0 !important; border-radius: 50%;
  display: grid !important; place-items: center; background: #e6bf6a; color: #1a1408 !important;
  font: 600 20px/1 system-ui, -apple-system, sans-serif !important; box-shadow: 0 8px 22px rgba(230, 191, 106, .35);
}
html.mmv-on body #accountModal #familyView#familyView #mundoMapaSheet #mundoOriginsEntry:active { transform: scale(.985) !important; }
