/* === Map Container === */
.map-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Let tooltips render outside the image bounds if needed */
  overflow: visible;
  max-height: none;
  background-color: transparent; /* ✅ no black bar behind image */
}

/* === Image Wrapper (anchor for nodes) === */
.map-image-wrapper {
  position: relative;   /* ✅ nodes & tooltip positioned relative to this */
  display: inline-block;
  width: auto;          /* ✅ let image define width */
  height: auto;         /* ✅ let image define height */
  max-width: 100%;      /* ✅ responsive scaling */
  z-index: 10;          /* ✅ force map above backdrop layers */
}

/* === Map Image === */
.map-image {
  display: block;
  max-width: 100%;      /* ✅ scale down if container is smaller */
  height: auto;         /* ✅ preserve aspect ratio */
  object-fit: contain;
  margin: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4); /* ✅ optional depth */
  position: relative;
  z-index: 10;          /* ✅ ensure image is above backdrops */
  /* border: 3px solid red; 🔧 removed debug border */
}

/* === Backdrop Layers === */
#nodeBackdropImage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  background-color: #000;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.001);
  z-index: -1;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}

#nodeBackdropVideo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  transform: scale(1.001);
  z-index: -1;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}

/* === Map Nodes & Tooltip === */
.map-node {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  transform: translate(-50%, -50%); /* ✅ center node on anchor */
  transition: opacity 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  will-change: transform, box-shadow, opacity;
  opacity: 0;                /* 🔽 invisible by default */
  background-color: transparent;
  z-index: 20;               /* ✅ ensure nodes are above the map image */
}

.map-node:hover {
  opacity: 1;                /* 🔼 reveal on hover */
  background-color: #00ffff55;
  box-shadow: 0 0 10px #00ffffcc, 0 0 20px #00ffff88;
  transform: translate(-50%, -50%) scale(1.2);
}

.map-node.active {
  opacity: 1;                /* 🔼 active node always visible */
  background-color: #00ffffaa;
  animation: pulse 1.5s infinite;
  z-index: 25;               /* ✅ active node above others */
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 4px #00ffff55, 0 0 12px #00ffffcc; }
  50%  { box-shadow: 0 0 0 6px #00ffff88, 0 0 18px #00ffffee; }
  100% { box-shadow: 0 0 0 4px #00ffff55, 0 0 12px #00ffffcc; }
}

.tooltip {
  position: absolute; /* ✅ positioned relative to map-image-wrapper */
  background-color: rgba(255, 255, 255, 0.08);
  color: inherit; /* ✅ follow global font color */
  font-family: 'MapleStory', 'Segoe UI', sans-serif;
  padding: 0.4em 0.6em;
  border-radius: 5px;
  font-size: 0.85em;
  display: none;
  z-index: 30; /* ✅ tooltip above nodes */
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: opacity 0.15s ease, transform 0.1s ease;
  will-change: transform, top, left, opacity;
}

.tooltip strong {
  font-weight: 600;
  color: inherit;
}

.tooltip-bgm {
  display: block;
  font-size: 0.75em;
  opacity: 0.7;
  margin-top: 2px;
  position: relative;
  padding-left: 1.2em; /* space for icon */
}

.tooltip-bgm::before {
  content: "♪"; /* 🎵 music note icon */
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.9em;
  opacity: 0.8;
}

/* === Preview Node (logger mode) === */
.map-node.preview {
  width: 24px;
  height: 24px;
  background-color: #ff00ffaa;
  box-shadow: 0 0 12px #ff00ffcc, 0 0 24px #ff00ff88;
  z-index: 999;
  opacity: 1;
}

/* === Logger Mode Overrides === */
body.logger-mode .map-node {
  pointer-events: none;
  opacity: 0.5;
}

/* === Hide Map Toggle === */
.map-container.map-hidden .map-image {
  display: none;
}
.map-container.map-hidden .map-node {
  display: none;
}
