diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
new file mode 100644
index 0000000..88dd7c7
--- /dev/null
+++ b/docs/PROTOCOL.md
@@ -0,0 +1,565 @@
+# GameStream protocol, as DomiStream speaks it (client side)
+
+The protocol between a GameStream host (Sunshine, later Lumen) and a client (Arena Domi TV). Written from the Wolf
+protocol docs in our own words, completed with facts read in Moonshine (BSD-2). Every fact has a tag; every gap is
+marked **UNKNOWN Un** with what would settle it. Status: 2026-11-25, Phase A (docs + API, no logic yet).
+
+**Tags** (details in the source log, [CLEAN_ROOM.md](CLEAN_ROOM.md)):
+
+| Tag | Source |
+| :-- | :-- |
+| [W1]-[W7] | Wolf docs: index, pairing, RTSP, control, RTP video, RTP Opus, input (S-1 to S-7) |
+| [M] | Moonshine `f184d5e` (S-9). A host implementation: we mirror its behaviour for the client. |
+| [M*] | Moonshine, but the value has GPL provenance (Moonshine cites Sunshine or moonlight-common-c). Confirm by measurement before use. |
+| [T] | tokio-enet `364628e` (S-10), pending approval as a source |
+| [F] | fec-rs README (S-13) |
+| [RFC n] | the RFC |
+
+**Not in DomiStream:** sockets, TLS, the clock, video decoding and **Opus decoding**. DomiStream hands the platform
+layer (ArenaTV: webOS NDL, Android MediaCodec, Windows D3D11VA) a complete Annex-B access unit per video frame and one
+Opus packet (or a "lost" marker) per audio packet, plus the Opus multistream configuration. Decoding, packet-loss
+concealment and output are the platform's job.
+
+---
+
+## 0. Overview
+
+Six protocols [W1]:
+
+| Protocol | Default port | Transport | Protection | Purpose |
+| :-- | :-- | :-- | :-- | :-- |
+| HTTP | TCP 47989 | plain | none | server info, pairing |
+| HTTPS | TCP 47984 | TLS, client certificate | TLS | app list, launch/resume/cancel, the last pairing step |
+| RTSP | TCP 48010 | plain | none | negotiate the three streams |
+| Control | UDP 47999 | ENet | AES-128-GCM per message | input, feedback, host events |
+| Video | UDP 47998 | RTP | none by default; optional AES-128-GCM [M] | H.264 / HEVC / AV1 |
+| Audio | UDP 48000 | RTP | AES-128-CBC | Opus |
+
+All ports except HTTP/HTTPS can be changed by the host and reach the client through RTSP [W1].
+
+Session order (client view): `serverinfo` (HTTP) → pair once (HTTP + one HTTPS step) → `applist` (HTTPS) →
+`launch` (HTTPS, hands over the stream keys) → RTSP OPTIONS, DESCRIBE, SETUP ×3, ANNOUNCE, PLAY → UDP PING to the
+video and audio ports + ENet connect to the control port → `START_B` on control → video and audio flow [W1][W3][M].
+
+---
+
+## 1. HTTP and HTTPS
+
+Source: [Wolf: HTTP/S pairing](https://games-on-whales.github.io/wolf/stable/protocols/http-pairing.html) [W2], Moonshine `src/webserver/` and `src/clients.rs` [M].
+
+### 1.1 Common shape
+
+- Every call is a `GET` with a query string. Every response body is XML with one root:
+ `…`; a non-200 `status_code` is an error, possibly with a `status_message`
+ attribute (UNKNOWN U27: attribute names on errors). [M]
+- Every call carries `uniqueid=` [M]. Our client id: 16 random hex characters, stored with the pairing
+ (UNKNOWN U1: whether the host requires a particular form).
+- Binary values travel as hex in both directions [M]. Our parser accepts upper and lower case.
+- HTTPS: the host presents its certificate (the same one it sends as `plaincert` while pairing [M]); the client
+ presents its own certificate. Only a client certificate that completed pairing may call HTTPS APIs [W2].
+ The client **pins** the host certificate: the TLS certificate must equal the paired `plaincert` byte for byte.
+ TLS itself (version, ciphers) belongs to the platform layer (UNKNOWN U24: TLS versions Sunshine offers).
+
+### 1.2 serverinfo
+
+`GET /serverinfo?uniqueid=…` over HTTP (unpaired) or HTTPS (paired). `PairStatus` is 1 only over HTTPS with a
+paired certificate [M]. Elements under `root` [M]:
+
+| Element | Meaning |
+| :-- | :-- |
+| `hostname` | host name to show |
+| `appversion` | protocol version string, e.g. `7.1.431.-1`; a negative fourth part marks the Sunshine-era protocol [M] |
+| `GfeVersion` | compatibility version string |
+| `uniqueid` | host id (stable across restarts) |
+| `HttpsPort`, `ExternalPort` | HTTPS and HTTP ports |
+| `mac` | MAC address for Wake-on-LAN (may be empty) |
+| `LocalIP` | host's address as it sees it |
+| `MaxLumaPixelsHEVC` | HEVC capability (0 = none) |
+| `ServerCodecModeSupport` | codec bitmask (UNKNOWN U25: bit meanings) |
+| `SupportedDisplayMode` | display modes (may be empty) |
+| `PairStatus` | 1 = this client is paired |
+| `currentgame` | running app id, 0 = none |
+| `state` | busy/free string, host-specific suffix (e.g. `…_SERVER_BUSY`, `…_SERVER_FREE`) |
+
+### 1.3 applist
+
+`GET /applist?uniqueid=…` over HTTPS. One `` per app with ``, `` (decimal) and
+`` (0/1) [M]. Box art: `GET /appasset?appid=…` returns an image [M] (not used: Arena Domi TV
+shows Arena's own covers).
+
+### 1.4 launch, resume, cancel
+
+`GET /launch?…` over HTTPS. Parameters [M]:
+
+| Parameter | Value |
+| :-- | :-- |
+| `appid` | app `ID` from applist |
+| `mode` | `xx`, e.g. `1920x1080x60` |
+| `rikey` | 16-byte AES key, hex. Used for control, audio and video encryption [W6][M] |
+| `rikeyid` | integer key id, decimal. Feeds the audio IV (section 6.3) [M] |
+| `hdrMode` | 0/1 |
+| `surroundAudioInfo` | `(channel_mask << 16) | channel_count`; stereo default 196610 = `0x30002` [M] |
+| others | UNKNOWN U4 (e.g. local audio playback, SOPS, gamepad mask, any version field) |
+
+Response [M]: `1` and `rtsp://:`
+(UNKNOWN U4: what to assume when `sessionUrl0` is missing; we use port 48010 of the same host).
+
+`GET /resume?rikey=…&rikeyid=…` reattaches to the running app with fresh keys [M]. `GET /cancel` quits the running
+app [M]. `GET /unpair` forgets this client [M].
+
+**Key rule (ours):** a fresh random `rikey` and `rikeyid` for every launch and resume. Counters behind the GCM
+nonces restart with each session (section 7), so a reused key would reuse nonces.
+
+### 1.5 Pairing
+
+The host shows nothing to the user in Arena Domi: arena-host submits the PIN to Sunshine locally. On the wire the PIN
+handshake is unchanged.
+
+Inputs: `PIN` (4 ASCII digits [M]), the client's RSA certificate and key, randomness. Notation: `‖` concatenation,
+`E_K` / `D_K` AES-128-ECB with key `K` and no padding (inputs are whole blocks) [M], `sig(cert)` the raw
+`signatureValue` bytes of an X.509 certificate [M], `Sign`/`Verify` RSASSA-PKCS1-v1_5 with SHA-256 [M][RFC 8017].
+
+| Step | Client sends | Host answers | Client then |
+| :-- | :-- | :-- | :-- |
+| 1 (HTTP) | `/pair?uniqueid&devicename&updateState=1&phrase=getservercert&salt=hex(salt)&clientcert=hex(client cert PEM)`; `salt` 16 random bytes | blocks until the PIN is entered on the host [M], then `paired=1`, `plaincert=hex(host cert PEM)` | derives `K = SHA-256(salt ‖ PIN)[0..16]` [W2][M]; stores the host cert |
+| 2 (HTTP) | `clientchallenge=hex(E_K(C))`; `C` 16 random bytes | `challengeresponse=hex(E_K(H_s ‖ S_c))`, 48 bytes: `H_s = SHA-256(C ‖ sig(host cert) ‖ secret_s)`, `S_c` the 16-byte host challenge [W2][M] | decrypts, keeps `H_s` and `S_c`; cannot check `H_s` yet |
+| 3 (HTTP) | `serverchallengeresp=hex(E_K(H_c))`, `H_c = SHA-256(S_c ‖ sig(client cert) ‖ secret_c)`, `secret_c` 16 random bytes | `pairingsecret=hex(secret_s ‖ Sign_host(secret_s))` [W2][M] | checks `Verify_host(secret_s, signature)` **and** `SHA-256(C ‖ sig(host cert) ‖ secret_s) == H_s`. Failure = wrong PIN or man in the middle: stop. |
+| 4 (HTTP) | `clientpairingsecret=hex(secret_c ‖ Sign_client(secret_c))` | host checks `H_c` and the signature, answers `paired=1` (or `paired=0`) [W2][M] | |
+| 5 (HTTPS) | `phrase=pairchallenge`, with the client certificate | `paired=1` [W2] | pairing done; store host cert + host `uniqueid` |
+
+All step responses are `1…` with the named element inside [M].
+`paired` is `0` when the host refuses.
+
+- UNKNOWN U1: whether Sunshine requires `devicename` / `updateState`, and the order of steps 4 and 5 (Wolf's diagram:
+ secret then HTTPS `pairchallenge`; Moonshine's comment lists `pairchallenge` first). We follow Wolf. Settle: lab
+ capture of a pairing against Sunshine.
+- UNKNOWN U2: what Sunshine checks in the client certificate (key size, validity, subject). Our certificate: RSA-2048,
+ SHA-256, self-signed, long validity, `CN` from the device name. Settle: lab pairing.
+- UNKNOWN U28: what a client should do after a failed step (call `/unpair`? just stop?). Settle: lab capture.
+
+---
+
+## 2. RTSP
+
+Source: [Wolf: RTSP](https://games-on-whales.github.io/wolf/stable/protocols/rtsp.html) [W3], Moonshine `src/rtsp.rs` [M], [RFC 2326].
+
+### 2.1 Messages
+
+Plain text over TCP [W3]. A request is a start line ` RTSP/1.0`, header lines `Name: value`, an
+empty line, then an optional payload; lines end in CRLF [W3]. A response starts `RTSP/1.0 ` [W3].
+`CSeq` is always present and counts requests [W3]. Wolf's example carries `X-GS-ClientVersion: 14` [W3]
+(UNKNOWN U5: which value Sunshine expects).
+
+- UNKNOWN U5: framing. Wolf calls the payload "anything after the headers". Our framer uses `Content-Length` when
+ present and otherwise ends the message when the host closes the connection. Settle: lab capture (does Sunshine
+ close the TCP connection after each reply, and does it send `Content-Length`?).
+- Target: `rtsp://:` from `sessionUrl0` [W3][M].
+
+### 2.2 Sequence [W3]
+
+| # | Request | Answer that matters |
+| :-- | :-- | :-- |
+| 1 | `OPTIONS` | 200 |
+| 2 | `DESCRIBE` | SDP payload with the host's capabilities (2.3) |
+| 3 | `SETUP` audio | `Transport: server_port=