feat(frontend): unlocks/inventory UI, sigil designer, listening-tool EVP threshold

Workstream F of the character-depth/ghost-log spec.

- InventoryPanel.tsx: essence balance, owned unlocks/items (terminal
  listing + Codex-style rarity-glow borders on items), and a buy flow
  for a small fixed unlock catalog (currently just "listening_tool",
  the only key the contract names) with afford/can't-afford button
  states. Prices are fetched from a best-guess /api/inventory/catalog
  endpoint and fall back to a flagged "(est.)" price sourced from the
  spec's own worked example when that endpoint isn't available yet —
  the contract doesn't define a price-list REST shape.

- SigilDesigner.tsx + lib/sigil.ts: constrained geometric builder —
  points snap to 24 fixed clock-face slots around a circle, capped at
  12 to match the backend's payload limit, connected in placement
  order. Five hand-drawn stroke-only rune glyphs (eye/crescent/key/
  spiral/thorn) overlay the center. Point-cap enforcement, rune
  selection and payload-shape building are pure functions in
  lib/sigil.ts, unit-tested directly. Saves via POST
  /api/inventory/sigils (path inferred; payload shape matches the
  contract exactly: {"points": [[x,y],...], "rune": str}). Art
  direction: the builder itself reads like a plotting/debug tool
  (crosshair cursor, monospace coordinate HUD) while the rendered
  lines + rune glow violet, consistent with GhostGlyph's conventions.

- lib/evp.ts: new evpThresholdDb(hasListeningTool) pure function and
  EvpListener.start() now accepts { hasListeningTool } to lower the
  EVP anomaly threshold (8dB -> 4dB) when the unlock is owned — wired
  from useAuth().user.unlocks in SeancePage's EvpPanel, a real
  gameplay effect on which faint signals register as anomalies.

- api.ts User type gains unlocks/essence per the contract's /auth/me
  extension; new InventoryPage.tsx mounts both components behind auth
  at /inventory, linked from the séance nav.

166/166 tests pass (137 pre-existing + 29 new), i18n coverage check
clean, tsc -b clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Indiana
2026-07-23 16:26:18 +00:00
parent 6d8c6f2496
commit ebe6a4b0b8
18 changed files with 1792 additions and 4 deletions

View File

