.qc-character-rig {
  transform-origin: 50% 82%;
  will-change: transform, filter, opacity;
}

.qc-character-effects { pointer-events: none; }
.qc-character-effects::before,
.qc-character-effects::after { position: absolute; display: none; content: ""; }

/* Shared hand anchors: the weapon grip sits inside the toon hand, not beside it. */
.qc-character-left-hand-weapon,
.qc-character-right-hand-weapon {
  top: -4% !important;
  width: 44% !important;
  height: 72% !important;
  transform-origin: 50% 90% !important;
  will-change: transform, filter;
}
.qc-character-left-hand-weapon {
  left: 12% !important;
  transform: scaleX(-1) rotate(26deg);
}
.qc-character-right-hand-weapon {
  right: 12% !important;
  transform: rotate(26deg);
}

/* Rarity treatment is intentionally subtle for unique and theatrical for legendary. */
.rarity-unique.qc-character-upper-body,
.rarity-unique.qc-character-lower-body {
  animation: qc-unique-armor-glint 2800ms ease-in-out infinite;
}
.rarity-legendary.qc-character-upper-body,
.rarity-legendary.qc-character-lower-body {
  animation: qc-legendary-armor-glint 1900ms ease-in-out infinite;
}
.rarity-unique.qc-character-left-hand-weapon,
.rarity-unique.qc-character-right-hand-weapon {
  filter: brightness(1.08) drop-shadow(0 0 3px rgba(182, 116, 255, .72));
}
.rarity-legendary.qc-character-left-hand-weapon,
.rarity-legendary.qc-character-right-hand-weapon {
  filter: brightness(1.2) saturate(1.14) drop-shadow(0 0 3px rgba(255, 228, 163, .95)) drop-shadow(0 0 8px rgba(239, 93, 116, .55));
}
.pixel-character-stage[data-rarity="unique"],
.toon-stage[data-rarity="unique"],
.demo-character-stage[data-rarity="unique"] {
  animation: qc-unique-stage-aura 2800ms ease-in-out infinite;
}
.pixel-character-stage[data-rarity="legendary"],
.toon-stage[data-rarity="legendary"],
.demo-character-stage[data-rarity="legendary"] {
  animation: qc-legendary-stage-aura 1900ms ease-in-out infinite;
}
[data-rarity="unique"] .qc-character-base {
  animation: qc-unique-sprite-glow 2600ms ease-in-out infinite;
}
[data-rarity="legendary"] .qc-character-base {
  animation: qc-legendary-sprite-glow 1700ms ease-in-out infinite;
}
[data-rarity="unique"] .qc-character-effects::after {
  display: block;
  top: 22%;
  left: 18%;
  width: 4px;
  height: 4px;
  background: #d8b4fe;
  box-shadow: 7em 1em #a855f7, 1.2em 7em #c084fc, 8.2em 8.4em #7c3aed;
  animation: qc-unique-motes 3200ms steps(6, end) infinite;
}
[data-rarity="legendary"] .qc-character-effects::after {
  display: block;
  top: 15%;
  left: 13%;
  width: 5px;
  height: 5px;
  background: #fff8d6;
  box-shadow: 8.6em .9em #f2c771, 1.1em 5em #ef5d74, 9.6em 7.6em #ffe4a3, 3em 10.5em #f2c771, 7.5em 12em #fff8d6;
  animation: qc-legendary-motes 2100ms steps(7, end) infinite;
}

