/* Load after styles.css, cave.css and effects.css. No facility, floor or camera transforms. */
.person-sprite[data-wm-managed="true"],
.mining-crew img[data-wm-managed="true"],
.dig-worker img[data-wm-managed="true"] {
  animation: none !important;
  transform: none;
  transform-origin: 50% 94%;
  transition: none;
}
/* The legacy rotating whole mining wrapper must not fight actual pose frames. */
.mining-crew { animation: none !important; }
.person-sprite[data-wm-active="true"][data-state="idle"] {
  animation: wm-idle-breath 4.8s ease-in-out infinite !important;
}
.person-sprite[data-wm-active="true"][data-state="work"][data-wm-phase="1"] {
  transform: translateY(-1px);
}
.person-sprite[data-wm-active="true"][data-state="walk"][data-wm-phase="0"] {
  transform: translateX(-2px);
}
.person-sprite[data-wm-active="true"][data-state="walk"][data-wm-phase="1"] {
  transform: translate(2px, -1px);
}
body[data-fx="full"] .person-sprite[data-wm-active="true"][data-state="walk"][data-wm-phase="0"] { transform: translateX(-3px); }
body[data-fx="full"] .person-sprite[data-wm-active="true"][data-state="walk"][data-wm-phase="1"] { transform: translate(3px, -1px); }
@keyframes wm-idle-breath { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.02); } }
.wm-mining-dust {
  position: absolute; left: 75%; top: 61%; width: 0; height: 0;
  pointer-events: none; z-index: 4;
}
.wm-mining-dust i {
  position: absolute; width: 2px; height: 2px; border-radius: 1px;
  background: #c1ac83; opacity: 0;
  animation: wm-tool-dust 550ms ease-out var(--wm-dust-delay, 0ms) both;
}
@keyframes wm-tool-dust {
  0% { opacity: 0; transform: translate(0, 0); }
  16% { opacity: .55; }
  100% { opacity: 0; transform: translate(var(--wm-dust-x), var(--wm-dust-y)); }
}
body[data-fx="off"] [data-wm-managed], body[data-paused="true"] [data-wm-managed],
body[data-hidden="true"] [data-wm-managed], body.paused [data-wm-managed],
.room:not(.fx-visible) [data-wm-managed], .room.fx-off [data-wm-managed] {
  animation: none !important; transform: none !important;
}
body[data-fx="off"] .wm-mining-dust, body[data-fx="low"] .wm-mining-dust,
body[data-paused="true"] .wm-mining-dust, body[data-hidden="true"] .wm-mining-dust,
body.paused .wm-mining-dust { display: none; }
@media (prefers-reduced-motion: reduce) {
  [data-wm-managed],
  [data-wm-managed][data-wm-active="true"][data-state][data-wm-phase] {
    animation: none !important; transform: none !important;
  }
  .wm-mining-dust { display: none; }
}

