/* Theatre plate. Set --oddity-stage-height on the host to reserve a fixed camera height. */
.oddity-stage {
  --od-focus: 53% 56%;
  background: #263948;
  border: 1px solid #8d806c;
  border-radius: 10px;
  box-sizing: border-box;
  display: block;
  isolation: isolate;
  line-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.oddity-stage > svg {
  display: block;
  height: var(--oddity-stage-height, auto);
  margin: auto;
  max-height: var(--oddity-stage-max-height, min(38dvh, 300px));
  width: 100%;
}

.oddity-stage .od-camera {
  transform-box: view-box;
  transform-origin: var(--od-focus);
}

.oddity-stage .od-review-rail {
  opacity: 0;
}

.oddity-stage[data-beat="replay"] .od-review-rail {
  opacity: .8;
}

.oddity-stage[data-beat="replay"] .od-camera {
  animation: od-film-review 2s cubic-bezier(.16,.55,.22,1) both;
}

@keyframes od-film-review {
  0%, 8% { transform: scale(1); }
  57% { transform: scale(1.055); }
  100% { transform: scale(1.09); }
}

/* Every cutout owns its local setup and final poses. Replay runs an independent, slower exposure. */
.od-move {
  --od-from: none;
  --od-to: none;
  --od-peak: var(--od-to);
  --od-start-alpha: 1;
  --od-end-alpha: 1;
  --od-time: 820ms;
  --od-lag: 0ms;
  --od-pivot: 0px 0px;
  opacity: var(--od-start-alpha);
  transform: var(--od-from);
  transform-box: view-box;
  transform-origin: var(--od-pivot);
}

.oddity-stage:is([data-beat="reveal"],[data-beat="replay"]) .od-move {
  animation-delay: var(--od-lag);
  animation-duration: var(--od-time);
  animation-fill-mode: both;
  animation-name: od-live-cut;
  animation-timing-function: cubic-bezier(.3,.2,.25,1);
  opacity: var(--od-end-alpha);
  transform: var(--od-to);
}

.oddity-stage[data-beat="replay"] .od-move {
  animation-delay: calc(var(--od-lag) * 1.25);
  animation-duration: calc(var(--od-time) * 1.55);
  animation-name: od-slow-cut;
}

@keyframes od-live-cut {
  0% { opacity: var(--od-start-alpha); transform: var(--od-from); }
  68% { opacity: var(--od-end-alpha); transform: var(--od-peak); }
  100% { opacity: var(--od-end-alpha); transform: var(--od-to); }
}

@keyframes od-slow-cut {
  0%, 7% { opacity: var(--od-start-alpha); transform: var(--od-from); }
  76% { opacity: var(--od-end-alpha); transform: var(--od-peak); }
  100% { opacity: var(--od-end-alpha); transform: var(--od-to); }
}

/* The baton rotates into a giant whistle as the receiving runner leans away. */
.oddity-stage[data-oddity="daikon"] { --od-focus: 54% 48%; }
.od-d-giver {
  --od-pivot: 192px 167px;
  --od-peak: translate(14px, -4px) rotate(6deg);
  --od-to: translate(13px, 0) rotate(3deg);
}
.od-d-taker {
  --od-pivot: 405px 179px;
  --od-lag: 430ms;
  --od-peak: translate(14px, -4px) rotate(10deg);
  --od-to: translate(7px, 0) rotate(5deg);
}
.od-d-whistle {
  --od-from: rotate(-59deg);
  --od-peak: translate(78px, -9px) rotate(-15deg) scale(1.15);
  --od-to: translate(97px, 13px) rotate(-10deg) scale(1.13);
  --od-time: 940ms;
}
.od-d-cord {
  --od-start-alpha: 0;
  --od-from: rotate(-19deg) scale(.65);
  --od-peak: rotate(5deg);
  --od-to: rotate(0deg);
  --od-lag: 285ms;
}
.od-d-sound {
  --od-start-alpha: 0;
  --od-from: scale(.55);
  --od-peak: scale(1.08);
  --od-to: scale(1);
  --od-pivot: 396px 89px;
  --od-lag: 590ms;
  --od-time: 430ms;
}

.oddity-stage[data-beat="setup"] .od-d-leaves {
  transform-box: fill-box;
  transform-origin: 54% 93%;
  animation: od-leaf-lean 1.65s ease-in-out 2 alternate;
}

.oddity-stage[data-beat="setup"] .od-gait {
  transform-box: fill-box;
  transform-origin: 48% 12%;
  animation: od-gait 820ms ease-in-out 3 alternate;
}

@keyframes od-leaf-lean { from { transform: rotate(-3deg); } to { transform: rotate(5deg); } }
@keyframes od-gait { from { transform: rotate(-4deg); } to { transform: rotate(6deg); } }

/* Eight wooden seals descend in staggered pairs. Only the sixth leaves any ink. */
.oddity-stage[data-oddity="octopus"] { --od-focus: 59% 55%; }
.od-o-arm {
  --od-from: translateY(-4px);
  --od-peak: translateY(var(--od-press,15px));
  --od-to: translateY(-2px);
  --od-time: 700ms;
}
.od-o-head {
  --od-pivot: 310px 118px;
  --od-from: rotate(-1deg);
  --od-peak: translateY(4px) scale(1,.97);
  --od-to: rotate(3deg);
  --od-lag: 150ms;
  --od-time: 740ms;
}
.od-o-imprint {
  --od-pivot: 404px 176px;
  --od-start-alpha: 0;
  --od-from: scale(.2);
  --od-peak: scale(1.11);
  --od-to: scale(1);
  --od-lag: 480ms;
  --od-time: 370ms;
}
.od-o-burst {
  --od-pivot: 403px 171px;
  --od-start-alpha: 0;
  --od-from: scale(.5);
  --od-to: scale(1.04);
  --od-lag: 620ms;
  --od-time: 400ms;
}

/* In the photograph a single grain has slipped beyond the red timing line. */
.oddity-stage[data-oddity="onigiri"] { --od-focus: 68% 54%; }
.od-r-back {
  --od-peak: translate(43px,-2px) rotate(.6deg);
  --od-to: translate(46px,0);
  --od-pivot: 277px 145px;
}
.od-r-front {
  --od-peak: translate(46px,-3px) rotate(1deg);
  --od-to: translate(49px,0);
  --od-pivot: 274px 201px;
}
.od-r-grain {
  --od-start-alpha: 0;
  --od-from: translate(-3px,2px) rotate(-5deg);
  --od-peak: translate(40px,-7px) rotate(11deg);
  --od-to: translate(52px,-2px) rotate(0deg);
  --od-pivot: 321px 158px;
  --od-lag: 60ms;
}
.od-r-plane {
  --od-start-alpha: 0;
  --od-from: scaleY(.3);
  --od-pivot: 368px 156px;
  --od-to: scaleY(1);
  --od-lag: 570ms;
  --od-time: 290ms;
}
.od-r-photo {
  --od-start-alpha: 0;
  --od-from: scale(.87);
  --od-peak: scale(1.025);
  --od-to: scale(1);
  --od-lag: 610ms;
  --od-time: 450ms;
}

/* The carriage stays where it is. A carp balloon is hauled into the calipers. */
.oddity-stage[data-oddity="catfish"] { --od-focus: 58% 53%; }
.od-c-fish {
  --od-from: translate(238px,-6px) rotate(5deg);
  --od-peak: translate(-7px,-4px) rotate(-4deg);
  --od-to: translate(0,0) rotate(1deg);
  --od-time: 1080ms;
}
.od-c-tape {
  --od-pivot: 208px 156px;
  --od-from: scaleX(.1);
  --od-peak: scaleX(1.015);
  --od-to: scaleX(1);
  --od-lag: 90ms;
  --od-time: 930ms;
}
.od-c-eyes { --od-to: translateX(2.2px); --od-lag: 230ms; --od-time: 490ms; }
.od-c-jaws { --od-start-alpha: 0; --od-end-alpha: .9; --od-lag: 760ms; --od-time: 350ms; }
.od-c-ticks {
  --od-start-alpha: 0;
  --od-pivot: 504px 139px;
  --od-from: scale(.55);
  --od-to: scale(1);
  --od-lag: 785ms;
  --od-time: 350ms;
}

/* The tug heaves once. The rope straightens under a prawn's swimming harness. */
.oddity-stage[data-oddity="shrimp"] { --od-focus: 63% 61%; }
.od-h-tug {
  --od-pivot: 217px 158px;
  --od-from: rotate(-1deg);
  --od-peak: translate(13px,-2px) rotate(-1.6deg);
  --od-to: translate(12px,1px) rotate(-.5deg);
  --od-lag: 380ms;
  --od-time: 890ms;
}
.od-h-shrimp {
  --od-start-alpha: 0;
  --od-from: translate(-22px,25px) rotate(11deg) scale(.8);
  --od-peak: translate(3px,-3px) rotate(-7deg);
  --od-to: translate(0,0) rotate(-2deg);
  --od-time: 920ms;
}
.od-h-slack { --od-end-alpha: 0; --od-time: 445ms; --od-lag: 145ms; }
.od-h-rope { --od-start-alpha: 0; --od-to: none; --od-time: 480ms; --od-lag: 208ms; }
.od-h-smoke { --od-start-alpha: .73; --od-end-alpha: .12; --od-to: translate(-8px,-7px); --od-lag: 295ms; }
.od-h-spray {
  --od-start-alpha: 0;
  --od-from: scale(.62);
  --od-to: scale(1);
  --od-pivot: 477px 159px;
  --od-lag: 460ms;
  --od-time: 540ms;
}
.oddity-stage[data-beat="reveal"] .od-h-paddles {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: od-paddles 470ms 340ms ease-in-out 3 alternate;
}
@keyframes od-paddles { from { transform: rotate(-4deg); } to { transform: rotate(10deg); } }

/* The lantern drifts out of its cloud, revealing the sauce and the cook on its skewer. */
.oddity-stage[data-oddity="takoyaki"] { --od-focus: 61% 45%; }
.od-t-flight {
  --od-peak: translate(-41px,-13px) rotate(-3deg);
  --od-to: translate(-63px,-7px) rotate(-4deg);
  --od-time: 1240ms;
}
.od-t-halo { --od-from: scale(1); --od-to: scale(.85); --od-end-alpha: 0; --od-time: 690ms; }
.od-t-lantern { --od-end-alpha: 0; --od-time: 470ms; }
.od-t-glaze {
  --od-start-alpha: 0;
  --od-from: rotate(4deg) scale(.97);
  --od-to: rotate(0deg) scale(1);
  --od-lag: 170ms;
  --od-time: 650ms;
}
.od-t-rig {
  --od-start-alpha: 0;
  --od-from: rotate(9deg);
  --od-peak: rotate(-4deg);
  --od-to: rotate(0deg);
  --od-lag: 330ms;
  --od-time: 810ms;
}
.od-t-chef {
  --od-pivot: -29px -22px;
  --od-from: rotate(-29deg);
  --od-peak: rotate(9deg);
  --od-to: rotate(-5deg);
  --od-lag: 340ms;
  --od-time: 1010ms;
}
.od-t-cloud {
  --od-start-alpha: .92;
  --od-end-alpha: .65;
  --od-to: translate(25px,7px);
  --od-time: 1150ms;
}

/* Static poses still distinguish the setup, the joke, and the film-strip replay. */
.calm .oddity-stage *,
.oddity-stage.calm * {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .oddity-stage * { animation: none !important; }
}

.oddity-stage[data-paused="true"] *,
[data-paused="true"] .oddity-stage * {
  animation-play-state: paused !important;
}

@media (max-height: 550px) and (orientation: landscape) {
  .oddity-stage > svg { max-height: var(--oddity-stage-max-height, 31dvh); }
}

/* A curling stone sprouts a head, produces a broom, and sends its thrower sliding back. */
.oddity-stage[data-oddity="curling"] { --od-focus: 43% 63%; }
.od-cu-player {
  --od-pivot: 190px 184px;
  --od-from: translate(5px,0) rotate(7deg);
  --od-peak: translate(-64px,-4px) rotate(-14deg);
  --od-to: translate(-50px,1px) rotate(-9deg);
  --od-lag: 465ms;
  --od-time: 900ms;
}
.od-cu-turtle {
  --od-pivot: 340px 163px;
  --od-peak: translate(-20px,-4px) rotate(-3deg);
  --od-to: translate(-30px,-1px);
  --od-time: 1000ms;
}
.od-cu-limbs {
  --od-start-alpha: 0;
  --od-from: translate(13px,1px) scale(.65,.6);
  --od-peak: translate(-2px,-1px) scale(1.03);
  --od-to: scale(1);
  --od-lag: 100ms;
  --od-time: 515ms;
}
.od-cu-shell { --od-start-alpha: 0; --od-lag: 240ms; --od-time: 390ms; }
.od-cu-broom {
  --od-start-alpha: 0;
  --od-pivot: -54px 3px;
  --od-from: scale(.68) rotate(-80deg);
  --od-peak: rotate(23deg);
  --od-to: rotate(-4deg);
  --od-lag: 240ms;
  --od-time: 880ms;
}
.od-cu-sweep {
  --od-start-alpha: 0;
  --od-end-alpha: .88;
  --od-pivot: 239px 186px;
  --od-from: scaleX(.15);
  --od-to: scaleX(1);
  --od-lag: 670ms;
  --od-time: 530ms;
}

/* The umbrella opens and floats; its springboard performs the actual dive. */
.oddity-stage[data-oddity="parasol"] { --od-focus: 48% 51%; }
.od-pa-board {
  --od-pivot: 183px 119px;
  --od-peak: translate(96px,-7px) rotate(23deg);
  --od-to: translate(109px,35px) rotate(34deg);
  --od-lag: 225ms;
  --od-time: 1010ms;
}
.od-pa-umbrella {
  --od-pivot: 240px 108px;
  --od-peak: translate(24px,-35px) rotate(4deg);
  --od-to: translate(34px,-25px) rotate(-4deg);
  --od-time: 1120ms;
}
.od-pa-folded { --od-end-alpha: 0; --od-from: scale(1); --od-to: scale(1.25,.7); --od-lag: 110ms; --od-time: 325ms; }
.od-pa-open {
  --od-start-alpha: 0;
  --od-from: scale(.22,1.16);
  --od-peak: scale(1.045,.96);
  --od-to: scale(1);
  --od-lag: 155ms;
  --od-time: 480ms;
}
.od-pa-shoe { --od-pivot: 0 16px; --od-peak: rotate(16deg); --od-to: rotate(10deg); --od-lag: 170ms; }
.od-pa-splash {
  --od-start-alpha: 0;
  --od-pivot: 368px 198px;
  --od-from: scale(.3,.12);
  --od-peak: scale(1.04,1.15);
  --od-to: scale(1,.95);
  --od-lag: 845ms;
  --od-time: 520ms;
}

/* The judges let go, the jelly wobbles, and the tiny cherry steps out wearing the gold medal. */
.oddity-stage[data-oddity="pudding"] { --od-focus: 57% 61%; }
.od-pu-jelly {
  --od-pivot: 316px 158px;
  --od-peak: scale(1.10,.82) skewX(-3deg);
  --od-to: scale(.99,1.015) skewX(1deg);
  --od-lag: 160ms;
  --od-time: 930ms;
}
.od-pu-cherry {
  --od-from: translate(-24px,-17px) scale(.95);
  --od-peak: translate(3px,-6px) rotate(5deg);
  --od-to: translate(0,0);
  --od-pivot: 403px 183px;
  --od-lag: 480ms;
  --od-time: 680ms;
}
.od-pu-gloves { --od-peak: translateY(-14px); --od-to: translateY(-19px); --od-time: 680ms; }
.od-pu-medal {
  --od-pivot: 321px 51px;
  --od-peak: translate(8px,101px) rotate(-6deg);
  --od-to: translate(82px,145px) rotate(4deg) scale(.9);
  --od-lag: 110ms;
  --od-time: 1140ms;
}
.od-pu-crumbs {
  --od-start-alpha: 0;
  --od-pivot: 418px 183px;
  --od-from: scale(.35);
  --od-to: scale(1);
  --od-lag: 1030ms;
  --od-time: 370ms;
}

/* The two panda athletes leave; the black eye patches remain stuck to the photograph. */
.oddity-stage[data-oddity="panda"] { --od-focus: 50% 52%; }
.od-pd-team-a {
  --od-pivot: 244px 164px;
  --od-peak: translate(-92px,-8px) rotate(-5deg);
  --od-to: translate(-100px,2px) rotate(3deg);
  --od-lag: 245ms;
  --od-time: 1010ms;
}
.od-pd-team-b {
  --od-pivot: 360px 165px;
  --od-peak: translate(89px,-6px) rotate(5deg);
  --od-to: translate(99px,2px) rotate(-4deg);
  --od-lag: 340ms;
  --od-time: 1030ms;
}
.od-pd-patch-l { --od-pivot: -14px -27px; --od-peak: rotate(9deg); --od-to: rotate(4deg); --od-lag: 405ms; }
.od-pd-patch-r { --od-pivot: 9px -28px; --od-peak: rotate(-5deg); --od-to: translateY(1px) rotate(-7deg); --od-lag: 505ms; }
.od-pd-tape { --od-start-alpha: 0; --od-end-alpha: .85; --od-lag: 615ms; --od-time: 380ms; }
.od-pd-camera { --od-pivot: 0 11px; --od-peak: rotate(-6deg); --od-to: rotate(3deg); --od-time: 570ms; }
.od-pd-click { --od-start-alpha: 0; --od-end-alpha: .75; --od-from: translate(-2px,3px); --od-to: none; --od-time: 450ms; }

/* The tiny magnet takes the clock off its hook; the bent paperclip has never moved. */
.oddity-stage[data-oddity="magnet"] { --od-focus: 48% 54%; }
.od-mg-clock {
  --od-pivot: 488px 87px;
  --od-peak: translate(-155px,17px) rotate(-25deg);
  --od-to: translate(-164px,29px) rotate(-13deg);
  --od-lag: 160ms;
  --od-time: 1010ms;
}
.od-mg-robot {
  --od-pivot: 211px 192px;
  --od-peak: translate(-11px,0) rotate(-8deg);
  --od-to: translate(-4px,1px) rotate(-3deg);
  --od-lag: 620ms;
  --od-time: 680ms;
}
.od-mg-eyes { --od-peak: translate(2px,-2px); --od-to: translate(3px,-1px); --od-time: 450ms; }
.od-mg-chain { --od-pivot: 488px 29px; --od-peak: rotate(-24deg); --od-to: rotate(10deg); --od-lag: 235ms; --od-time: 730ms; }
.od-mg-slip { --od-start-alpha: 0; --od-lag: 840ms; --od-time: 400ms; }
.od-mg-lines {
  --od-start-alpha: 0;
  --od-end-alpha: .76;
  --od-pivot: 463px 83px;
  --od-from: scaleX(.3);
  --od-to: scaleX(1);
  --od-lag: 485ms;
  --od-time: 530ms;
}
.od-mg-hit { --od-start-alpha: 0; --od-from: translateX(7px); --od-to: translateX(-7px); --od-lag: 890ms; --od-time: 370ms; }
