# Poker Arena design system

- Design System artifact: https://claude.ai/artifact/DRsrhNRBmoWxZp8EvS5CLp
- Canvas: https://claude.ai/artifact/6BFcAG61pys8t6zrLMYT4W
- Site: https://poker-arena-design.pages.dev (`index.html` gallery; Cloudflare Pages serves this folder from `main`, no build step)
- Tokens: [tokens.json](tokens.json) (source), [design-tokens.css](design-tokens.css) (CSS, copied unchanged to `styles/tokens.css`), [design-tokens.json](design-tokens.json)
- Motion: [design-motion.json](design-motion.json)
- Components: [components.md](components.md), [components/](components/) (`bundle.css`, `bundle.js`, `index.d.ts`, a README and `preview.html` per component)
- Rendered in the app at `/design-system`

Poker Arena is planning poker that feels like a game night: a table, a deck of cards, a few friends and a quick vote. The look is cool, simple and playful: chunky ink edges, flat colour, a pop of pink, rounded type. Everything here is built on one set of semantic tokens, so the same components work in four themes, each light and dark, with six accent presets on top.

## Voice

- Cool, simple, playful. Short sentences. Australian English: colour, organise, centre.
- Talk to the person ("Pick a card"), not about the system ("Selection required").
- Buttons are verbs in sentence case: "Reveal cards", "Start round", "Copy invite link".
- Celebrate consensus in one word ("Consensus"), never with exclamation marks or emoji.
- Never shame an outlier. High and Low are invitations to explain, not verdicts.
- Names in examples are fictional first names only, the same eight everywhere: Sam (you), Mia, Theo, Ari, Jun, Lola, Rafi, Zane. The example space is Harbour Squad and the example ticket is PA-101.

## Themes and modes

There are four themes, each with a light and a dark mode. Arena light is the default and the first theme in tokens.json.

| Theme | Feel | Display | UI | Numerals |
| --- | --- | --- | --- | --- |
| Arena | The default: off-white ground, indigo, hot pink, ink edges. | Fredoka | Inter | Fredoka |
| Felt | A card room: green baize table, cream cards, a gold rim. | Fraunces | Inter | Fraunces |
| Arcade | Neon arcade: deep violet, yellow, pink and cyan pops, chunky type. | Fredoka | Nunito | Fredoka |
| Calm | Quiet and focused: neutral greys, one clear accent, mono numerals. | Inter | Inter | JetBrains Mono |

### How to theme

Set three attributes on ONE element, the `.arena` root that `PokerArena.ArenaRoot` renders:

```html
<div class="arena" data-theme="felt" data-mode="dark" data-accent="teal">…</div>
```

- `data-theme`: `arena`, `felt`, `arcade` or `calm`. It sets the colours and the `--font-display`, `--font-ui` and `--font-num` variables.
- `data-mode`: `light` or `dark`.
- `data-accent` (optional): an accent preset. It overrides `accent`, `accent-hover`, `accent-fg` and `focus` only.
- All three go on the same element; the selectors combine them. Without a root, `:root` falls back to Arena light.
- In React use `ArenaRoot` and `useArena()`; NavBar already wires the theme picker, accent picker and mode toggle.
- The colour ids in tokens.json (`arena-light`, `felt-dark` and so on) are the same values, named theme-mode for this page.

## Colour

Use the semantic names, never raw values. Every text pair below passes 4.5:1 and every control border and focus ring 3:1, in all eight theme-modes and with every accent preset.

- Page: `bg`. Panels, seats, inputs and modals: `surface`. Wells, chips and hover fills: `surface-2`. The table: `table`.
- Text: `text` on `bg`, `surface`, `surface-2` and `table`. Secondary text: `muted` on the same grounds.
- The one primary action: `accent` fill, `accent-fg` label, `edge` outline, `shadow-button`. Hover: `accent-hover`.
- Pop colour: `accent-2` for the selected card and the hard offset shadow, with `accent-2-fg` on it. Never `accent-2` as text on `bg`.
- Control borders: `border`. Decorative dividers: `hairline`, never on controls.
- Status: `success-fg` on `success-bg` (Voted, Consensus), `high-fg` on `high-bg`, `low-fg` on `low-bg`, `live-fg` on `live-bg` (Voting now, Public). `warning` and `danger` are text and borders on `surface`.
- Cards: `card-fg` on `card-face`; face down is `card-back` with `card-back-dot` dots.
- Focus: a solid 3px `focus` outline, offset 2px. Never remove it.
- State is never colour alone: every status carries a word, and High and Low carry an arrow too.

### Accent presets

A person can pick an accent. Each preset has light and dark values, checked against every theme it can sit on.

| Preset | Light accent | Light accent-fg | Dark accent | Dark accent-fg |
| --- | --- | --- | --- | --- |
| indigo | `#4B3FE0` | `#FFFFFF` | `#B8B3FF` | `#121018` |
| pink | `#B8185F` | `#FFFFFF` | `#FFA3CF` | `#121018` |
| teal | `#0B6E66` | `#FFFFFF` | `#5EEAD4` | `#121018` |
| orange | `#A6470A` | `#FFFFFF` | `#FDBA74` | `#121018` |
| green | `#17703A` | `#FFFFFF` | `#86EFAC` | `#121018` |
| blue | `#1D5FCC` | `#FFFFFF` | `#93C5FD` | `#121018` |

