# Joocy: the guide for agents

Joocy runs interactive presentations. A presenter shows slides on a big screen,
the audience joins on their phones, and every slide decides what the phones show:
a question, a picture, buttons, or simply "look up". Answers appear on the screen live.

You can make new decks and change the presenter's own, add questions, restyle
everything, write slides and phone screens in HTML with three.js, GSAP and
more, design transitions, start a live session, drive it, and read the results.

- Base URL: https://joo.cy/api/v1
- Auth: send `Authorization: Bearer $JOOCY_TOKEN` on every call. The presenter
  makes a key in the app under **Your AI**. This guide and the catalog need none.
- A key works on decks, files and live sessions. It can never delete for good
  (a deck, an upload, a session's answers), make or remove keys, change the
  presenter's account, pair a phone as their clicker or use the owner's powers:
  those are the presenter's own, in the app, and a key gets 403.
- MCP: the same abilities as tools at `https://joo.cy/mcp` (same header), or at
  `https://joo.cy/mcp/t/<key>` for clients that cannot send headers.
- Everything is JSON. Errors come back as `{ "error": "...", ... }` with a real
  HTTP status.

## Contents

- How to work
- The deck
- Patch ops
- Everything you can use
- Styling: questions, answers, everything
- Coded decks (HTML)
- Full HTML, WebGL and animation (custom slides and phone screens)
- Transitions: built in, and your own
- Live signals, during a talk
- Video slides
- The presenter's own video
- Questions that depend on who answers
- Finding and organising decks
- Live sessions
- Designing the experience: show it, do not just chart it
- Writing for a room

This guide is long. Each part can be read on its own: `get_guide` with
`section` (its name above, like "Patch ops"), or
`GET https://joo.cy/api/v1/guide?section=Patch%20ops`.

## How to work

The presenter's request says what to do: a new deck, a change to one they
have, a deck written in HTML, a live session, or what a room answered. Do
that, and leave every other deck as it is.

**A new deck** (whenever the request does not name one they have): build the
whole presentation as one spec (below) and send it in one call,
`POST /decks` with `{ "spec": ... }`. It is checked before it is saved; you
get back `{ id, title, version, spec }` with 201. `{ "title": "..." }` alone
makes a blank deck. `POST /decks/{id}/duplicate` copies a deck they have,
with its uploaded files, to make something new from it.

**A deck they have:**

1. Find it: `GET /decks?q=words` searches every word in every deck, and
   `GET /decks` lists them all. `GET /decks/{id}` reads one: you get
   `{ id, title, version, spec }`. `spec` is the whole presentation.
2. Change it with `PATCH /decks/{id}` and a list of ops (below). This is the
   safe way: it applies to whatever is current, so the presenter can keep
   editing in the app while you work. Change only what they asked for.
3. Or replace it whole with `PUT /decks/{id}` and `{ "spec": ..., "version": n }`,
   where `n` is the version you read. A stale version gets 409: read again.

**Either way:**

- If the deck is not right, nothing is saved and you get 422 with
  `problems: [{ path, message }]`. Each path points at the exact field.
  Fix those and send again. `POST /decks/{id}/validate` checks a spec without saving.
- Every save is kept. `GET /decks/{id}/versions` lists them and
  `POST /decks/{id}/versions/{v}/restore` goes back, so any change to a deck
  can be undone. A file uploaded again replaces the one at that path.
- When you finish, tell the presenter what you made or changed, with the link
  that opens it in the app: `https://joo.cy/app/#/d/{id}`.

**Design the moments, not only the slides.** Answers, taps and people joining
can be shown as things happening in a world that fits the talk (every vote a
drop filling its glass, everyone who joins a star with their name), not only
as charts. See "Designing the experience" before you make a deck.

## The deck

```json
{
  "format": "stoa.deck/1",
  "title": "AI for Creative People",
  "aspect": "16:9",
  "theme": { "preset": "aurora" },
  "settings": { "reactions": ["heart", "laugh", "wow", "mindblown", "fire"] },
  "interactions": {
    "mood": { "type": "choice", "prompt": "How are you feeling?",
              "options": [{ "id": "good", "label": "Good" }, { "id": "meh", "label": "Meh" }] }
  },
  "slides": [
    { "id": "s_hello", "stage": { "type": "title", "title": "Hello" } },
    { "id": "s_mood",
      "stage": { "type": "results", "interaction": "mood", "view": "bars" },
      "phone": { "type": "ask", "interaction": "mood" },
      "notes": "Read the top answer out loud." }
  ]
}
```

- A slide has a **stage** (the big screen) and a **phone** (what the audience sees).
  No phone means "look up at the screen".
- Questions live in `interactions`, keyed by an id you choose (letters first:
  `mood`, `q_rate`). A slide asks one with `phone: { type: "ask", interaction }`
  and shows its answers with a `results` stage, or with an `overlay` on any slide:
  `"overlay": { "interaction": "mood", "place": "bottom" }`. Asking on one slide
  and showing the results three slides later is fine.
- The most common pair is one slide that does both: results on the stage, the
  question on the phones. That is what the editor's "Question" button makes.
- Imported pages are `{ "type": "image", "src": "/a/..." }`. Keep their `src`,
  `thumb`, `mid`, `source` and `page` as they are.
- **Layers**: any slide can carry `layers`, words and pictures placed anywhere
  on it, over whatever it is (a layout, an imported page, a coded slide):
  `{ "id": "l_1", "type": "text", "text": "Ask *early*", "x": 8, "y": 70, "w": 44, "size": 3.2 }`,
  `{ "id": "l_2", "type": "image", "src": "/a/...", "x": 58, "y": 12, "w": 34, "h": 52 }`.
  Places and sizes are % of the slide; `step` makes one arrive on a later
  press. Every field is under Layers, in "Everything you can use".
- **To change the words on an imported page** (a picture), do what the editor
  does: cover them. A PDF's `words.json` (`read_deck_file` with the slide's
  `stage.source` and path `words.json`) says where each block of words is on
  each page, its size and whether it is bold. Add a text layer over the block
  with `bg` the page's colour (`white` for most PDFs) and the new words.
  Leave the page picture as it is.
- `notes` are speaker notes. Only the presenter sees them.
- `skip: true` keeps a slide in the deck but never shows it.
- `phoneByStep: { "1": {...} }` changes what phones show from a later beat of the
  same slide, for slides that build.
- Only store what you mean. Defaults fill everything else in.
- Choice options can be sent as plain strings (`"options": ["Yes", "No"]`): ids are
  added for you. Slide ids are added for you too.
- An open question (`text`) can say what its send button says, `"button": "Join"`
  (up to 20 characters), and offer words to tap instead of typing,
  `"suggestions": ["afraid", "excited", "overwhelmed"]` (up to 12, each up to 24
  characters). A tap sends the word exactly as typed words go: the same checks,
  `entries`, word filter and approval.
- An open question can also say what the phone shows once that person has sent
  all they can (`entries`): `"thanks": "Welcome {name|friend} 🙏 We'll start
  shortly."` (up to 140 characters, tokens allowed). It shows big, in place of
  the question and the box. Without it, phones say "Sent".
- A poll with `"other": "Write your own"` (up to 40 characters) gets a last option
  that opens a box for up to 80 characters. It counts under `_other` in `counts`,
  so no real option can have that id. The words are kept like an open answer:
  card numbers refused, `filter` and `moderate` apply, only shown words reach
  the screen. Single and multiple answer both work.
- `"phone": { "type": "ask", "interaction": "pick", "closed": true }` shows a question
  that takes no more answers, for a reveal: each phone keeps that person's own
  answer, and answers close on that beat (a question `open: "always"` still takes
  them elsewhere). Phones mark `#main` with `data-open="0"`, or `"1"` while open.
- Pictures: never invent a URL. `POST /files/from-url` with `{ "url": "https://..." }`
  copies a picture in and returns `{ "url": "/a/..." }` to use. Or upload bytes with
  `POST /files?name=x.png` and the right content-type.

## Patch ops

JSON Patch (RFC 6902) with two additions:

- Address list items by id: `/slides/@s_mood/notes`. Adding at `/slides/@s_mood`
  inserts before that slide. `/slides/-` appends.
- `merge` sets several fields at once; a field set to `null` is removed.

```json
{ "ops": [
  { "op": "merge", "path": "/slides/@s_hello/stage", "value": { "title": "Welcome", "subtitle": "Phones out" } },
  { "op": "add", "path": "/interactions/rate", "value": { "type": "scale", "prompt": "Rate today", "max": 5 } },
  { "op": "add", "path": "/slides/-", "value": { "stage": { "type": "results", "interaction": "rate" },
      "phone": { "type": "ask", "interaction": "rate" } } },
  { "op": "move", "from": "/slides/@s_mood", "path": "/slides/0" },
  { "op": "remove", "path": "/slides/@s_old" }
] }
```

