/* ============================================================================
   POKÉSPIRE · HD-2D 3D TABLETOP DIORAMA ROUTE MAP (60-120FPS GPU-OPTIMIZED)
   - Octopath-inspired HD-2D pixel-art diorama with 3 biome themes (Acts 1-3)
   - Zero per-prop CSS drop-shadow / backdrop-filter / mix-blend-mode stalls
   - Full-hitbox 3D-elevated node pedestals + upright icon billboards
   - Rich forest storytelling: wildflowers, stumps, mushrooms, signposts,
     fences, forest ponds, wild animated Pokémon & hidden route items
   ============================================================================ */

/* Hide legacy scenic backdrop on Map screen */
body:has(#app[data-screen="map"]) #bg-stage {
  display: none !important;
}

/* Truly floating top HUD on Map screen (clicks pass through empty space) */
#app[data-screen="map"] > .run-hud,
#app[data-screen="map"] > .run-hud.pa-live-hud {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 260 !important;
  pointer-events: none !important;
}

#app[data-screen="map"] > .run-stage {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* Full-bleed 3D Diorama Viewport — Biome Atmospheres */
#app .atlas-screen.hd2d-atlas-screen {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: radial-gradient(ellipse 110% 80% at 50% 24%, #2d4c3b 0%, #1c3127 56%, #111e18 100%) !important;
  display: block !important;
  user-select: none;
  -webkit-user-select: none;
}

#app .atlas-screen.hd2d-atlas-screen[data-act="2"] {
  background: radial-gradient(ellipse 110% 80% at 50% 24%, #573620 0%, #331f14 56%, #1c100b 100%) !important;
}

#app .atlas-screen.hd2d-atlas-screen[data-act="3"] {
  background: radial-gradient(ellipse 110% 80% at 50% 24%, #2a4254 0%, #192836 56%, #0f1822 100%) !important;
}

/* 3D Camera Perspective Container */
.hd2d-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
  perspective: 980px;
  perspective-origin: 50% 42%;
  cursor: grab;
  touch-action: none;
}

.hd2d-viewport.is-dragging {
  cursor: grabbing;
}

/* Ambient Floating HD-2D Particle Canvas (Pre-rendered sprite stamps, 30fps) */
.hd2d-atmosphere-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 22;
  pointer-events: none;
}

/* Warm Golden-Hour Sunlight Shafts (Zero mix-blend-mode / zero full-screen animation stall) */
.hd2d-godrays {
  position: absolute;
  inset: 0;
  z-index: 23;
  pointer-events: none;
  background:
    linear-gradient(
      118deg,
      rgba(255, 240, 188, 0.14) 0%,
      rgba(255, 240, 188, 0.05) 16%,
      transparent 28%,
      rgba(255, 244, 198, 0.10) 39%,
      transparent 52%,
      rgba(255, 232, 164, 0.07) 64%,
      transparent 78%
    );
}

.hd2d-atlas-screen[data-act="2"] .hd2d-godrays {
  background:
    linear-gradient(
      118deg,
      rgba(255, 200, 122, 0.16) 0%,
      rgba(255, 184, 98, 0.06) 18%,
      transparent 30%,
      rgba(255, 206, 130, 0.10) 42%,
      transparent 58%,
      rgba(255, 174, 88, 0.06) 70%,
      transparent 84%
    );
}

.hd2d-atlas-screen[data-act="3"] .hd2d-godrays {
  background:
    linear-gradient(
      118deg,
      rgba(202, 236, 255, 0.14) 0%,
      rgba(190, 226, 255, 0.05) 18%,
      transparent 32%,
      rgba(224, 244, 255, 0.09) 45%,
      transparent 60%,
      rgba(182, 220, 255, 0.05) 74%,
      transparent 88%
    );
}

/* HD-2D Atmospheric Horizon Mist & Warm Diorama Vignette (Zero backdrop-filter readback) */
.hd2d-horizon-fog {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background:
    radial-gradient(ellipse 84% 72% at 50% 54%, transparent 56%, rgba(9, 18, 14, 0.42) 100%),
    linear-gradient(
      180deg,
      rgba(218, 238, 212, 0.92) 0%,
      rgba(212, 234, 206, 0.62) 10%,
      rgba(212, 234, 206, 0.22) 20%,
      transparent 33%,
      transparent 84%,
      rgba(14, 26, 20, 0.46) 100%
    );
}

