/* Hunt backgrounds cover the viewport; combat geometry uses the same scale. */
/* Keep the waterfall visible behind Hunt and its menus. */
main:not(.hunt-active):not(.base-active) {
  background-image:url("assets/locations/waterfall-arena-v1.webp"),linear-gradient(#0d3045,#123b35);
  background-size:cover,100% 100%;
  background-position:center;
  background-repeat:no-repeat;
  background-color:#123b35;
}
main.hunt-active.platform-stage { background:#123b35 linear-gradient(#0d3045,#123b35); }
.stage-platform-background { position:absolute; inset:0; z-index:-2; width:100%; height:100%; object-fit:cover; object-position:center; pointer-events:none; }
.waterfall-ambience { display:none; position:absolute; inset:0; z-index:-1; width:100%; height:100%; pointer-events:none; }
main.hunt-active.platform-stage:not(.hunt-camp-active)[data-platform-map="waterfall"] > .waterfall-ambience { display:block; }
.waterfall-streak { animation:waterfall-stream-fall 1.25s linear infinite; }
.waterfall-streak-late { animation-delay:-.625s; }
.waterfall-mist { animation:waterfall-mist-drift 4.6s ease-in-out infinite; }
.waterfall-mist-late { animation-delay:-2.3s; }
@keyframes waterfall-stream-fall {
  from { transform:translate(5px,0); opacity:.18; }
  43% { opacity:.86; }
  to { transform:translate(-13px,155px); opacity:0; }
}
@keyframes waterfall-mist-drift {
  0%,100% { transform:translate(4px,1px); opacity:.14; }
  50% { transform:translate(-10px,-3px); opacity:.7; }
}
.platform-stage .forest-bats { display:none; }
.platform-stage .hero-idle,.platform-stage .hero-ground-shadow,
.platform-stage .loot-drop,.platform-stage .equipment-world-drop { translate:0 var(--platform-lift,0px); }
.platform-stage .monster,
.platform-stage .arena::before,.platform-stage .monster-arrival-wind,
.platform-stage .explosive-mark,.platform-stage .seal-explosion,.platform-stage .skill-axe-slash { translate:0 var(--platform-enemy-offset,0px); }
.stage-platform-status { position:absolute; z-index:30; top:60px; left:50%; transform:translateX(-50%); display:grid; justify-items:center; gap:8px; width:min(260px,90%); padding:12px; border:1px solid #9c835f; border-radius:8px; background:#101d30ed; color:#f6e3ba; font:700 13px/1.4 "Trebuchet MS",sans-serif; }
.stage-platform-status[hidden] { display:none; }
.stage-platform-status button { width:140px; min-height:44px; }
.hunt-active .stage-track .stage-node {
  background-image:linear-gradient(#06101d08,#06101d22),url("assets/locations/waterfall-arena-v1.webp");
  background-size:180% auto;
  background-position:50% 54%;
}

main:not(.hunt-active):not(.base-active)[data-platform-map="sunlit-ruins"] { background-image:url("assets/locations/sunlit-ruins-arena-v1.webp"); }
.hunt-active .stage-track .stage-node[data-stage="1"] { background-image:linear-gradient(#06101d08,#06101d22),url("assets/locations/sunlit-ruins-arena-v1.webp"); }
main:not(.hunt-active):not(.base-active)[data-platform-map="snow-pass"] { background-image:url("assets/locations/snow-pass-arena-v1.webp"); }
.hunt-active .stage-track .stage-node[data-stage="2"] { background-image:linear-gradient(#06101d08,#06101d22),url("assets/locations/snow-pass-arena-v1.webp"); }
main:not(.hunt-active):not(.base-active)[data-platform-map="mushroom-grotto"] { background-image:url("assets/locations/mushroom-grotto-arena-v1.webp"); }
.hunt-active .stage-track .stage-node[data-stage="3"] { background-image:linear-gradient(#06101d08,#06101d22),url("assets/locations/mushroom-grotto-arena-v1.webp"); }

/* One selected intro is owned during the transition and released on reveal. */
.location-curtain { position:absolute; inset:0; z-index:90; overflow:hidden; isolation:isolate; background:linear-gradient(#d38343,#b47661 55%,#673d35); color:#ffe4a3; pointer-events:auto; }
.location-curtain[data-location="moonstone"] { background:linear-gradient(#263c74,#2d4a86 55%,#1c315c); }
.location-curtain[data-location="amethyst"] { background:linear-gradient(#34204c,#67408a 55%,#3d235b); }
.location-curtain-art { position:absolute; inset:0; z-index:0; width:100%; height:100%; object-fit:contain; object-position:center; pointer-events:none; }
.location-curtain-copy { position:absolute; top:31%; left:0; right:0; z-index:1; display:flex; flex-direction:column; align-items:center; gap:14px; padding:0 12px; text-align:center; text-shadow:0 2px 4px #23152be6,0 0 14px #23152bcc; }
.location-curtain-copy::before { content:"◆"; color:#f0cf7d; font-size:20px; }
.location-curtain-copy > span { font:700 11px/1.3 "Trebuchet MS",sans-serif; letter-spacing:3px; text-transform:uppercase; color:#e5e4ec; }
.location-curtain-copy > strong { max-width:95%; font:700 clamp(24px,7vw,38px)/1.25 Georgia,serif; text-align:center; }
.location-curtain[hidden],.location-unlock[hidden] { display:none; }
.location-unlock { position:absolute; z-index:95; top:clamp(125px,20%,190px); left:0; right:0; width:min(86%,350px); margin-inline:auto; display:grid; justify-items:center; gap:5px; padding:15px 22px 16px; border:1px solid #d3b679b3; border-radius:4px 15px 4px 15px; background:linear-gradient(140deg,#233449f5,#111b2cf5); box-shadow:inset 0 0 0 3px #0a1327,0 5px 18px #050b1970; text-align:center; pointer-events:none; }
.location-unlock::before { content:"◆"; position:absolute; top:-10px; color:#f1d397; font-size:16px; text-shadow:0 1px 3px #071020; }
.location-unlock > span:first-child { color:#b9c9d7; font:700 10px/1.2 "Trebuchet MS",sans-serif; letter-spacing:2.5px; text-transform:uppercase; }
.location-unlock > strong { color:#ffe4aa; font:700 clamp(20px,5.5vw,26px)/1.25 Georgia,serif; text-shadow:0 2px 2px #071020; }
.location-unlock > span:last-child { color:#dfcda7; font:600 13px/1.3 "Trebuchet MS",sans-serif; letter-spacing:.6px; }
/* Prototype with two selectable positions on the waterfall arena. */
.hunt-active .stage-target-mode {
  --target-left:24%;
  --reserve-left:76%;
  --hero-target-left:24%;
  --hero-depth-rise:calc(-1 * clamp(10px,4vw,18px));
  --far-rise:clamp(18px,6vw,27px);
  --active-rise:0px;
  --target-base-span:calc(min(clamp(158px,51vw,215px),53cqh) * 1.1);
  --target-span:calc(var(--target-base-span) * var(--monster-scale,1));
  --stage-shadow-x:clamp(-13px,-2.8vw,-8px);
  --stage-shadow-y:clamp(3px,1.35vw,7px);
}
.hunt-active .stage-target-mode.target-right {
  --target-left:76%;
  --reserve-left:24%;
  --active-rise:var(--far-rise);
}
.hunt-active.platform-stage .arena:not(.stage-target-mode) > :is(#monster,#monsterWard) {
  top:var(--platform-ground);
  transform:translate(-50%,calc(var(--monster-foot,.86) * -100%));
}
.hunt-active .stage-target-mode > .monster {
  --slot-rise:0px;
  --monster-slot-base:var(--target-left);
  left:var(--monster-slot-left,var(--monster-slot-base));
  top:calc(var(--platform-ground,56%) - var(--slot-rise));
  width:calc(var(--target-base-span) * var(--target-species-scale,1));
  transform:translate(-50%,calc(var(--target-foot,var(--monster-foot,.86)) * -100%)) scaleX(var(--target-facing,1));
  translate:none;
}
.hunt-active .stage-target-mode > .monster.stage-target-mirrored { --target-facing:-1; }
.hunt-active .stage-target-mode > .stage-target-reserve { --monster-slot-base:var(--reserve-left); }
.hunt-active .stage-target-mode > .stage-target-left { --monster-slot-base:24%; }
.hunt-active .stage-target-mode > .stage-target-right { --monster-slot-base:76%; }
.hunt-active .stage-target-mode > .stage-target-right,
.hunt-active .stage-target-mode:not(.target-right) > .stage-target-reserve,
.hunt-active .stage-target-mode.target-right > :is(#monster,#stageTargetGround,#monsterWard) {
  --slot-rise:var(--far-rise);
}
.stage-target-mode .enemy-hud > .hp { visibility:hidden; }
.stage-target-mode::before,.stage-target-waiting > .monster,.stage-target-mode > .stage-pose-pending { visibility:hidden; }
.platform-stage .stage-target-mode :is(.hero-idle,.hero-ground-shadow) {
  translate:0 calc(var(--platform-lift,0px) - var(--hero-depth-rise,0px));
}
.hunt-active .stage-target-mode.hero-at-target {
  --hero-approach-rise:clamp(7px,2.6vw,12px);
  --hero-depth-rise:var(--hero-approach-rise);
}
.stage-target-mode.hero-at-target :is(.hero-idle,.hero-ground-shadow) {
  left:var(--hero-target-left);
  transition:left var(--hero-travel-duration,180ms) linear,
    translate var(--hero-travel-duration,180ms) linear;
}
.stage-target-mode .hero-ground-shadow {
  bottom:calc(44% - clamp(120px,36vw,150px) * .996153846);
  width:calc(clamp(120px,36vw,150px) * 288 / 208 * .9);
  height:auto; aspect-ratio:288 / 208; border-radius:0; transform:translateX(-52.777778%);
  background:
    radial-gradient(ellipse 7% 3.2% at 43% 96%,#0009,transparent 100%),
    radial-gradient(ellipse 7% 3.2% at 62% 96%,#0009,transparent 100%),
    radial-gradient(ellipse 27% 6% at 53% 95%,#0006,transparent 100%);
}
.arena > .stage-stop-dust { position:absolute; width:0; height:0; pointer-events:none; z-index:3; }
.stage-stop-dust i {
  position:absolute; left:-5px; top:-5px; opacity:0; width:11px; height:7px; border-radius:50%;
  background:radial-gradient(ellipse,#b29c72d9,#a29370a0 45%,transparent 74%);
}
.stage-stop-dust i:nth-child(n+3) { width:8px; height:5px; }
.hunt-active .stage-target-mode.hero-at-right-target {
  --hero-target-left:73.5%;
  --hero-depth-rise:calc(var(--far-rise) + var(--hero-approach-rise));
}
.platform-stage .stage-target-mode :is(.explosive-mark,.seal-explosion,.skill-axe-slash) {
  left:var(--target-left);
  top:calc(var(--platform-ground,56%) - var(--active-rise) - var(--target-span) * (var(--monster-foot,.86) - .5));
  translate:none;
}
.platform-stage .stage-target-mode .monster-arrival-wind { translate:none; }

.stage-target-marker { z-index:1; }
.stage-target-marker:has(#enemyInfoDialog:not([hidden])) { z-index:8; }
.salamander-bolt {
  position:absolute; z-index:4; inset:0 auto auto 0; width:20px; height:20px; translate:-50% -50%; opacity:0;
  pointer-events:none;
  background:url('assets/salamander-bolt-v1.svg') center / contain no-repeat;
}
.salamander-impact {
  position:absolute; z-index:5; width:46px; height:46px; translate:-50% -50%; pointer-events:none;
  background:url('assets/salamander-impact-v1.svg') center / contain no-repeat;
}

.stage-target-health {
  position:absolute; top:calc(var(--target-head,24%) - var(--target-jump,0%)); left:50%; transform:translate(-50%,calc(-100% - 8px));
  --hp-info-width:15%;
  --hp-height:9px;
  --hp-corner:2px;
  width:52%; min-width:70px;
  isolation:isolate; transition:top 60ms linear;
}
@media (prefers-reduced-motion:reduce) { .stage-target-health { transition:none; } }
.stage-target-health::before,.stage-target-health::after {
  content:""; position:absolute; z-index:-1; pointer-events:none;
  clip-path:polygon(var(--hp-corner) 0,calc(100% - var(--hp-corner)) 0,100% var(--hp-corner),
    100% calc(100% - var(--hp-corner)),calc(100% - var(--hp-corner)) 100%,
    var(--hp-corner) 100%,0 calc(100% - var(--hp-corner)),0 var(--hp-corner));
}
.stage-target-health::before {
  inset:0; background:linear-gradient(#785a62,#362333 38%,#362333 75%,#554050);
}
.stage-target-health::after {
  --hp-corner:1.4px;
  inset:.7px; background:linear-gradient(#1e1623,#2b1b2b);
}
.stage-target-health-number {
  position:absolute; inset:0; z-index:1; display:grid; place-items:center; pointer-events:none;
  color:#fff2dc; white-space:nowrap; font:700 7px/1 system-ui,sans-serif;
  font-variant-numeric:tabular-nums; text-shadow:0 .5px #572137;
}
.stage-target-health-track {
  position:relative; isolation:isolate; box-sizing:border-box;
  width:calc(100% - var(--hp-info-width)); height:var(--hp-height);
  padding:1px 2px 1px 1px; background:transparent; overflow:hidden;
}
.stage-target-health-track progress {
  appearance:none; display:block; width:100%; height:100%; border:0; background:transparent;
}
.stage-target-health-track progress::-webkit-progress-bar { background:transparent; }
.stage-target-health-track progress::-webkit-progress-value {
  background:linear-gradient(#f47375,#a92746); box-shadow:inset 0 .55px #ffaba1;
  --fill-corner:min(1.8px,25%);
  clip-path:polygon(var(--fill-corner) 0,calc(100% - var(--fill-corner)) 0,100% 25%,100% 75%,calc(100% - var(--fill-corner)) 100%,var(--fill-corner) 100%,0 75%,0 25%);
}
.stage-target-health-track progress::-moz-progress-bar { background:linear-gradient(#f47375,#a92746); }
.stage-target-health-track i { position:absolute; top:0; bottom:0; background:#fff; opacity:0; }
.stage-target-ground::before,.stage-target-ground::after {
  content:""; position:absolute; top:calc(var(--target-foot,var(--monster-foot,.86)) * 100%); left:50%; border-radius:50%;
  transform:translate(-50%,-50%);
}
.stage-target-ground::before {
  width:57%; height:14%;
  background:radial-gradient(ellipse,#0009 0%,#0006 39%,#0002 61%,transparent 74%);
}
.stage-cast-shadow {
  position:absolute; left:50%; top:var(--target-foot-percent,86%);
  width:var(--cast-shadow-width,57%); height:var(--cast-shadow-height,14%);
  opacity:calc(var(--cast-shadow-opacity,.42) - .16 * var(--shadow-lift,0));
  transform:translate(calc(-50% + var(--stage-shadow-x)),calc(-50% + var(--stage-shadow-y))) scale(calc(1 + .08 * var(--shadow-lift,0)));
  background:radial-gradient(ellipse,#0008 12%,#0006 40%,#0003 61%,transparent 76%);
}
.stage-target-ground[data-monster-type="stone"] { --cast-shadow-width:73%; --cast-shadow-height:18%; --cast-shadow-opacity:.55; }
.stage-target-ground[data-monster-type="goblin"] { --cast-shadow-width:48%; --cast-shadow-height:12%; --cast-shadow-opacity:.40; }
.stage-target-ground[data-monster-type="orc"] { --cast-shadow-width:66%; --cast-shadow-height:16%; --cast-shadow-opacity:.50; }
.stage-target-ground[data-monster-type="salamander"] { --cast-shadow-width:87%; --cast-shadow-height:16%; --cast-shadow-opacity:.32; }
.stage-target-ground[data-monster-type="jackal"] { --cast-shadow-width:82%; --cast-shadow-height:11%; --cast-shadow-opacity:.38; }
.stage-target-ground[data-monster-type="jackal"]::before {
  inset:0; width:auto; height:auto; border-radius:0;
  transform:scaleX(var(--shadow-facing,1));
  background:
    radial-gradient(ellipse 10% 3.5% at 21% 75.5%,#000b,transparent 100%),
    radial-gradient(ellipse 9% 3% at 50% 76%,#000a,transparent 100%),
    radial-gradient(ellipse 9% 3% at 83% 71%,#0009,transparent 100%),
    radial-gradient(ellipse 43% 7% at 51% 74%,#0008,#0004 54%,transparent 100%);
}
.stage-target-ground[data-monster-type="salamander"] .stage-cast-shadow {
  background:
    radial-gradient(ellipse 46% 50% at 43% 51%,#0008 12%,#0005 55%,transparent 100%),
    radial-gradient(ellipse 19% 36% at 82% 39%,#0005,transparent 100%);
}
.stage-target-ground:is([data-monster-type="salamander"],[data-monster-type="stone"])::before {
  inset:0; width:auto; height:auto; border-radius:0; transform:none;
}
.stage-target-ground[data-monster-type="salamander"]::before {
  opacity:calc(1 - .5 * var(--shadow-lift,0));
  background:
    radial-gradient(ellipse 12% 4.3% at 18% 82%,#000c,transparent 100%),
    radial-gradient(ellipse 13% 4.7% at 54% 85%,#000d,transparent 100%),
    radial-gradient(ellipse 12% 3.6% at 73% 79%,#000a,transparent 100%),
    radial-gradient(ellipse 10% 3% at 38% 77%,#000a,transparent 100%),
    radial-gradient(ellipse 46% 10% at 49% 80%,#000a 0%,#0007 46%,transparent 100%);
}
.stage-target-ground[data-monster-type="stone"]::before {
  background:
    radial-gradient(ellipse 12% 3.6% at 36.3% 83.5%,#000a,transparent 100%),
    radial-gradient(ellipse 12% 3.6% at 62.4% 83.5%,#000a,transparent 100%),
    radial-gradient(ellipse 34% 7% at 49.5% 83%,#0008 0%,#0005 45%,transparent 100%);
}
.stage-target-ground:is([data-monster-type="goblin"],[data-monster-type="orc"])::before {
  inset:0; width:auto; height:auto; border-radius:0; transform:none;
  background:
    radial-gradient(ellipse 10% 4% at 39% var(--target-foot-percent,87%),#0009,transparent 100%),
    radial-gradient(ellipse 10% 4% at 61% var(--target-foot-percent,87%),#0009,transparent 100%),
    radial-gradient(ellipse 35% 7% at 50% var(--target-foot-percent,87%),#0008 0%,#0005 45%,transparent 100%);
}
.stage-target-ground::after { width:59%; height:10%; opacity:0; z-index:1; }
.stage-target-ground.is-selected::after {
  opacity:1; border:1.5px solid #ffdc90; border-top-color:#e9b862a0;
  box-shadow:0 1px 8px #ecab4c80,inset 0 -1px 4px #f5c27269;
}
.stage-target-ground.is-pending::after { opacity:.8; border:1px dashed #e1bf84; }
:is(.stage-target-marker,.stage-target-ground,.stage-target-reserve)[hidden] { display:none; }
@media (prefers-reduced-motion: reduce) {
  .stage-target-mode.hero-at-target :is(.hero-idle,.hero-ground-shadow) { transition:none; }
}

.stage-local-drop .loot-coin { left:-5.2px; top:-5.2px; width:10.4px; height:10.4px; }
.stage-local-drop .loot-material { left:-9.1px; top:-9.1px; width:18.2px; height:18.2px; }
.equipment-world-drop.stage-local-drop { --equipment-drop-size:30.7125px; --equipment-drop-glow-width:43.225px; }
.stage-local-drop .loot-reward[hidden] { display:none; }
.arena > .stage-ward { z-index:2; will-change:auto; }
.stage-ward[hidden] { display:none; }
.stage-ward::before {
  content:""; position:absolute;
  left:var(--ward-left); top:var(--ward-top);
  width:var(--ward-width); height:var(--ward-height);
  background:url('assets/golem-ward-dome-v1.svg') center / 100% 100% no-repeat;
  animation:stage-ward-breathe 1.35s ease-in-out infinite alternate;
}
@keyframes stage-ward-breathe { from { opacity:.67; } to { opacity:1; } }
@media (prefers-reduced-motion: reduce) {
  .waterfall-streak,.waterfall-mist,.stage-ward::before { animation:none; }
  .waterfall-streak { opacity:0; }
}

.monster-curse-orb {
  position: absolute;
  left: 0;
  top: 0;
  height: auto;
  transform-origin: 78% 51%;
  pointer-events: none;
  z-index: 8;
}

.arena > .monster-curse-arrows {
  z-index: 3 !important;
  will-change: auto;
}

.monster-curse-orb[hidden],
.monster-curse-arrows[hidden] { display: none; }

.monster-curse-arrows i {
  position: absolute;
  left: var(--arrow-x);
  top: var(--arrow-y);
  width: 8px;
  height: 13px;
  background: linear-gradient(#7d41a8, #dda5ff);
  clip-path: polygon(35% 0, 65% 0, 65% 58%, 100% 58%, 50% 100%, 0 58%, 35% 58%);
  animation: monster-curse-arrow-fall 780ms linear infinite;
  animation-delay: var(--arrow-delay);
}

.monster-curse-arrows i:nth-child(1) { --arrow-x: 32%; --arrow-y: 43%; --arrow-delay: 0ms; }
.monster-curse-arrows i:nth-child(2) { --arrow-x: 43%; --arrow-y: 29%; --arrow-delay: -320ms; }
.monster-curse-arrows i:nth-child(3) { --arrow-x: 58%; --arrow-y: 34%; --arrow-delay: -140ms; }
.monster-curse-arrows i:nth-child(4) { --arrow-x: 68%; --arrow-y: 45%; --arrow-delay: -550ms; }

@keyframes monster-curse-arrow-fall {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: .95; }
  66% { opacity: .8; }
  100% { opacity: 0; transform: translateY(29px); }
}

@media (prefers-reduced-motion: reduce) {
  .monster-curse-arrows i { animation: none; opacity: .75; }
}