## Everything you can use

The full machine-readable list is `GET /catalog`. In short:

### Layouts: `slide.stage.type`
- **image**: An imported page, or any picture. `src` (asset, required), `fit` (select, contain|cover, default "contain"), `caption` (text, max 140), `alt` (longtext, max 4000)
- **html**: One slide of an HTML deck you uploaded. `source` (ref, required), `index` (number, required, 0..5000), `steps` (number, default 0, 0..50), `mouse` (bool)
- **video**: A video on the big screen. Pause points make it a slide that builds: each press plays on to the next pause. A PowerPoint or Keynote deck exported as a video keeps every animation this way, and each part between pauses can be a slide of its own (from and to), so the deck has thumbnails, notes and questions in between. `src` (asset, required), `stops` (times, up to 50), `muted` (bool, default false), `loop` (bool, default false), `from` (number, 0..86400), `to` (number, 0..86400), `fit` (select, contain|cover, default "contain"), `poster` (asset)
- **title**: Title. `eyebrow` (text, max 60), `title` (text, required, max 140), `subtitle` (text, max 200)
- **statement**: One idea per line. Each line arrives on its own press. `lines` (lines, required, max 160, up to 6), `small` (text, max 220), `build` (bool, default true)
- **takeaway**: The thing they leave with. Loud on purpose. `tag` (text, default "Remember", max 24), `n` (number, 0..99), `lines` (lines, required, max 60, up to 3), `note` (longtext, max 400)
- **bullets**: Short items. Each arrives on its own press. `title` (text, max 140), `items` (lines, required, max 140, up to 8), `build` (bool, default true)
- **quote**: Quote. `text` (longtext, required, max 400), `by` (text, max 80)
- **number**: One number, huge. It can follow a question live. `eyebrow` (text, max 60), `value` (text, max 24), `live` (live), `label` (text, max 160)
- **split**: Words and picture. `title` (text, max 140), `body` (longtext, max 600), `src` (asset), `side` (select, left|right, default "right"), `fit` (select, cover|contain, default "cover")
- **qr**: Any link, as a code the room can scan. `url` (url, required), `title` (text, max 140), `caption` (text, max 140)
- **join**: The code to join, with the live headcount. `title` (text, default "Join in", max 140), `sub` (text, max 160)
- **results**: Live answers to a question, drawn big. `interaction` (ref, required), `view` (view), `by` (ref), `title` (text, max 280), `count` (bool, default true)
- **leaderboard**: Quiz scores so far. `title` (text, default "Leaderboard", max 140), `top` (number, default 8, 3..20)
- **embed**: YouTube, Vimeo, or any page that allows it. `url` (url, required), `title` (text, max 140), `thumb` (asset)
- **countdown**: Breaks and exercises. Starts when the slide does. `title` (text, default "Back in", max 140), `minutes` (number, default 5, 0.25..180)
- **custom**: Your own HTML and script, safely boxed in. Gets live answers too. `html` (code, required, max 200000), `steps` (number, 0..50), `thumb` (asset)
- **blank**: Just the background. For when you want them looking at you. `text` (text, max 120)

### Phone views: `slide.phone.type`
- **follow**: A calm card that sends their eyes back to you. `text` (text, max 140)
- **ask**: They answer. The screen counts it live. `interaction` (ref, required), `closed` (bool, default false)
- **card**: Words, a picture, buttons and links. `blocks` (blocks, required, up to 8)
- **mirror**: Their phone shows what the screen shows. Good for the back row. no fields
- **results**: The answers to a question, on every phone. `interaction` (ref, required), `view` (view)
- **custom**: Your own phone screen, as HTML, on every phone: three.js, GSAP, Motion, React and more from the library kit. It runs sealed: it can reach nothing but the room. Room.send(value) saves an answer (any JSON, up to 4 KB) into its question, which is a custom one; Room.emit(name, data) sends a live signal to the big screen; Room.on("signal", fn) hears the big screen; Room.on("data", fn) hears the room's answers when phones may see them. Or use a page from an uploaded folder: source and src. `html` (code, max 100000), `interaction` (ref), `fill` (bool, default false), `source` (text, max 48), `src` (text, max 300)

### Card blocks: `slide.phone.blocks[].type`
- **text**: `text` (longtext, required, max 600), `size` (select, big|normal|small, default "normal")
- **image**: `src` (asset, required), `alt` (text, max 200)
- **button**: `label` (text, required, max 40), `url` (url, required)
- **social**: `platform` (select, instagram|linkedin|x|youtube|tiktok|whatsapp|website, default "instagram"), `handle` (text, required, max 60), `url` (url), `line` (text, max 140), `photo` (asset)
- **file**: `label` (text, required, max 40), `src` (asset, required)