Presets live in `components/bundle.css` as `[data-accent="…"]` blocks, not in tokens.json, because this page reads one colour value per theme. `focus` follows `accent` in every preset; `accent-hover` is one step deeper in light and one step lighter in dark.

## Type

Fonts come from Google Fonts (no files here). bundle.css imports all five families; to load only a theme's own, use its query:

| Theme | Google Fonts query |
| --- | --- |
| Arena | `https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap` |
| Felt | `https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap` |
| Arcade | `https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;700;800&display=swap` |
| Calm | `https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap` |

- Headings and the brand: `var(--font-display)` with `display-xl` to `display-sm`.
- Everything else: `var(--font-ui)` with `title`, `body`, `small` and `eyebrow`.
- Card values, timers and ticket keys: `var(--font-num)` with `card-value` and `card-value-sm`, tabular figures.
- Sentence case everywhere. `eyebrow` is the only small bold label; do not uppercase long text.
- The font variables change per theme; the sizes do not.

## Space, radius and shadow

- Spacing runs `space-1` (4px) to `space-9` (64px). Card padding `space-5`, page gutters `space-6`, section gaps `space-8`.
- Radius: `radius-sm` small controls, `radius-md` buttons and inputs, `radius-card` playing cards, `radius-lg` panels, `radius-xl` modals, `radius-table` the table, `radius-pill` badges and chips.
- `shadow-hard` is the signature: an ink ring plus an `accent-2` offset. Use it on the selected card, the table and one feature panel per view, not on everything.
- `shadow-button` sits under primary buttons and drops to 1px on press. `shadow-hard-sm` sits under toasts, the ticket panel and seat cards; `shadow-soft` is for menus only. Secondary and danger buttons take the ink edge and a 3px drop that presses down.
- `glow-consensus` only on cards in a consensus, always with the Consensus word.
- In CSS use the variables (`var(--shadow-hard)`): they follow `edge` and `accent-2` per theme. tokens.json writes each shadow out per theme for this page.

## Iconography

- Inline SVG, 24px grid, 2px stroke, round caps and joins, `currentColor`. `PokerArena.Icon` holds the set: check, alert, lock, globe, up, down, x, sun, moon, clock, crown, dot, coffee.
- Icons sit beside words; an icon on its own needs an accessible name.
- No emoji anywhere: not in the product, not in copy, not in avatars.
- Avatars are generated faces from a seed (`Avatar`), never photos in the room.

## Motion

Motion is native CSS: registered custom properties (`@property`), `linear()` springs, `@starting-style` for entering, view transitions for the reveal and page changes, and `offset-path` for throwables. Stagger is `calc(var(--i) * var(--stagger))`, with `--i` set per seat.

| Token | Value | Use |
| --- | --- | --- |
| `dur-fast` | `120ms` | Hover, press, anticipation dip. |
| `dur-base` | `180ms` | Lifts, switches, panel changes. |
| `dur-slow` | `320ms` | Squash on land. |
| `dur-flip` | `420ms` | One card flip at reveal. |
| `dur-throw` | `900ms` | Throwable arc, after reveal only. |
| `dur-confetti` | `1400ms` | Consensus confetti, under 1.5 s, consensus only. |
| `stagger` | `60ms` | Delay between seats when cards flip. |
| `dur-crossfade` | `150ms` | Replaces all movement when reduced motion is on. |
| `ease-out` | `cubic-bezier(.22,1,.36,1)` | Settling, fades, panels. |
| `ease-spring` | `linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12 …)` | Lift and pick overshoot, as linear() points. |
| `ease-squash` | `linear(0, 0.62 18%, 1.08 34%, 0.94 52%, 1.03 70%, 0.99 8 …)` | Card landing squash and settle, as linear() points. |
| `ease-in-out` | `cubic-bezier(.65,0,.35,1)` | Flip and loops. |

