/* Decorative motion stays inside the existing scenes; game state never waits for it. */
.motion-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 34px;min-width:34px;min-height:34px;padding:5px;border:1px solid #6e8b7155;border-radius:8px;background:transparent;color:inherit;font:700 17px/1 system-ui;cursor:pointer}
.motion-toggle:hover{background:#99c74d20}.motion-toggle:focus-visible{outline:3px solid #8bcf15;outline-offset:3px}.motion-toggle:disabled{opacity:.5;cursor:default}
.football-page .intro>.motion-toggle{margin-left:auto;color:#344d34}
.football-page .game-toolbar-right>.motion-toggle{color:#d5e8d7}
.sea-page #sea-setup .sea-setup-header{gap:16px}.sea-page .sea-setup-header>.motion-toggle{margin-left:auto;color:#d5e8d7}
.sea-page .bottom-bar>.motion-toggle{margin-left:auto;color:#bdd4d5}
html[data-motion="on"] .football-page .setup-pitch-ball{animation:motion-pass 11s cubic-bezier(.45,0,.55,1) infinite;will-change:transform}
.football-page .setup-pitch-ball::after{content:"";position:absolute;inset:2px;border-radius:2px;background:#294e35;transform:rotate(20deg)}
.football-page .football-setup-pitch::before,.football-page .football-setup-pitch::after{content:"";position:absolute;width:5px;height:5px;border-radius:50%;top:25%;left:28%;background:#ff8c79;box-shadow:0 0 0 1px #143d2b}
.football-page .football-setup-pitch::after{top:68%;left:72%;background:#95baff}
html[data-motion="on"] .football-page .football-setup-pitch::before{animation:motion-player 9s ease-in-out infinite}
html[data-motion="on"] .football-page .football-setup-pitch::after{animation:motion-player 9s ease-in-out -4.5s infinite reverse}
.sea-page #sea-setup .sea-mini-board{overflow:hidden;isolation:isolate}
.sea-page .sea-mini-board::before{content:"";position:absolute;width:160px;height:160px;left:50%;top:50%;margin:-80px;border-radius:50%;background:conic-gradient(from 0deg,transparent 0deg 285deg,#a3f5bf04 285deg,#a3f5bf55 360deg);pointer-events:none;opacity:0}
html[data-motion="on"] .sea-page .sea-mini-board::before{opacity:1;animation:motion-radar 6s linear infinite}
html[data-motion="on"] .sea-page #sea-setup .sea-mini-hit{animation:motion-signal 3s ease-out infinite}
html[data-motion="on"] .sea-page #sea-setup .sea-mini-ship-a{animation:motion-ship 5s ease-in-out infinite}
html[data-motion="on"] .sea-page #sea-setup .sea-mini-ship-b{animation:motion-ship-vertical 6s ease-in-out -2s infinite}
/* Stop the background while a teacher is typing. */
.football-page:has(#builder-screen :is(input,textarea,select):focus) .football-setup-pitch *,.football-page:has(#builder-screen :is(input,textarea,select):focus) .football-setup-pitch::before,.football-page:has(#builder-screen :is(input,textarea,select):focus) .football-setup-pitch::after,.sea-page:has(#sea-setup :is(input,textarea,select):focus) .sea-mini-board *,.sea-page:has(#sea-setup :is(input,textarea,select):focus) .sea-mini-board::before{animation-play-state:paused!important}
.motion-layer{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:-1}
.motion-confetti{position:absolute;left:50%;top:50%;width:9px;height:18px;border-radius:2px;pointer-events:none}
.sea-page .cell{position:relative}
.motion-impact{position:absolute;inset:10%;border:2px solid currentColor;border-radius:50%;pointer-events:none;z-index:3}
.motion-droplet{position:absolute;left:50%;top:50%;width:4px;height:7px;border-radius:50%;pointer-events:none;z-index:3}
html[data-motion="off"] .football-page .match-ball{transition:none!important}
html[data-motion="off"] .football-page .goal-flash{animation:none!important}
html[data-motion="off"] .sea-page .cell{transition:none!important}
/* Container units keep travel proportional without changing layout each frame. */
.football-page .football-setup-pitch{container-type:size}
@keyframes motion-pass{0%,100%{transform:translate(calc(-50% - 22cqw),calc(-50% - 18cqh)) rotate(0deg)}25%{transform:translate(calc(-50% + 2cqw),calc(-50% + 12cqh)) rotate(170deg)}50%{transform:translate(calc(-50% + 32cqw),calc(-50% - 8cqh)) rotate(340deg)}75%{transform:translate(calc(-50% + 2cqw),calc(-50% - 22cqh)) rotate(170deg)}}
@keyframes motion-player{0%,100%{translate:0 0}45%{translate:9px 7px}75%{translate:3px -2px}}
@keyframes motion-radar{to{transform:rotate(360deg)}}
@keyframes motion-signal{0%{box-shadow:0 0 0 0 #d8f35f80}70%,100%{box-shadow:0 0 0 15px #d8f35f00}}
@keyframes motion-ship{0%,100%{translate:0 0}50%{translate:3px 1px}}
@keyframes motion-ship-vertical{0%,100%{translate:0 0}50%{translate:0 -3px}}
@media(max-width:600px){.football-page .intro>.motion-toggle{position:absolute;right:0;top:14px}.football-page .intro{position:relative;padding-right:42px!important}}
@media(prefers-reduced-motion:reduce){.football-page .football-setup-pitch *,.football-page .football-setup-pitch::before,.football-page .football-setup-pitch::after,.sea-page .sea-mini-board *,.sea-page .sea-mini-board::before{animation:none!important}.football-page .match-ball,.sea-page .cell{transition:none!important}.football-page .goal-flash{animation:none!important}}

html[data-motion="on"] .football-page .match-ball{transition:left .58s cubic-bezier(.4,0,.2,1),transform .58s cubic-bezier(.4,0,.2,1)}