### Question types: `interactions.<id>.type`
- **choice** (Poll). Results as: bars, columns, donut, grid, stickers. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `options` (options, required, up to 24), `multi` (bool, default false), `max` (number, 2..24), `exclusive` (ref), `style` (select, auto|list|grid|stickers, default "auto"), `correct` (ids), `points` (number, default 1000, 0..10000), `timer` (number, default 0, 0..600), `shuffle` (bool, default false), `change` (bool), `other` (text, max 40), `filter` (bool, default true), `moderate` (bool)
- **scale** (Rating). Results as: average, bars. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `min` (number, default 1, 0..1), `max` (number, default 5, 2..100), `minLabel` (text, max 40), `maxLabel` (text, max 40), `style` (select, auto|stars|numbers|slider, default "auto"), `change` (bool, default true)
- **text** (Open question). Results as: wall, cloud. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `asName` (bool, default false), `max` (number, default 120, 5..500), `entries` (number, default 1, 1..10), `placeholder` (text, max 80), `suggestions` (lines, max 24, up to 12), `button` (text, default "Send", max 20), `thanks` (text, max 140), `filter` (bool, default true), `moderate` (bool)
- **number** (Number). Results as: average, histogram. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `min` (number), `max` (number), `unit` (text, max 12), `unitFirst` (bool, default false), `decimals` (bool, default false), `correct` (number), `change` (bool, default true)
- **photo** (Photo). Results as: wall. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `entries` (number, default 1, 1..5), `moderate` (bool, default true)
- **audio** (Voice note). Results as: list. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `seconds` (number, default 30, 5..120), `entries` (number, default 1, 1..3), `moderate` (bool, default true)
- **qa** (Q&A). Results as: top, wall. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `votes` (bool, default true), `names` (bool, default false), `filter` (bool, default true), `moderate` (bool, default false)
- **form** (Sign-up). Results as: count. Fields: `prompt` (text, required, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `fields` (formfields, required, up to 8), `consent` (text, default "I am happy to be contacted about this.", max 200), `button` (text, default "Send", max 30)
- **custom** (Custom). Results as: raw. Fields: `prompt` (text, max 280), `hint` (text, max 160), `view` (view), `reveal` (select, live|click, default "live"), `phones` (select, never|after|reveal, default "never"), `open` (select, slide|always, default "slide"), `change` (bool, default true), `latest` (number, default 50, 0..50), `filter` (bool, default true)

Choice options: `id` (text, required, max 48), `label` (text, max 80), `glyph` (glyph), `image` (asset). Sign-up fields: `key` (text, required, max 32), `label` (text, required, max 60), `kind` (select, text|email|phone|long, default "text"), `required` (bool, default false).

### Overlay: `slide.overlay`
`interaction` (ref, required), `view` (view), `place` (select, bottom|right|center|full, default "bottom")

### Layers: `slide.layers`, words and pictures placed anywhere
slide.layers: up to 40 per slide, over whatever the slide is (a layout, an imported page, a coded or custom slide). They stack in list order: the last is on top. Each needs an id of its own (letters first), so patches can address it: /slides/@<slide>/layers/@<layer>.
x and y place the top left corner and w is the width, as % of the slide's width and height (x 10, y 10, w 40 is a box a tenth in from the top left, two fifths wide). h is a share of the height: a picture needs it, words grow to fit without it. size is the words' size as % of the slide's width (3 reads well, 6 is a headline). rotate in degrees, opacity 0 to 1.
A layer with step n arrives on the nth press after the slide lands, like a line of a statement, and adds beats to the slide if it needs them (not on a coded slide or a video, whose beats are their own).
- **text**: Words. A new line and *stars* for the accent, as everywhere. bg puts a plate behind them, which covers what is under them: how to change the words on an imported page. `id` (text, required, max 48), `x` (number, default 10, -100..200), `y` (number, default 10, -100..200), `w` (number, default 40, 0.5..300), `h` (number, 0.5..300), `rotate` (number, -360..360), `opacity` (number, 0..1), `step` (number, 0..50), `text` (longtext, required, max 1000), `size` (number, default 3, 0.4..40), `font` (select, display|body|heavy|mono, default "body"), `bold` (bool), `italic` (bool), `color` (paint, default "ink"), `align` (select, left|center|right, default "left"), `bg` (paint), `lh` (number, 0.7..3)
- **image**: A picture: copy it in first (save_image_from_url, or an upload) and use its /a/ address. `id` (text, required, max 48), `x` (number, default 10, -100..200), `y` (number, default 10, -100..200), `w` (number, default 40, 0.5..300), `h` (number, 0.5..300), `rotate` (number, -360..360), `opacity` (number, 0..1), `step` (number, 0..50), `src` (asset, required), `fit` (select, cover|contain, default "cover"), `radius` (number, 0..50), `alt` (text, max 300)
Colours (color, bg): ink, dim, faint, accent, accent2, accent3, gold, ground, surface, line, white, black, or a hex colour. Fonts: display, body, heavy, mono. With the morph transition, a layer with the same id on the slide before and after glides from one place and size to the other.

### Theme: `theme`
Presets: aurora, marble, ink, paper. Fonts: didot, serif, sans, heavy, rounded, mono. Fields: `preset` (select, aurora|marble|ink|paper, default "aurora"), `ground` (color), `surface` (color), `ink` (color), `dim` (color), `faint` (color), `accent` (color), `accent2` (color), `accent3` (color), `gold` (color), `line` (color), `display` (select, didot|serif|sans|heavy|rounded|mono), `body` (select, didot|serif|sans|heavy|rounded|mono), `aurora` (number, 0..1), `radius` (number, 0..32), `scheme` (select, dark|light), `css` (code, max 100000), `stickers` (select, animated|drawn, default "animated"), `glyphs` (glyphmap), `logo` (asset)

### Settings: `settings`
`reactions` (lines, default ["heart","laugh","wow","mindblown","fire"], max 32, up to 6), `joinBadge` (select, auto|always|off, default "auto"), `names` (select, never|quiz|always, default "quiz"), `filter` (bool, default true), `blocked` (lines, default [], max 40, up to 50), `sound` (bool, default true), `transition` (transition, default {"type":"fade"}), `transitions` (motions), `qa` (ref), `mirror` (bool, default false), `mouse` (bool, default false), `display` (select, auto|safe|standard, default "auto"), `camera` (camera)

### Your video: `settings.camera`, and a slide's own `camera`
- **corner**: A box in a corner, over the slide, like a video call: corner, size (% of the width), shape (rounded, rect, circle).
- **beside**: One side of the screen, top to bottom, with the slide shrunk to the other side: side (left, right) and split (its share of the width, %).
- **behind**: The whole screen, under the slide: dim (how much it darkens, %) keeps the words readable, blur softens it.
- **full**: The whole screen. The slide's own words step aside; live results on top (overlay) and the join code stay.
- **code**: The slide's own code draws it: a custom slide or a coded deck gets Stage.camera (a playing video element and its stream), for a three.js texture, a canvas, CSS. Only a slide can say this, and only one with code.
- **off**: Not on this slide.

Fields: `place` (select, corner|beside|behind|full|code|off, default "corner"), `corner` (select, bottom-right|bottom-left|top-right|top-left, default "bottom-right"), `size` (number, default 26, 12..50), `shape` (select, rounded|rect|circle, default "rounded"), `side` (select, right|left, default "right"), `split` (number, default 40, 25..60), `dim` (number, default 45, 0..90), `blur` (number, default 0, 0..20), `label` (longtext, max 120), `mirror` (bool, default false), `src` (url). A slide's own camera takes all of them but `mirror` and `src`.

### Transitions: `settings.transition` and `slide.transition` (`{ type, duration }`), and your own in `settings.transitions`
- **fade**: A soft dissolve: one fades as the next arrives. The house default.
- **none**: No animation: an instant change.
- **slide**: The next slide pushes the last one off, the way you are moving.
- **rise**: The next slide rises up as the last lifts away.
- **zoom**: The last slide grows past you; the next one comes in from the distance.
- **blur**: A dreamy blur out and back into focus.
- **iris**: A circle opens from the middle onto the next slide.
- **wipe**: The next slide wipes across the last, right to left.
- **curtain**: The next slide rises like a curtain, bottom to top.
- **flip**: The slide turns over like a card, the way you are moving.
- **spin**: A small turn and scale as one hands over to the next.
- **drop**: The next slide drops in from above, with a little bounce.
- **glide**: Slow and cinematic: a long dissolve with a gentle drift.
- **morph**: Pieces both slides share glide into their new places and sizes; the rest dissolves. Titles, numbers, pictures and lines pair by role, or by name in your CSS (view-transition-name) and data-morph.

### Library kit: import these in a coded deck, custom slide or phone screen
- `three` (0.186.1): 3D and WebGL: scenes, meshes, materials, cameras, lights.
- `three/webgpu` (0.186.1): three.js on WebGPU (WebGPURenderer), with node materials.
- `three/tsl` (0.186.1): three.js shading language: write shaders in JavaScript.
- `three/addons/...` (0.186.1): Every three.js add-on: OrbitControls, GLTFLoader, DRACOLoader, EffectComposer, UnrealBloomPass, Water, Sky and the rest. Import by path, as in three’s own examples.
- `gsap` (3.15.0): The GSAP animation engine: tweens and timelines.
- `gsap/all` (3.15.0): GSAP and every plugin at once.
- `gsap/ScrollTrigger` (3.15.0): GSAP ScrollTrigger. Register it: gsap.registerPlugin(ScrollTrigger).
- `gsap/ScrollSmoother` (3.15.0): GSAP ScrollSmoother. Register it: gsap.registerPlugin(ScrollSmoother).
- `gsap/Flip` (3.15.0): GSAP Flip. Register it: gsap.registerPlugin(Flip).
- `gsap/SplitText` (3.15.0): GSAP SplitText. Register it: gsap.registerPlugin(SplitText).
- `gsap/MotionPathPlugin` (3.15.0): GSAP MotionPathPlugin. Register it: gsap.registerPlugin(MotionPathPlugin).
- `gsap/MorphSVGPlugin` (3.15.0): GSAP MorphSVGPlugin. Register it: gsap.registerPlugin(MorphSVGPlugin).
- `gsap/DrawSVGPlugin` (3.15.0): GSAP DrawSVGPlugin. Register it: gsap.registerPlugin(DrawSVGPlugin).
- `gsap/Draggable` (3.15.0): GSAP Draggable. Register it: gsap.registerPlugin(Draggable).
- `gsap/InertiaPlugin` (3.15.0): GSAP InertiaPlugin. Register it: gsap.registerPlugin(InertiaPlugin).
- `gsap/Observer` (3.15.0): GSAP Observer. Register it: gsap.registerPlugin(Observer).
- `gsap/CustomEase` (3.15.0): GSAP CustomEase. Register it: gsap.registerPlugin(CustomEase).
- `gsap/CustomBounce` (3.15.0): GSAP CustomBounce. Register it: gsap.registerPlugin(CustomBounce).
- `gsap/CustomWiggle` (3.15.0): GSAP CustomWiggle. Register it: gsap.registerPlugin(CustomWiggle).
- `gsap/EasePack` (3.15.0): GSAP EasePack. Register it: gsap.registerPlugin(EasePack).
- `gsap/ScrollToPlugin` (3.15.0): GSAP ScrollToPlugin. Register it: gsap.registerPlugin(ScrollToPlugin).
- `gsap/TextPlugin` (3.15.0): GSAP TextPlugin. Register it: gsap.registerPlugin(TextPlugin).
- `gsap/ScrambleTextPlugin` (3.15.0): GSAP ScrambleTextPlugin. Register it: gsap.registerPlugin(ScrambleTextPlugin).
- `gsap/Physics2DPlugin` (3.15.0): GSAP Physics2DPlugin. Register it: gsap.registerPlugin(Physics2DPlugin).
- `gsap/PhysicsPropsPlugin` (3.15.0): GSAP PhysicsPropsPlugin. Register it: gsap.registerPlugin(PhysicsPropsPlugin).
- `gsap/PixiPlugin` (3.15.0): GSAP PixiPlugin. Register it: gsap.registerPlugin(PixiPlugin).
- `motion` (14.2.0): Motion (the engine behind Framer Motion): animate, spring, scroll, inView.
- `motion/react` (14.2.0): Framer Motion for React: <motion.div>, AnimatePresence, layout animations.
- `animejs` (4.5.0): Anime.js: a small, expressive animation library.
- `react` (19.3.1): React.
- `react/jsx-runtime` (19.3.1): React JSX runtime (jsx, jsxs).
- `react-dom` (19.3.1): React DOM.
- `react-dom/client` (19.3.1): React DOM createRoot.
- `htm` (3.1.1): JSX-like tagged templates, no build step.
- `htm/react` (3.1.1): htm bound to React: html`<div />`.
- `d3` (7.9.0): D3: data-driven documents, scales, shapes, selections.
- `pixi.js` (8.22.0): PixiJS: fast 2D WebGL rendering.
- `p5` (2.3.4): p5.js: creative coding sketches.
- `lottie-web` (5.13.0): Play Lottie / Bodymovin animations.
- `matter-js` (0.20.0): Matter.js: 2D rigid-body physics.
- `canvas-confetti` (1.9.4): Confetti bursts on a canvas.
- `chart.js` (4.5.1): Chart.js: bar, line, pie and more (auto-registered).
- `simplex-noise` (4.0.3): Simplex noise: createNoise2D, 3D, 4D.
- `tone` (15.1.22): Tone.js: synths, effects and timing for Web Audio.

### Stickers
hungover, sleepy, fine, buzzing, party, heart, laugh, wow, mindblown, fire, stressed, coin, poop, pray, catlaugh, thumbsup, thumbsdown, star, check, cross, sparkles, rocket, bulb, question, hundred, clap, popper, hearteyes, raisedhands, thinking, crying, cool, eyes, muscle, handshake, target, wave, trophy, gem, crown, rainbow, zap, boom, brain, moneyface, grin, wink, hug, shush, yawn

## Styling: questions, answers, everything

Presenters can ask you to restyle anything: question and answer sizes, spacing,
fonts, colours, the results, the phones. Write CSS.

Put CSS in `theme.css` (merge `/theme` with `{ "css": "..." }`). Any CSS, up to 100,000 characters. Every property works.

- Big screen: the whole stage page. Phones: the whole phone page. Editor and console: only the slide previews, never their controls.
- :root, html and body mean the deck itself. Variables set there override the theme.
- The deck itself is .deck-scope. On the big screen and on phones that is the page's body: body.stage-page on the big screen, body.phone on phones. So body.stage-page .x styles only the big screen, and body.phone .x only phones. In the editor and the console it is each slide preview.
- @media, @supports, @container, @layer, @keyframes and @font-face all work.
- @import works only for a font service's style sheet, over https: Google Fonts, Bunny Fonts, Fontshare or Adobe Fonts. Put it at the top, write the address plainly in url("..."), and end it with ";". A Google Fonts address with ";" in it is fine. Any other import is ignored.

**Variables**, set on `:root`:

- `--ground`: the background
- `--surface`: cards and panels
- `--ink`: main text
- `--dim`: quieter text
- `--faint`: quietest text
- `--accent`: the main highlight
- `--accent2`: second highlight
- `--accent3`: third highlight
- `--gold`: the gilt lines and marks
- `--line`: thin lines
- `--display`: the display font
- `--body`: the body font
- `--heavy`: the heavy font
- `--radius`: corner rounding

**Big screen and previews**:

- `[data-slide="s_id"]`: one slide (on the big screen and in previews)
- `[data-layout="results"]`: every slide of one layout
- `[data-mode="stage"]`: only the big screen (also: preview, thumb, phone)
- `[data-iid="mood"]`: slides that show this question
- `.L-eyebrow, .L-title, .L-sub`: small line above, title, line under
- `.L-line, .L-bullets li, .L-quote, .L-tk, .L-big, .L-caption`: statement lines, bullets, quotes, takeaway lines, big numbers, captions
- `.L-rtitle`: the question on a results slide
- `.view.v-bars (v-columns, v-donut, v-grid, v-stickers, v-average, v-histogram, v-cloud, v-wall, v-top, v-count)`: one results view
- `.vrow, .vcol`: one answer in bars or columns
- `.vlabel, .vfill, .vnum`: its label, its bar, its count and percent
- `.lead, .right, .wrong`: the leading answer; after a quiz reveal, right and wrong answers
- `.L-join-url, .L-join-n, .L-plaque`: join address, headcount, QR code

**Phones**:

- `#main[data-kind="ask"]`: what phones show (also: follow, results, card, mirror, custom, ended)
- `#main[data-type="choice"]`: one kind of question (choice, scale, text, number, photo, audio, qa, form)
- `#main[data-iid="mood"]`: one question
- `#main[data-open="0"]`: a question that takes no more answers: stopped, or shown closed for a reveal ("1" while it does)
- `.q, .sub`: the question, and the hint under it
- `.opts (.grid, .list, .stickers)`: the options, and how they are laid out
- `.opt, .opt.on, .opt span`: one option, a picked option, its label
- `.sticker, .sticker b`: one sticker option, its label
- `.opt.other, .osaid`: the last option, which people write themselves (other), and their words
- `.tchips, .tchip, .tchip.on`: words to tap instead of typing (suggestions), one already sent
- `.big, .field, textarea`: main buttons, text boxes
- `.note`: messages under a question
- `#top, #bar, .p-follow, .blocks`: header, reaction bar, the look-up screen, info cards

**Example**:

```css
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display&display=swap");
:root { --accent: #FFB703; --display: "Playfair Display", serif; }
[data-kind="ask"] .q { font-size: 2.4rem; line-height: 1.1; }
[data-kind="ask"] .opts { gap: 1rem; }
[data-kind="ask"] .opt { border-radius: 999px; padding: 1.2rem 1.4rem; font-size: 1.2rem; }
.v-bars .vfill { background: linear-gradient(90deg, var(--accent), #FB8500); }
[data-slide="s_intro"] .L-title { text-transform: uppercase; letter-spacing: .05em; }
```

CSS cannot run code. Addresses in it (fonts, pictures) load from the web, so use https. Every save is versioned: if a change looks wrong, restore the version before it.

## Coded decks (HTML)

A presenter may already have a deck written in HTML, or you can write one. Rules:

- One HTML file. One element per slide with a `data-slide` attribute, in order.
- Optional per slide: `data-title`, `data-notes`, `data-id` (keeps settings
  stable when the file is uploaded again), `data-steps` or elements with
  `data-step="1"`, `data-step="2"` that light up one per arrow press.
- A slide can declare its own question: `data-ask='{"id":"tea","type":"choice","prompt":"Tea or coffee?","options":["Tea","Coffee"]}'`.
  Phones are asked it on that slide automatically. The `id` is how other slides refer to it.
- A slide can say where the presenter's live video goes: `data-camera="corner"`
  (or beside, behind, full, off), JSON like `data-camera='{"place":"corner","corner":"top-left"}'`,
  or `data-camera="code"` to draw it yourself with `Stage.camera` (below).
- Show live answers inside your own design: `<b data-live="q1.n"></b>` fills in a
  number (`n`, `avg`, `total`, `people`, `top`), and
  `<div data-results="q1"></div>` draws simple bars you can style. Or listen in script:
  `Stage.on('data', (d) => ...)`.
- The bridge script is added for you when the file is served. Slides are shown one
  at a time and the presenter's arrow keys drive them.
- Upload: `PUT /decks/{id}/sources/{sourceId}/files/index.html` with the HTML as the
  body (and any other files at their paths), then
  `POST /decks/{id}/sources/{sourceId}/apply` with `{ "entry": "index.html", "scan": true }`.
- The presenter can change a coded deck's files in the app too (words and
  pictures where they are, or the code itself). Read a file again
  (`read_deck_file`) right before you write it, so you never write over
  their changes.
