.kungfu-scene {
  --cloth: #297b9b; --cloth-dark: #21566f; --cloth-light: #72b5bf; --sash: #e9bf68;
  --strike-distance: calc(44cqw - 120px);
  --leap-height: 63px;
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 320px;
  overflow: hidden;
  background: #e1eee3 url("./assets/kungfu-bamboo-v1.png") center 62% / cover no-repeat;
  container-type: inline-size;
  border-bottom: 2px solid #8aa193;
}
.kf-holder { position:absolute; width:280px; height:250px; bottom:3%; left:calc(28% - 140px); }
.kf-team-1 { left:calc(72% - 140px); --cloth:#b54f64; --cloth-dark:#823a52; --cloth-light:#e28b92; --sash:#e9c47b; }
.kf-facing,.kf-motion,.kf-drawing { width:100%; height:100%; }
.kf-facing { position:relative; }
.kf-team-1 .kf-facing { transform:scaleX(-1); }
.kf-drawing { overflow:visible; filter:drop-shadow(1px 2px 0 #ffffff80); }
.kf-shadow { position:absolute; width:72%; height:10px; left:14%; bottom:6%; background:#344f3945; border-radius:50%; }
.kf-figure { transform-origin:105px 228px; }
.kf-painted {position:relative;transform-origin:50% 86%;filter:drop-shadow(0 2px 2px #253c3e25);}
.kf-pose {position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none;opacity:0;}
.kf-pose-guard {opacity:1;}
[data-action="attack"] .kf-pose-guard,[data-action="miss"] .kf-pose-guard {animation:kf-guard-frames 1.45s step-end both;}
[data-action="attack"] .kf-pose-palm,[data-action="miss"] .kf-pose-palm {animation:kf-pose-frames 1.45s step-end both;}
.kungfu-scene:is([data-move="whirlwind"],[data-move="flying-kick"]) [data-action="attack"] .kf-pose-palm {animation:none;}
.kungfu-scene[data-move="whirlwind"] [data-action="attack"] .kf-pose-sweep,
.kungfu-scene[data-move="flying-kick"] [data-action="attack"] .kf-pose-kick {animation:kf-pose-frames 1.45s step-end both;}
.kungfu-scene:is([data-move="turning-strike"],[data-move="swallow-flight"]) [data-action="attack"] .kf-pose-palm {animation:kf-second-pose 1.45s step-end both;}
.kungfu-scene:is([data-move="turning-strike"],[data-move="swallow-flight"]) [data-action="attack"] .kf-pose-kick {animation:kf-first-pose 1.45s step-end both;}
.kungfu-scene[data-move="sweeping-cloud"] [data-action="attack"] .kf-pose-palm {animation:none;}
.kungfu-scene[data-move="sweeping-cloud"] [data-action="attack"] .kf-pose-sweep {animation:kf-first-pose 1.45s step-end both;}
.kungfu-scene[data-move="sweeping-cloud"] [data-action="attack"] .kf-pose-kick {animation:kf-second-pose 1.45s step-end both;}
.kungfu-scene[data-move="bamboo-combo"] [data-action="attack"] .kf-motion {animation:kf-three-palms 1.45s ease-in-out both;}
.kungfu-scene[data-move="swallow-flight"] [data-action="attack"] .kf-motion {animation:kf-swallow 1.45s ease-in-out both;}
.kungfu-scene[data-move="sweeping-cloud"] [data-action="attack"] .kf-motion {animation:kf-low-high 1.45s ease-in-out both;}
.kungfu-scene[data-move="flowing-water"] [data-action="attack"] .kf-motion {animation:kf-flow 1.45s ease-in-out both;}
.kungfu-scene[data-active]:is([data-move="bamboo-combo"],[data-move="flowing-water"]) .kf-impact {animation:kf-triple-impact 1.45s ease-out both;}
.kungfu-scene[data-active]:is([data-move="swallow-flight"],[data-move="sweeping-cloud"]) .kf-impact {animation:kf-double-impact 1.45s ease-out both;}
@keyframes kf-guard-frames {0%,84%,100%{opacity:1}12%{opacity:0}}
@keyframes kf-pose-frames {0%,84%,100%{opacity:0}12%{opacity:1}}
@keyframes kf-first-pose {0%,48%,100%{opacity:0}12%{opacity:1}}
@keyframes kf-second-pose {0%,84%,100%{opacity:0}48%{opacity:1}}
@keyframes kf-three-palms {0%,100%{transform:translateX(0)}18%{transform:translateX(-12px)}31%,48%,66%{transform:translateX(var(--strike-distance))}39%,56%{transform:translateX(calc(var(--strike-distance) - 32px))}84%{transform:translateX(8cqw)}}
@keyframes kf-swallow {0%,100%{transform:translate(0,0)}18%{transform:translate(6cqw,-20px)}34%{transform:translate(var(--strike-distance),-55px) rotate(-8deg)}47%{transform:translate(calc(var(--strike-distance) - 45px),-18px)}59%,68%{transform:translate(var(--strike-distance),0)}84%{transform:translate(8cqw,-15px)}}
@keyframes kf-low-high {0%,100%{transform:translateX(0)}20%{transform:translate(7cqw,15px)}39%{transform:translate(var(--strike-distance),18px)}48%{transform:translate(calc(var(--strike-distance) - 25px),8px)}62%{transform:translate(var(--strike-distance),-35px)}84%{transform:translate(8cqw,0)}}
@keyframes kf-flow {0%,100%{transform:translateX(0)}15%{transform:translate(8cqw,-8px) rotate(-4deg)}29%,47%,65%{transform:translateX(var(--strike-distance)) rotate(3deg)}38%,55%{transform:translate(calc(var(--strike-distance) - 30px),-14px) rotate(-5deg)}84%{transform:translateX(8cqw)}}
@keyframes kf-triple-impact {0%,27%,38%,45%,55%,63%,76%,100%{opacity:0;transform:scale(.5)}31%,48%,66%{opacity:.9;transform:scale(1.15)}}
.kf-torso { transform-origin:105px 144px; }
.kf-arm-front { transform-origin:119px 94px; transform:rotate(-26deg); }
.kf-arm-back { transform-origin:91px 94px; transform:rotate(-12deg); }
.kf-leg-front { transform-origin:109px 153px; }
.kf-leg-back { transform-origin:93px 153px; }
.kf-ribbon { transform-origin:120px 141px; animation:kf-silk 3s ease-in-out infinite; }
.kf-headband { transform-origin:92px 48px; animation:kf-silk 2.3s ease-in-out infinite reverse; }
.kf-move-name { position:absolute; top:15px; left:50%; transform:translateX(-50%); padding:4px 18px; color:#244b3c; font-size:20px; font-weight:700; white-space:nowrap; background:#fffffff0; border-block:1px solid #aac6a9; }
.kf-impact { position:absolute; pointer-events:none; width:110px; height:110px; left:calc(72% - 55px); top:36%; opacity:0; color:#308299; }
.kf-impact svg { width:100%; height:100%; }
.kungfu-scene[data-attacker="1"] .kf-impact { left:calc(28% - 55px); color:#b75166; }
.kungfu-scene[data-active] .kf-impact { animation:kf-impact 1.45s ease-out both; }
.kungfu-scene:has([data-action="miss"]) .kf-impact { display:none; }
.kf-holder[data-action="attack"] .kf-motion { animation:kf-lunge 1.45s ease-in-out both; }
.kf-holder[data-action="attack"] .kf-arm-front { animation:kf-palm 1.45s ease-in-out both; }
.kf-holder[data-action="attack"] .kf-torso { animation:kf-lean 1.45s ease-in-out both; }
.kf-holder[data-action="attack"] .kf-ribbon { animation:kf-ribbon-whip 1.45s ease-out both; }
.kf-holder[data-action="hit"] .kf-motion { animation:kf-recoil 1.45s ease-out both; }
.kf-holder[data-action="hit"] .kf-figure { animation:kf-stagger 1.45s ease-out both; }
.kf-holder[data-action="miss"] .kf-motion { animation:kf-feint 1.45s ease-in-out both; }
.kf-holder[data-action="miss"] .kf-arm-front { animation:kf-palm 1.45s ease-in-out both; }
.kf-holder[data-action="dodge"] .kf-motion { animation:kf-dodge 1.45s ease-in-out both; }
.kf-holder[data-action="dodge"] .kf-torso { animation:kf-duck 1.45s ease-in-out both; }
.kf-holder[data-action="fall"] .kf-motion { animation:kf-fall-slide 1.45s ease-out both; }
.kf-holder[data-action="fall"] .kf-figure { animation:kf-fall-kneel 1.45s ease-out both; }
.kf-holder[data-action="fall"][data-fall="roll"] .kf-figure { animation:kf-fall-roll 1.45s ease-out both; }
.kf-holder[data-action="fall"][data-fall="slide"] .kf-figure { animation:kf-fall-sit 1.45s ease-out both; }
.kungfu-scene[data-move="whirlwind"] [data-action="attack"] .kf-motion { animation:kf-spin-travel 1.45s ease-in-out both; }
.kungfu-scene[data-move="whirlwind"] [data-action="attack"] .kf-leg-front { animation:kf-sweep 1.45s ease-in-out both; }
.kungfu-scene[data-move="whirlwind"] [data-action="attack"] .kf-arm-back { animation:kf-counter-arm 1.45s ease-in-out both; }
.kungfu-scene[data-move="flying-kick"] [data-action="attack"] .kf-motion { animation:kf-fly 1.45s ease-in-out both; }
.kungfu-scene[data-move="flying-kick"] [data-action="attack"] .kf-leg-front { animation:kf-kick 1.45s ease-in-out both; }
.kungfu-scene[data-move="flying-kick"] [data-action="attack"] .kf-leg-back { animation:kf-tuck 1.45s ease-in-out both; }
.kungfu-scene[data-move="turning-strike"] [data-action="attack"] .kf-motion { animation:kf-turn 1.45s ease-in-out both; }
.kungfu-scene[data-move="turning-strike"] [data-action="attack"] .kf-arm-back { animation:kf-back-strike 1.45s ease-in-out both; }
.kungfu-scene[data-move="turning-strike"] .kf-impact { animation-name:kf-double-impact; }
.game-stage:has(#pauseOverlay:not([hidden])) .kungfu-scene * { animation-play-state:paused !important; }
@keyframes kf-silk { 50% { transform:rotate(-7deg) skewY(6deg); } }
@keyframes kf-lunge { 0%,100% {transform:translateX(0)} 18% {transform:translateX(-12px)} 42%,55% {transform:translateX(var(--strike-distance))} 75% {transform:translateX(8cqw)} }
@keyframes kf-feint { 0%,100% {transform:translateX(0)} 40% {transform:translateX(var(--strike-distance))} 60% {transform:translateX(16cqw)} }
@keyframes kf-palm { 0%,100% {transform:rotate(-26deg)} 20% {transform:rotate(24deg)} 42%,55% {transform:rotate(-18deg) scaleX(1.22)} 75% {transform:rotate(-40deg)} }
@keyframes kf-lean { 0%,100% {transform:rotate(0)} 20% {transform:rotate(-8deg)} 44%,58% {transform:rotate(12deg)} }
@keyframes kf-ribbon-whip { 0%,100% {transform:rotate(0)} 40%,60% {transform:rotate(150deg) scaleX(1.25)} }
@keyframes kf-recoil { 0%,39%,100% {transform:translateX(0)} 48%,65% {transform:translateX(-7cqw)} }
@keyframes kf-stagger { 0%,39%,100% {transform:rotate(0)} 50% {transform:rotate(-21deg)} 65% {transform:rotate(-12deg)} }
@keyframes kf-dodge { 0%,100% {transform:translateX(0)} 36%,65% {transform:translateX(-8cqw) translateY(-8px)} }
@keyframes kf-duck { 0%,100% {transform:rotate(0)} 40%,60% {transform:rotate(-32deg)} }
@keyframes kf-spin-travel { 0%,100% {transform:translateX(0)} 25% {transform:translate(8cqw,-20px) rotate(-15deg)} 44% {transform:translate(var(--strike-distance),-40px) rotate(12deg)} 60% {transform:translate(var(--strike-distance),-12px)} }
@keyframes kf-sweep { 0%,100% {transform:rotate(0)} 22% {transform:rotate(30deg)} 44%,56% {transform:rotate(-92deg)} 78% {transform:rotate(-25deg)} }
@keyframes kf-counter-arm { 0%,100% {transform:rotate(-12deg)} 35%,60% {transform:rotate(75deg)} }
@keyframes kf-fly { 0%,100% {transform:translate(0,0)} 20% {transform:translate(2cqw,10px) rotate(-8deg)} 42% {transform:translate(var(--strike-distance),calc(0px - var(--leap-height))) rotate(-17deg)} 58% {transform:translate(var(--strike-distance),-26px) rotate(-10deg)} 78% {transform:translate(8cqw,4px)} }
@keyframes kf-kick { 0%,100% {transform:rotate(0)} 20% {transform:rotate(25deg)} 40%,60% {transform:rotate(-82deg)} }
@keyframes kf-tuck { 0%,100% {transform:rotate(0)} 35%,65% {transform:rotate(52deg)} }
@keyframes kf-turn { 0%,100% {transform:translateX(0)} 25% {transform:translateX(10cqw) scaleX(-1)} 40% {transform:translateX(var(--strike-distance)) scaleX(-1)} 55%,65% {transform:translateX(var(--strike-distance)) scaleX(1)} 80% {transform:translateX(10cqw)} }
@keyframes kf-back-strike { 0%,100% {transform:rotate(-12deg)} 25%,43% {transform:rotate(85deg) scaleX(1.2)} 58% {transform:rotate(-45deg)} }
@keyframes kf-fall-slide { 0%,39% {transform:translateX(0)} 70%,100% {transform:translateX(-12cqw)} }
@keyframes kf-fall-kneel { 0%,39% {transform:rotate(0)} 65%,100% {transform:translateY(30px) rotate(-22deg) scaleY(.78)} }
@keyframes kf-fall-roll { 0%,39% {transform:rotate(0)} 78%,100% {transform:rotate(-80deg) translateY(-12px)} }
@keyframes kf-fall-sit { 0%,39% {transform:rotate(0)} 70%,100% {transform:rotate(-50deg) scaleY(.8)} }
@keyframes kf-impact { 0%,37%,75%,100% {opacity:0;transform:scale(.4) rotate(-40deg)} 44% {opacity:1;transform:scale(1) rotate(0)} 63% {opacity:0;transform:scale(1.5) rotate(30deg)} }
@keyframes kf-double-impact { 0%,31%,49%,76%,100% {opacity:0;transform:scale(.5)} 37%,58% {opacity:1;transform:scale(1.15)} 68% {opacity:0;transform:scale(1.6)} }
@media(max-width:600px) {
  .kungfu-scene {height:240px;--strike-distance:calc(50cqw - 72px);--leap-height:38px;}
  .kf-holder {width:172px;height:170px;left:calc(25% - 86px);bottom:6%;}
  .kf-team-1 {left:calc(75% - 86px);}
  .kf-move-name {font-size:16px;top:10px;padding:3px 12px;}
  .kf-impact {width:72px;height:72px;left:calc(75% - 36px);}
  .kungfu-scene[data-attacker="1"] .kf-impact {left:calc(25% - 36px);}
}
@media(prefers-reduced-motion:reduce) {
  .kungfu-scene * {animation:none !important;}
  .kf-holder[data-action="hit"],.kf-holder[data-action="fall"] {opacity:.55;}
  .kungfu-scene[data-active]:not(:has([data-action="miss"])) .kf-impact {opacity:1;}
}
