/* Interactive dungeon map — match Battler map scene (floor 1) */

.map-page.map-page--dungeon {
  --map-ink: #0c0812;
  --map-veil: rgba(8, 4, 14, 0.55);
  background-color: var(--map-ink);
  background-image:
    linear-gradient(180deg, rgba(10, 6, 16, 0.35) 0%, rgba(8, 4, 14, 0.72) 100%),
    url("../assets/images/bg-title-grid-0000.png");
  background-size: auto, 480px 480px;
  background-position: center, center;
  background-repeat: no-repeat, repeat;
  background-attachment: fixed, fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.page--dungeon {
  min-height: calc(100vh - var(--nav-h));
  min-height: calc(100dvh - var(--nav-h));
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
}

.dungeon-map {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

/* Soft top vignette like map-top-layer */
.dungeon-map__veil {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--nav-h);
  height: min(42vh, 360px);
  background:
    linear-gradient(180deg, rgba(5, 3, 8, 0.65) 0%, transparent 70%),
    url("../assets/images/map-top-layer-0000.png") center top / min(1400px, 160%) auto no-repeat;
  opacity: 0.55;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: soft-light;
}

/* Bottom FG trees strip (mapfab-f1bottomfgtrees) */
.dungeon-map__fg {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(22vh, 170px);
  background:
    linear-gradient(180deg, transparent 0%, rgba(5, 3, 8, 0.35) 40%, rgba(5, 3, 8, 0.7) 100%),
    url("../assets/images/mapfab-f1bottomfgtrees-0000.png") center bottom / cover no-repeat;
  pointer-events: none;
  z-index: 4;
  image-rendering: auto;
}

.dungeon-map__controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.1rem 0.25rem;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  z-index: 6;
  position: relative;
}

.dungeon-map__title-link {
  color: var(--bone);
  text-shadow: 0 2px 8px #000, 0 0 12px rgba(0, 229, 224, 0.25);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.dungeon-map__title-link:hover {
  color: var(--cyan);
}

.dungeon-map__regen {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--bone);
  background: transparent;
  border: 0;
  border-bottom: 2px solid rgba(255, 42, 168, 0.55);
  border-radius: 0;
  padding: 0.1rem 0.15rem;
  cursor: pointer;
  text-shadow: 0 2px 6px #000;
  box-shadow: none;
}

.dungeon-map__regen:hover {
  color: var(--pink-soft);
  border-bottom-color: var(--cyan);
}

.dungeon-map__scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  padding: 0.15rem 1rem 0;
  cursor: grab;
  z-index: 1;
  scrollbar-color: rgba(0, 229, 224, 0.35) transparent;
}

.dungeon-map__scroll:active {
  cursor: grabbing;
}

.dungeon-map__stage {
  position: relative;
  margin: 0.5rem auto 0;
  background: transparent;
  border-radius: 0;
}

.dungeon-map__decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.dungeon-map__decor--back {
  z-index: 0;
}

.dungeon-map__decor--mid {
  z-index: 2;
}

.dungeon-map__decor--front {
  z-index: 5;
}

.dungeon-map__decor img {
  position: absolute;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.65));
  image-rendering: auto;
  will-change: transform;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

.dungeon-map__decor img[data-fab="tree"] {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.75));
}

.dungeon-map__decor img[data-fab="grave"] {
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.7));
}

.dungeon-map__decor img.is-fog {
  filter: none;
  mix-blend-mode: screen;
  animation: map-fog-drift 18s ease-in-out infinite alternate;
}

.dungeon-map__decor img.is-fog:nth-child(3n) {
  animation-duration: 22s;
  animation-delay: -4s;
}

.dungeon-map__decor img.is-fog:nth-child(3n + 1) {
  animation-duration: 26s;
  animation-delay: -9s;
}

.dungeon-map__decor img.is-crow {
  animation: map-crow-bob 4.5s ease-in-out infinite;
}