- A key can replace a file with `PUT`, not take one out. Taking one out
  (`DELETE /decks/{id}/sources/{sourceId}/files/{path}`) is the presenter's,
  signed in to the app: ask them. It never takes the page the deck starts from.
- A picture of each slide, a file in the upload (`data-thumb="shots/intro.png"`
  on its section, or `thumb` in a `joocy-slides` entry), is its thumbnail.
- Upload again later and apply again: each slide keeps what is already set on it
  in the deck. That is its `phone`, `phoneByStep`, `notes`, `title`,
  `camera` and `transition`. A page's question is made once, and changes only when the
  page's own question changes.
- So a new `data-phone`, notes or question id in the file does not reach a
  slide that already has one. To change those from code, write them into the
  deck after you apply: `PATCH` each slide's `phone`, `phoneByStep` and
  `notes`, or `PUT` the whole spec with the version you read. A deploy
  script does this every time.
- Keynote's HTML export (File, Export To, HTML) works as it is: upload every file
  with its path and apply with `"scan": true`. Its builds and transitions play
  exactly as designed, one step per click.
- **A deck that is one world** (a three.js scene the camera flies through, one
  long canvas): list its slides in
  `<script type="application/json" id="joocy-slides">[{ "id": "earth", "title": "Earth", "steps": 2, "notes": "...", "ask": {...}, "phone": {...}, "camera": "code" }]</script>`
  instead of sections, and draw each one in your own code with
  `Stage.on('goto')`, `Stage.on('step')` and `Stage.on('progress')` (0 to 1
  through the whole deck, moving smoothly between beats: bind a camera path to it).