.hd2d-atlas-screen[data-act="2"] .hd2d-horizon-fog {
  background:
    radial-gradient(ellipse 84% 72% at 50% 54%, transparent 56%, rgba(26, 14, 8, 0.46) 100%),
    linear-gradient(
      180deg,
      rgba(248, 224, 184, 0.92) 0%,
      rgba(242, 210, 162, 0.60) 10%,
      rgba(242, 210, 162, 0.20) 20%,
      transparent 33%,
      transparent 84%,
      rgba(28, 15, 9, 0.50) 100%
    );
}

.hd2d-atlas-screen[data-act="3"] .hd2d-horizon-fog {
  background:
    radial-gradient(ellipse 84% 72% at 50% 54%, transparent 56%, rgba(10, 18, 28, 0.48) 100%),
    linear-gradient(
      180deg,
      rgba(216, 236, 248, 0.94) 0%,
      rgba(196, 224, 240, 0.62) 10%,
      rgba(196, 224, 240, 0.22) 20%,
      transparent 33%,
      transparent 84%,
      rgba(12, 22, 32, 0.50) 100%
    );
}

/* 3D Camera Rig: locked 52° tabletop diorama angle, pans strictly along Y rail */
.hd2d-camera {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1600px;
  transform-style: preserve-3d;
  transform-origin: 50% 0%;
  transform: translate3d(-50%, 0, 0) rotateX(52deg) translate3d(0, var(--hd2d-cam-y, 0px), 0);
  will-change: transform;
}

/* Sculpted HD-2D Tabletop Diorama Board (Tiled Pixel Terrain + Warm Sunlight + 3D Base Rim) */
.hd2d-board {
  position: relative;
  width: 1600px;
  transform-style: preserve-3d;
  border-radius: 30px;
  background-color: #467844;
  background-image:
    radial-gradient(ellipse 64% 40% at 48% 45%, rgba(255, 244, 198, 0.18) 0%, transparent 72%),
    linear-gradient(90deg, rgba(16, 36, 24, 0.34) 0%, transparent 18%, transparent 82%, rgba(16, 36, 24, 0.34) 100%),
    url('../assets/map/hd2d/terrain-act1.png');
  background-size: 100% 100%, 100% 100%, 256px 256px;
  background-repeat: no-repeat, no-repeat, repeat;
  image-rendering: pixelated;
  border: 3px solid rgba(196, 224, 152, 0.35);
  box-shadow:
    0 26px 0 0 #34261b,
    0 32px 0 0 #231912,
    0 46px 90px -8px rgba(0, 0, 0, 0.62),
    inset 0 0 110px rgba(14, 30, 18, 0.38);
}

.hd2d-board[data-act="2"] {
  background-color: #7c6236;
  background-image:
    radial-gradient(ellipse 64% 40% at 48% 45%, rgba(255, 212, 134, 0.22) 0%, transparent 72%),
    linear-gradient(90deg, rgba(38, 20, 12, 0.38) 0%, transparent 18%, transparent 82%, rgba(38, 20, 12, 0.38) 100%),
    url('../assets/map/hd2d/terrain-act2.png');
  border-color: rgba(244, 198, 122, 0.35);
  box-shadow:
    0 26px 0 0 #3f281a,
    0 32px 0 0 #26170e,
    0 46px 90px -8px rgba(0, 0, 0, 0.65),
    inset 0 0 110px rgba(34, 16, 8, 0.42);
}

.hd2d-board[data-act="3"] {
  background-color: #496670;
  background-image:
    radial-gradient(ellipse 64% 40% at 48% 45%, rgba(214, 240, 255, 0.18) 0%, transparent 72%),
    linear-gradient(90deg, rgba(16, 28, 38, 0.38) 0%, transparent 18%, transparent 82%, rgba(16, 28, 38, 0.38) 100%),
    url('../assets/map/hd2d/terrain-act3.png');
  border-color: rgba(188, 224, 242, 0.38);
  box-shadow:
    0 26px 0 0 #283642,
    0 32px 0 0 #18222b,
    0 46px 90px -8px rgba(0, 0, 0, 0.65),
    inset 0 0 110px rgba(12, 22, 34, 0.44);
}

