# Direction D: live 3D slots

Kyle's rule: animals are never pasted stills. Every place an animal appears in `d/` is a slot that hosts a page from the 3D lane's export, `../live/<page>.html` (the static export of `apps/mobile/lab/mocks/live/` in the `aa-ui-live-stage` worktree).

`d/assets/live.js` mounts a slot by itself as soon as `../live/<page>.html` exists (pages served over http; `?live=1` forces the iframe, `?live=0` forces the shimmer). It appends `&alpha=1` to every query so small slots can draw over our own backdrop. Until then each slot shows a marked shimmer and a tag with the look and clip it will play.

Status on 2026-11-29: `live/` holds only `video/endgame-{phone,desk}-60fps.mp4`; no `API.md` yet. One page has a known API: the lab's `endgame.html` (read from its source), and the end-of-game panel is wired to it. Everything else below is the contract this direction needs.

Looks are skin ids (`cafe-maid-cat`), animal ids (`hippo`), or `animal:skin`, as `cast.js parseLook` reads them. Seat order is always you, left, far, right.

## 1. `clearing`: Home (pending)

Screen: `d/screens/home.html`, one full-bleed scene slot (`#scene`).

| Param | Value | Meaning |
|---|---|---|
| `field` | `petal-pond` | the player's field |
| `you` | `strawberry-pig` | your look, front and centre behind the stump |
| `cast` | `barista-dog,gentleman-thief-raccoon,loan-shark` | the three recent animals beside you |
| `shot` | `home` (phone) / `home-wide` (desktop) | camera; keep animals above y 700 on phone (the chips and dock) and between y 120 and 640 on desktop |
| `youClip` | `idle` | your animal's loop |
| `tap` | `you` | report taps on your animal |

Messages in: `{aa:'clearing', cmd:'shot', shot:'home'|'stump'}` (Play tapped: lean onto the stump while the queue runs; back to `home` on Cancel). Out: `{aa:'clearing', type:'tap', who:'you'}` opens the Wardrobe.

## 2. `stage`: Wardrobe stage (pending)

Screen: `d/screens/wardrobe.html`, slot `#stage` (phone 250 x 290 at the top centre; desktop 460 x 560 in the left column). Transparent background over our banner backdrop.

| Param | Value | Meaning |
|---|---|---|
| `look` | `cafe-maid-cat` (banner), `strawberry-pig` (picked), `cafe-maid-bear` (locked) | who stands on the stage |
| `clip` | `idle` | starting loop |
| `turntable` | `1` | slow turn; drag to spin by hand |
| `framing` | `full` | whole body, feet on the slot's bottom 12% |
| `bg` | `none` | transparent canvas (`alpha=1`) |
| `shadow` | `1` | contact shadow only |

Messages in: `{aa:'stage', cmd:'look', look, clip}`, `{aa:'stage', cmd:'emote', clip}` with the skin's real clips (`silverCloche`, `checkPlease` for Cafe Maid Cat; `carefulTea`, `goldenHoneyPour` for Cafe Maid Bear; the animal's default intro and win for the rest), `{aa:'stage', cmd:'turntable'}` toggles the turn. Out (wanted): `{aa:'stage', type:'emoteEnd'}` so the key un-presses.

## 2b. Wardrobe tiles: recorded loops (pending files)

Screen: `d/screens/wardrobe.html`, every skin tile. Not an iframe: one `<video muted loop playsinline autoplay preload="metadata">` per tile, `src=../../live/tiles/<skin-id>.mp4`, `poster=../../live/tiles/<skin-id>.jpg`, recorded by the 3D lane as a 2 to 3 s idle loop on a flat `#f3e6cc` backdrop, framed for a 4:5 portrait well (object-fit cover). Only tiles in view play (IntersectionObserver on the grid); the rest pause. Missing mp4 falls back to the poster, missing poster to the face icon. Checked with stand-in files: 4 playing, 2 on posters, 9 on icons, 1 off screen paused on phone.

## 3. `stage` (small): end-of-game unlock callout (pending)

Screen: `d/screens/endgame.html`, slot `#unl`, 62 x 62 px (72 desktop).

`look=hippo&clip=happyDance&framing=bust&turntable=0&bg=none`. Needs a bust framing that reads at 62 px.

## 4. `table`: Table HUD (pending)

Screen: `d/screens/table.html` (built by the tray worker), one full-bleed scene slot (`#scene`).

| Param | Value | Meaning |
|---|---|---|
| `seats` | `strawberry-pig,barista-dog,gentleman-thief-raccoon,loan-shark` | you, left, far, right |
| `field` | `forest` | |
| `shot` | `play` | today's play camera |
| `trayTop` | phone `686` (`638` while a card is lifted), desktop `654` (the top of the cards) | the y where the tray starts; frame the camera so your animal stands fully above it |

Your animal stands at x 143 to 247 on phone with its feet at `trayTop`; the purse and state tabs cover only x 148 and below and x 250 and up, in the 22 px above the tray. Stump centre: phone (195, 448), desktop (720, 392); the 2D prize, leader chip, stakes, discards and target rings are placed against it. In the round result state the stump is clear and the camera may celebrate the winner.

Messages in: `{type:'trayTop', value, state}` on every tray morph (`table.js` also rewrites `data-q`).

## 5. `endgame`: End of game (wired to the lab API, export pending)

Screen: `d/screens/endgame.html`, one full-bleed scene slot (`#scene`). Params as the lab page reads them:

`seats=strawberry-pig,cafe-maid-cat,barista-dog,loan-shark&winner=1&place=2&unlock=1&rankup=1&panel=0.30&autoplay=0` (desktop `panel=0.24`). `panel` is the panel's share of the screen height plus a 2% gap: 236 / 844 on phone, 196 / 900 on desktop.

Messages in: `{aa:'eg', cmd:'goto', beat}` for `winner | you | placement | xp | rank | done`, plus `play | pause | resume`. Out: `{aa:'eg', type:'beat', beat, ...}` moves the panel to that step, so a played-through table drives the panel. Beat names match the lab page's.

## 6. `loading`: Loading in (pending)

Screen: `d/screens/loading.html`, one full-bleed scene slot (`#scene`).

| Param | Value | Meaning |
|---|---|---|
| `field` | `forest` | |
| `seats` | `strawberry-pig,cafe-maid-cat,gentleman-thief-raccoon,loan-shark` | you, left, far, right, each in its skin |
| `arrive` | `1,2,0,3` | arrival order |
| `hold` | `1` | after seating, hold the seated idle until told to start |
| `shot` | `phone` / `wide` | keep seated animals between y 120 and 560 on phone, 120 and 640 on desktop |
| `footer` | `0.33` phone / `0.27` desktop | share of the screen the nameplates, tip and bar take |

Messages in: `{aa:'loading', cmd:'arrive', seats:[...]}` (who has joined so far; walk or hop each newcomer in and seat it). Out (wanted): `{aa:'loading', type:'seated', seat}` so its nameplate lands as it sits.
