.hero-rig {
  position:relative;
  display:block;
  height:100%;
  aspect-ratio:80/110;
  flex:none;
  container-type:size;
  isolation:isolate;
  image-rendering:pixelated;
  --weapon-size:45;
  --idle-arm:-12deg;
  --attack-windup:20deg;
  --attack-release:-76deg;
  --attack-wrist:100deg;
  --attack-step:12%;
  --attack-rise:-2%;
  --attack-hue:#ffbe72;
}
.hero-rig.rig-swordsman:not(.rig-equipped) {--attack-wrist:145deg}
.hero-rig.rig-tank {
  --weapon-size:39;
  --idle-arm:-8deg;
  --attack-windup:15deg;
  --attack-release:-71deg;
  --attack-wrist:110deg;
  --attack-step:8%;
  --attack-rise:0%;
}
.hero-rig.rig-hunter {
  --weapon-size:49;
  --idle-arm:-16deg;
  --attack-windup:-59deg;
  --attack-release:-64deg;
  --attack-wrist:54deg;
  --attack-step:1%;
  --attack-rise:0%;
  --attack-hue:#98ffc5;
}
.hero-rig.rig-assassin {
  --weapon-size:33;
  --idle-arm:-11deg;
  --attack-windup:12deg;
  --attack-release:-92deg;
  --attack-wrist:111deg;
  --attack-step:23%;
  --attack-rise:-5%;
  --attack-hue:#d1a1ff;
}
.hero-rig.rig-priest {
  --weapon-size:49;
  --idle-arm:-14deg;
  --attack-windup:-35deg;
  --attack-release:-63deg;
  --attack-wrist:50deg;
  --attack-step:1%;
  --attack-rise:0%;
  --attack-hue:#efb6ff;
}
.hero-rig .rig-pose {
  position:absolute;
  inset:0;
  transform-origin:50% 100%;
  animation:rig-breathe 2.8s steps(6,end) infinite;
}
.expedition-unit:nth-child(2) .rig-pose,.side-1 .rig-pose {animation-delay:-.8s}
.expedition-unit:nth-child(3) .rig-pose {animation-delay:-1.6s}
.hero-rig .rig-joint {
  position:absolute;
  inset:0;
  transform-origin:var(--joint-x) var(--joint-y);
  transform:rotate(var(--idle-arm));
  animation:rig-shoulder-idle 2.8s steps(6,end) infinite;
}
.hero-rig .rig-body,.hero-rig .rig-arm {
  position:absolute;
  display:block;
  inset:0;
  width:100%;
  height:100%;
  object-fit:fill;
  image-rendering:pixelated;
  pointer-events:none;
}
.hero-rig .rig-weapon {
  position:absolute;
  width:0;
  height:0;
  transform:rotate(var(--grip-angle));
  pointer-events:none;
}
.hero-rig .rig-weapon img {
  display:block;
  position:absolute;
  width:auto;
  height:calc(var(--weapon-size)*1cqh);
  max-width:none;
  max-height:none;
  transform:translate(var(--grip-x),var(--grip-y));
  image-rendering:pixelated;
}
.hero-rig.rig-awakened,.journey-walk.rig-awakened {
  filter:drop-shadow(0 0 3px #ffd9a8) drop-shadow(0 0 11px #d55cff91);
}
.hero-attacking .rig-pose {animation:rig-step .44s ease-out both}
.hero-attacking .rig-joint {animation:rig-attack .44s ease-out both}
.hero-attacking .rig-weapon {animation:rig-wrist .44s ease-out both}
.hero-attacking .hero-rig::after {
  content:"";
  position:absolute;
  inset:37% auto auto 70%;
  width:64%;
  height:5%;
  z-index:1;
  background:linear-gradient(90deg,transparent 4%,var(--attack-hue) 65%,#fff5b4 80%,transparent);
  clip-path:polygon(0 44%,25% 44%,25% 22%,70% 22%,70% 0,100% 0,100% 55%,80% 55%,80% 77%,37% 77%,37% 100%,0 100%);
  pointer-events:none;
  animation:rig-impact .44s ease-out both;
}
.hero-attacking .rig-hunter::after {width:48%;animation-name:rig-arrow}
.hero-attacking .rig-priest::after {transform-origin:left center;animation-name:rig-cast}
.down .hero-rig :is(.rig-pose,.rig-joint,.rig-weapon),
.defeated .hero-rig :is(.rig-pose,.rig-joint,.rig-weapon) {animation:none}
#expedition-actors .enemy-target:has(.hero-rig) .hero-rig {animation:rig-hit .34s .20s ease-out}
#expedition-scene #expedition-actors .enemy-target .hero-rig img {animation:none}
#expedition-actors .expedition-unit .hero-rig {
  height:clamp(54px,24cqh,230px);
  max-width:100%;
  margin-inline:auto;
}
#expedition-scene.party-preview #expedition-actors .hero-rig {height:clamp(62px,22cqh,180px)}
#expedition-scene:is([data-environment],.party-preview) #expedition-actors>.expedition-unit:not(.expedition-enemy) .hero-rig :is(.rig-body,.rig-arm) {
  width:100%;
  height:100%;
  max-height:none;
  object-fit:fill;
}
#expedition-scene:is([data-environment],.party-preview) #expedition-actors>.expedition-unit:not(.expedition-enemy) .hero-rig .rig-weapon img {
  width:auto;
  height:calc(var(--weapon-size)*1cqh);
  max-height:none;
}
.arena .hero-rig {max-width:100%}
.world-fighter:has(.hero-rig) {
  display:grid;
  place-items:end center;
  animation:none;
  filter:drop-shadow(0 10px 12px #080718);
}
#rpg-station[data-screen="hangar"] .world-fighter[hidden] {display:none}
.world-fighter .hero-rig {max-width:100%}
@keyframes rig-breathe {
  0%,100% {transform:scaleY(1)}
  52% {transform:scaleY(.981)}
}
@keyframes rig-shoulder-idle {
  0%,100% {transform:rotate(var(--idle-arm))}
  52% {transform:rotate(calc(var(--idle-arm) + 4deg))}
}
@keyframes rig-step {
  0%,100% {transform:none}
  23% {transform:translateX(-4%) scale(1.02,.96)}
  49% {transform:translate(var(--attack-step),var(--attack-rise)) skewX(-5deg)}
  71% {transform:translateX(calc(var(--attack-step)*.48)) scaleY(.985)}
}
@keyframes rig-attack {
  0%,100% {transform:rotate(var(--idle-arm))}
  27% {transform:rotate(var(--attack-windup))}
  51% {transform:rotate(var(--attack-release))}
  71% {transform:rotate(calc(var(--attack-release)*.7))}
}
@keyframes rig-wrist {
  0%,100% {rotate:0deg}
  25% {rotate:12deg}
  49% {rotate:var(--attack-wrist)}
  72% {rotate:calc(var(--attack-wrist)*.52)}
}
@keyframes rig-impact {
  0%,37% {opacity:0;transform:translate(-15%,0) rotate(-21deg) scaleX(.3)}
  53% {opacity:.85;transform:translate(5%,15%) rotate(9deg) scaleX(1)}
  78%,100% {opacity:0;transform:translate(26%,34%) rotate(24deg) scaleX(.72)}
}
@keyframes rig-arrow {
  0%,42% {opacity:0;transform:translateX(0)}
  52% {opacity:.85}
  85%,100% {opacity:0;transform:translateX(185%)}
}
@keyframes rig-cast {
  0%,36% {opacity:0;transform:scale(.3,2)}
  55% {opacity:.9;transform:scale(1,3)}
  88%,100% {opacity:0;transform:translateX(85%) scale(1.3,1)}
}
@keyframes rig-hit {
  40% {transform:translateX(-4%);filter:brightness(1.8)}
}
@media (max-width:570px) {
  #expedition-actors .expedition-unit .hero-rig {
    height:min(clamp(60px,23cqh,175px),34vw);
  }
  .world-fighter:has(.hero-rig) {width:56%}
}
@media (prefers-reduced-motion:reduce) {
  .hero-rig :is(.rig-pose,.rig-joint,.rig-weapon),
  #expedition-actors .enemy-target:has(.hero-rig) .hero-rig {animation:none}
  .hero-attacking .hero-rig::after {display:none}
}