@@ -0,0 +1,231 @@
/* InventoryPanel — terminal item listing meets occult rarity-glow cards.
Reuses the app-wide palette (App.css): bg #07070d, panel rgba(16,16,26,.85),
phosphor #7cffb2, violet #b26bff, blood #ff3b5c, border rgba(124,255,178,.18).
Rarity glow borders mirror CodexPage.css's `.codex-rarity[data-rarity]`. */
.inv-panel {
display: flex;
flex-direction: column;
gap: 1.6rem;
font-family: var(--qm-font-ui);
color: var(--qm-text);
}
/* ---- essence readout: big terminal stat, front and center ---- */
.inv-essence {
display: flex;
align-items: baseline;
gap: 0.6rem;
padding: 0.9rem 1.2rem;
background: var(--qm-panel);
border: 1px solid var(--qm-border);
border-radius: 8px;
box-shadow: 0 0 22px rgba(124, 255, 178, 0.08);
}
.inv-essence-label {
font-size: 0.68rem;
letter-spacing: 0.32em;
text-transform: uppercase;
color: var(--qm-dim);
}
.inv-essence-value {
font-size: 1.8rem;
font-weight: 700;
color: var(--qm-green);
text-shadow: 0 0 14px rgba(124, 255, 178, 0.55);
}
/* ---- sections ---- */
.inv-section-title {
font-family: var(--qm-font-display);
font-size: 1rem;
letter-spacing: 0.1em;
color: #eef7f0;
margin: 0 0 0.8rem;
}
.inv-state {
color: var(--qm-dim);
font-size: 0.85rem;
}
.inv-state-error {
color: var(--qm-blood);
}
/* ---- terminal-style item/unlock listing ---- */
.inv-term-list {
list-style: none;
margin: 0 0 1rem;
padding: 0;
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.inv-term-row {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.4rem 0.6rem;
background: rgba(16, 16, 26, 0.6);
border: 1px solid var(--qm-border);
border-radius: 4px;
font-size: 0.82rem;
}
.inv-term-empty {
color: var(--qm-dim);
font-size: 0.82rem;
}
.inv-key {
font-family: var(--qm-font-ui);
color: #eef7f0;
letter-spacing: 0.02em;
}
.inv-tag {
font-size: 0.65rem;
letter-spacing: 0.15em;
padding: 0.12rem 0.4rem;
border-radius: 3px;
border: 1px solid;
}
.inv-tag-owned {
color: var(--qm-green);
border-color: rgba(124, 255, 178, 0.5);
text-shadow: 0 0 8px rgba(124, 255, 178, 0.5);
}
.inv-tag-locked {
color: var(--qm-dim);
border-color: rgba(138, 143, 152, 0.45);
}
/* ---- catalog offer cards ---- */
.inv-offer-grid {
list-style: none;
margin: 0;
padding: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 0.9rem;
}
.inv-offer-card {
display: flex;
flex-direction: column;
gap: 0.4rem;
padding: 0.9rem 1rem;
background: var(--qm-panel);
border: 1px solid var(--qm-border);
border-radius: 8px;
transition: border-color 200ms ease, box-shadow 200ms ease;
}
.inv-offer-card.is-affordable {
border-color: rgba(178, 107, 255, 0.4);
box-shadow: 0 0 18px rgba(178, 107, 255, 0.14);
}
.inv-offer-card.is-locked {
opacity: 0.72;
}
.inv-price {
font-size: 0.78rem;
color: var(--qm-dim);
}
.inv-price-est {
opacity: 0.7;
font-style: italic;
}
.inv-buy-btn {
margin-top: 0.2rem;
padding: 0.45rem 0.8rem;
font-family: var(--qm-font-ui);
font-size: 0.75rem;
letter-spacing: 0.12em;
text-transform: uppercase;
color: #0a0a12;
background: var(--qm-violet);
border: none;
border-radius: 5px;
cursor: pointer;
transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}
.inv-buy-btn:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 0 16px rgba(178, 107, 255, 0.5);
}
.inv-buy-btn:disabled {
cursor: not-allowed;
opacity: 0.4;
background: #3a3a46;
color: rgba(216, 230, 220, 0.5);
box-shadow: none;
}
.inv-offer-error {
margin: 0;
font-size: 0.7rem;
color: var(--qm-blood);
}
/* ---- item grid: rarity-glow borders, same convention as CodexPage ---- */
.inv-item-grid {
list-style: none;
margin: 0;
padding: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 0.7rem;
}
.inv-item-card {
display: flex;
flex-direction: column;
gap: 0.3rem;
padding: 0.7rem 0.85rem;
background: rgba(16, 16, 26, 0.7);
border: 1px solid rgba(124, 255, 178, 0.18);
border-radius: 6px;
}
.inv-item-type {
font-size: 0.62rem;
letter-spacing: 0.22em;
text-transform: uppercase;
color: var(--qm-dim);
}
.inv-item-card[data-rarity='common'] {
border-color: rgba(138, 143, 152, 0.45);
}
.inv-item-card[data-rarity='uncommon'] {
border-color: rgba(124, 255, 178, 0.45);
}
.inv-item-card[data-rarity='rare'] {
border-color: rgba(178, 107, 255, 0.5);
box-shadow: 0 0 14px rgba(178, 107, 255, 0.2);
}
.inv-item-card[data-rarity='mythic'] {
border-color: rgba(255, 157, 74, 0.55);
box-shadow: 0 0 16px rgba(255, 157, 74, 0.3), inset 0 0 8px rgba(255, 157, 74, 0.12);
}