/* Body movement uses fluid anticipation and follow-through; no avatar-size pulsing. */
[data-character-animation="idle"] .qc-character-rig { animation: qc-character-idle 2400ms ease-in-out infinite; }
[data-character-animation="idle"] .qc-character-base { animation: qc-character-base-idle 2400ms ease-in-out infinite; }
[data-rarity="unique"][data-character-animation="idle"] .qc-character-base { animation: qc-character-base-idle 2400ms ease-in-out infinite, qc-unique-sprite-glow 2600ms ease-in-out infinite; }
[data-rarity="legendary"][data-character-animation="idle"] .qc-character-base { animation: qc-character-base-idle 2400ms ease-in-out infinite, qc-legendary-sprite-glow 1700ms ease-in-out infinite; }
[data-character-animation="idle"] .qc-character-upper-body:not(.rarity-unique):not(.rarity-legendary) { animation: qc-armor-upper-idle 2400ms ease-in-out infinite; }
[data-character-animation="idle"] .qc-character-lower-body:not(.rarity-unique):not(.rarity-legendary) { animation: qc-armor-lower-idle 2400ms ease-in-out infinite; }
[data-character-animation="idle"] .qc-character-left-hand-weapon { animation: qc-weapon-left-idle 2400ms ease-in-out infinite; }
[data-character-animation="idle"] .qc-character-right-hand-weapon { animation: qc-weapon-right-idle 2400ms ease-in-out infinite; }
[data-character-animation="entrance"] .qc-character-rig { animation: qc-character-entrance 900ms cubic-bezier(.18,.8,.22,1) both; }
[data-character-animation="entrance"] .qc-character-left-hand-weapon { animation: qc-weapon-left-settle 900ms cubic-bezier(.18,.8,.22,1) both; }
[data-character-animation="entrance"] .qc-character-right-hand-weapon { animation: qc-weapon-right-settle 900ms cubic-bezier(.18,.8,.22,1) both; }
[data-character-animation="entrance"] .qc-character-upper-body { animation: qc-armor-upper-entrance 900ms cubic-bezier(.18,.8,.22,1) both; }
[data-character-animation="entrance"] .qc-character-lower-body { animation: qc-armor-lower-entrance 900ms cubic-bezier(.18,.8,.22,1) both; }
[data-character-animation="run"] .qc-character-rig { animation: qc-character-run 700ms ease-in-out infinite; }
[data-character-animation="run"] .qc-character-left-hand-weapon { animation: qc-weapon-left-run 700ms ease-in-out infinite; }
[data-character-animation="run"] .qc-character-right-hand-weapon { animation: qc-weapon-right-run 700ms ease-in-out infinite; }
[data-character-animation="run"] .qc-character-upper-body { animation: qc-armor-upper-run 700ms ease-in-out infinite; }
[data-character-animation="run"] .qc-character-lower-body { animation: qc-armor-lower-run 700ms ease-in-out infinite; }
[data-character-animation="attack"] .qc-character-rig { animation: qc-character-attack 650ms cubic-bezier(.2,.76,.22,1) both; }
[data-character-animation="attack"] .qc-character-upper-body { animation: qc-armor-upper-attack 650ms ease-out both; }
[data-character-animation="attack"] .qc-character-lower-body { animation: qc-armor-lower-attack 650ms ease-out both; }
[data-character-animation="attack"] .qc-character-right-hand-weapon { animation: qc-weapon-right-attack 650ms cubic-bezier(.2,.8,.18,1) both; }
[data-character-animation="attack"] .qc-character-left-hand-weapon { animation: qc-weapon-left-attack 650ms cubic-bezier(.2,.8,.18,1) both; }
[data-character-animation="critical"] .qc-character-rig { animation: qc-character-critical 900ms cubic-bezier(.15,.75,.2,1) both; }
[data-character-animation="critical"] .qc-character-right-hand-weapon { animation: qc-weapon-right-critical 900ms cubic-bezier(.15,.75,.2,1) both; }
[data-character-animation="critical"] .qc-character-left-hand-weapon { animation: qc-weapon-left-critical 900ms cubic-bezier(.15,.75,.2,1) both; }
[data-character-animation="critical"] .qc-character-upper-body { animation: qc-armor-upper-critical 900ms ease-out both; }
[data-character-animation="critical"] .qc-character-lower-body { animation: qc-armor-lower-critical 900ms ease-out both; }
[data-character-animation="hit"] .qc-character-rig { animation: qc-character-hit 480ms cubic-bezier(.2,.85,.35,1) both; }
[data-character-animation="hit"] .qc-character-upper-body { animation: qc-armor-upper-hit 480ms ease-out both; }
[data-character-animation="hit"] .qc-character-lower-body { animation: qc-armor-lower-hit 480ms ease-out both; }
[data-character-animation="victory"] .qc-character-rig { animation: qc-character-victory 1500ms cubic-bezier(.2,.72,.25,1) both; }
[data-character-animation="victory"] .qc-character-left-hand-weapon { animation: qc-weapon-left-victory 1500ms cubic-bezier(.2,.72,.25,1) both; }
[data-character-animation="victory"] .qc-character-right-hand-weapon { animation: qc-weapon-right-victory 1500ms cubic-bezier(.2,.72,.25,1) both; }
[data-character-animation="victory"] .qc-character-upper-body { animation: qc-armor-upper-victory 1500ms ease-out both; }
[data-character-animation="victory"] .qc-character-lower-body { animation: qc-armor-lower-victory 1500ms ease-out both; }
[data-character-animation="defeat"] .qc-character-rig { animation: qc-character-defeat 1200ms cubic-bezier(.3,.05,.55,1) both; }
[data-character-animation="defeat"] .qc-character-left-hand-weapon { animation: qc-weapon-left-defeat 1200ms ease-in both; }
[data-character-animation="defeat"] .qc-character-right-hand-weapon { animation: qc-weapon-right-defeat 1200ms ease-in both; }
[data-character-animation="defeat"] .qc-character-upper-body { animation: qc-armor-upper-defeat 1200ms ease-in both; }
[data-character-animation="defeat"] .qc-character-lower-body { animation: qc-armor-lower-defeat 1200ms ease-in both; }

