/* Arena roaming scene: walk the pass, walk into a rival to duel. */
/* Notice banner sits between scenes, so it owns its spacing here. */
#banner {
  text-align: center;
  padding: 0 16px;
  margin: 0 auto;
  max-width: 900px;
}
#roam {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 20px 26px;
  outline: none;
}
#roam[hidden] {
  display: none;
}
.roam-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 16 / 9;
  /* Per-act ground plate on the 1280×720 frame. applyCamera pans it. */
  background: 0 26% / 200% 238.9% repeat-x url("assets/bamboo-maze-natural.png"), #16232a;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 50px #0007;
}
.roam-stage img {
  position: absolute;
  height: 24%;
  transform: translate(-50%, -100%);
  pointer-events: none;
  filter: drop-shadow(0 10px 12px #0008);
}
.roam-stage img[hidden] {
  display: none;
}
.roam-weather-overlay { position: absolute; inset: 0; background: center / cover no-repeat; pointer-events: none; z-index: 600; }
.roam-weather-overlay[hidden] { display: none; }
#roam-hero {
  height: 27%;
  transform: translate(-50%, -100%) scaleX(var(--face, 1));
  z-index: 2;
}
.roam-rival {
  z-index: 1;
}
/* First blood on the pass: the rival reels, ready to open the duel stunned. */
.roam-rival.first-blood {
  filter: drop-shadow(0 0 14px #ff9d6bbb) saturate(1.35);
}
.roam-menu { margin-top: 16px; }
.roam-menu > summary { margin: 0 auto; }
.roam-menu[open] > summary { margin-bottom: 18px; }
.roam-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(2, 50px);
  gap: 6px;
}
.dpad button {
  font-size: 17px;
  background: #1b2b29;
  border: 1px solid #667b69;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.dpad button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.dpad button:active {
  border-color: var(--jade);
  color: var(--gold);
}
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
@media (max-width: 720px) {
  #roam {
    padding: 6px 10px 18px;
  }
  .dpad {
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(2, 46px);
  }
}

#roam-effects { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:700; }
.roam-actions { text-align:center; }
.roam-actions button { margin:4px; padding:12px 15px; }
.roam-party-hud { display:flex; justify-content:center; flex-wrap:wrap; gap:6px; margin:8px 0; }
.party-hp-chip { display:flex; flex-direction:column; gap:3px; padding:6px 9px; border:1px solid #bfe9df44; border-radius:6px; background:#061410cc; font-size:12px; }
.party-hp-chip.lead { border-color:var(--jade); box-shadow:inset 0 2px var(--jade); }
.party-hp-chip.swap-ready { cursor:pointer; }
.party-hp-chip.swap-ready:hover { border-color:var(--jade); }
/* WU-PLAY-01: one-shot post-duel invite — follower chips pulse as tappable. */
.party-hp-chip.swap-cue {
  border-color: var(--jade);
  box-shadow: 0 0 0 2px #5dcaa866, 0 0 14px #5dcaa855;
  animation: swap-cue-pulse 1.1s ease-in-out 3;
}
.roam-party-hud.swap-cue-active { outline: 1px dashed #5dcaa855; outline-offset: 4px; border-radius: 8px; }
@keyframes swap-cue-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px #5dcaa866, 0 0 10px #5dcaa844; }
  50% { transform: scale(1.04); box-shadow: 0 0 0 3px #5dcaa8aa, 0 0 18px #5dcaa888; }
}
.reduced-motion .party-hp-chip.swap-cue { animation: none; }
.chip-name { color:var(--jade); }
.chip-hp { font-size:11px; }
.roam-controls > .hint { flex-basis:100%; text-align:center; max-width:680px; }


/* Cosmetic party followers trail the lead; smaller and slightly muted.
   WU-PARTY-07: beat .roam-stage img specificity so scaleX(var(--face)) applies. */
.roam-stage img.roam-follower {
  height: 22%;
  transform: translate(-50%, -100%) scaleX(var(--face, 1));
  z-index: 1;
  filter: drop-shadow(0 8px 10px #0007) saturate(0.92);
  opacity: 0.92;
}

/* WU-FRAME-03: sheet cell via CSS background; still src → transparent pixel. */
#roam-hero.sheet-anim,
.roam-follower.sheet-anim {
  aspect-ratio: 1 / 1;
  width: auto;
  background-repeat: no-repeat;
  /* Keep painted height from #roam-hero (27%) / .roam-follower (22%). */
}

.roam-thicket {
  position: absolute;
  background: var(--blocker-position, center) / var(--blocker-size, contain) no-repeat var(--blocker-art, url("assets/bamboo-thicket-blocker.png"));
  transform: translate(-50%, -50%) scaleX(var(--flip, 1)) rotate(var(--tilt, 0deg));
  pointer-events: none;
  filter: var(--blocker-filter, none);
  clip-path: var(--blocker-clip, none);
}
@keyframes original-walk {
  from { transform: translate(-50%, -100%) scaleX(var(--face, 1)); }
  to { transform: translate(-50%, -102%) scaleX(var(--face, 1)); }
}
#roam-hero.original-walk,
.roam-stage img.roam-follower.original-walk { animation: original-walk .27s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) {
  #roam-hero.original-walk, .roam-stage img.roam-follower.original-walk { animation: none; }
}
.reduced-motion .original-walk { animation: none !important; }
.route-overview { align-self: center; width: min(100%, 520px); padding: 8px 12px; border: 1px solid #bfe9df33; border-radius: 6px; background: #071410; }
.route-overview summary { cursor: pointer; font-size: 12px; color: var(--gold); }
.route-overview canvas { display: block; width: min(100%, 340px); height: auto; margin-top: 6px; }
.route-legend { display: flex; gap: 16px; justify-content: center; margin: 3px 0; font-size: 11px; }
.route-you { color: #fff3cf; } .route-party { color: #79c5dc; } .route-rivals { color: #ed8f75; } .route-shrine { color: #ffca6e; }

.roam-spawn-marker {
  position: absolute;
  box-sizing: border-box;
  width: 3.2%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid #e8c547;
  border-radius: 50%;
  background: #e8c54755;
  box-shadow: 0 0 14px #c9a22799, inset 0 0 8px #c9a22766;
  pointer-events: none;
}

/* The existing cutout contains mossy rocks below the bamboo; use its rock
   detail for terrace barriers while keeping the source asset unchanged. */
.roam-stage[data-scene="mount-canglan"] .roam-thicket,
.roam-stage[data-scene="meridian-citadel"] .roam-thicket {
  background-size: 100% 200%;
  background-position: center bottom;
  border-radius: 45%;
  filter: saturate(.5) brightness(1.15);
}

/* Generated overlays support weather without obscuring feet or telegraphs. */
.roam-weather-overlay[data-weather="rain"] { opacity: .35; }
.roam-weather-overlay[data-weather="night"] { opacity: .5; }
.roam-weather-overlay[data-weather="fog"] { opacity: .3; }