/* Warm dappled sunlight pools across the forest floor */
.hd2d-board::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse 420px 210px at 34% 22%, rgba(255, 245, 190, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 460px 240px at 66% 48%, rgba(255, 240, 180, 0.13) 0%, transparent 70%),
    radial-gradient(ellipse 440px 220px at 42% 78%, rgba(255, 242, 188, 0.15) 0%, transparent 70%);
}

/* ============================================================================
   PIXEL-ART DIRT FOOTPATHS & STEPPING-STONE DASHES (4x Nearest-Neighbor Canvas)
   ============================================================================ */
.hd2d-board .atlas-trails-canvas,
.hd2d-board .atlas-trails-open-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  z-index: 2;
}

.hd2d-board .atlas-trails-open-canvas {
  z-index: 3;
}

/* ============================================================================
   HD-2D UPRIGHT PIXEL-ART DIORAMA PROPS (Zero filter: drop-shadow GPU stall)
   ============================================================================ */
.hd2d-prop {
  position: absolute;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 4;
}

/* Grounded directional shadow cast to bottom-right */
.hd2d-prop-shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 28px;
  transform: translate(-34%, -32%) skewX(24deg);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(12, 26, 18, 0.48) 0%, rgba(12, 26, 18, 0.20) 56%, transparent 78%);
}

/* Upright HD-2D pixel-art standee standing perpendicular to the 52° board */
.hd2d-prop-standee {
  position: absolute;
  left: 50%;
  bottom: 0;
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: 50% 100%;
  transform: translate3d(-50%, 6px, 0) rotateX(-52deg);
}

.hd2d-prop.is-flipped .hd2d-prop-standee {
  transform: translate3d(-50%, 6px, 0) rotateX(-52deg) scaleX(-1);
}

/* Flat ground feature (forest pond) lying flush on the terrain */
.hd2d-prop-flat {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 152px;
  height: 102px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0.94;
}

.hd2d-prop--tree-lg  .hd2d-prop-standee { width: 92px; height: 138px; }
.hd2d-prop--tree-lg  .hd2d-prop-shadow  { width: 82px; height: 32px; }
.hd2d-prop--tree-md  .hd2d-prop-standee { width: 76px; height: 114px; }
.hd2d-prop--tree-md  .hd2d-prop-shadow  { width: 68px; height: 28px; }
.hd2d-prop--tree-sm  .hd2d-prop-standee { width: 60px; height: 90px; }
.hd2d-prop--tree-sm  .hd2d-prop-shadow  { width: 54px; height: 22px; }
.hd2d-prop--oak      .hd2d-prop-standee { width: 96px; height: 124px; }
.hd2d-prop--oak      .hd2d-prop-shadow  { width: 86px; height: 34px; }
.hd2d-prop--bush     .hd2d-prop-standee { width: 54px; height: 40px; }
.hd2d-prop--bush     .hd2d-prop-shadow  { width: 48px; height: 18px; }
.hd2d-prop--rock     .hd2d-prop-standee { width: 54px; height: 40px; }
.hd2d-prop--rock     .hd2d-prop-shadow  { width: 48px; height: 18px; }
.hd2d-prop--flowers  .hd2d-prop-standee { width: 58px; height: 38px; }
.hd2d-prop--flowers  .hd2d-prop-shadow  { width: 46px; height: 16px; opacity: 0.65; }
.hd2d-prop--stump    .hd2d-prop-standee { width: 50px; height: 40px; }
.hd2d-prop--stump    .hd2d-prop-shadow  { width: 46px; height: 18px; }
.hd2d-prop--mushroom .hd2d-prop-standee { width: 42px; height: 38px; }
.hd2d-prop--mushroom .hd2d-prop-shadow  { width: 34px; height: 14px; }
.hd2d-prop--signpost .hd2d-prop-standee { width: 42px; height: 58px; }
.hd2d-prop--signpost .hd2d-prop-shadow  { width: 34px; height: 14px; }
.hd2d-prop--fence    .hd2d-prop-standee { width: 84px; height: 42px; }
.hd2d-prop--fence    .hd2d-prop-shadow  { width: 76px; height: 16px; }
.hd2d-prop--lantern  .hd2d-prop-standee { width: 36px; height: 66px; }
.hd2d-prop--lantern  .hd2d-prop-shadow  { width: 32px; height: 14px; }

