clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

main
miau-is-true / openspec / changes / add-proof-title-fitting / design.md
design.md 3.3K rendered
1## Context23The design review recorded in `docs/design-inbox.md` and the current4"Proof titles never truncate" section of `docs/design.md` require authored5words to remain visible. The title is currently rendered inside a fixed HUD6region, so a long title can collide with the step counter or clip at the7mobile edge.89## Decisions1011### Use measured owning regions1213Each scene computes the title region from its actual geometry. In the Proof14HUD, the region begins after the `[NN]` number tile and ends before the step15counter, with a 16px inset on both sides. INDEX and Win derive equivalent16regions from their own settled layout. Text measurement uses the existing17font/Pretext-compatible measurement path and never changes cell size or grid18coordinates.1920### Shrink, then wrap, never ellipsize2122Start at 22px for the Proof HUD and reduce one pixel at a time to a 16px23floor while testing the full title on one line. If the title still exceeds24the measured width, wrap only at word boundaries into at most two lines. The25renderer must retain the authored words and must not add `…`, silently drop a26word, or split a word to force a fit.2728On a narrow viewport, a two-line overflow is an exceptional layout path. The29title receives the full band from the title's left inset to the right inset and30is fitted at 16px into up to three lines. The compact step counter moves into31the subline row: `PROOF NN OF NN` is left aligned and `STEPS 02` is right32aligned on that same row. The 40px HUD-to-board clearance remains mandatory.33The loader rejects titles over 64 characters with `Titles can be at most 6434characters so they fit on phones`, so authored titles cannot exceed this35mobile layout contract. The W11 note for titles over 32 characters remains a36nonblocking authoring recommendation.3738### Preserve the HUD-to-board contract3940When the Proof title takes two or three lines, the `PROOF NN OF NN` subline and41board origin move down as one measured group. In the exceptional narrow layout,42the compact `STEPS 02` counter shares the subline row. The board retains at43least 40px of clear space below the HUD. The board cell size and authored44coordinates remain unchanged; only the available vertical presentation region45is recomputed.4647### Keep motion and reduced motion deterministic4849Title fitting is settled geometry. Existing title type/drop, INDEX banner50type, Win stamp, slow-motion clock, and reduced-motion behavior continue to51consume the fitted lines. Reduced motion shows both final lines immediately.52No fitting decision may delay input or alter pointer hit rectangles.5354## Risks and mitigations5556- A narrow title region can create an unexpected two- or three-line title. Test57 the exact desktop and 390x844 mobile widths and return measured line58 geometry.59- A board shift can collide with the footer or ledger. Add layout assertions60 for the 40px gap and bottom safe region.61- Different scenes may drift into different wrapping behavior. Share a pure62 fit helper and test its output directly before wiring each renderer.6364## Non-goals6566- Changing title copy, sentence case, level IDs, or authoring data.67- Changing the >32-character W11 guidance semantics; the 64-character loader68 ceiling is part of this presentation contract.69- Changing Pretext's grid placement or simulation coordinates.70- Changing navigation, pointer hit testing, or scene transition timing.