.dungeon-map__paths {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.dungeon-map__path {
  position: absolute;
  height: 28px;
  object-fit: fill;
  opacity: 0.55;
  image-rendering: auto;
  transform-origin: center center;
  -webkit-user-drag: none;
  user-select: none;
}

.dungeon-map__path.is-lit {
  opacity: 0.95;
  filter: drop-shadow(0 0 6px rgba(0, 229, 224, 0.45));
}

.dungeon-map__nodes {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.dungeon-map__node {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
  transition: transform 0.15s var(--ease), filter 0.15s;
}

.dungeon-map__node img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.dungeon-map__node:disabled {
  cursor: default;
  opacity: 0.55;
  filter: grayscale(0.25) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.dungeon-map__node.is-available:not(:disabled) {
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(0, 229, 224, 0.55));
  animation: node-pulse 2s ease-in-out infinite;
}

.dungeon-map__node.is-available:not(:disabled):hover {
  transform: scale(1.08);
}

.dungeon-map__node.is-current {
  opacity: 1;
  filter: drop-shadow(0 0 14px rgba(255, 42, 168, 0.55));
}

.dungeon-map__node.is-complete:not(.is-current) {
  opacity: 0.85;
}

.dungeon-map__node.is-locked,
.dungeon-map__node.is-teaser {
  opacity: 0.38;
  filter: grayscale(0.85) brightness(0.75) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
  cursor: not-allowed;
}

.dungeon-map__node.is-teaser:hover {
  transform: none;
  opacity: 0.48;
}

.dungeon-map__node.is-teaser-pulse {
  animation: teaser-shake 0.45s ease;
}

@keyframes teaser-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

.dungeon-map__path.is-teaser-path {
  opacity: 0.28;
  filter: grayscale(1) brightness(0.7);
}

.dungeon-map__spawn {
  position: absolute !important;
  width: 120% !important;
  height: auto !important;
  bottom: 20%;
  left: -115%;
  z-index: -1;
  opacity: 0.9;
}

.dungeon-map__tag {
  position: absolute;
  left: 50%;
  bottom: -1.15rem;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--bone);
  text-shadow: 0 2px 6px #000;
  pointer-events: none;
  user-select: none;
}

.dungeon-map__pawn {
  position: absolute;
  width: 145px;
  height: 250px;
  z-index: 4;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.7));
  transition: left 0.28s var(--ease), top 0.28s var(--ease);
}

.dungeon-map__pawn.is-moving {
  filter: drop-shadow(0 0 14px rgba(0, 229, 224, 0.65));
}

.dungeon-map__tooltip {
  position: fixed;
  left: 50%;
  bottom: min(10vh, 88px);
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  padding: 0.55rem 1.25rem 0.7rem;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--bone);
  background: rgba(8, 4, 14, 0.82);
  border: 0;
  border-top: 2px solid rgba(0, 229, 224, 0.35);
  border-bottom: 2px solid rgba(255, 42, 168, 0.35);
  border-radius: 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  max-width: 560px;
  width: calc(100% - 2rem);
  text-shadow: 0 2px 6px #000;
  pointer-events: none;
}

@keyframes node-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 10px rgba(0, 229, 224, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(0, 229, 224, 0.75));
  }
}

@keyframes map-fog-drift {
  from {
    transform: translate3d(-10px, 0, 0);
  }
  to {
    transform: translate3d(14px, -6px, 0);
  }
}

@keyframes map-crow-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@media (max-width: 700px) {
  .dungeon-map__tag {
    font-size: 1.05rem;
  }

  .dungeon-map__tooltip {
    font-size: 1.15rem;
  }

  .dungeon-map__fg {
    height: min(18vh, 130px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dungeon-map__node.is-available:not(:disabled) {
    animation: none;
  }

  .dungeon-map__pawn {
    transition: none;
  }

  .dungeon-map__decor img.is-fog,
  .dungeon-map__decor img.is-crow {
    animation: none;
  }
}