- Pages move with transitions: `data-transition="zoom"` on a page (or JSON
  `'{"base":"slide","duration":600}'`), `<html data-transition="...">` for the deck.
  Pieces with the same `data-morph="name"` on two pages glide from one to the
  other (magic move). `Stage.transition(fn)` takes over entirely (below).
- Examples to start from, each a file you can upload as it is:
  https://joo.cy/kit/example-deck (every convention),
  https://joo.cy/kit/examples/world (a 3D world: camera path, phones light stars, answers as pillars),
  https://joo.cy/kit/examples/summit (the presenter's live video on a mountain's face, the room climbing it),
  https://joo.cy/kit/examples/magic (magic move with data-morph),
  https://joo.cy/kit/examples/showcase (three.js, GSAP, a live poll, a phone screen),
  https://joo.cy/kit/examples/night-sky (everyone who joins becomes a star with their name),
  https://joo.cy/kit/examples/pour (every vote a drop filling its glass).
- To try a deck on your own computer, add `<script src="https://joo.cy/kit/map.js"></script>`,
  `<script src="https://joo.cy/kit/motion.js"></script>` and `<script src="https://joo.cy/kit/bridge.js"></script>`
  to its head: the kit, the motion engine and the arrow keys work in any browser.
  More in "Trying it", below.
- Full detail: https://joo.cy/docs/coded-decks/

## Full HTML, WebGL and animation (custom slides and phone screens)

Beyond a whole coded deck, a single slide, or a single phone screen, can be
your own HTML with real libraries. Two places:

- **A custom stage slide** (the big screen): `{ "type": "custom", "html": "..." }`
  as a slide's `stage`. Add `"steps": n` for beats, or put `data-step="1"`,
  `data-step="2"` on elements that light up one per arrow press.
- **A custom phone screen** (every phone): `{ "type": "custom", "html": "..." }`
  as a slide's `phone`, with an optional `"interaction"` to save answers into
  (a question of type custom: `"interactions": { "pick": { "type": "custom" } }`),
  `"fill": true` for edge to edge, or `"source"` + `"src"` to use a page from an
  uploaded folder (so it can load models, textures and sound by relative path).

Both run sandboxed with no origin of their own, open no new windows and save
no files, and an import map is added so you can use the library kit with bare
imports:

```html
<script type="module">
  import * as THREE from 'three';
  import { gsap } from 'gsap';
  import confetti from 'canvas-confetti';
</script>
```

The kit, self-hosted so a venue that blocks CDNs still runs it:

- `three@0.186.1`
- `three/webgpu@0.186.1`
- `three/tsl@0.186.1`
- `three/addons/...@0.186.1`
- `gsap@3.15.0`
- `gsap/all@3.15.0`
- `gsap/ScrollTrigger@3.15.0`
- `gsap/ScrollSmoother@3.15.0`
- `gsap/Flip@3.15.0`
- `gsap/SplitText@3.15.0`
- `gsap/MotionPathPlugin@3.15.0`
- `gsap/MorphSVGPlugin@3.15.0`
- `gsap/DrawSVGPlugin@3.15.0`
- `gsap/Draggable@3.15.0`
- `gsap/InertiaPlugin@3.15.0`
- `gsap/Observer@3.15.0`
- `gsap/CustomEase@3.15.0`
- `gsap/CustomBounce@3.15.0`
- `gsap/CustomWiggle@3.15.0`
- `gsap/EasePack@3.15.0`
- `gsap/ScrollToPlugin@3.15.0`
- `gsap/TextPlugin@3.15.0`
- `gsap/ScrambleTextPlugin@3.15.0`
- `gsap/Physics2DPlugin@3.15.0`
- `gsap/PhysicsPropsPlugin@3.15.0`
- `gsap/PixiPlugin@3.15.0`
- `motion@14.2.0`
- `motion/react@14.2.0`
- `animejs@4.5.0`
- `react@19.3.1`
- `react/jsx-runtime@19.3.1`
- `react-dom@19.3.1`
- `react-dom/client@19.3.1`
- `htm@3.1.1`
- `htm/react@3.1.1`
- `d3@7.9.0`
- `pixi.js@8.22.0`
- `p5@2.3.4`
- `lottie-web@5.13.0`
- `matter-js@0.20.0`
- `canvas-confetti@1.9.4`
- `chart.js@4.5.1`
- `simplex-noise@4.0.3`
- `tone@15.1.22`

Other libraries can be loaded from a CDN **on the big screen** (the stage tier
is open). **Phone screens are sealed**: they may load only the kit, the deck's
own files and a font service, and can send nothing to any other site. So on a
phone, import from the kit or add the file to the deck.

### The Stage bridge (custom slides and coded decks)

A global `Stage` is there (opened on its own, outside the app, it simply is not,
so a deck still works in a plain browser):

- `Stage.on('data', d => ...)` the room's answers: `d.aggs[id]`, `d.interactions`,
  `d.people`. Draw them any way you like, or use `data-live` / `data-results`.
  Each question's shape is below.
- `Stage.on('step', ({ step, dir, instant }) => ...)` a beat changed (dir is 1 or
  -1; instant is a jump). `Stage.on('goto', ...)` the same with the slide index.
- `Stage.on('in'|'out', ...)` the slide came on or left the screen.
- `Stage.on('signal', ({ name, data, from }) => ...)` a live cue from a phone
  (see signals, below). `Stage.on('reaction', counts => ...)` the reaction taps.
- `Stage.broadcast(name, data)` sends a live cue to every phone.
- `Stage.timeline(tl, which)` drives a GSAP timeline by the beats: one press
  plays on to the next stop, back plays back, a jump goes straight there.
  `which`: `'deck'` (every beat of every slide is a stop: one timeline for a
  whole world), a slide (its index, data-id or an element in it), or nothing
  (the only slide, or the deck). Stops are labels (`"2"` for a slide's beat 2,
  `"3.1"` or `"<data-id>.1"` across a deck), or spread evenly.
- `Stage.on('progress', ({ value, beat, total }) => ...)`: where the talk is
  through the deck, 0 to 1, moving smoothly between beats.
- `Stage.camera`: the presenter's own video, on a slide whose camera place is
  `code` (`"camera": { "place": "code" }` on the slide, `data-camera="code"` on
  a coded page, `"camera": "code"` in a slide list). `Stage.camera.video` is a
  playing, muted video element (`new THREE.VideoTexture(Stage.camera.video)`),
  `.stream` its stream, `.canvas` the canvas it is drawn on; reading one asks
  for it. `Stage.on('camera', ({ on, width, height }) => ...)` says when it
  comes and goes (the presenter can hide it any time: keep a stand-in).
  `Stage.camera.want({ width: 1280, fps: 30 })` for a sharper one (960 and 30
  otherwise). Pictures only, never sound, never on phones, and only while that
  slide is on screen.
- `Stage.transition(async ({ fromEl, toEl, dir, instant, duration }) => { ... })`:
  move between this deck's pages yourself (GSAP, three.js, anything). Both pages
  are on screen while it runs, for up to 8 seconds; return false to use the
  built-in one. `Stage.motion(name, fromEl, toEl)` plays any built-in or deck
  transition between two elements of yours.
- Presets: an element with `data-anim="rise|fall|left|right|zoom|pop|fade|blur"`
  and a `data-step` animates in on its beat; on a page's first beat it arrives
  with the page.

### Live answers: what Stage.on('data') gives

`d.aggs` holds one roll-up per question id, the same the big screen draws.
`d.interactions[id]` is the question: its `type`, `prompt`, `options`,
`view` and `other`. `d.people` is how many have joined. A coded deck hears it on the
big screen. A custom slide hears it on the big screen and in the console,
the same roll-up in both. The editor's preview has no live answers.

- `choice`: `{ n, counts, total }`. `counts` is `{ optionId: number }`.
  `n` is people who answered. `total` is every pick (several per person
  on a multiple-answer question). With `other` set (it is in
  `d.interactions[id]` too), `counts._other` counts who wrote their own, and
  `others` is the newest 60 shown words: `{ id, text, at }`.
- `scale`: `{ n, avg, dist, min, max, width }`. `dist` is
  `{ value: number }`. A wide scale counts in buckets `width` wide, each
  keyed by where it starts.
- `text`: `{ n, words, items }`. `words` is `[[word, count], ...]`, most
  said first. `items` is the latest answers: `{ id, text, at }`.
- `qa`: `{ n, items }`, unanswered first, most votes first:
  `{ id, text, votes, answered, at }`.
- `number`: `{ n, avg, median, min, max, hist }`. `hist` is
  `[{ from, to, n }]`. With `correct` set, also `correct` and `closest`:
  the nearest guesses, `[{ name, value, off }]`.
