# game.screens.hud
The in-play HUD: four corner player cards (portrait medallion, coin count, star
count), the round and turn banner with the rules' latest note, and the die
readout along the bottom.
`M.build(state)` returns the tree from `Rules.state` alone, so the cards can
never disagree with the referee. `OrigoHud` registers it as `origo_hud`. It
steps out of the top-centre strip during COIN CLASH, where the showdown slice's
own scoreboard draws.
# game.screens.shop
The corner store sheet: a cream counter under a coral-and-cream awning, three
boosters with their prices and a coral BUY on each, the buyer's purse beside
them, and a NO THANKS.
`M.build(state, offer)` takes the offer the match publishes as `state.shop`
(`{ seat, items }`). The buttons only report a choice — `OrigoHud` sends it on
the bus as `shopBuy` — and the match takes the coins.
# game.screens.theme
The Origo Party screen look: the candy palette taken from the authored
materials, the thick cream-and-coral display type, and the pieces every screen
is assembled from — the corner player card, the coin, the star, the die face,
the toy portrait medallion.
`M.setCanvas(ui.screenSize())` sets the scale the screens are drawn at, and
`M.px(n)` turns a 1280-wide design measure into points. Every module under
`game/screens/` builds its tree from these pieces, and `OrigoHud` registers
them.
# game.screens.ceremony
The results ceremony: the winner under a gold crown on a coral podium card,
then all four standings with their stars and coins, confetti falling through
the frame, and PLAY AGAIN.
`M.build(state, result)` prefers the `matchEnd` payload's rankings and winner
and falls back to `Rules.state` — stars first, then coins, the same rule the
match uses. `OrigoHud` registers it as `origo_ceremony`.
# game.rules — Origo Party's shared contract
The one module every slice of Origo Party reads. It holds no mutable state:
the Match component owns the live state table and publishes it as
`Rules.state`, and every other slice reads that and listens on `Rules.on`.
## Constants
`ROUNDS` (3), `START_COINS` (10), `STAR_COST` (20), `BLUE_COINS` (3),
`RED_COINS` (-3), `SHOWDOWN_SECONDS` (60), `SHOWDOWN_BONUS` (10), and
`PLAYERS` — the four seats with their colour, candy material and whether the
seat is human.
## The board
`BOARD_SIZE` (32) tiles around a superellipse `RADIUS_X` x `RADIUS_Z`.
- `tilePosition(index) -> x, y, z` — where tile `index` (1..32) sits.
- `tileFacing(index)` — the heading a pawn faces standing on it.
- `pawnPosition(index, seat)` — beside the tile, fanned by seat so four pawns
on one tile do not overlap.
- `spaceKindAt(index, round)` -> `"blue" | "red" | "green" | "shop" | "star"`.
The Star Space moves every round; `starIndexForRound(round)` names it.
- `SPACE_MATERIAL` / `SPACE_LABEL` — what each kind looks like and reads as.
## The rules
- `advance(from, spaces)` — the tile you land on, wrapping the loop.
- `resolveSpace(kind, player, rng)` -> `{ coins, stars, kind, note }`.
- `rankings(players)` — final order, stars first then coins.
- `newState(rounds)` — the shape the Match component owns.
## The bus
`Rules.on(event, fn)` returns an unsubscribe. `Rules.emit(event, payload)`.
A handler that throws is dropped and logged; it never takes the bus down.
Events: `title`, `roundStart`, `turnStart`, `roll`, `moveStep`, `arrive`,
`resolve`, `shop`, `starBought`, `roundEnd`, `showdownStart`, `showdownScore`,
`showdownEnd`, `matchEnd`, `hud`.
# game.screens.title
The title screen: ORIGO PARTY in thick cream lettering over a coral drop, the
gold star bobbing above it, the four toys waving in from the corners, the rules
in one line, and the one coral PLAY button.
`M.build()` returns the tree; it is an overlay on the candy board already on
screen behind it. `OrigoHud` registers it as `origo_title` and hides it the
moment the match leaves its title phase.