/* Living Wild Pokémon Roaming Ecosystem Actors (GPU translate3d, zero reflow) */
.hd2d-wild-actor {
  position: absolute;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
  pointer-events: none;
  will-change: transform;
  z-index: 6;
}

.hd2d-wild-actor .hd2d-prop-standee {
  width: 60px;
  height: 60px;
}

.hd2d-wild-actor .hd2d-prop-shadow {
  width: 42px;
  height: 16px;
}

.hd2d-wild-actor.is-flyer .hd2d-prop-shadow {
  width: 34px;
  height: 12px;
  opacity: 0.62;
}

.hd2d-wild-actor.is-pond .hd2d-prop-standee {
  width: 54px;
  height: 54px;
}

.hd2d-wild-sparkle {
  position: absolute;
  left: 50%;
  bottom: 52px;
  transform: translate3d(-50%, 0, 4px) rotateX(-52deg);
  color: #fef08a;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 0 #b45309;
  pointer-events: none;
}

/* Collectible-style route items (berries, mushrooms, Poké Balls) tucked in clearings */
.hd2d-prop--route-item .hd2d-prop-standee {
  width: 30px;
  height: 30px;
}
.hd2d-prop--route-item .hd2d-prop-shadow {
  width: 24px;
  height: 10px;
}

/* Warm amber point-light pool cast onto the grass by glowing trailside lanterns (normal alpha blend) */
.hd2d-lantern-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 142px;
  height: 108px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 224, 128, 0.34) 0%,
    rgba(255, 186, 72, 0.14) 45%,
    transparent 74%
  );
}

/* ============================================================================
   STARTING OUTPOST (HD-2D Pixel Trailhead Cottage with Warm Window Glow)
   ============================================================================ */
.hd2d-origin {
  position: absolute;
  left: 50%;
  transform: translate3d(-50%, -50%, 2px);
  transform-style: preserve-3d;
  width: 120px;
  height: 76px;
  z-index: 12;
  pointer-events: none;
}

.hd2d-origin-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210px;
  height: 150px;
  transform: translate(-50%, -44%);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 224, 132, 0.32) 0%,
    rgba(255, 184, 76, 0.12) 48%,
    transparent 74%
  );
}

.hd2d-origin-base {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 138px;
  height: 88px;
  transform: translate(-50%, -44%);
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: url('../assets/map/hd2d/origin-pad-pixel.png') center / contain no-repeat;
  image-rendering: pixelated;
}

.hd2d-origin img {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 136px;
  height: 136px;
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: 50% 100%;
  transform: translate3d(-50%, 0, 2px) rotateX(-52deg);
}

/* ============================================================================
   HD-2D SCULPTED STONE NODE PEDESTALS & UPRIGHT PIXEL STANDEES
   - Elevated cleanly above Z=0 board plane so BOTH the pedestal circle AND
     the upright icon trigger hover scale-up & click in Safari / Chrome!
   ============================================================================ */
#app .hd2d-board .atlas-node {
  position: absolute !important;
  width: 108px !important;
  height: 108px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  transform: translate3d(-50%, -50%, 8px) !important;
  transform-style: preserve-3d;
  pointer-events: auto !important;
  z-index: 14;
  cursor: default;
  filter: none !important;
}

#app .hd2d-board .atlas-node.available {
  transform: translate3d(-50%, -50%, 12px) !important;
  cursor: pointer !important;
  z-index: 20;
}

#app .hd2d-board .atlas-node.standing {
  z-index: 22;
}

/* Pixel-art mossy cobblestone pedestal disc — full interactive hit target */
.hd2d-node-pedestal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84px;
  height: 90px;
  transform: translate3d(-50%, -48%, 2px);
  border-radius: 0;
  border: 0;
  box-shadow: none;
  pointer-events: auto;
  background: url('../assets/map/hd2d/pedestal-normal.png') center / contain no-repeat;
  image-rendering: pixelated;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.hd2d-board .atlas-node.boss .hd2d-node-pedestal {
  width: 102px;
  height: 108px;
  background-image: url('../assets/map/hd2d/pedestal-boss.png');
}