- `photo`, `audio`: `{ n, items }`, each `{ id, url, at }`.
- `form`: `{ n }` only. What people filled in stays with the presenter.
- `custom`: `{ n, latest }`, the newest values sent with `Room.send`: 50,
  or what the question's `latest` says (0 to 50). With `"latest": 0` it is
  `{ n }` alone. Give a custom question `"latest": 0` when a big room sends
  a lot (a paragraph each): every answer sends its roll-up to every screen
  again. Every answer stays whole in `GET /sessions/{sid}/results`.
- `d.aggs['@leaderboard']`: `{ n, rows }`, the top scores of every quiz,
  each `{ name, score }`.

Answers the presenter has not approved never arrive, and neither does a
filtered answer (a custom one too) until the presenter shows it. Names
arrive only where the room shows them: on the leaderboard, in the closest guesses, and on a Q&A
with "show who asked" on (`name` on each item). A name the room keeps hidden
reads "Guest 12". `n` can be 0 and a list empty: draw that too.

### The big screen around your deck

- **Leave room for the join badge.** On slides that ask something it sits in
  the bottom left corner, about a fifth of the width and a sixth of the
  height (`settings.joinBadge`: `"auto"`, `"always"` or `"off"`).
- **Reactions rise up the right edge**, across 22% of the width
  (`22vw`). Keep what people must read out of that strip.
- **Short notices** ("Answers locked", "Reconnecting") show at the top centre
  for a moment.
- **The mouse is the show's, unless you ask for it.** By default nothing
  of the mouse reaches a coded slide: a click on the left or right edge of
  the big screen moves the show, as on any slide.
  `"settings": { "mouse": true }` gives every coded slide the mouse,
  trackpad and pen (click, hover, drag, the edges too), and a coded slide's
  `stage.mouse` says `true` or `false` for that slide alone. Turn it on
  only for a deck that needs it.
- **A link replaces your deck.** With the mouse on, a plain link opens inside
  your deck's frame, and that page stays on the big screen until it reloads.
  It hears no answers and gets no pointer or keys. A new window
  (`target="_blank"`, `window.open`) or a download does nothing. Put links
  people should open on their phones instead: `Room.open`, or a card's
  button.
- **Keys reach your deck only once someone clicks into it**, so only with
  the mouse on. Even then, the bridge hands these to the show: arrows,
  Space, Enter, Page Up, Page Down, Backspace, Home, End, Escape, and `B`
  `.` `J` `R` `L` `N` `O` `F` `M` `C` `?`. Every other key is yours: digits, the other letters, and
  keys with Ctrl, Cmd or Alt. Skip `G` and `H` too: on the big screen
  itself they open all slides and the keys help.
- **What the presenter's keys do**, so a deck can plan for them: `R` reveals
  a question's results, `J` shows the big join code, `L` locks answers,
  `N` shows speaker notes, `B` (or `.`) goes black, `O` shows all slides,
  `F` full screen, `M` sound on or off, `C` opens the console.
- **Stickers** are this site's own animated WebP files, so a deck can use
  them as pictures: `/stickers/<name>.big.webp` (320 px, for the big screen),
  `/stickers/<name>.webp` (128 px) and `/stickers/<name>.still.webp` (still).
  The names are in the catalog under `glyphs`. Use them in `<img>` or a CSS
  background.
- **Theme CSS reaches the big screen page** (see Styling). `body.stage-page`
  there, `body.phone` on phones.

### The Room bridge (phone screens)

A global `Room` is there on a custom phone screen:

- `Room.send(value)` saves an answer (any JSON up to 4 KB) into the slide's
  `interaction`, a question of type custom. Returns `{ ok, error }`. An
  answer with a bad word anywhere in it (a key too) is filtered: it waits
  for the presenter's OK, like a filtered word on a wall. The phone is told
  it was sent, and no screen gets it until the presenter shows it. Leave
  "Filter bad words" on (the deck's `settings.filter` and each question's
  own `filter`) unless the presenter asks.
- `Room.answer` (and `answer` in `Room.on('state')`) is what this person
  last sent. The phone keeps it until the room has it, even when the phone
  closes the page (iPhones do, in the background): the next page sends it
  again and gives it back here. Fill your inputs from it, so a reload
  resumes where they were.
- `Room.emit(name, data)` sends a live cue to the big screen (a tap, a drag, a
  colour), kept nowhere. The screen hears `Stage.on('signal')`.
- `Room.on('signal', ({ name, data }) => ...)` a cue from the big screen
  (`Stage.broadcast`). `Room.on('state', ...)` the beat moved, or `Room.me`
  changed. `Room.on('motion', ...)` tilt, once the person allows it
  (`Room.motion()`).
- `Room.on('data', agg => ...)` the slide's question, in the same shapes as
  `Stage.on('data')` (above) with fewer items. Only when phones may see
  results: `phones: "after"` or `"reveal"`, and always for Q&A.
- `Room.me.tag` a short stable id for this person (also on their signals, so the
  screen can give each phone its own colour).
- `Room.me.name` their own name, as the room shows it: "Hi, Asha". It is
  empty until they give one, and while the room keeps it hidden. A screen
  never hears anybody else's name. Write for both: `Room.me.name || 'friend'`.
- `Room.theme` the deck's colours and fonts (also CSS variables:
  `var(--accent)`, `var(--ink)`, `var(--display)`).
- `Room.vibrate(ms)`, `Room.open(httpsUrl)` (call from a tap: recognised social
  links open directly; other sites ask first).
- Fast taps never zoom the phone, so a screen can be one big button people hit
  as fast as they like. A drawing pad or a drag of its own sets
  `touch-action: none` on itself.

### What phone screens may never do

The room refuses, and never shows, a phone screen that asks for a password, a
card number or a one-time code, and refuses any answer that is a card number or
is sent under a key like `password`, `otp` or `cvv`. Do not build screens that
ask a room for secrets; they will not work and the save fails.

A phone screen is sealed, so plan around these:

- It reaches only the kit, the deck's own files and a font service.
- No downloads, no popups, no dialogs (`alert`, `confirm`), no leaving the
  page, no `localStorage`. `Room.open(url)` opens an https link from a tap:
  recognised social links open directly, other sites ask the person first.
- To let people keep a picture, show it as an `<img>`. They long-press it to
  save it.
- Everything it sends goes to the room, through `Room.send` and `Room.emit`.

### Trying it

- Open a coded deck on its own (with the three scripts above): the arrow keys,
  the kit and the transitions work, but no answers arrive. Feed your drawing
  code sample answers in the shapes above. Without the bridge script there
  is no `Stage` at all, so guard it: `window.Stage && Stage.on(...)`.
- The big screen's link (`links.stage` from `start_session`) waits on a
  **Start** button, because browsers play sound only after a click. A
  browser test must click Start before the slides move. `links.screen`, a
  view-only second screen, starts by itself and moves nothing, even with the
  presenter signed in.
- Start a session and join from a phone to see real answers and
  `Room.me` arrive.

### Working with files, as an agent

- `import_html_deck` uploads a whole single-file deck (or re-uploads to update).
- `upload_deck_file` puts one text file (an extra page, a stylesheet, a phone
  screen, a JSON data file) into a source folder. `list_deck_files` and
  `read_deck_file` read what is there. Pictures and models: `save_image_from_url`.
- A phone screen from a folder: upload `screens/vote.html` into `src_show`, then
  set the slide's phone to `{ "type": "custom", "source": "src_show", "src": "screens/vote.html" }`
  (`upload_deck_file` returns it as `phone_screen`). Add `"interaction"` with a
  custom question's id to keep what the screen sends.

## Transitions: built in, and your own

`settings.transition` sets the deck's default move between slides; any slide's
`transition` overrides it: `{ "type": "slide" }`, `{ "type": "zoom", "duration": 600 }`.
Built in: fade, none, slide, rise, zoom, blur, iris, wipe, curtain, flip, spin, drop, glide, morph (push, dissolve, cut and magic-move work as names too). `morph` is magic move:
the pieces two slides share (the title, the big number, the picture, line by
line) glide from one place and size to the other while the rest dissolves.
Pair other pieces by name with `view-transition-name` in the deck's CSS.

**Design your own.** A transition is data, so you can write any you can
imagine: in `settings.transitions`, by name, then use its name like a
built-in. It is checked when saved: only visual properties animate, nothing
can load anything, every time is clamped. `get_transitions` returns every
built-in in full (start from one with `"base"`) and checks yours.

