/* Actors follow the painted 1024px-high stadium: 128/224 of the unit is body.
   0.124 * 128/224 gives a body ~83% of the near goalpost (87/1024).
   Shared by every role and pose; frozen scene-height prevents keyboard jumps. */
.stadium-plane .field-ball{top:var(--ground,65dvh);margin-top:calc(var(--actor-unit)*-.07142857)}
.field-player{z-index:4}.field-ball{z-index:5}.field-keeper{z-index:2}
#world{--actor-unit:clamp(46px,calc(var(--scene-height,100dvh)*.124),140px);--duel-unit:var(--actor-unit)}
.field-defender{position:absolute;top:var(--ground,65dvh);width:var(--duel-unit);height:var(--duel-unit);transform:translate(-50%,-100%);z-index:3;filter:drop-shadow(2px 3px 1px #061d2748);pointer-events:none;contain:layout style}
.stadium-plane .field-player,.stadium-plane .field-defender,.stadium-plane .field-keeper{top:var(--ground,65dvh);width:var(--actor-unit);height:var(--actor-unit)}
.defender-sprite{position:absolute;inset:0;background-image:url('/assets/defenders-v1.43ca815784d69291.webp');background-size:400% 800%;background-position:var(--defender-frame,0%) var(--defender-row,0%);image-rendering:pixelated;transform:scaleX(var(--defender-facing,-1));transform-origin:50% 92%}
.defender-shadow{position:absolute;bottom:7.142857%;left:20%;width:60%;height:7%;border-radius:50%;background:#071e2850}
.dribble-actor{display:none;position:absolute;inset:0;background-image:url('/assets/dribbles-v2.c4bc2229d8c2b7e0.webp');background-size:600% 700%;background-position:0 var(--dribble-row,0%);image-rendering:pixelated;pointer-events:none}
.duel-art-ready .field-player>img{visibility:hidden;animation:none}
.duel-art-ready .dribble-actor{display:block}
.field-player:before{content:'';position:absolute;left:25%;right:25%;bottom:5%;height:6%;border-radius:50%;background:#071e2850;pointer-events:none}
/* Crisp silhouettes and restrained kit colour lift preserve the shared artwork. */
.stadium-plane .field-player,.stadium-plane .field-defender,.stadium-plane .field-keeper{filter:drop-shadow(1px 2px 0 #071b2566) saturate(1.08) contrast(1.035)}
.player-step-dust{position:absolute;left:31%;bottom:7%;pointer-events:none}
.player-step-dust i{position:absolute;width:2px;height:2px;background:#e0d193;opacity:0}
.player-step-dust i:nth-child(2){left:4px;top:-1px}.player-step-dust i:nth-child(3){left:-3px;top:1px}
.duel-motion .player-step-dust i{animation:player-footstep .28s .16s ease-out both}
.duel-motion .player-step-dust i:nth-child(2){animation-delay:.43s}.duel-motion .player-step-dust i:nth-child(3){animation-delay:.76s}
@keyframes player-footstep{0%{opacity:0;transform:translate(0,0)}20%{opacity:.55}100%{opacity:0;transform:translate(-8px,-3px)}}
.duel-active.running{animation:none}
.duel-active.running .field-player,.duel-active.running .field-ball{animation:none}
.duel-dust{position:absolute;bottom:4%;left:38%;opacity:0;pointer-events:none}
.duel-dust i{position:absolute;width:3px;height:3px;background:#e6d39588}
.duel-dust i:nth-child(2){left:-6px;top:2px}.duel-dust i:nth-child(3){left:5px;top:-3px}
.defender-passed .duel-dust{animation:duel-dust .32s ease-out both}
@keyframes duel-dust{0%{opacity:0;transform:translate(0,0)}25%{opacity:.8}100%{opacity:0;transform:translate(-10px,-5px)}}
.crowd-pop .crowd-glints i{animation-duration:.55s}
@media(prefers-reduced-motion:reduce){.duel-dust{display:none}.defender-sprite{animation:none!important}}
.page-hidden .duel-dust{animation:none!important}

/* One physical coordinate system for idle, motion and goalkeepers. No portrait swap. */
.field-player>img,.field-keeper>img{width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.keeper-sprite{display:none;position:absolute;inset:0;background-image:url('/assets/keepers-unified-v1.645c86bf9355fb8b.webp');background-size:600% 300%;background-position:var(--keeper-frame,0%) var(--keeper-row,0%);image-rendering:pixelated;transform:scaleX(var(--keeper-facing,-1));pointer-events:none}
.duel-art-ready .keeper-sprite{display:block}
.duel-art-ready .field-keeper>img{visibility:hidden;animation:none!important}
.stadium-plane .field-keeper>img{animation:none!important}
.stadium-plane .field-keeper{transform-origin:50% 92.857143%;filter:drop-shadow(2px 3px 1px #061d2748)}
.shooting .field-keeper{animation:keeper-body-flight .64s .62s ease-out both}
.shooting.saved .field-keeper{animation:keeper-body-save .64s .62s ease-out both}
@keyframes keeper-body-flight{0%{transform:translate(-50%,-100%)}35%{transform:translate(calc(-50% - var(--actor-unit)*.10),calc(-100% - var(--actor-unit)*.16))}100%{transform:translate(calc(-50% - var(--actor-unit)*.16),-100%)}}
@keyframes keeper-body-save{0%{transform:translate(-50%,-100%)}45%{transform:translate(calc(-50% - var(--actor-unit)*.10),calc(-100% - var(--actor-unit)*.06))}100%{transform:translate(-50%,-100%)}}
body:has(#player-customize:not([hidden])):not(:has(#wardrobe-dialog[open])) .dribble-actor{animation:player-hint-glow 3s ease-in-out infinite}
body:has(#player-customize:focus-visible) .dribble-actor{filter:brightness(1.15) drop-shadow(0 0 3px #ffe7a0)}
@media(hover:hover) and (pointer:fine){body:has(#player-customize:hover) .dribble-actor{filter:brightness(1.15) drop-shadow(0 0 3px #ffe7a0)}}
@media(prefers-reduced-motion:reduce){.shooting .field-keeper{animation:none!important}.dribble-actor{animation:none!important}}
/* Gallery uses the same canonical idle cells, enlarged only inside the modal. */
.skin-stage>img{width:176px;height:176px;flex-shrink:0}.skin-card>img{width:112px;height:112px;max-width:100%}
@media(max-width:600px){.skin-stage>img{width:136px;height:136px}.skin-stage{gap:10px}.skin-card>img{width:96px;height:96px}}
@media(max-height:650px){.skin-stage>img{width:112px;height:112px}}
.keeper-has-ball .field-ball{visibility:hidden}
.lite-effects .player-step-dust{display:none}
.celebration-player .celebration-stage{filter:saturate(1.08) contrast(1.035)}
.skin-stage>img,.skin-card>img,.celebration-preview .celebration-stage{filter:saturate(1.08) contrast(1.035)}
@media(prefers-reduced-motion:reduce){.player-step-dust{display:none}}

/* Actor feet and painted pitch use the same floor on desktop and mobile. */
.stadium-plane{height:var(--scene-height,100dvh)}
.stadium-plane .stadium-art{top:calc(var(--ground,65dvh) - var(--scene-height,100dvh)*.71)}
#wardrobe-dialog{--wardrobe-unit:176px}
#wardrobe-dialog .skin-stage>img{width:var(--wardrobe-unit);height:var(--wardrobe-unit)}
.celebration-preview{--actor-unit:var(--wardrobe-unit,176px);height:calc(var(--actor-unit) + 48px)}
@media(max-width:600px){#wardrobe-dialog{--wardrobe-unit:136px}}
@media(max-height:650px){#wardrobe-dialog{--wardrobe-unit:112px}}
/* A narrow landscape viewport still needs space between full-size bodies. */
#world{--pitch-width:max(100vw,calc(var(--scene-height,100dvh)*1.5),calc(var(--actor-unit)*10.5))}
.stadium-plane{width:var(--pitch-width);transform:translateX(calc((100vw - var(--pitch-width))*var(--camera)))}
@keyframes camera-track{from{transform:translateX(calc((100vw - var(--pitch-width))*var(--camera-from)))}to{transform:translateX(calc((100vw - var(--pitch-width))*var(--camera)))}}

/* Native pixel sampling: canonical cells remain identical in every pose. */
.pixel-sprite-canvas{position:absolute;inset:0;width:100%;height:100%;image-rendering:pixelated;pointer-events:none}
.pixel-sprite-ready{background-image:none}
.stadium-plane .field-player,.stadium-plane .field-defender,.stadium-plane .field-keeper,
.celebration-player .celebration-stage,.celebration-actor,.celebration-photographer,
.skin-stage>img,.skin-card>img,.celebration-preview .celebration-stage{filter:none}
/* Keep the inviting twinkle separate from face/outline pixels. */
body:has(#player-customize:not([hidden])) .dribble-actor,
body:has(#player-customize:focus-visible) .dribble-actor{animation:none;filter:none}
@media(hover:hover) and (pointer:fine){body:has(#player-customize:hover) .dribble-actor{filter:none}}
body:has(#player-customize:not([hidden])) .field-player:after{content:'✦';position:absolute;left:72%;top:36%;font:12px monospace;color:#ffdf8c;pointer-events:none;animation:pixel-invite 3s steps(3) infinite}
@keyframes pixel-invite{0%,66%,100%{opacity:0}76%,84%{opacity:1}90%{opacity:.4}}
@media(prefers-reduced-motion:reduce){.field-player:after{display:none}}
