---
name: nx-playground
description: Live interactive UI prototyping & functional wireframe studio for Nexus ReGen (playground.nexusregen.dev). Pre-loaded with authentic nx-ui design tokens (Penn Blue #121541, Aureolin Yellow #F7EC33, Untitled UI cool grays, Graphite dark mode, compact density), <nx-logo>, component kit, multi-screen sessions, version history, and bidirectional human review pins.
---

# Nexus UI Playground (`https://playground.nexusregen.dev`)

**Nexus Playground** is a live collaborative prototyping studio for building semi-real, functional Nexus ReGen app mockups and interactive wireframes alongside a human reviewer.

Every screen pushed to a Playground session automatically runs with **authentic `nx-ui` styling** (the same Untitled UI + shadcn `base-vega` token system used by `nx-hub`, `nx-crm`, and `nx-register`):
- **Light Mode:** Penn Blue `#121541` primary, white lifted page cards (`16px` radius), cool gray `#F9FAFB` 248px sidebar, skeuomorphic primary buttons, Inter + JetBrains Mono.
- **Dark Mode (Graphite):** `#141415` background, `#1C1C1E` cards, `#27272A` borders, primary flips cleanly to **Aureolin Yellow `#F7EC33`** with Penn Blue text.
- **Compact Density:** Orthogonal `data-density="compact"` toggle for dense operational screens.

---

## 1. Quick Start for Agents (3 Steps)

### Step A — Mint a Session (or pick any unguessable slug)
```bash
curl -sS -X POST "https://playground.nexusregen.dev/api/sessions"
```
Share `viewerUrl` (`https://playground.nexusregen.dev/s/<session>`) with the user once.

### Step B — Push One or More Functional Screens (Up to 512 KB each)
Push clean HTML fragments (or full HTML) using the pre-loaded `nx-*` component kit (`nx-kit.css` + `nx-kit.js` + `<nx-logo>` are auto-injected — write zero boilerplate CSS!):

```bash
curl -sS -X POST "https://playground.nexusregen.dev/api/s/<session>/screens" \
  -H "Content-Type: application/json" \
  -d '{
    "screenKey": "requirements",
    "title": "Requirements Queue",
    "route": "/requirements",
    "by": "agent",
    "note": "v1 · table + ADR-0003 approval drawer",
    "html": "<div class=\"nx-shell\">...</div>"
  }'
```

Or pipe raw HTML directly with query params:
```bash
curl -sS -X POST "https://playground.nexusregen.dev/api/s/<session>/screens?screenKey=requirements&title=Requirements+Queue&route=/requirements&by=agent&note=v2+denser+table" \
  -H "Content-Type: text/plain" \
  --data-binary @screen.html
```

- Pushing the **same `screenKey`** creates a new version (`v1` → `v2` → `v3`) so the user can compare iterations side-by-side in history.
- Pushing a **different `screenKey`** adds a new Screen Tab in the top bar (e.g. `requirements`, `detail`, `mobile-intake`) so you can prototype a full multi-screen flow!

### Step C — Read & Resolve the User's Live Review Pins!
While reviewing your mockup at `/s/<session>`, the user can drop numbered comment pins directly on the UI (`Comment Mode`). Fetch them programmatically:

```bash
# Read all open pins on the session
curl -sS "https://playground.nexusregen.dev/api/s/<session>/pins"

# Mark a pin resolved after pushing your updated version
curl -sS -X POST "https://playground.nexusregen.dev/api/s/<session>/pins/<pinId>/resolve" \
  -H "Content-Type: application/json" \
  -d '{"resolved":true}'
```

---

## 2. Pre-Loaded `nx-ui` Component & Class Reference

Zero external CSS needed — everything below is live inside every screen automatically:

### Brand Mark Web Component
- `<nx-logo variant="emblem" height="24"></nx-logo>` — keyline down-left arrow (Navy on light, Aureolin Yellow on dark)
- `<nx-logo variant="lockup" height="26"></nx-logo>` — arrow + `NR` monogram lockup
- `<nx-logo variant="solid" height="24"></nx-logo>` — solid arrow silhouette

### App Shell & Layout
- `.nx-shell` — 248px `.nx-sidebar` + `.nx-main-gutter` > `.nx-page-card` (signature Nexus product frame)
- `.nx-sidebar-brand`, `.nx-nav-group`, `.nx-nav-label`, `.nx-nav-item` (`.active`)
- `.nx-page-header`, `.nx-page-title`, `.nx-page-sub`, `.nx-breadcrumbs`, `.nx-page-body`
- Utilities: `.nx-stack`, `.nx-row`, `.nx-between`, `.nx-grid`, `.nx-cols-2`, `.nx-cols-3`, `.nx-cols-4`, `.nx-split`, `.nx-muted`, `.nx-mono`, `.nx-tabular`

### Controls & Surfaces
- **Buttons:** `.nx-btn`, `.nx-btn-primary` (skeuomorphic Navy→Yellow), `.nx-btn-ghost`, `.nx-btn-destructive`, `.nx-btn-sm`, `.nx-btn-lg`
- **Cards:** `.nx-card`, `.nx-card-header`, `.nx-card-title`, `.nx-card-desc`, `.nx-metric-card` (`.nx-metric-label`, `.nx-metric-val`, `.nx-metric-foot`)
- **Badges:** `.nx-badge`, `.nx-badge-brand`, `.nx-badge-success`, `.nx-badge-warning`, `.nx-badge-error`, `.nx-badge-info`, with optional `<span class="nx-dot"></span>`
- **Inputs:** `.nx-field`, `.nx-label`, `.nx-hint`, `.nx-input`, `.nx-select`, `.nx-textarea`
- **Data Table:** `.nx-table-wrap` > `<table class="nx-table">` (`tr.clickable`, `tr.selected`)
- **Alerts & Progress:** `.nx-alert` (`.nx-alert-info|success|warning|error`), `.nx-progress` > `.nx-progress-fill`, `.nx-timeline` > `.nx-timeline-item` + `.nx-timeline-dot`, `.nx-avatar`, `.nx-kbd`
- **Drawers & Modals:** `<div class="nx-backdrop" id="myDrawer"><div class="nx-drawer">...</div></div>` (add `.center` + `.nx-modal` for centered dialogs)

### Nexus ReGen Domain Blocks
- `.nx-ewc` — European Waste Catalogue code pill (`17 05 04`, non-calt monospace)
- `.nx-ref` — Literal Nexus reference ID (`REQ-2026-0418`, `OPP-0092`, `C-104`)
- `.nx-gate-bar` — Highlighted Staff Supervision / ADR-0003 Approval Gate banner

### Built-In Zero-JS Declarative Interactivity (`nx-kit.js`)
- **Tabs:** Wrap in `data-nx-tabs`; buttons have `data-nx-tab="key"`, panels have `data-nx-panel="key"`.
- **Open/Close Drawers & Modals:** `data-nx-open="elementId"` and `data-nx-close`.
- **Live Table/List Filtering:** `<input class="nx-input" data-nx-filter="#reqTable tbody tr" placeholder="Filter...">`.
- **Toasts:** Call `nxToast("Approved & sent to customer", "success")` (`success` | `warning` | `error` | `info`).

---

## 3. Prototyping Best Practices
1. Make wireframes **semi-real and functional**: wire real clicks, filters, drawers, tabs, live calculations, and `nxToast()` feedback so the user can *feel* the workflow, not just stare at lorem ipsum.
2. Use realistic Nexus ReGen domain data (UK postcodes, EWC codes like `17 05 04` / `17 01 07`, tonnage `t`, haulage `km`, `£/t`, `tCO₂e`, Requirement Supervisor / Terra / Wren states).
3. Always use semantic tokens (`var(--background)`, `var(--foreground)`, `var(--primary)`, `var(--border)`) instead of hardcoded light/dark colors so the host toolbar's **Light ↔ Dark** and **Compact** toggles work seamlessly!
4. Keep `/kit.json` handy (`GET https://playground.nexusregen.dev/kit.json`) if you want a machine-readable JSON manifest of all classes and endpoints.
