sisyo 1.6.7 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +6 -1
  2. package/bin/known-hashes.json +109 -0
  3. package/bin/sisyo.js +285 -285
  4. package/package.json +30 -30
  5. package/templates/.claude/rules/agents-and-tests.md +24 -0
  6. package/templates/.claude/skills/g6-style/SKILL.md +125 -0
  7. package/templates/.claude/skills/g6-style/references/checks.md +58 -0
  8. package/templates/.claude/skills/g6-style/references/imagery.md +103 -0
  9. package/templates/.claude/skills/g6-style/references/motion.md +121 -0
  10. package/templates/.claude/skills/g6-style/references/sections.md +263 -0
  11. package/templates/.claude/skills/g6-style/references/tokens.md +197 -0
  12. package/templates/.claude/skills/hindsight/SKILL.md +13 -10
  13. package/templates/.claude/skills/i18n-multilang/SKILL.md +153 -0
  14. package/templates/.claude/skills/i18n-multilang/assets/languages.json +47 -0
  15. package/templates/.claude/skills/i18n-multilang/assets/plural-vectors.json +46 -0
  16. package/templates/.claude/skills/i18n-multilang/assets/project/README.md +17 -0
  17. package/templates/.claude/skills/i18n-multilang/assets/project/gitattributes.txt +6 -0
  18. package/templates/.claude/skills/i18n-multilang/assets/project/gitignore.txt +4 -0
  19. package/templates/.claude/skills/i18n-multilang/assets/project/glossary.json +6 -0
  20. package/templates/.claude/skills/i18n-multilang/assets/project/i18n.config.json +22 -0
  21. package/templates/.claude/skills/i18n-multilang/assets/project/locales/__source__/common.json +10 -0
  22. package/templates/.claude/skills/i18n-multilang/assets/project/notes/common.json +5 -0
  23. package/templates/.claude/skills/i18n-multilang/assets/project/style.md +20 -0
  24. package/templates/.claude/skills/i18n-multilang/references/format.md +100 -0
  25. package/templates/.claude/skills/i18n-multilang/references/languages.md +97 -0
  26. package/templates/.claude/skills/i18n-multilang/references/layout-and-versioning.md +256 -0
  27. package/templates/.claude/skills/i18n-multilang/references/numbers.md +161 -0
  28. package/templates/.claude/skills/i18n-multilang/references/platform-unity.md +142 -0
  29. package/templates/.claude/skills/i18n-multilang/references/platform-web.md +107 -0
  30. package/templates/.claude/skills/i18n-multilang/references/translation.md +143 -0
  31. package/templates/.claude/skills/i18n-multilang/references/voice.md +271 -0
  32. package/templates/.claude/skills/i18n-multilang/scripts/i18n.py +1041 -0
  33. package/templates/.claude/skills/i18n-multilang/scripts/numwords.py +1013 -0
  34. package/templates/.claude/skills/i18n-multilang/scripts/voice.py +478 -0
  35. package/templates/.claude/skills/neon-game-ui-ux-skill/COMPONENTS.md +490 -0
  36. package/templates/.claude/skills/neon-game-ui-ux-skill/GAMIFICATION.md +246 -0
  37. package/templates/.claude/skills/neon-game-ui-ux-skill/ICONS.md +249 -0
  38. package/templates/.claude/skills/neon-game-ui-ux-skill/LAYOUT-NAV.md +362 -0
  39. package/templates/.claude/skills/neon-game-ui-ux-skill/MOTION-A11Y.md +168 -0
  40. package/templates/.claude/skills/neon-game-ui-ux-skill/SKILL.md +137 -0
  41. package/templates/.claude/skills/neon-game-ui-ux-skill/TOKENS.md +323 -0
  42. package/templates/SISYO.md +1 -1
