# One page, many skins (v1.0.0)

Every JBNX site with more than one look (Easy, Classic, Game, light, dark) keeps **one page**.
A skin is a set of token values. It never copies a page.

```
<html data-ux="easy|classic|game" data-theme="light|dark">
        │                         │
        │                         └─ color scheme: per device, follows the system unless picked
        └─ UX skin: saved on the ACCOUNT, so XP, scores and data never split
```

## The four rules

1. **Tokens only.** Components read `var(--token)`. Skins set token values in
   `[data-ux="…"]` and `[data-theme="dark"]` blocks. No hex colors inside components.
2. **One switch.** `jb-theme.js` sets the two attributes before first paint, caches the
   choice in `localStorage["jb.theme"]` and PUTs `{"ux": "…"}` to the account when
   `data-save` is set. The server renders `data-ux` from the account on every page.
3. **Shared components.** One button set (`/design/ux/buttons`), one card, one nav.
   A variant exists only where CSS cannot do it, and then as `[data-ux="easy"] .x {…}`
   or `.jb-only-easy`, never as a second HTML file or a second route.
4. **CI guard.** `theme-check.mjs` runs on every PR: every token resolves in every skin,
   no skin leaves a hole, text passes AA 4.5:1 in every skin. Check each screen renders
   in every UX at **390×844** and desktop.

## Drop-in

```html
<link rel="stylesheet" href="buttons.css">
<link rel="stylesheet" href="themes.css">
<script src="jb-theme.js" data-uxes="easy classic game" data-default="classic" data-save="/api/me/ux"></script>
<button class="jb-btn jb-btn--second" data-jb-ux="easy">Easy</button>
<button class="jb-btn jb-btn--second" data-jb-scheme="dark">Dark</button>
```

JS: `JBTheme.get()` → `{ux, theme, scheme}`; `JBTheme.set({ux:"game"})`;
listen for `jb-theme-change` on `document`.

## CI

```sh
node theme-check.mjs --config themes.json   # {"files":["static/style.css"], "baseHidden": false}
```

`baseHidden: true` when `<html>` always carries a theme attribute (no bare base view).

## Retiring a duplicated page

Save a PDF of the old landing page to Drive "Claude Files", merge it into the one page,
301 the old URL to `?ux=<skin>` so links keep working, then delete the copy.