/* Residents share a floor-wide foreground corridor, independent of facility scenery. */
.floor-citizens{position:absolute;inset:0;z-index:6;pointer-events:none;overflow:visible}
.floor-citizens::before{content:"";position:absolute;left:54px;right:0;bottom:38px;height:21px;background:linear-gradient(0deg,#7c80632b,#252d29b8 45%,#83896a36 52%,transparent 60%);border-bottom:1px solid #acb48c22;box-shadow:0 5px 8px #0a12135c}
.wm-resident{position:absolute;left:0;bottom:49px;width:62px;height:88px;transform:translateX(calc(var(--wm-x,120px) - 31px));transition:transform 135ms linear}
.wm-resident>.person-sprite{height:100%;width:100%;object-fit:contain;animation:none!important;transform:none!important}
.wm-resident[data-rig-ready="true"]>.person-sprite{opacity:0}
.wm-rig{position:absolute;inset:0;transform:scaleX(var(--wm-facing,1));filter:drop-shadow(0 3px 2px #0008)}
.wm-rig img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.wm-rig .wm-upper{clip-path:inset(0 0 31% 0)}
.wm-rig .wm-left-leg{clip-path:polygon(0 68%,50% 68%,50% 100%,0 100%);transform-origin:43% 69%}
.wm-rig .wm-right-leg{clip-path:polygon(50% 68%,100% 68%,100% 100%,50% 100%);transform-origin:57% 69%}
.wm-resident[data-walking="true"] .wm-left-leg{animation:wm-stride-left .72s ease-in-out infinite}
.wm-resident[data-walking="true"] .wm-right-leg{animation:wm-stride-right .72s ease-in-out infinite}
.wm-resident[data-walking="true"] .wm-upper{animation:wm-walk-body .36s ease-in-out infinite}
.wm-resident[data-working="true"] .wm-upper{animation:wm-task-reach 2.2s ease-in-out infinite;transform-origin:50% 68%}
.wm-name{position:absolute;top:100%;left:50%;transform:translateX(-50%);color:#d8dfc9;text-shadow:0 1px 3px #000;font-size:9px;white-space:nowrap;line-height:1.4}
@keyframes wm-stride-left{0%,100%{transform:rotate(-19deg)}50%{transform:rotate(19deg)}}
@keyframes wm-stride-right{0%,100%{transform:rotate(19deg)}50%{transform:rotate(-19deg)}}
@keyframes wm-walk-body{0%,100%{transform:translateY(0)}50%{transform:translateY(-1px)}}
@keyframes wm-task-reach{0%,65%,100%{transform:rotate(0)}30%{transform:rotate(3deg)}}
body[data-fx="off"] .wm-resident,body[data-paused="true"] .wm-resident{transition:none}
body[data-fx="off"] .wm-rig img,body[data-paused="true"] .wm-rig img,body[data-hidden="true"] .wm-rig img{animation:none!important;transform:none!important}
@media(prefers-reduced-motion:reduce){.wm-resident{transition:none}.wm-rig img{animation:none!important;transform:none!important}}

/* Speech belongs to the actor host, outside the mirrored image rig. */
.wm-resident:has(>.speech-bubble){z-index:30}
.wm-resident>.speech-bubble{left:50%;top:auto;bottom:calc(100% + 7px);transform:translateX(-50%);width:max-content;max-width:178px;min-width:70px;white-space:normal;text-align:left;line-height:1.45;font-size:10px;padding:7px 9px;z-index:31;overflow-wrap:break-word}
.wm-resident>.speech-bubble::after{left:calc(50% - 4px);bottom:-4px}
.wm-task{position:absolute;top:calc(100% + 14px);left:50%;transform:translateX(-50%);width:max-content;max-width:140px;color:#a4c3b9;background:#0e1c22da;border:1px solid #89b6a42b;border-radius:3px;padding:1px 4px;line-height:1.3;font-size:8px;white-space:nowrap}
.wm-task:empty{display:none}
.wm-resident[data-carrying="true"] .wm-task{color:#e6cd98;border-color:#b59c594d}
.wm-resident[data-activity="rest"] .wm-task{color:#a7bdcb}
/* A role label is not a finished work-animation asset. Stop the placeholder
   whole-torso rocking rather than claiming every profession has the same job. */
.wm-resident[data-role][data-working="true"] .wm-upper{animation:none;transform:none}

/* Movement, facing and articulated joints have independent transforms. */
.wm-resident{transform:translate(calc(var(--wm-x,120px) - 31px),var(--wm-y,0px));transition:transform var(--wm-motion-duration,0ms) linear}
button.wm-resident{display:block;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible;pointer-events:auto;color:inherit;font:inherit;text-align:inherit;cursor:pointer}
button.wm-resident:hover{background:transparent;box-shadow:none}
.wm-resident.selected::before,.wm-resident:focus-visible::before{content:"";position:absolute;left:13px;right:13px;bottom:-2px;height:7px;border:1px solid #8ae1c9aa;border-radius:50%;background:#8ae1c91a;box-shadow:0 0 7px #83d5bd44}
.wm-resident:focus-visible{outline:1px dashed #8ae1c999;outline-offset:5px}
.wm-resident.selected>.wm-name{color:#a4f0d5}
.crew-card.selected{outline:1px solid #85cdb5;outline-offset:-1px;background:#213d38}
.resident-focus{border:1px solid #72ac9766;background:#17322c88;border-radius:7px;padding:12px;margin-bottom:12px;line-height:1.65}
.resident-focus strong{color:#c8e8d9}