@@ -0,0 +1,362 @@
1
+ # Layout and navigation
2
+
3
+ The app shell: a HUD top bar, a side rail on desktop, a bottom bar with a raised centre dial on phones and tablets,
4
+ plus the rules for responsive behaviour, safe areas, sheets, dialogs and loading skeletons. Every number is the one
5
+ LenS ships; the components named here are described in `COMPONENTS.md`.
6
+
7
+ ## 1. Shell anatomy
8
+
9
+ ```
10
+ < lg (phones, tablets) >= lg (desktop)
11
+ ┌──────────────────────────────┐ ┌────┬──────────────────────────────┐
12
+ │ logo [hex][🔥12][◔] │ 56 px │ ◎ │ Page title [hex ▰▰▱][🔥][◔]│ 56 px
13
+ │▁▁▁▁▁ 2 px XP line ▁▁▁▁▁▁▁▁▁▁▁│ ├────┼──────────────────────────────┤
14
+ │ │ │ ⌂ │ │
15
+ │ page │ │ ▤ │ page │
16
+ │ │ │ ▶ │ │
17
+ │ ╭───╮ │ │ ⚑ │ │
18
+ │ ⌂ ▤ ( 60% ) ⌕ ⚙ │ 64 px │ ⚙ │ │
19
+ └──────────────────────────────┘ + inset └────┴──────────────────────────────┘
20
+ 72 px (lg) / 240 px with labels (xl)
21
+ ```
22
+
23
+ Element order in the shell root (`relative min-h-dvh`): backdrop, skip link, side rail, content column (top bar +
24
+ `<main>`), bottom bar.
25
+
26
+ | Piece | Definition | z |
27
+ |---|---|---|
28
+ | Backdrop | `.neon-backdrop` (fixed, behind everything), rendered once, `aria-hidden` | -10 |
29
+ | Skip link | "Skip to content", the first focusable element: visually hidden until focused, then fixed at top-left as a small `surface-2` pill; targets `#main` | 50 |
30
+ | Top bar | `sticky top-0`, 56 px high, bottom border `line` at 70 %, `surface-base` at 70 % + `backdrop-blur-xl` | 30 |
31
+ | Side rail | `fixed inset-y-0 left`, hidden below `lg`, 72 px wide (240 px from `xl`), right border `line` at 70 %, `surface-base` at 85 % | 30 |
32
+ | Content column | `flex min-h-dvh flex-col`, left padding 72 px from `lg` and 240 px from `xl`, plus the side safe-area insets | |
33
+ | `<main>` | `flex-1`, `padding-bottom: var(--shell-bottom)`, `id="main" tabIndex={-1}`, no focus outline | |
34
+ | Bottom bar | `fixed inset-x-0 bottom-0`, 64 px + the bottom safe-area inset as padding, top border `line` at 70 %, `surface-base` at 80 % + `backdrop-blur-xl`, hidden from `lg` | 30 |
35
+ | Sheets, the dial's radial menu | portal to `<body>` | 40 |
36
+ | Reward burst overlay / reward toast / level-up modal / toasts | portal to `<body>` | 100 / 105 / 110 / 120 |
37
+
38
+ This table is the only place the z-order is defined; the other guides refer to it.
39
+
40
+ `--shell-top` (`3.5rem + 1px`: bar + border) and `--shell-bottom` (`4rem + env(safe-area-inset-bottom)`, `0px` from
41
+ 1024 px) are defined on `:root`. Anything sticky inside a page offsets by them (`top: var(--shell-top)`), and
42
+ `scroll-padding-top / -bottom` on `html` uses them so a focused control never hides under a bar. A page that pins its
43
+ own bar above the bottom bar sets `--page-bar` to that bar's height, which is added to the bottom scroll padding.
44
+
45
+ `backdrop-filter` is used on the top bar, bottom bar, sheets, toasts and modal scrims **only**. Blur on cards or on
46
+ the backdrop makes scrolling janky on mid-range phones; the background lights are static gradients for that reason.
47
+
48
+ Safe areas (needs `viewport-fit=cover`): the content column is padded by `env(safe-area-inset-left / -right)`; the top
49
+ bar cancels that with equal negative margins and re-adds it as its own padding, so its **background** runs under a
50
+ landscape notch while its **content** stays clear. The rail sits at `left: env(safe-area-inset-left)`.
51
+
52
+ ## 2. Top bar: the HUD
53
+
54
+ Inner row: 56 px high, 12 px gaps, horizontal padding 16 px (24 from `sm`, 32 from `lg`).
55
+
56
+ Left: the logo link below `lg` (min height 44 px); from `lg` the page title instead (display font 18 px semibold,
57
+ truncated), because the rail carries the logo there.
58
+
59
+ Right: a group with a 4 px gap (8 px from `sm`) holding the HUD button and, from `md`, the theme toggle and the
60
+ account menu. The HUD is **one button** that opens a details panel; its parts sit in a row with an 8 px gap (12 px
61
+ from `sm`), in this order:
62
+
63
+ 1. `LevelBadge` `md` (34 x 38 hexagon)
64
+ 2. `XpBar` (176 px, `LV 7` / `120 / 500 XP`): from `md` only. Its wrapper is marked `data-xp-target`.
65
+ 3. `StreakPill`
66
+ 4. `ProgressRing` 34 px for the daily goal, with the percentage inside (9 px bold display font, lime-ink) until
67
+ 100 %; then the ring's own check pops in. **Floor** the percentage, here and in the dial (§4), so 99.6 % never
68
+ reads "100%" next to a ring that is not closed. (LenS rounds in this ring and floors in the dial; use one rule.)
69
+
70
+ Then, from `md`: a ghost `RoundButton` `sm` theme toggle (shows the sun on dark, the moon on light; its label says
71
+ which theme it switches to) and the account menu. On phones those two live on the Settings page, not in the bar: at
72
+ 320 px the bar holds logo + hexagon + streak + ring and nothing else.
73
+
74
+ Phones: the XP bar becomes a **2 px line on the bottom edge of the top bar** (`absolute inset-x-0 -bottom-px`, the
75
+ compact `XpBar`, hidden from `md`), also marked `data-xp-target`, so the reward burst always has a visible landing
76
+ point. How the burst chooses between the two targets: COMPONENTS.md, Reward system.
77
+
78
+ HUD button details:
79
+
80
+ - Slightly padded (6 px sideways, 4 px vertical, with matching negative margins so it does not shift the row),
81
+ `rounded-2xl`, hover tint `ink-title` at 4 %.
82
+ - Its accessible name is the whole state in words: "Level 7, 120 of 500 XP. 12-day streak, done today. Daily goal
83
+ 40 of 60 XP. Show details". The parts inside are presentational for assistive tech (roles inside a button are
84
+ flattened), so without this label a screen-reader user hears only "button".
85
+ - `aria-expanded` + `aria-controls`; the panel is a non-modal `role="region"` popover labelled "Your progress":
86
+ anchored to the button's right edge, 8 px below, width `min(20rem, 100vw - 1.5rem)`, `rounded-3xl`, `border-line`,
87
+ `bg-surface-2`, `shadow-edge`, padding 16 px. It enters in 160 ms (opacity 0 → 1, y -6 → 0, scale .98 → 1, origin
88
+ top right). An outside pointer-down or Escape closes it; Escape returns focus to the button.
89
+ - The panel repeats the three facts as rows separated by hairlines (`line`); each row has 16 px of vertical padding
90
+ (none above the first or below the last) and a 14 px gap between its graphic and its text:
91
+ - a `lg` level badge + a full-width XP bar + "380 XP to level 8";
92
+ - a flame tile (44 px, `rounded-2xl`, ember at 10 %, an inset 1 px ember ring at 30 %, a 24 px flame: ember, with
93
+ `glow` when today is done, mono when there is no streak) + "12-day streak · best 21" + one sentence for the state;
94
+ - a 44 px goal ring with stroke 4 + "40 / 60 XP today" + "20 XP to reach your daily goal." or "Daily goal reached.
95
+ Nice work!".
96
+ - While the HUD read is pending, show a skeleton with the same boxes (34 x 38 hexagon, 176 x 24 bar from `md`,
97
+ 64 x 36 pill, 34 px circle), so the bar does not reflow when data arrives. If the read failed, render nothing: the
98
+ bar still works without the game.
99
+
100
+ Account menu (pattern): a 44 px avatar button (the user's initial inside a thin spectral ring: a conic gradient with
101
+ 1.5 px padding around a `surface-1` disc), `aria-haspopup="menu"`. The popover is 256 px wide, `rounded-2xl`, with the
102
+ name and e-mail, a hairline, then a `role="menu"` of 44 px rows (Settings; Log out in coral). Focus moves to the first
103
+ item on open; arrow keys, Home and End move; Tab closes; Escape closes and returns focus.
104
+
105
+ ## 3. Side rail (desktop)
106
+
107
+ - Header: a 56 px row with the logo link (mark only at `lg`, mark + wordmark at `xl`), a hairline under it. List:
108
+ 12 px side padding, 16 px top, 6 px between items. Footer: the app version in mono 9 px, `ink-muted`.
109
+ - `lg`: 72 px, icons only, with a tooltip to the right of the item on hover **and keyboard focus** (a small
110
+ `surface-2` label, `shadow-edge`, `line-strong` ring, fades in 150 ms); every link has an `aria-label`.
111
+ - `xl`: 240 px with labels (14 px medium), items left-aligned with 12 px padding; no tooltip.
112
+ - Item: 48 px high, `rounded-2xl`, 22 px icon, in the destination's tone scope. Active = `bg-surface-2` +
113
+ `inset 0 0 0 1.5px rgb(tone/.7), 0 0 18px rgb(tone/.22)` + `ink-title` text + icon `glow`; at `xl` the face becomes
114
+ a 7 % tone tint. Inactive = `ink-soft`, hover tint `ink-title` at 5 %.
115
+ - The rail lists **every** destination, including the activity modes that the phone dial fans out. Desktop has the
116
+ room; nothing is hidden behind a menu there.
117
+ - Icons keep their tone when inactive in the rail (it is a colour map of the app); in the bottom bar inactive icons
118
+ are mono, because five coloured icons in 320 px read as noise.
119
+ - A navigation item is one record `{ to, label, short, icon, tone }`; the rail, the bottom bar, the dial menu and the
120
+ page title all read the same list. An item is active when the path equals `to` or starts with `to + '/'`.
121
+
122
+ ## 4. Bottom bar with the centre dial (phones, tablets)
123
+
124
+ Five slots: **two destinations · the dial · two destinations** (LenS: Home, Words, **Practice**, Dictionary,
125
+ Settings). The dial replaces a row of activity tabs and a "More" sheet: the product's core activities sit behind one
126
+ big, central control, so the bar keeps four stable places and every page stays one or two taps away. Theme and
127
+ log-out, which a "More" sheet would hold, live on the Settings page.
128
+
129
+ The bar's list is `grid grid-cols-5`, 64 px high, `max-width: 32rem`, centred. `<nav aria-label="Main">`.
130
+
131
+ ### Flat tabs
132
+
133
+ - Slot: a column, centred, 4 px gap: a 56 x 32 px `rounded-full` pill holding a 22 px icon, then an 11 px display-font
134
+ label (semibold, `leading-none`, tracking .04em).
135
+ - Active: pill `bg-tone/.14` + `inset 0 0 0 1px rgb(tone/.45), 0 0 14px rgb(tone/.22)`, icon in its tone with `glow`,
136
+ label in tone-ink. Inactive: mono icon and label in `ink-muted`, no pill.
137
+ - The whole slot is the link (64 px tall, a fifth of the width: 64 px wide at 320 px).
138
+ - Labels are one word. If a label does not fit at 320 px, give the destination a shorter word (the `short` field),
139
+ never a smaller font.
140
+
141
+ ### Centre dial: the pattern
142
+
143
+ The centre slot holds one round, raised button that does two jobs: it **shows today's progress** (the daily-goal
144
+ ring) and it **opens the activity modes** as a radial menu above itself. LenS labels it "Practice" and fans out Quiz,
145
+ Read, Speak and Dictation.
146
+
147
+ Rules:
148
+
149
+ - The dial is navigation, not an action: it never starts an activity directly, it opens the choice.
150
+ - The ring shows a real number from the server (today's XP / daily goal, capped at 1). No decorative spinning ring.
151
+ While the number is unknown the ring is empty and an icon shows; the button never changes size.
152
+ - When the current route is one of the dial's modes, the dial is the **active** tab (tone ink + glow), because the
153
+ four flat tabs are all inactive at that moment.
154
+ - The dial is not the XP landing target; the XP bar is. Two competing targets make the burst ambiguous.
155
+ - Only the disc rises above the bar; the bar's height and `--shell-bottom` do not change. Content that a page pins
156
+ directly above the bar (a sticky action bar, a feedback sheet) keeps its controls out of the centre fifth, or sits
157
+ at least 1 rem above `--shell-bottom`.
158
+ - Hide the whole bar while a full-screen mode has the screen (LenS: a voice call). The bar is not rendered, an
159
+ attribute on `<html>` shrinks `--shell-bottom` to the safe-area inset alone, and an open menu is closed. A stray
160
+ tap on a tab must not end a call or a timed exercise.
161
+ - Desktop (`lg+`) has no dial: the side rail lists the modes directly. The menu closes itself when the viewport
162
+ reaches `lg`, so it can never leave the page inert behind a hidden bar.
163
+
164
+ **Tone scopes.** Every slot of the bar carries the `.tone-*` scope of its destination (on the list item), and the
165
+ dial's slot carries the **primary tone** (`tone-lime`); "the dial's tone" below means that. The radial menu is
166
+ portalled to `<body>`, **outside** the bar, so it inherits no scope: set it again inside the portal, `tone-<mode
167
+ tone>` on each item's positioned wrapper and `tone-lime` on the close button. Without it `rgb(var(--tone)/...)` has
168
+ no value there, and the rings and glows of the menu items and of the close disc are simply not painted.
169
+
170
+ ### Sizes
171
+
172
+ ```
173
+ (B) (C) 56 px discs, 11 px label under each, item box 64 px wide,
174
+ (A) (D) on an arc above the dial; the lowest disc centres are 62 px above the dial's centre
175
+ ╭───╮
176
+ ─────────────│ ✕ │────────────── bar top edge; the 60 px disc stands 17 px above it
177
+ ⌂ ▤ ╰───╯ ⌕ ⚙ bar: 64 px + safe-area inset, five equal slots
178
+ Home Words Practice Dict Settings
179
+ ```
180
+
181
+ | Part | Value |
182
+ |---|---|
183
+ | Disc | 60 px, `bg-surface-2`, `ring-4 ring-surface-base` (an opaque 4 px collar in the bar's colour, so page content does not show through next to the raised part). 60, not 64: the disc and its label together must still read as one tab. Transition: `box-shadow` and `transform`, 200 ms, glide easing |
184
+ | Ring | `ProgressRing` at 60 px, stroke 5, wrapped in `aria-hidden` |
185
+ | Disc position | The button fills the slot (`h-full w-full`); its content is a column **pinned to the slot's bottom** (`absolute inset-x-0 bottom-0`, 8 px bottom padding, 2 px gap between disc and label), so the disc overflows upwards instead of pushing the label out. The disc's centre is therefore `8 + 11 + 2 + 30 = 51 px` above the bar's bottom edge |
186
+ | Label | The tab label style: display font 11 px semibold, `leading-none`, tracking .04em |
187
+ | Menu item | 56 px disc with a 26 px icon in the mode's tone, a 4 px gap, the 11 px label (`ink-title`, `nowrap`); box 64 px wide and about 71 px tall, above the 44 px minimum |
188
+ | Scrim | `fixed inset-0`, `surface-void` at 80 % + `backdrop-blur-sm`, over the page and both bars, hidden from `lg` |
189
+
190
+ The **51 px constant ties the dial and its menu together**: the menu anchors a zero-size element at
191
+ `left: 50%; bottom: calc(env(safe-area-inset-bottom) + 51px)`, exactly on the dial's centre, and places everything
192
+ from it. Change the disc size, the label or the padding and this constant changes with them.
193
+
194
+ ### States of the disc
195
+
196
+ | State | Centre | Look |
197
+ |---|---|---|
198
+ | Progress unknown (loading, or the read failed) | a 22 px mono target icon | empty ring, `ink-title`, drop shadow `0 4px 14px rgb(0 0 0/.35)` |
199
+ | In progress | `60%` in the display font, 15 px bold, `leading-none`, `tabular-nums`, **floored** (99.6 % must not read as 100 %) | the same |
200
+ | Goal reached | a 24 px check in the dial's tone (lime), with `glow` when active | the same; full ring |
201
+ | Active (a mode's route is current) | as above | text and label in tone-ink, glow `0 0 20px rgb(tone/.45)` instead of the drop shadow |
202
+ | Open | a 22 px mono cross | active look; this is the menu's own copy of the disc, inside the portal under its own `tone-lime` scope |
203
+ | Pressed | | the disc scales to .95 |
204
+
205
+ Menu item states, in the mode's tone (the scope on the item's wrapper): default = `bg-surface-2` +
206
+ `inset 0 0 0 1.5px rgb(tone-ink/.7), 0 0 14px rgb(tone/.22)`; the current mode =
207
+ `inset 0 0 0 2px rgb(tone-ink), 0 0 22px rgb(tone/.5)` and icon `glow`; pressed = scale .95 (150 ms).
208
+
209
+ ### The geometry rule
210
+
211
+ Offsets are measured from the dial's centre to each item's disc centre, x to the right, y down; every y is negative.
212
+ Keep this as a pure function with unit tests: it is the part that breaks silently.
213
+
214
+ 1. **Even spread on an arc, mirrored around the vertical axis.** For `count` items over `span` degrees:
215
+ `angle_i = (i / (count - 1) - 0.5) * span`, `x_i = radiusX * sin(angle_i)`, `y_i = -radius * cos(angle_i)`.
216
+ A single item sits straight above the dial (`angle = 0`).
217
+ 2. **Span by item count:** 3 → 100°, 4 → 120°, 5 → 136°, 6 → 150° (2 → 64°, though two items should not be a radial
218
+ menu). Each span is wide enough that neighbouring discs and labels do not touch on a 320 px screen.
219
+ 3. **Radius:** `radius = max(112, 62 / cos(span / 2))`. The second term keeps the **outer** items exactly 62 px above
220
+ the dial's centre whatever the span, so their labels (ending 43 px under the disc centre) clear the bar's top
221
+ edge by 6 px. Results: 112, 124, 165.5 and 239.5 px for 3, 4, 5 and 6 items.
222
+ 4. **Squeeze, do not shrink.** When the circle is wider than the screen, only the horizontal radius is reduced:
223
+ `radiusX = min(radius, (viewportWidth / 2 - margin - itemWidth / 2) / sin(span / 2))` with `margin = 8` and
224
+ `itemWidth = 64`. The arc becomes an ellipse: heights stay, the outer items move in, and nothing is cut off by the
225
+ screen edge. Item sizes and labels never change.
226
+ 5. Read the viewport width from `document.documentElement.clientWidth` and recompute on `resize`.
227
+
228
+ | Items | 320 px wide | 360 px | 390 px and wider |
229
+ |---|---|---|---|
230
+ | 3 | (±86, -72) (0, -112) | the same | the same |
231
+ | 4 | (±107, -62) (±42, -117) | the same | the same |
232
+ | 5 | (±120, -62) (±72, -137) (0, -166) | (±140, -62) (±84, -137) (0, -166) | (±153, -62) (±93, -137) (0, -166) |
233
+ | 6 | (±120, -62) (±88, -169) (±32, -231) | (±140, -62) (±102, -169) (±38, -231) | (±155, -62) (±113, -169) (±42, -231) at 390; a full circle only from about 545 px: (±231, -62) (±169, -169) (±62, -231) |
234
+
235
+ Each item is positioned absolutely from the anchor: `left = x - 32`, `top = y - 28`, `width = 64`.
236
+
237
+ What the tests assert, for 3 to 6 items at 320, 360, 390 and 768 px: mirror symmetry and left-to-right order; every
238
+ item inside the viewport with the 8 px margin; every item at least 60 px above the dial's centre and at least 8 px
239
+ clear of the dial (centre distance >= 30 + 28 + 8); discs at least 4 px apart; no label box touching a neighbouring
240
+ disc or label. Re-run them after changing any constant. Labels are assumed to fit in 64 px: one short word
241
+ ("Dictation" is about the limit at 11 px).
242
+
243
+ ### Motion
244
+
245
+ - Scrim: opacity 0 → 1 in 180 ms.
246
+ - Items: each starts **on the dial's centre** (translated by `(-x, -y)`), scale .4, opacity 0, and springs to its
247
+ place (stiffness 420, damping 26) with a 35 ms stagger left to right. Exit: back into the dial in 140 ms, no
248
+ stagger. Only `transform` and `opacity` animate.
249
+ - The dial does not move or morph: the menu draws its own disc exactly over it, so the swap is invisible.
250
+ - Reduced motion: the root motion setting drops the travel and the scale; the items fade in place.
251
+
252
+ ### Accessibility
253
+
254
+ - Dial: `<button aria-haspopup="menu" aria-expanded>`; accessible name "Practice", "Practice, 60% of today's goal" or
255
+ "Practice, today's goal reached". The ring inside is `aria-hidden` (a `progressbar` nested in a button is ignored
256
+ by assistive tech), so the name carries the value.
257
+ - Menu: `role="menu"` with a label ("Practice modes") and `aria-orientation="horizontal"`; each mode is a router link
258
+ with `role="menuitem"`, its positioned wrapper `role="none"`. The current mode gets `aria-current` from the router
259
+ and the stronger ring.
260
+ - It is **modal** (§6): focus starts on the first mode, Tab stays inside (modes, then the close button), Escape
261
+ closes, the app root is inert and scroll-locked, and focus returns to the dial on close.
262
+ - Arrow Right / Down and Left / Up move between modes and wrap; Home and End jump to the first and last.
263
+ - Because the app root (and with it the real dial) is inert while the menu is open, the close control must live
264
+ **inside the portal**: a second button ("Close practice modes") placed exactly over the dial
265
+ (`left: -30px; top: -30px` from the anchor) with the same face showing a cross. The thumb that opened the menu
266
+ closes it without moving.
267
+ - Closes on: choosing a mode, the close button, a scrim tap, Escape, the viewport reaching `lg`, and the bar being
268
+ hidden.
269
+ - The menu is mounted only while open, inside an exit-animation boundary: the modal-focus behaviour runs on mount.
270
+
271
+ ### When not to use a radial menu
272
+
273
+ - **Fewer than 3 or more than 6 items.** One or two do not make an arc (use a plain raised link, or two flat tabs);
274
+ seven or more cannot keep 56 px discs apart at 320 px (use a bottom sheet with a list).
275
+ - **Long or translated labels.** Each label has 64 px. If the names do not fit in one short word in every language
276
+ the product ships, use a sheet.
277
+ - **Items that are not peers.** The arc says "equal choices of one kind". Do not mix modes with settings, account
278
+ actions or destructive commands; those belong in Settings or a sheet.
279
+ - **A list that changes** (per user, per day, feature flags that reorder). A radial menu is learned by position;
280
+ moving items breaks that.
281
+ - **Desktop or pointer-first layouts.** The arc exists for a thumb at the bottom edge of a phone. With a rail or a
282
+ top navigation, list the destinations.
283
+ - **A product with one core activity.** A menu with one real choice is a detour: make the centre button a plain
284
+ raised link to it.
285
+ - **Nested menus.** Never open a second level from an arc item.
286
+
287
+ ## 5. Responsive rules
288
+
289
+ | Breakpoint | Shell | Notes |
290
+ |---|---|---|
291
+ | 320-639 | Bottom bar + compact HUD (hexagon, streak, ring; XP as a 2 px line) | Design here first. Paths zigzag; cards stack; page padding 16 px |
292
+ | `sm` 640 | The same shell | Horizontal path; two-column stat rows; padding 24 px |
293
+ | `md` 768 | Bottom bar; the full XP bar, theme toggle and account menu appear in the top bar | Toasts move from top-centre to bottom-left |
294
+ | `lg` 1024 | 72 px icon rail, no bottom bar | `--shell-bottom: 0px`; padding 32 px |
295
+ | `xl` 1280 | 240 px rail with labels | Home gets a side column (quests, week strip) |
296
+
297
+ - No hover-only actions: everything reachable by hover is also reachable by tap and by keyboard focus.
298
+ - Phones get **sheets** where desktop gets popovers.
299
+ - Use `min-h-dvh` / `100dvh`, not `100vh`: mobile browser bars change the viewport height.
300
+ - Long lists: `content-visibility: auto` on rows.
301
+ - Page container: centred, max width 1320 px, the paddings above, 24 px top (32 from `lg`); 68ch for reading text.
302
+
303
+ ## 6. Sheets and dialogs
304
+
305
+ All of them: portal to `<body>`, `role="dialog" aria-modal="true"`, a label (`aria-labelledby` or `aria-label`),
306
+ `tabIndex={-1}` on the panel (so a click on its plain content keeps focus inside), and the modal-focus behaviour
307
+ below. The dial's radial menu (§4) is the one modal layer that is a `role="menu"` instead of a dialog; it uses the
308
+ same behaviour.
309
+
310
+ Modal focus, as one hook `(dialogRef, onClose, initialFocus?)` that acts while the dialog is mounted:
311
+
312
+ | Behaviour | Why |
313
+ |---|---|
314
+ | On mount, remember the focused element, then move focus into the dialog: the `initialFocus` selector, else the first focusable, else the panel | Keyboard and screen-reader users land where the action is |
315
+ | Tab / Shift+Tab wrap inside; a Tab pressed while focus is outside or on the panel itself goes to the first / last focusable | Focus cannot wander into the page behind |
316
+ | Escape closes; the key listener is on `document`, not on the dialog | Keys still work after focus lands on `<body>` (a click on plain text) |
317
+ | Sets `inert` on the app root (`#root`) and `overflow: hidden` on `body` (remembering the previous value) | The page behind is unreachable for pointer, keyboard and assistive tech; no scroll bleed |
318
+ | Keeps a module-level stack of open dialogs; only the top one handles keys; the lock is applied by the first and released when the last closes | A dialog opened from a sheet works |
319
+ | On unmount, returns focus to the remembered element | The user continues where they were |
320
+
321
+ "Focusable" = links with `href`, enabled buttons, inputs, selects, textareas, and anything with a `tabindex` other
322
+ than -1. Keep `onClose` in a ref so a new callback identity does not re-run the effect.
323
+
324
+ Consequences to respect:
325
+
326
+ - **Dialogs must be portalled outside the app root**, or they become inert with it.
327
+ - Providers that render overlays (rewards, toasts) also portal to `<body>` for the same reason.
328
+ - The behaviour runs on mount: mount the dialog component only while it is open, inside the exit-animation boundary;
329
+ do not keep it mounted and hidden.
330
+ - If the trigger disappears while the dialog is open (a Claim button), move focus somewhere sensible on close.
331
+
332
+ Bottom sheet (phones): scrim `surface-void` at 70 % + `backdrop-blur-sm` (fades 200 ms); the panel is pinned to the
333
+ bottom, `max-height: 85dvh`, scrolls inside, `rounded-t-4xl`, top border `line`, `bg-surface-1`, `shadow-edge`, and
334
+ slides from `y: 100%` in 280 ms `ease-glide`; padding includes the safe area
335
+ (`padding-bottom: calc(1.25rem + env(safe-area-inset-bottom))`); a 40 x 4 px `line-strong` grab handle (decorative)
336
+ and a real close button (ghost `RoundButton` with an `aria-label`).
337
+
338
+ Centre modal (confirmation, level-up): scrim `surface-void` at 80 % + `backdrop-blur-md`; the scrim container scrolls
339
+ vertically and holds an inner `grid min-h-full place-items-center` with 24 px padding, so on a short screen the dialog
340
+ scrolls and its primary button stays reachable. Clicking the scrim closes; clicks inside the panel stop propagation.
341
+
342
+ Destructive confirmation: the title states the action and object ("Delete 3 items?"), the body states the
343
+ consequence, the buttons are a `ghost` Cancel + a `danger` verb. Initial focus on Cancel.
344
+
345
+ Non-modal popovers (HUD panel, account menu): no inert, no scrim; closed by an outside pointer-down or Escape. A menu
346
+ uses `role="menu"` / `menuitem`, arrow keys, and closes on Tab.
347
+
348
+ ## 7. Page skeletons and route loading
349
+
350
+ - Each page is its own lazily loaded chunk. The suspense boundary sits **inside** the shell, around the page outlet:
351
+ the bars stay on screen and only the page area shows a skeleton.
352
+ - The route skeleton (a heading bar, a line, two 160 px cards in the page container) appears only after **150 ms**, so
353
+ a cached or fast chunk never flashes it. It is a `role="status"` with an `sr-only` "Loading".
354
+ - A skeleton has the same boxes as the loaded page section (same card, same heights). Layout shift on load is
355
+ treated as a bug.
356
+ - Data inside a loaded page: per-card skeletons, never a full-page spinner. Buttons that wait show their own spinner,
357
+ keep their size and keep focus.
358
+ - Errors: an inline `role="alert"` line in coral-ink next to the control that failed, with a retry; an `EmptyState`
359
+ when there is nothing yet. A failed HUD read hides the HUD, it does not block the page. A page whose chunk failed to
360
+ load shows an `EmptyState` with a Reload button in the page area, inside the shell, and navigating to another route
361
+ clears it.
362
+ - On navigation: scroll to top, set `document.title` to the page name, keep the HUD mounted (it must not flash).
@@ -0,0 +1,168 @@
1
+ # Motion and accessibility
2
+
3
+ The style is loud by design (neon, glow, celebration). These rules are what keep it usable: every animation has a
4
+ job and a budget, and every state is readable without colour, without motion and without a pointer. Token names
5
+ are those of `TOKENS.md`.
6
+
7
+ ## 1. Easing and duration
8
+
9
+ | Use | Easing | Duration |
10
+ |---|---|---|
11
+ | Press | `ease-glide` `cubic-bezier(.22,1,.36,1)` | 120 ms |
12
+ | Hover, focus, colour change | `ease-glide` | 180-200 ms |
13
+ | Enter (popover, toast, sheet, menu item) | `ease-glide` | 160-280 ms |
14
+ | Fill, slide, count-up (XP bar, ring, numbers) | `ease-glide` / cubic ease-out | 600-700 ms |
15
+ | Celebration (pop-in, badge open, chip flight) | `ease-pop` `cubic-bezier(.34,1.56,.64,1)` for pops, `ease-glide` for flight | 450-700 ms |
16
+ | Ambient loop | `ease-in-out` / linear | 2.4-6 s per cycle (rays: 20 s) |
17
+
18
+ - `ease-pop` overshoots. It is reserved for **rewards** (a check appearing, a badge earned, a chest ready). On
19
+ ordinary UI (menus, cards, navigation) overshoot reads as toy-like and tiring.
20
+ - Exits are faster than entrances (about 160 ms) and never bounce.
21
+ - With `motion/react`, pass the glide curve as `ease: [0.22, 1, 0.36, 1]`. Springs are used in two places only: the
22
+ shared-layout pill of the segmented control (`bounce: 0.18, duration: 0.35`) and the dial menu's items flying out of the dial
23
+ (`stiffness: 420, damping: 26`, 35 ms stagger), the one piece of navigation that is allowed a small overshoot.
24
+
25
+ ## 2. What animates, and how
26
+
27
+ Animate **only** `transform`, `opacity` and `background-position` (plus `stroke-dashoffset` on the ring and the
28
+ registered `--neon-angle`). These stay off the layout path.
29
+
30
+ | Want | Do | Do not |
31
+ |---|---|---|
32
+ | A bar filling | `translateX((ratio - 1) * 100%)` on a full-width fill inside an `overflow-hidden` track | animate `width` |
33
+ | A glow appearing on hover | put the shadow on `::after`, animate its `opacity` | animate `box-shadow` on the card |
34
+ | A pulsing halo | a blurred sibling element with `animate-glow-pulse` | pulse the control's own shadow or scale |
35
+ | A key press | `translate-y-[3px]` + swap the depth shadow | animate `height` / `margin` |
36
+ | A split bar changing | `flex-grow` transition (one cheap layout, 300 ms) | re-render with a new width each frame |
37
+
38
+ Never use a global `* { transition: all }`: it animates layout properties, makes theme switching smear, and fights
39
+ `motion/react`. Transitions are listed per property (`transition-[transform,box-shadow,background-color]`).
40
+
41
+ ## 3. What never animates
42
+
43
+ - Body text, headings, table rows, form fields (no entrance animation for content the user came to read).
44
+ - Page transitions: a route change is instant; only the skeleton → content swap happens.
45
+ - Layout: nothing moves other content when it animates.
46
+ - Anything during typing or a timed task, except direct feedback to that input.
47
+ - Focus rings: they appear instantly.
48
+
49
+ ## 4. Loop budget
50
+
51
+ Infinite animations are the main risk of this style.
52
+
53
+ - **At most two ambient loops visible at once** (for example: the CTA gradient drift and the current step's sweep
54
+ ring). A third loop makes the screen feel restless and costs battery.
55
+ - Prefer finite variants: `animate-float-3` (three cycles, then rest), `animate-shimmer-once` (one sweep per value
56
+ change). A loop is justified only while something **waits for the user** (a claimable reward, the current step,
57
+ a live recording) or is loading.
58
+ - One loop per component: the current path node has the sweep ring and a static halo, not both pulsing.
59
+ - Loops stop when their reason ends (claimed → no shimmer). Do not leave a "new" pulse on something the user has
60
+ already seen.
61
+
62
+ ## 5. Reduced motion
63
+
64
+ Three layers, all needed:
65
+
66
+ 1. **CSS**, at the end of the base stylesheet, outside any layer:
67
+
68
+ ```css
69
+ @media (prefers-reduced-motion: reduce) {
70
+ *, *::before, *::after {
71
+ animation-duration: 1ms !important;
72
+ animation-iteration-count: 1 !important;
73
+ transition-duration: 1ms !important;
74
+ scroll-behavior: auto !important;
75
+ }
76
+ }
77
+ ```
78
+
79
+ Durations are 1 ms rather than `none`, so end states still apply (a `forwards` animation lands on its last frame)
80
+ and `animationend` / `transitionend` still fire.
81
+ 2. **`<MotionConfig reducedMotion="user">`** at the root: `motion/react` drops transform and layout animations and
82
+ keeps opacity.
83
+ 3. **Component branches** where the motion carries meaning: the XP chip does not fly, it fades in above the source
84
+ (`useReducedMotion()`); count-ups set the final number at once; the level-up badge appears without rotating;
85
+ ambient pulses carry Tailwind's `motion-safe:` variant (`motion-safe:animate-glow-pulse`).
86
+
87
+ Under reduced motion the user still gets **every state change**: colours, icons, text, toasts and the level-up
88
+ dialog remain. Only travel, bounce and loops go.
89
+
90
+ Offer an in-app "Calm mode" switch as well if the audience includes people who cannot change OS settings (shared or
91
+ managed devices); it sets the same behaviour from a class on `<html>`.
92
+
93
+ ## 6. Colour contrast
94
+
95
+ Targets: WCAG 2.2 AA. Text 4.5:1 (large text >= 24 px or bold >= 18.66 px: 3:1); meaningful graphics, control
96
+ boundaries and focus indicators 3:1.
97
+
98
+ | Rule | Reason / number |
99
+ |---|---|
100
+ | Text on a neon fill is `text-on-neon` (`#05060A`) | 6.2-16.8:1. White on neon is 1.2-3.3:1 |
101
+ | `ink-muted` is the lightest colour for text that must be read | 5.3:1 on a card, 4.5:1 on `shade`. `ink-faint` (2.5:1) is for disabled and decoration |
102
+ | Coloured text uses `neon-ink-*` | Equals the neon on dark; 5.2-6.0:1 on white in the light theme, where raw neon is about 1.2:1 |
103
+ | Coloured text is not placed on `surface-3` in the light theme | The ink stops were measured on white (5.2-6.0:1); on the light `shade` they drop below 4.5:1 |
104
+ | Neon text on a 12 % tint of itself (chips) | iris 4.9, flare 5.6, coral 5.4: passes; do not raise the tint |
105
+ | Ring and arc colours on light come from the `-ink` stops | A lime arc on a pale track disappears |
106
+ | Disabled = `opacity-40 saturate-0` | Deliberately below contrast targets, and never the only cue: the control is also non-interactive and announced as disabled |
107
+ | No glow on body text | `text-shadow` blurs glyph edges; glow is for shapes |
108
+
109
+ Check both themes. The light theme is where neon designs fail: every review of a new page includes a light-theme
110
+ pass on the gallery and on the page.
111
+
112
+ ## 7. Colour is never the only signal
113
+
114
+ | State | Colour | Plus |
115
+ |---|---|---|
116
+ | Correct / wrong | lime / coral | check / cross icon, text |
117
+ | New / known / mastered | flare / aqua / gold | "NEW" tag / underline style / dot, and an `sr-only` suffix |
118
+ | Streak done / at risk / lapsed | ember / amber / grey | glow / short float / dimmed flame, and the label text |
119
+ | Quest active / complete / claimed | tone / gold / dimmed | reward chip / Claim button / "Claimed" + check |
120
+ | Locked | grey | lock badge, `aria-disabled`, hint |
121
+ | Active nav item | tone | a filled, ringed pill behind the icon (inactive tabs have none), `aria-current` (from the router's NavLink) |
122
+ | Error | coral | warning icon, `role="alert"` text |
123
+
124
+ ## 8. Targets and focus
125
+
126
+ - **44x44 px minimum** for every interactive element (WCAG 2.5.8 asks 24; 44 is the touch-comfortable size this
127
+ system uses). When the visual is smaller (36 px disc, 32 px chip, 36 px segmented option), extend the hit area
128
+ with a pseudo-element: `relative after:absolute after:-inset-1 after:content-['']`. Neighbouring extended areas
129
+ must not overlap.
130
+ - **Focus ring**: global `:focus-visible { outline: 2px solid rgb(var(--c-aqua-ink)); outline-offset: 2px }`.
131
+ Aqua is the focus colour everywhere (13.5:1 on dark; the ink stop on light); lime means selection, so the two are
132
+ never confused.
133
+ - Composite controls draw the ring on their visible part (`group-focus-visible:outline` on the round button's
134
+ disc, on the switch's track) and suppress it on the wrapper.
135
+ - Controls inside a clipped container use `focus-visible:outline-offset-0` (segmented options) or a negative
136
+ offset (menu items) so the ring is not cut off.
137
+ - Never `outline: none` without a replacement, and never rely on glow as the focus indicator.
138
+ - **Focus is never hidden under the bars**: `scroll-padding-top/bottom` on `html` from `--shell-top` /
139
+ `--shell-bottom` (WCAG 2.4.11).
140
+ - **Focus management**: dialogs trap and restore focus (LAYOUT-NAV.md §6); when a control removes itself
141
+ (Claim → Claimed, Delete), move focus to a stable neighbour or the section heading (`tabIndex={-1}`); a button that
142
+ turns disabled while focused stays focusable with `aria-disabled` (`focusableWhenDisabled`, COMPONENTS.md).
143
+ - **Keyboard**: radio groups and menus use arrow keys with roving `tabIndex`; Escape closes the top-most layer only;
144
+ a "Skip to content" link is first in the tab order.
145
+
146
+ ## 9. Screen readers
147
+
148
+ - Icons are `aria-hidden` unless they are the only content; then the **control** has `aria-label`.
149
+ - Composite HUD pieces are `role="img"` with a full sentence label ("12-day streak, done today"); their visible
150
+ digits are `aria-hidden` to avoid double reading.
151
+ - Progress: `role="progressbar"` with `aria-valuenow` and, where the raw number is not meaningful,
152
+ `aria-valuetext` ("Level 7: 120 of 500 XP").
153
+ - Animated numbers: an `sr-only` copy holds the final value; the animated one is `aria-hidden`.
154
+ - Live regions are mounted before they receive text (toasts, XP announcements). Small XP gains are announced politely
155
+ without a visual toast; errors are assertive.
156
+ - Celebration overlays are `aria-hidden` and `pointer-events-none`; the level-up is a real dialog with a heading.
157
+ - Loading: `aria-busy` on the region or button; skeletons are `aria-hidden`.
158
+
159
+ ## 10. Review checklist for a new screen
160
+
161
+ - [ ] 320 px wide: no horizontal scroll, labels fit, targets >= 44 px.
162
+ - [ ] Light theme: every coloured text and line readable; no raw neon text.
163
+ - [ ] Keyboard only: reach and operate everything; focus always visible; Escape closes layers in order.
164
+ - [ ] Reduced motion on: nothing travels or loops; every state still shown.
165
+ - [ ] Count the loops on screen at rest: two or fewer.
166
+ - [ ] Count the glows at rest: each one marks something active, current, or waiting.
167
+ - [ ] Each tone on the screen means what it means elsewhere.
168
+ - [ ] Loading and error states exist and keep the layout's boxes.