```json
"settings": {
  "transition": { "type": "hero-zoom" },
  "transitions": {
    "hero-zoom": {
      "label": "Hero zoom", "duration": 1300, "easing": "cubic-bezier(.7,0,.2,1)",
      "out": { "keyframes": [{ "opacity": 1, "transform": "scale(1)" }, { "opacity": 0, "transform": "scale(1.4)", "filter": "blur(14px)" }], "at": [0, 0.55] },
      "in":  { "keyframes": [{ "opacity": 0, "transform": "scale(.7) rotate(-3deg)" }, { "opacity": 1, "transform": "none" }], "at": [0.35, 1] },
      "parts": [
        { "select": "title", "from": { "opacity": 0, "transform": "translateY(8cqh)", "letterSpacing": ".3em" }, "delay": 500, "duration": 800 },
        { "select": "items", "from": { "opacity": 0, "transform": "translateX(-4cqw)" }, "delay": 700, "stagger": 90 }
      ],
      "phone": { "from": { "opacity": 0, "transform": "scale(.9)" } }
    }
  }
}
```

- `out` and `in`: the leaving and arriving slide, as Web Animations keyframes
  (camelCase: opacity, transform, filter, clipPath, colours, shadows ...), with
  `at`: when, as parts of the duration. A layer's `style` holds for the move
  (a mask, a 3D origin), and can use the animatable --t-r, --t-x, --t-y, --t-a, --t-n.
- `parts`: pieces of the arriving slide by role (title, eyebrow, sub, lines, items, number, quote, image, results, qr, tag, join, layers, all) or a CSS
  selector inside it, each with `from`, `delay`, `duration`, `stagger`, `easing`.
- `morph`: true, or `{ "select": ["title", "image"], "duration": 900 }`.
- `back`: its own design for going back. Without it, going back plays the
  same transition backwards in time (a push goes the other way, an iris closes).
- `phone`: how a phone's screen arrives on that slide.
- Slides are see-through over one shared background, so design the two layers
  not to sit in the same place at full strength: stagger them with `at`, or move
  them apart. People whose device asks for less motion get a short dissolve.
- A transition can also be written in place on one slide:
  `"transition": { "base": "slide", "duration": 500 }`.
- A coded deck's pages play the same transitions (data-transition, or the one
  you set on its slide in the deck), and `Stage.transition(fn)` lets its own
  code do anything at all.

## Live signals, during a talk

- A phone screen's `Room.emit(name, data)` reaches a custom slide or coded deck
  on the big screen as `Stage.on('signal')`: taps, drags, colours, a game move.
- The big screen's `Stage.broadcast(name, data)`, or your `control_session` with
  `command: "broadcast"`, reaches every phone screen as `Room.on('signal')`.
- Both are ephemeral (kept nowhere), rate- and size-limited; a phone's signals
  are word-filtered, so the audience cannot push a slur onto the screen.

## Video slides

`{ "type": "video", "src": "/a/...", "stops": [4.8, 12.1] }` plays a video on the
big screen and pauses at each stop: one step per stop, so the next press plays
on to the next one. A deck exported as a video keeps its animations this way.
Upload the file with `POST /files` first. The presenter's app can find the stops
for them; you can also set them.

A slide can also be one part of a video: `"from"` and `"to"` (seconds) limit it
to that stretch of the file. A deck exported as a video works best as one slide
per part, all with the same `src`: the big screen keeps one player for the file,
so one press forward plays on from where the last part stopped, with nothing
reloading. Give each part `"thumb"` (a picture of how it ends, for thumbnails)
and `"poster"` (how it starts, which is how the part before it ends). Arriving
any other way than one press forward shows how the part ends. Questions and
other slides can sit between parts.

## The presenter's own video

The presenter's camera can be part of the talk, like a speaker on a video
call, with every slide, question and world exactly as it is. Where it sits
is part of the deck:

- `settings.camera` for every slide: `{ "place": "corner", "label": "Asha Rao\nFounder, Lumen" }`
  (a name, then what they do: two lines at most).
- A slide's own `camera` says otherwise for that slide: `{ "place": "full" }`.
- Places: `corner` (a box over the slide; `corner`, `size`, `shape`),
  `beside` (the slide shrinks to the other side; `side`, `split`),
  `behind` (under the words, darkened by `dim` so they read; `blur`),
  `full` (the slide's words step aside; live results on top and the join
  code stay), `code` (a custom slide or coded deck draws it, with
  `Stage.camera`, above), `off`. Every field is in the catalog, under
  "Your video".
- `settings.camera.src`: a live stream or a video link (or a YouTube or
  Vimeo page) that every big screen plays instead of a camera.
- The camera itself is the presenter's choice on the night, from the
  console: any camera the stage's computer has, a window or screen, or a
  phone they pair as the camera. Nothing in the deck names one.
- A deck that never mentions it shows none, and no camera opens.

Good defaults: `corner` for a talk with full slides, `beside` when the
speaker matters as much as the slides, `full` or `behind` to open and to
close, `code` for a world the speaker is part of. Put their name and role
in `label`. Between two slides the video glides from one place to the
next with the slide's transition, so changing places is never a jump.

The camera opens only in the presenter's own browser, on the big screen,
after the browser asks them: you cannot open it, see it or record it.
During a talk you can:

- hide it on every screen and show it again: `{ "t": "control", "action": "camera", "on": false }`
  (MCP: `control_session` with `video_off` and `video_on`);
- hold one place for every slide for now, `full` for a story say:
  `{ "t": "control", "action": "camera", "place": "full" }`, and let go with
  `"place": null` (MCP: `video_place`, with `place` full, corner, beside,
  behind, or slides to let go);
- see how it is: `GET /sessions/{sid}` has
  `"camera": { "on": true, "place": null, "running": true, "kind": "device", "label": "FaceTime HD Camera" }`.
  `running` false means the big screen has no camera open yet (it opens
  at Start); `error`, when there is one, says why in words to pass on.

### Going live online

A talk can go out live through the join link: what the room's screen
shows, the presenter's video, their voice. The site must have it set up
(`GET /sessions/{sid}` says `"live": { "available": true }`), and it
starts on the stage itself: the presenter presses **Start and go live**,
or a key when the stage asks, and their browser asks to share the tab.
Phones go on answering as always and play nothing unless the presenter
says so: a room of phones playing video takes down a venue's Wi-Fi. To
stream to YouTube, Twitch, Instagram, a call (Google Meet, Zoom), the
presenter captures the stage with their streaming app or the call's
"present a tab" (the Presenting guide, "Going live anywhere").

- Ask the stage to ask them: MCP `control_session` with `go_live`.
- What phones do: `{ "t": "control", "action": "live", "watch": "off" }`
  (they only answer, the default), `"tap"` (a Watch button, for people
  far away with one device) or `"everyone"` (every phone that joins
  plays it: an audience that is all online). MCP: `live_watch`.
- Stop: `{ "t": "control", "action": "live", "on": false }`. MCP: `live_off`.
- `GET /sessions/{sid}` has `"live": { "on": true, "watch": "off", "available": true, "watching": 0 }`.

## Questions that depend on who answers

- **Only some people.** Any phone view can carry a condition and what everybody
  else sees instead. Each phone picks for itself from its own earlier answers,
  and the room checks the same way before it keeps an answer.

  ```json
  { "type": "ask", "interaction": "rate_shoot",
    "when": { "interaction": "craft", "in": ["photo", "video"] },
    "otherwise": { "type": "ask", "interaction": "rate_event" } }
  ```

  `when` needs a choice question and some of its option ids, or a custom
  question and up to 24 words (each up to 48 characters). A custom answer picks
  somebody when it is one of those words, or a list with one in it: a phone
  screen that ran `Room.send(['cap', 'Jalebi'])` makes that person one of
  `"in": ["cap"]`. Only strings count, and an answer the word filter holds
  picks nobody until the presenter shows it. Photos and voice notes are
  checked the same way, so a photo screen only for captains takes only
  captains' photos. `otherwise` can carry its own `when`, up to four deep;
  without one, everybody else looks up.
- **In their own words.** `{craft}` in a question's prompt, a card's text or a
  "look up" line puts in what that person answered to "craft":
  "{craft|Friends}, how was your year?" reads "Photographer, how was your
  year?" on a photographer's phone, and "Friends, how was your year?" on the
  big screen, where there is no one person, and for anybody who has not
  answered. Write it so any answer reads well in it.
- **Their name.** `{name|friend}` is always the person's own name: "Hi
  {name|friend}, ready?" People give a name when the deck asks
  (`"settings": { "names": "always" }` asks when they join), or through a
  text question with `"asName": true` ("What should we call you?"), whose
  answer becomes their name on the leaderboard, in Q&A and in `{name}`.
- **Split by an answer.** A results slide with `"by": "craft"` shows the answers
  split by profession: a ball pit per profession for a sticker poll (moods by
  profession), a split bar per profession for other polls, and an average per
  profession for ratings and numbers. Only people who answered both count.
  `get_results` returns these in `splits`, group by group with each group's
  name, and `GET /sessions/{sid}/results` in `aggs` under `"mood@craft"`.

## Finding and organising decks

- `GET /decks?q=words` searches every word in every deck: titles, slides, notes,
  questions and options. Every word has to appear somewhere in a deck.