.hd2d-board .atlas-node.available .hd2d-node-pedestal {
  background-image: url('../assets/map/hd2d/pedestal-available.png');
  cursor: pointer;
}

/* Hovering ANY part of an available node (pedestal circle OR upright icon) lifts & scales both! */
.hd2d-board .atlas-node.available:hover .hd2d-node-pedestal,
.hd2d-board .atlas-node.available.is-hovered .hd2d-node-pedestal {
  transform: translate3d(-50%, -48%, 4px) scale(1.15);
}

/* Tactile preview feedback when hovering future/upcoming nodes too */
.hd2d-board .atlas-node:not(.available):not(.skipped):hover .hd2d-node-pedestal,
.hd2d-board .atlas-node:not(.available):not(.skipped).is-hovered .hd2d-node-pedestal {
  transform: translate3d(-50%, -48%, 3px) scale(1.08);
}

.hd2d-board .atlas-node.visited .hd2d-node-pedestal {
  background-image: url('../assets/map/hd2d/pedestal-visited.png');
}

.hd2d-board .atlas-node.skipped {
  opacity: 0.54;
}

/* Pixel-art dashed selection ring around available nodes */
#app .hd2d-board .atlas-node .atlas-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 106px;
  height: 106px;
  transform: translate3d(-50%, -50%, 3px);
  border-radius: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  pointer-events: none;
}

#app .hd2d-board .atlas-node.available .atlas-ring {
  background: url('../assets/map/hd2d/ring-available-pixel.png') center / contain no-repeat !important;
  image-rendering: pixelated;
  animation: hd2dRingSpin 12s steps(16, end) infinite;
}

@keyframes hd2dRingSpin {
  from { transform: translate3d(-50%, -50%, 3px) rotate(0deg); }
  to   { transform: translate3d(-50%, -50%, 3px) rotate(360deg); }
}