[data-character-animation="critical"] .qc-character-effects::before {
  display: block;
  top: 4%;
  right: -18%;
  width: 8%;
  height: 90%;
  transform: rotate(42deg);
  background: #ffe4a3;
  box-shadow: .55em 0 #ef5d74, -.55em 0 rgba(255, 228, 163, .42);
  animation: qc-critical-slash 900ms steps(6, end) both;
}
[data-character-animation="hit"] .qc-character-effects::before {
  display: block;
  top: 32%;
  left: 44%;
  width: 7%;
  aspect-ratio: 1;
  background: #fff8f0;
  box-shadow: -1.2em -.7em #ef5d74, 1.2em -1em #ef5d74, -1.4em 1em #8f2449, 1.5em .8em #8f2449;
  animation: qc-hit-burst 480ms steps(4, end) both;
}
[data-character-animation="victory"] .qc-character-effects::before {
  display: block;
  top: 16%;
  left: 12%;
  width: 5%;
  aspect-ratio: 1;
  background: #f2c771;
  box-shadow: 8em .5em #ffe4a3, 1.5em 5em #ef5d74, 9em 6em #f2c771, 4.5em -1em #fff8f0;
  animation: qc-victory-sparkles 1500ms steps(6, end) both;
}

@keyframes qc-character-idle {
  0%, 100% { transform: translate(0, 0) rotate(-.35deg); }
  45% { transform: translate(0, -3px) rotate(.35deg); }
  60% { transform: translate(0, -2px) rotate(.15deg); }
}
@keyframes qc-character-entrance {
  0% { opacity: 0; transform: translate(-118%, 16px) rotate(-7deg); }
  46% { opacity: 1; transform: translate(13%, -7px) rotate(3deg); }
  68% { transform: translate(-5%, 2px) rotate(-1.5deg); }
  84% { transform: translate(2%, -1px) rotate(.5deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes qc-character-run {
  0%, 100% { transform: translate(-5px, 1px) rotate(-2deg); }
  25% { transform: translate(0, -6px) rotate(.5deg); }
  50% { transform: translate(5px, 1px) rotate(2deg); }
  75% { transform: translate(0, -6px) rotate(-.5deg); }
}
@keyframes qc-character-attack {
  0%, 100% { transform: none; }
  18% { transform: translate(-10px, 2px) rotate(-4deg); }
  34% { transform: translate(-13px, -2px) rotate(-5deg); }
  58% { transform: translate(25px, -4px) rotate(6deg); }
  74% { transform: translate(17px, 1px) rotate(3deg); }
  90% { transform: translate(-3px, 0) rotate(-.5deg); }
}
@keyframes qc-character-critical {
  0%, 100% { transform: none; filter: none; }
  16% { transform: translate(-13px, 3px) rotate(-6deg); }
  34% { transform: translate(-18px, -4px) rotate(-8deg); }
  55% { transform: translate(31px, -10px) rotate(9deg); filter: brightness(1.45); }
  72% { transform: translate(20px, -3px) rotate(4deg); filter: brightness(1.16); }
  90% { transform: translate(-4px, 0) rotate(-1deg); filter: none; }
}
@keyframes qc-character-hit {
  0%, 100% { transform: none; filter: none; }
  16% { transform: translate(13px, -2px) rotate(5deg); filter: brightness(1.9) saturate(.45); }
  34% { transform: translate(-11px, 3px) rotate(-5deg); filter: sepia(1) saturate(4) hue-rotate(310deg); }
  52% { transform: translate(7px, -1px) rotate(3deg); }
  72% { transform: translate(-4px, 0) rotate(-1.5deg); }
}
@keyframes qc-character-victory {
  0%, 100% { transform: none; }
  14% { transform: translateY(2px) rotate(-1deg); }
  30% { transform: translateY(-15px) rotate(1.5deg); }
  46% { transform: translateY(0) rotate(-.5deg); }
  61% { transform: translateY(-9px) rotate(1deg); }
  76% { transform: translateY(0); }
}
@keyframes qc-character-defeat {
  0% { opacity: 1; transform: none; }
  26% { transform: translate(-3px, 5px) rotate(-2deg); }
  54% { transform: translate(7px, 15px) rotate(7deg); }
  78%, 100% { opacity: .58; transform: translate(9px, 31px) rotate(10deg) scaleY(.72); }
}

@keyframes qc-character-base-idle { 0%,100%{transform:translateY(0) rotate(-.15deg)} 48%{transform:translateY(-1px) rotate(.18deg)} }
@keyframes qc-armor-upper-idle { 0%,100%{transform:translateY(0) rotate(-.12deg)} 48%{transform:translateY(-2px) rotate(.18deg)} }
@keyframes qc-armor-lower-idle { 0%,100%{transform:translateY(0)} 48%{transform:translateY(-1px)} }

@keyframes qc-weapon-left-idle { 0%,100%{transform:scaleX(-1) rotate(26deg)} 50%{transform:scaleX(-1) rotate(30deg)} }
@keyframes qc-weapon-right-idle { 0%,100%{transform:rotate(26deg)} 50%{transform:rotate(30deg)} }
@keyframes qc-weapon-left-settle { 0%{transform:scaleX(-1) rotate(48deg)} 58%{transform:scaleX(-1) rotate(16deg)} 100%{transform:scaleX(-1) rotate(26deg)} }
@keyframes qc-weapon-right-settle { 0%{transform:rotate(48deg)} 58%{transform:rotate(16deg)} 100%{transform:rotate(26deg)} }
@keyframes qc-weapon-left-run { 0%,100%{transform:scaleX(-1) rotate(32deg)} 50%{transform:scaleX(-1) rotate(7deg)} }
@keyframes qc-weapon-right-run { 0%,100%{transform:rotate(32deg)} 50%{transform:rotate(7deg)} }
@keyframes qc-weapon-right-attack { 0%,100%{transform:rotate(26deg)} 18%{transform:rotate(-52deg)} 36%{transform:rotate(-74deg)} 61%{transform:rotate(82deg)} 82%{transform:rotate(36deg)} }
@keyframes qc-weapon-left-attack { 0%,100%{transform:scaleX(-1) rotate(26deg)} 18%{transform:scaleX(-1) rotate(52deg)} 36%{transform:scaleX(-1) rotate(70deg)} 61%{transform:scaleX(-1) rotate(-70deg)} 82%{transform:scaleX(-1) rotate(-30deg)} }
@keyframes qc-weapon-right-critical { 0%,100%{transform:rotate(26deg);filter:inherit} 17%{transform:rotate(-72deg)} 38%{transform:rotate(-96deg)} 58%{transform:rotate(108deg);filter:brightness(1.65) drop-shadow(0 0 8px #ffe4a3)} 80%{transform:rotate(39deg);filter:inherit} }
@keyframes qc-weapon-left-critical { 0%,100%{transform:scaleX(-1) rotate(26deg);filter:inherit} 17%{transform:scaleX(-1) rotate(72deg)} 38%{transform:scaleX(-1) rotate(92deg)} 58%{transform:scaleX(-1) rotate(-98deg);filter:brightness(1.55)} 80%{transform:scaleX(-1) rotate(-36deg);filter:inherit} }
@keyframes qc-weapon-left-victory { 0%,100%{transform:scaleX(-1) rotate(26deg)} 24%,72%{transform:scaleX(-1) rotate(62deg)} 84%{transform:scaleX(-1) rotate(34deg)} }
@keyframes qc-weapon-right-victory { 0%,100%{transform:rotate(26deg)} 24%,72%{transform:rotate(62deg)} 84%{transform:rotate(34deg)} }
@keyframes qc-weapon-left-defeat { 0%{transform:scaleX(-1) rotate(26deg)} 60%,100%{transform:scaleX(-1) translate(-9px,18px) rotate(86deg);opacity:.62} }
@keyframes qc-weapon-right-defeat { 0%{transform:rotate(26deg)} 60%,100%{transform:translate(9px,18px) rotate(86deg);opacity:.62} }

@keyframes qc-armor-upper-entrance { 0%{transform:translate(-5px,3px) rotate(-3deg)} 54%{transform:translate(3px,-2px) rotate(1.5deg)} 100%{transform:none} }
@keyframes qc-armor-lower-entrance { 0%{transform:translate(-3px,5px) rotate(-1deg)} 68%{transform:translate(2px,1px) rotate(.5deg)} 100%{transform:none} }
@keyframes qc-armor-upper-run { 0%,100%{transform:translate(-1px,1px) rotate(-1deg)} 50%{transform:translate(1px,-3px) rotate(1deg)} }
@keyframes qc-armor-lower-run { 0%,100%{transform:translate(1px,0) rotate(.6deg)} 50%{transform:translate(-1px,-2px) rotate(-.6deg)} }
@keyframes qc-armor-upper-attack { 0%,100%{transform:none} 36%{transform:translateX(-3px) rotate(-1.8deg)} 64%{transform:translate(4px,-1px) rotate(2deg)} 82%{transform:translateX(1px) rotate(.5deg)} }
@keyframes qc-armor-lower-attack { 0%,100%{transform:none} 34%{transform:translateX(-1px) rotate(-.7deg)} 62%{transform:translate(2px,1px) rotate(1deg)} }
@keyframes qc-armor-upper-critical { 0%,100%{transform:none;filter:inherit} 34%{transform:translate(-4px,-1px) rotate(-2.4deg)} 58%{transform:translate(5px,-3px) rotate(2.8deg);filter:brightness(1.35)} 78%{transform:translate(2px,0) rotate(.8deg)} }
@keyframes qc-armor-lower-critical { 0%,100%{transform:none} 34%{transform:translateX(-2px) rotate(-1deg)} 60%{transform:translate(3px,1px) rotate(1.3deg)} }
@keyframes qc-armor-upper-hit { 0%,100%{transform:none} 24%{transform:translate(4px,-2px) rotate(3deg)} 52%{transform:translate(-3px,1px) rotate(-2deg)} }
@keyframes qc-armor-lower-hit { 0%,100%{transform:none} 26%{transform:translate(2px,1px) rotate(1.2deg)} 54%{transform:translate(-2px,0) rotate(-.8deg)} }
@keyframes qc-armor-upper-victory { 0%,100%{transform:none} 30%{transform:translateY(-4px) rotate(1deg)} 46%{transform:translateY(1px) rotate(-.5deg)} 61%{transform:translateY(-2px) rotate(.6deg)} }
@keyframes qc-armor-lower-victory { 0%,100%{transform:none} 30%,61%{transform:translateY(-2px)} 46%,76%{transform:translateY(1px)} }
@keyframes qc-armor-upper-defeat { 0%{transform:none} 54%{transform:translate(2px,4px) rotate(3deg)} 100%{transform:translate(5px,10px) rotate(7deg)} }
@keyframes qc-armor-lower-defeat { 0%{transform:none} 54%{transform:translate(1px,2px) rotate(1deg)} 100%{transform:translate(3px,7px) rotate(4deg)} }

@keyframes qc-unique-stage-aura { 0%,100%{filter:drop-shadow(0 0 2px rgba(168,85,247,.18))} 50%{filter:drop-shadow(0 0 7px rgba(192,132,252,.46))} }
@keyframes qc-legendary-stage-aura { 0%,100%{filter:drop-shadow(0 0 4px rgba(242,199,113,.45))} 48%{filter:drop-shadow(0 0 10px rgba(255,228,163,.9)) drop-shadow(0 0 18px rgba(239,93,116,.42))} }
@keyframes qc-unique-sprite-glow { 0%,100%{filter:brightness(1) drop-shadow(0 0 1px rgba(168,85,247,.22))} 50%{filter:brightness(1.1) drop-shadow(0 0 5px rgba(192,132,252,.7))} }
@keyframes qc-legendary-sprite-glow { 0%,100%{filter:brightness(1.06) saturate(1.04) drop-shadow(0 0 3px rgba(242,199,113,.6))} 45%{filter:brightness(1.28) saturate(1.16) drop-shadow(0 0 7px rgba(255,248,214,.98)) drop-shadow(0 0 13px rgba(239,93,116,.65))} 70%{filter:brightness(1.13) saturate(1.1) drop-shadow(0 0 6px rgba(242,199,113,.82))} }
@keyframes qc-unique-armor-glint { 0%,100%{transform:translateY(0);filter:brightness(1) drop-shadow(0 0 0 transparent)} 50%{transform:translateY(-2px);filter:brightness(1.12) drop-shadow(0 0 3px rgba(168,85,247,.55))} }
@keyframes qc-legendary-armor-glint { 0%,100%{transform:translateY(0) rotate(-.15deg);filter:brightness(1.05) saturate(1.06) drop-shadow(0 0 2px rgba(242,199,113,.45))} 50%{transform:translateY(-2px) rotate(.2deg);filter:brightness(1.3) saturate(1.2) drop-shadow(0 0 6px rgba(255,228,163,.9))} }
@keyframes qc-unique-motes { 0%,100%{opacity:.2;transform:translateY(9px)} 45%{opacity:.85;transform:translateY(-7px)} 70%{opacity:.45;transform:translate(2px,-12px)} }
@keyframes qc-legendary-motes { 0%,100%{opacity:.28;transform:translateY(12px) rotate(0)} 38%{opacity:1;transform:translateY(-6px) rotate(45deg)} 68%{opacity:.58;transform:translate(3px,-16px) rotate(90deg)} }
@keyframes qc-critical-slash { 0%,28%{opacity:0;transform:translate(-120px,90px) rotate(42deg)} 52%{opacity:1} 78%,100%{opacity:0;transform:translate(120px,-70px) rotate(42deg)} }
@keyframes qc-hit-burst { 0%,15%{opacity:0;transform:scale(.2)} 40%{opacity:1;transform:scale(1.4)} 100%{opacity:0;transform:scale(2)} }
@keyframes qc-victory-sparkles { 0%,100%{opacity:0;transform:translateY(18px) scale(.4)} 35%,72%{opacity:1;transform:translateY(-8px) scale(1)} }

@media (prefers-reduced-motion: reduce) {
  .pixel-character-stage,
  .toon-stage,
  .demo-character-stage,
  .qc-character-rig,
  .qc-character-layer,
  .qc-character-effects::before,
  .qc-character-effects::after { animation: none !important; transition: none !important; }
}