- `?folder={id}`, `?folder=none` or `?folder=starred` narrows the list. Each
  deck in it has `folder_id` and `starred`.
- `GET /folders` lists folders with how many decks each holds.
  `POST /folders` with `{ "name": "Workshops" }` makes one, `PATCH /folders/{id}`
  renames it, `DELETE /folders/{id}` removes it. Its decks stay, without a folder.
- `PUT /decks/{id}/meta` with `{ "folder": "{id}" or null, "starred": true }` moves
  or stars a deck. It never changes the deck itself or its history.
- `POST /decks` takes `"folder": "{id}"` to start a new deck inside a folder.
- `POST /decks/{id}/duplicate` copies a deck, with its uploaded files, into a
  new one titled "... (copy)".

## Live sessions

- `POST /decks/{id}/present` starts one (or resumes the running one) and returns the
  join code and links. `{ "fresh": true }` starts over for a new audience.
- `POST /sessions/{sid}/control` drives it:
  `{ "t": "nav", "dir": "next" }`, `{ "t": "goto", "slide": "s_mood", "step": 0 }`,
  `{ "t": "control", "action": "reveal", "iid": "quiz1" }`.
  Actions: reveal, lock, clear, black, overlay (`"name": "join"` or null), spotlight,
  item (`"item"` and `"state": "ok"` or `"hidden"`), approve-all, room-pause and
  room-lock (`"on": true` or false), name (`"pid"`, `"show": true` or false),
  remove (`"pid"`: everything they sent leaves, their phone is let go),
  camera (`"on": false` hides the presenter's video, `"place": "full"` holds
  a place for now, `null` lets go; see "The presenter's own video"),
  live (`"on": false` stops going live, `"watch": "off"`, `"tap"` or `"everyone"`), end.
- `GET /sessions?deck={id}` lists sessions. `GET /sessions/{sid}/results` returns every
  answer, rolled up per question in `aggs`.
- `GET /sessions/{sid}` is the session, and where its show is now:
  `"state": { "slide": "s_mood", "step": 1 }` (null if the room does not
  answer). To follow a show every few seconds, ask this, not the results.
  `"display"` says whether its screens are HTTPS only (below), `"camera"`
  how the presenter's video is, and `"live"` whether the talk goes out online.
- **Strict company networks** often block WebSockets. The stage and the
  console need nothing for that: they use a WebSocket where the network
  allows one and plain HTTPS where it does not, by themselves, and show
  everything either way (coded and custom slides, 3D, embeds, fonts, cues
  from phones). `settings.display: "safe"` makes them HTTPS only, never
  trying a WebSocket, for a network that must not see one; `"standard"`
  lets them use one wherever it works; `"auto"` (the default) leaves it to
  the presenter's account, in Settings. `links.stage` from present is the
  one to open; `links.safe` (`/stage/safe/{sid}`) is always the HTTPS
  only stage, which the sites the presenter names may show inside their own
  pages, and `?safe` on a stage link does the same once. The account's
  choice and those sites are the presenter's own: a key cannot change them.

## Designing the experience: show it, do not just chart it

Joocy is not only slides and bar charts. Every answer, every tap and every
person joining reaches the big screen live, and a slide with code of its own
(a custom slide, or a whole coded deck) can draw it as anything a browser
can: a three.js world, physics, particles, light, sound. So when you make a
deck, design the moments, not only the content. Ask what the talk is about
and how it should feel, then let the room's answers become part of that
world.

This is something you can do, not a rule. A plain chart is right when people
need to read exact numbers, and most slides should stay simple. But the
moments a room remembers (people arriving, a big choice, a reveal, the
close) deserve something they will talk about afterwards. When the
presenter's request leaves room for it, offer it, or build one or two such
moments into the deck.

### How to think about it

1. **Start from the talk's own world.** A talk about travel has gates,
   platforms and runways. One about growth has seeds and roots. An evening
   event has a night sky. A cooking class has pots and steam.
2. **Turn each interaction into an action in that world.** People do not
   "answer a poll": they pour into a cup, board a train, light a lantern,
   plant a seed, throw a dart.
3. **Make every person visible.** One answer, one thing on the screen: a
   drop, a star, a passenger, a balloon. A room that sees itself leans in.
4. **Let it build over the talk.** A world that fills as the talk goes on
   (stars that stay, a garden that grows, a map that lights up) pays off at
   the end, when you pull back and show all of it.
5. **Keep it readable from the back.** Big, few and slow enough to follow.
   Show the real number too, quietly, where it matters.
6. **Fit the presenter's look.** Their colours and fonts are the deck's
   (`Stage.theme`, or `var(--accent)`, `var(--ink)`, `var(--display)` in CSS).

### Moments, and what they can be

| Moment | Not only | But |
| --- | --- | --- |
| People joining | "42 joined" | each person rises into a night sky as a star that glows with their name; passengers walk to the gate and board the plane or train; lanterns float up; seats fill in a stadium; lights come on in a city at night |
| A choice (tea or coffee?) | two bars | every vote is a drop falling into its team's glass, which fills; marbles rolling into jars (physics); two teams pulling a rope; votes as runners racing to a line |
| A rating or a mood | an average | the weather over a landscape, from storm to sunshine; a plant that grows or wilts; a thermometer; a crowd that stands up |
| Words from the room | a word cloud | words written into the stars; lanterns drifting up carrying the words; words floating down a river; a wall of sticky notes |
| Questions from the room | a list | paper boats on a river, the most voted sailing to the front; bubbles rising, the biggest at the top |
| A quiz | a leaderboard | a race: every player's car, horse or rocket moving with their score |
| A guess (a number) | a histogram | darts landing around the bullseye of the true answer |
| A countdown or a reveal | a timer | a rocket on the launch pad, its count; a curtain; a door opening; a fuse burning down |
| Photos from the room | a wall | polaroids pinned to a board; a gallery the camera flies through |
| Taps on phones | nothing | every tap is a spark, a firework, a shooting star or a heartbeat on the big screen |
| The close | a thank-you slide | pull back and show the whole night's world at once: every star, every name, joined |

Two of these are ready to start from, each a file you can upload as it is
and change: https://joo.cy/kit/examples/night-sky (everyone who joins becomes a
star with their name; phones send shooting stars; a constellation at the
end) and https://joo.cy/kit/examples/pour (tea or coffee: every vote is a drop
poured into its glass). https://joo.cy/kit/examples/world is a deck that is one 3D
world the camera flies through.

### How to build it

- **One moment:** a custom slide, `{ "type": "custom", "html": "..." }`, with
  the question asked on the same slide's phones. **A whole world:** a coded
  deck (see Coded decks), whose slides are places in it.
- **The room, live:** `Stage.on('data', d => ...)`. `d.people` is how many have
  joined. `d.aggs[id]` is each question's roll-up: `counts` per option for a
  choice, `items` and `words` for words, `avg` for a rating (every shape is in
  "Live answers: what Stage.on('data') gives").
- **One answer, one thing:** keep what is on screen and compare with the last
  roll-up: draw one drop, star or passenger for each new answer since then,
  so every arrival is a moment of its own. Keep what you drew when the next
  roll-up comes, so the world only grows.
- **Names:** ask "What should we call you?" as a text question with
  `"asName": true` (say `"button": "Join"`) on the join slide's phones. Its
  answers are the names (`d.aggs[id].items`, each `{ id, text }`, the newest
  120), and they arrive only once the room shows them: a filtered name waits
  for the presenter. People without a name yet are `d.people` less the names.
- **Taps:** a phone screen of your own with one big button that calls
  `Room.emit('spark')`; the big screen hears `Stage.on('signal')` with a short
  tag of who sent it, so each phone can have its own colour.
- **The kit has the tools:** `three` for worlds and skies, `matter-js` for
  drops, marbles and anything that falls and piles up, `pixi.js` for many 2D
  particles, `gsap` for motion, `canvas-confetti` for bursts, `d3` for maps
  and layouts, `tone` for sound, `simplex-noise` for things that drift and
  breathe.
- **On a projector laptop:** cap what you draw (a few thousand particles at
  most), keep the pixel ratio at 2 or less, stop drawing while the slide is
  away (`Stage.on('out')` and `'in'`), and draw less for people who ask for
  less motion (`prefers-reduced-motion`).
- **Leave room** for the join code (bottom left, on slides that ask) and for
  reactions rising up the right edge.
- **Check it anywhere:** feed your drawing sample answers when no room is
  there (opened on its own, or `Stage.mode === 'preview'` in the editor), as
  both examples do.

## Writing for a room

- One idea per slide. Short lines. Big words read from the back row.
- Questions under ten words. Options under five words each. Two to six options.
- Ask early, and often enough that phones stay in hands.
- Keep the presenter's own wording and voice when you edit their slides.