/* Upright HD-2D Pixel Icon Standee */
.hd2d-node-billboard {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 6px 10px 4px;
  transform-origin: 50% 100%;
  transform: translate3d(-50%, -94%, 6px) rotateX(-52deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hd2d-board .atlas-node.available:hover .hd2d-node-billboard,
.hd2d-board .atlas-node.available.is-hovered .hd2d-node-billboard {
  transform: translate3d(-50%, -118%, 16px) rotateX(-52deg) scale(1.22);
}

.hd2d-board .atlas-node:not(.available):not(.skipped):hover .hd2d-node-billboard,
.hd2d-board .atlas-node:not(.available):not(.skipped).is-hovered .hd2d-node-billboard {
  transform: translate3d(-50%, -106%, 10px) rotateX(-52deg) scale(1.12);
}

.hd2d-node-billboard img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  image-rendering: pixelated;
}

.hd2d-board .atlas-node.boss .hd2d-node-billboard img {
  width: 68px;
  height: 68px;
}

.hd2d-board .atlas-node.visited .hd2d-node-billboard img {
  opacity: 0.62;
  filter: grayscale(0.45);
}

/* Floating crisp label tag on hover or on Boss */
.hd2d-node-tag {
  margin-bottom: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(20, 28, 24, 0.90);
  border: 1px solid rgba(253, 224, 71, 0.55);
  color: #fefce8;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.hd2d-board .atlas-node.available:hover .hd2d-node-tag,
.hd2d-board .atlas-node.available.is-hovered .hd2d-node-tag,
.hd2d-board .atlas-node:not(.skipped):hover .hd2d-node-tag,
.hd2d-board .atlas-node:not(.skipped).is-hovered .hd2d-node-tag,
.hd2d-board .atlas-node.boss .hd2d-node-tag {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================================
   UPRIGHT 3D PARTNER PAWN (GPU translate3d — Zero Layout Thrash When Walking)
   ============================================================================ */
.hd2d-pawn {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate3d(var(--pawn-x, 800px), var(--pawn-y, 1200px), 24px) translate(-50%, -50%);
  transform-style: preserve-3d;
  will-change: transform;
  z-index: 40;
  pointer-events: none;
}

.hd2d-pawn-base {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 66px;
  transform: translate(-50%, -48%);
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: url('../assets/map/hd2d/pawn-base-pixel.png') center / contain no-repeat;
  image-rendering: pixelated;
}

.hd2d-pawn-canvas {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 84px;
  height: 84px;
  image-rendering: pixelated;
  transform-origin: 50% 100%;
  transform: translate3d(-50%, 0, 6px) rotateX(-52deg);
  animation: hd2dPawnBob 1.9s ease-in-out infinite;
}

.hd2d-pawn.has-pmd-walk .hd2d-pawn-canvas {
  display: block;
}

.hd2d-pawn.has-pmd-walk .hd2d-pawn-sprite {
  display: none;
}

.hd2d-pawn-sprite {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 82px;
  height: 82px;
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: 50% 100%;
  transform: translate3d(-50%, 0, 6px) rotateX(-52deg) scaleX(var(--pawn-flip-x, 1));
  animation: hd2dPawnSpriteBob 1.9s ease-in-out infinite;
}

.hd2d-pawn.is-walking .hd2d-pawn-sprite,
.hd2d-pawn.is-walking .hd2d-pawn-canvas {
  animation: none;
}

@keyframes hd2dPawnBob {
  0%, 100% { transform: translate3d(-50%, 0, 10px) rotateX(-52deg); }
  50%      { transform: translate3d(-50%, -6px, 10px) rotateX(-52deg); }
}

@keyframes hd2dPawnSpriteBob {
  0%, 100% { transform: translate3d(-50%, 0, 10px) rotateX(-52deg) scaleX(var(--pawn-flip-x, 1)); }
  50%      { transform: translate3d(-50%, -6px, 10px) rotateX(-52deg) scaleX(var(--pawn-flip-x, 1)); }
}

/* ============================================================================
   FLOATING PORCELAIN LEGEND CARD (Crisp Contrast Against Lush HD-2D Forest)
   ============================================================================ */
#app .hd2d-atlas-screen .atlas-legend {
  position: fixed !important;
  right: clamp(14px, 2vw, 24px) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 100 !important;
  width: 148px;
  padding: 14px 14px 12px !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.78) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 14px 32px -10px rgba(8, 18, 12, 0.42),
    0 2px 8px rgba(8, 18, 12, 0.16) !important;
  color: #0f172a !important;
}

#app .hd2d-atlas-screen .atlas-legend h2 {
  margin: 0 0 10px !important;
  padding-bottom: 7px !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24) !important;
}

#app .hd2d-atlas-screen .atlas-legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#app .hd2d-atlas-screen .atlas-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: #334155 !important;
}

#app .hd2d-atlas-screen .atlas-legend li img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  image-rendering: pixelated;
}

/* Floating Bottom-Right Camera Helper Pill (Back to Current Pawn) */
.hd2d-recenter-btn {
  position: fixed;
  right: clamp(14px, 2vw, 24px);
  bottom: 18px;
  z-index: 100;
  appearance: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.82);
  color: #0f172a;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 12px 28px -8px rgba(8, 18, 12, 0.42);
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.hd2d-recenter-btn:hover {
  transform: translateY(-2px);
  border-color: #f59e0b;
  color: #b45309;
}

@media (max-width: 780px) {
  #app .hd2d-atlas-screen .atlas-legend {
    display: none !important;
  }
}

/* Full-bleed HD-2D Map Overlay inside battle/event/shop/center (matches normal map screen) */
#app .run-inspection.run-map-view {
  padding: 0 !important;
  background: transparent !important;
}

#app .run-inspection.run-map-view .atlas-screen.hd2d-atlas-screen {
  height: 100% !important;
  padding: 0 !important;
}

#app .run-inspection.run-map-view .run-map-close-pill {
  position: fixed !important;
  left: clamp(14px, 2vw, 24px) !important;
  bottom: 18px !important;
  z-index: 110 !important;
  margin: 0 !important;
  padding: 8px 18px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 12px 28px -8px rgba(8, 18, 12, 0.42) !important;
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

#app .run-inspection.run-map-view .run-map-close-pill:hover {
  transform: translateY(-2px);
  border-color: #0ea5e9 !important;
  color: #0284c7 !important;
}