| Motion | Duration | Easing | Technique | Runs when | Reduced motion |
| --- | --- | --- | --- | --- | --- |
| anticipation-lift | 300 ms | `var(--ease-spring)` | @property | Pointer hover or keyboard focus on an unvoted card in the deck: a 120 ms dip of 2px, then a lift to -8px. | none; Card stays in place; the focus ring and hover border show the state. |
| card-pick-squash | 320 ms | `var(--ease-squash)` | @property | The person picks a card (radio checked): lift to -16px, land with a squash, settle. | 150 ms opacity crossfade; Selected card fill (accent-2) and Selected label, no movement. |
| staggered-flip | 420 ms | `var(--ease-in-out)` | @property + view-transition | Reveal, after the countdown: each seat's card flips from 180deg to 0deg, 60 ms apart by seat index; the table snapshot runs as a view transition. | 150 ms opacity crossfade, no stagger; Every card face up with its value. |
| reveal-countdown | 3000 ms | `var(--ease-out)` | @starting-style | Host presses Reveal: 3, 2, 1, each number entering from scale 1.4 and opacity 0 over 1000 ms; the timer announces once. | Numbers swap with a 150 ms opacity crossfade, no scale; The cards are face up. |
| consensus-confetti | 1400 ms | `var(--ease-out)` | @property | Only on consensus, once per round, under 1.5 s. Never on a split vote. | none; Consensus badge and the glow-consensus ring, shown statically. |
| throwable-arc | 900 ms | `cubic-bezier(.33,0,.67,1)` | offset-path | Only after the reveal: a person throws an item at a seat; it travels along the arc and lands. | none; The item appears at the target seat with a 150 ms fade. |
| toast-in-out | 180 ms | `var(--ease-out)` | @starting-style | A toast is added (in, 180 ms from translate 0 16px) or dismissed (out, 150 ms, transition-behavior: allow-discrete). | 150 ms opacity only; Toast shown or gone. |
| modal-open | 180 ms | `var(--ease-out)` | @starting-style | A modal opens: scale 0.96 to 1 and opacity 0 to 1; the backdrop fades. | 150 ms opacity only; Modal open, focus on its heading. |
| argue-panel-slide | 320 ms | `var(--ease-out)` | @starting-style | After the reveal, opening the argue panel: translate 100% 0 to 0. | 150 ms opacity only; Panel open, focus on its heading; Esc returns focus. |
| page-transition | 260 ms | `var(--ease-out)` | view-transition | Navigating lobby to room and back: @view-transition { navigation: auto } with a root crossfade and a 12px slide. | 150 ms root crossfade, no slide; The new page. |

- Stagger is 60 ms per seat. Sound is off by default.
- Confetti only on consensus, once per round, under 1.5 s, with the word Consensus as the fallback.
- Throwables only after the reveal.
- Under `prefers-reduced-motion: reduce` nothing moves: every transition becomes a 150 ms opacity crossfade (`dur-crossfade`) and the end state shows at once. ArenaRoot adds the `reduced-motion` class that does this.
- No full-screen effects and never more than three flashes a second.

## Anti-patterns

- Showing a vote before the reveal, including on hover or in a tooltip. The reveal is decided by the server.
- Colour-only state. Always the word: Voted, High, Low, Consensus.
- Leaderboards, streaks or scores for estimates.
- Admin settings in a modal inside the room.
- Timers on by default.
- Full-screen effects, or more than three flashes a second.
- Confetti for anything but consensus; throwables before the reveal.
- Blue-purple gradients, emoji, left-border accent cards.
- Using `hairline` for control borders, or `accent-2` as text on `bg`.

## Accessibility

- One `aria-live="polite"` summary after the reveal ("Consensus at 3 hours" or "Split: 1 to 13"), not a message per card.
- A timer announces at 30 and 10 seconds only.
- The argue panel moves focus to its heading; Esc returns focus to the table.
- The deck is a real radio group: arrow keys work with no extra code.

## Components

Components are React 18 in `components/bundle.js` as `window.PokerArena`. Wrap every screen in `ArenaRoot`. CSS classes follow a CSS Module naming (`.PlayingCard_root`, `.PlayingCard_face`) inside `@layer tokens, base, shared, components`, with shared classes (`focus-ring`, `card-shadow`, `hard-shadow`, `hard-shadow-sm`, `pressed`, `pill`, `visually-hidden`, `reduced-motion`) in the shared layer.

| Component | What it is |
| --- | --- |
| ArenaRoot | The provider every Poker Arena screen sits inside. |
| NavBar | The top bar. |
| Button | Buttons for actions; primary is the one thing a view is for, with an ink edge and a drop shadow that presses down. |
| Input | A labelled text field with an optional hint and an error message tied to it by aria-describedby. |
| Badge | A short status label; tone always comes with words and, where it helps, an icon. |
| Chip | A compact tag for filters and labels, optionally selectable and removable. |
| Avatar | A generated face from a seed, drawn as inline SVG so it recolours with the theme. |
| PlayingCard | One estimate card, face up or down, with every state the table needs from vote to consensus. |
| Deck | The hand of cards a person votes with. |
| Seat | One person at the table. |
| TicketPanel | The ticket being estimated. |
| ArgueItem | One person explaining an outlier vote after the reveal. |
| Timer | A round timer showing minutes and seconds, turning to the warning style with the word Low near the end. |
| Toast | A brief message after something happens, such as a copied link or a person joining. |
| Modal | A dialog for one focused task or confirmation, with a title, body and footer actions. |
| ThemeShowcase | A small table scene in one theme and mode, used to compare themes side by side. |

## What tokens.json leaves out

- Accent presets and per-theme fonts are not token families this page can read. They are documented above and shipped in `components/bundle.css`.
- Motion is not a token family either; the values above and the CSS variables in bundle.css are the source.
- The `@property` registrations (`--lift`, `--squash`, `--flip`, `--burst`, `--i`) are in bundle.css.
