Create a single-file, playable browser claw machine (an arcade crane game).
Output ONE file named index.html — all CSS inline in <style>, all JS inline in <script>. No external dependencies, no build step, no images, fonts or audio from the internet. Draw everything with Canvas 2D, CSS or inline SVG.
## The machine (all of this must actually work, not just be drawn)
1. A cabinet seen from the front: a glass box, a pile of at least 12 prizes on the floor, a prize chute on one side, and a claw hanging on a cable from a rail at the top.
2. Prizes are little characters or objects drawn in code — at least 4 different kinds, in different sizes. Their starting positions are randomized with `Math.random()` on every new game, so no two games start with the same pile. No prize starts above the chute.
3. Controls: the claw moves left or right for as long as a control is held — on-screen left and right buttons that work with mouse AND touch, plus the ArrowLeft and ArrowRight keys. A DROP control: an on-screen button, plus the Space key. The claw cannot leave the cabinet.
4. A drop is a real sequence animated with `requestAnimationFrame`: the claw descends, closes, lifts, carries to the chute, opens, and returns. The controls are locked until it is over. No instant jumps.
5. Grabbing is decided by geometry, not by a dice roll alone: the claw can only pick up a prize that is actually under it when it closes. A drop over empty floor, or over the chute, must always come back empty.
6. The grip is imperfect, like the real thing. A held prize hangs and swings as the claw moves, and it can slip and fall back into the pile. How well the claw was centred over the prize must change the chance of keeping it: a centred grab holds more often than a grab at the prize's edge. A prize that falls lands back in the pile and can be grabbed again.
7. A prize released over the chute is won: it leaves the pile, appears on a "collected" shelf, and the win counter goes up.
8. Credits: a game starts with 10 credits and each drop costs 1. At 0 credits the drop control is disabled and a game-over panel shows how many prizes were won, with a "New game" button that resets the credits, the counter and the shelf, and re-randomizes the pile.
## Feel (attempt these; a working machine comes first)
- The pile behaves like a pile: prizes rest on the floor or on each other, and when one lands or is pulled out, its neighbours settle or get nudged instead of floating in place.
- The cable gets longer and shorter; the prongs visibly open and close; a held prize hangs from the claw rather than being glued to a point.
- Small touches that make it feel like an arcade: a flourish on a win, a wobble on a near miss, a marquee or lights. Sound is not required.
## Hooks for automated checking — required, with these exact names
The page must expose its real state so a script can check it without guessing at your layout.
- Elements: `id="btn-left"`, `id="btn-right"`, `id="btn-drop"`, `id="btn-new"` (the New game button; it may stay hidden until the game is over, but it must exist), `id="credits"` and `id="wins"` (their text content is the number and nothing else).
- `window.clawGame.getState()` returns a plain object at any time:
`{ phase, clawX, chuteX, credits, wins, prizes, held }`
- `phase`: one of `"idle"`, `"dropping"`, `"closing"`, `"lifting"`, `"carrying"`, `"releasing"`, `"returning"`, `"gameover"`.
- `clawX`: the claw's horizontal position, from 0 (its left limit) to 1 (its right limit).
- `chuteX`: the `clawX` value at which the claw releases over the chute.
- `prizes`: an array of `{ id, kind, x, y, inPile }`. `x` is on the same 0–1 scale as `clawX`, so a claw at `clawX === x` is centred over that prize. `y` runs from 0 (top of the cabinet) to 1 (the floor). `inPile` becomes false once the prize is won.
- `held`: the `id` of the prize the claw is holding, or `null`.
- This must be the state the game really runs on. A separate object that does not match what is on screen is a fail.
## Layout and access
- Works at 1440×900 and at 390×844 with no horizontal page scrolling. At the phone size the on-screen buttons are at least 44×44px.
- Every control can be reached and used from the keyboard, with a visible focus ring.
- Respect `prefers-reduced-motion`: decorative lights and flourishes stop; the game still plays.
## Style
Yours to choose — but give it a point of view. A claw machine is a charming object; make one that people want to play twice. Keep the counters clean and readable.
Write only index.html. No commentary, just create the file.