:root{
  --mw-card-bg: rgba(255,255,255,.03);
  --mw-border: rgba(255,255,255,.12);
  --mw-muted: rgba(255,255,255,.70);
}

/* IMPORTANT: index.html uses .magic-map-section (not .magic-map) */
.magic-map-section{
  margin: 18px 0 34px;
}

/* Keep the module within the page container and never overflow viewport */
.magic-map-section .magic-card{
  border: 1px solid var(--mw-border);
  border-radius: 22px;
  padding: 18px 18px 16px;
  background: var(--mw-card-bg);
  box-shadow: 0 18px 48px rgba(0,0,0,.40);
  max-width: 980px;
  margin: 0 auto;
  box-sizing: border-box;
}

.magic-map-section .magic-title{
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.1;
}

.magic-map-section .magic-sub{
  margin: 0 0 14px;
  color: var(--mw-muted);
  font-size: 14px;
}

/* Globe shell */
.magic-map-section .globe-shell{
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  overflow: hidden;
  background: rgba(0,0,0,0.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
}

.magic-status{
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 2;
  font-size: 14px;
  opacity: 0.9;
  pointer-events: none;
}

/* Responsive height: large on desktop, compact on mobile */
.magic-map-section .globe-mount{
  width: 100%;
  height: clamp(300px, 46vh, 560px);
  position: relative;
  touch-action: none;
}

.magic-map-section .globe-mount canvas{
  display:block;
  width: 100%;
  height: 100%;
}

/* Controls */
.magic-map-section .controls{
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.magic-map-section label{
  color: var(--mw-muted);
  font-size: 14px;
}

.magic-map-section select{
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--mw-border);
  background: rgba(255,255,255,.06);
  color: #fff;
  padding: 0 14px;
  outline: none;
  box-sizing: border-box;
}

.magic-map-section option{
  background: #0d0d0d;
  color: #fff;
}

.magic-map-section .story{
  margin-top: 12px;
  border: 1px solid var(--mw-border);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.03);
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.magic-map-section .story h4{
  margin: 0 0 6px;
  font-size: 16px;
}

.magic-map-section .story p{
  margin: 0;
  color: var(--mw-muted);
  font-size: 14px;
}

/* --- Location Media Gallery --- */

.location-media{
  margin-top:14px;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap:10px;
}

.location-media img{
  width:100%;
  height:auto;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
}

.location-media video{
  width:100%;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
}

.location-slider{
  position:relative;
  overflow:hidden;
}

.location-slider img,
.location-slider video{
  width:100%;
  border-radius:10px;
  display:none;
}

.location-slider img.active,
.location-slider video.active{
  display:block;
}

.slider-nav{
  display:flex;
  justify-content:center;
  gap:6px;
  margin-top:8px;
}

.slider-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#666;
  cursor:pointer;
}

.slider-dot.active{
  background:#fff;
}

/* Footer hint only (no duplicate hint injected by JS) */
.magic-map-section .hint{
  margin-top: 10px;
  color: var(--mw-muted);
  font-size: 12px;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

/* Mobile: stack label + dropdown and keep the card inside viewport */
@media (max-width: 820px){
  .magic-map-section .controls{ grid-template-columns: 1fr; }
}

@media (max-width: 520px){
  .magic-map-section{ margin: 14px 0 26px; }
  .magic-map-section .magic-card{
    padding: 14px 12px 12px;
    border-radius: 18px;
  }
  .magic-map-section .magic-title{ font-size: 22px; }
  .magic-map-section .globe-mount{ height: 320px; }
}

.worldmap-lightbox{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.worldmap-lightbox.is-open{
  display: flex;
}

.worldmap-lightbox-stage{
  width: min(92vw, 1200px);
  height: min(86vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  user-select: none;
}

.worldmap-lightbox-image{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.worldmap-lightbox-close{
  position: absolute;
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.worldmap-lightbox-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.worldmap-lightbox-arrow.prev{
  left: 18px;
}

.worldmap-lightbox-arrow.next{
  right: 18px;
}

.worldmap-lightbox-arrow:disabled{
  opacity: .35;
  cursor: default;
}

body.worldmap-lightbox-open{
  overflow: hidden;
}

@media (max-width: 720px){
  .worldmap-lightbox{
    padding: 14px;
  }

  .worldmap-lightbox-stage{
    width: 100%;
    height: 78vh;
  }

  .worldmap-lightbox-arrow{
    width: 46px;
    height: 46px;
    font-size: 30px;
  }

  .worldmap-lightbox-arrow.prev{
    left: 10px;
  }

  .worldmap-lightbox-arrow.next{
    right: 10px;
  }

  .worldmap-lightbox-close{
    top: 10px;
    right: 10px;
  }
}