Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(deck): the board is a display case — depth, glass, a floor and pointer parallax

rubenluetke10-beep062f5f528a1b
diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckCard.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckCard.tsx
index 19c01c1912..f1ddb328b7 100644
--- a/jarvis/ui/web/frontend/src/components/deck/DeckCard.tsx
+++ b/jarvis/ui/web/frontend/src/components/deck/DeckCard.tsx
@@ -73,7 +73,7 @@ export function DeckCard({
return (
<section
ref={ref}
- className={cn("group/card relative flex min-h-0 flex-col", variant === "rail" ? "pl-2" : "", className)}
+ className={cn("group/card deck-card relative flex min-h-0 flex-col", variant === "rail" ? "pl-2" : "", className)}
>
<HudFrameOverlay variant={variant} w={size.w} h={size.h} live={live} />
diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckStage3D.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckStage3D.tsx
new file mode 100644
index 0000000000..dcd79f5fb2
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/deck/DeckStage3D.tsx
@@ -0,0 +1,116 @@
+import { useEffect, useRef, type RefObject } from "react";
+import { useReducedMotion } from "framer-motion";
+import { useDesktopWallpaper } from "@/hooks/useDesktopWallpaper";
+import {
+ PERSPECTIVE_ORIGIN,
+ driftCompensation,
+ parallaxShift,
+ pointerOffset,
+} from "@/lib/deckDepth";
+
+/**
+ * The display case's moving parts: the pointer parallax, the slots' drift
+ * compensation, and the floor.
+ *
+ * `useDeckParallax` does two things on the board element it is given:
+ *
+ * 1. It follows the pointer over the board and writes the shift of the
+ * nearest plane into two custom properties (`--deck-px`, `--deck-py`);
+ * every slot's transform rule in index.css multiplies them by its own
+ * parallax factor (`lib/deckDepth.ts`). One animation frame per move at
+ * most, no React state on the way — the pointer must never go through a
+ * render to reach a transform. Leaving the board eases the planes back
+ * to rest (the transition is CSS). With reduced motion the vars stay at
+ * zero: the depth is still there, the sway is not.
+ * 2. It measures where each `.deck-slot-3d` child sits relative to the
+ * board's vanishing point (its layout position, before any transform)
+ * and writes the pre-translation that keeps the plane's centre on its
+ * slot under the shared perspective (`driftCompensation`) — once, and
+ * again whenever the board or a slot changes size. Without it the near
+ * planes at the board's edges drift outward and are clipped.
+ *
+ * `DeckFloor` is the ground the case stands on: a plane laid flat under the
+ * board, receding from the viewer to the wallpaper, carrying a blurred,
+ * upside-down echo of the picture — the mascot and the planes stand on a
+ * floor that reflects the wall behind them, which is what turns a picture
+ * with things in front of it into a room. It takes the theme's ground colour
+ * (so it is dark glass under the wave and pale stone under the terrace) and
+ * the current wallpaper URL, nothing else.
+ */
+export function useDeckParallax<T extends HTMLElement>(
+ ref: RefObject<T | null>,
+ /**
+ * Whether the board element is mounted. The view owns the ref from its
+ * first render while the board only mounts after the start sequence, so
+ * the effects must re-run when it does — a ref alone never re-triggers.
+ */
+ active = true,
+): void {
+ const reduced = useReducedMotion() ?? false;
+ const frame = useRef<number | null>(null);
+
+ // 2. drift compensation — layout geometry, re-measured on resize
+ useEffect(() => {
+ const el = ref.current;
+ if (!el || !active) return;
+ const measure = () => {
+ const ox = el.clientWidth * PERSPECTIVE_ORIGIN.x;
+ const oy = el.clientHeight * PERSPECTIVE_ORIGIN.y;
+ el.querySelectorAll<HTMLElement>(".deck-slot-3d").forEach((slot) => {
+ const z = parseFloat(slot.style.getPropertyValue("--slot-z")) || 0;
+ const cx = slot.offsetLeft + slot.offsetWidth / 2 - ox;
+ const cy = slot.offsetTop + slot.offsetHeight / 2 - oy;
+ const { dx, dy } = driftCompensation(cx, cy, z);
+ slot.style.setProperty("--slot-dx", `${dx}px`);
+ slot.style.setProperty("--slot-dy", `${dy}px`);
+ });
+ };
+ measure();
+ if (typeof ResizeObserver === "undefined") return;
+ const ro = new ResizeObserver(measure);
+ ro.observe(el);
+ el.querySelectorAll<HTMLElement>(".deck-slot-3d").forEach((slot) => ro.observe(slot));
+ return () => ro.disconnect();
+ }, [ref, active]);
+
+ // 1. pointer parallax — transform only, one frame per move
+ useEffect(() => {
+ const el = ref.current;
+ if (!el || !active || reduced) return;
+ let pending: { x: number; y: number } | null = null;
+ const flush = () => {
+ frame.current = null;
+ if (!pending) return;
+ const shift = parallaxShift(pending);
+ el.style.setProperty("--deck-px", `${shift.x}px`);
+ el.style.setProperty("--deck-py", `${shift.y}px`);
+ };
+ const onMove = (e: PointerEvent) => {
+ pending = pointerOffset(e.clientX, e.clientY, el.getBoundingClientRect());
+ if (frame.current === null) frame.current = window.requestAnimationFrame(flush);
+ };
+ const onLeave = () => {
+ pending = { x: 0, y: 0 };
+ if (frame.current === null) frame.current = window.requestAnimationFrame(flush);
+ };
+ el.addEventListener("pointermove", onMove, { passive: true });
+ el.addEventListener("pointerleave", onLeave, { passive: true });
+ return () => {
+ el.removeEventListener("pointermove", onMove);
+ el.removeEventListener("pointerleave", onLeave);
+ if (frame.current !== null) window.cancelAnimationFrame(frame.current);
+ el.style.removeProperty("--deck-px");
+ el.style.removeProperty("--deck-py");
+ };
+ }, [ref, active, reduced]);
+}
+
+export function DeckFloor() {
+ const wallpaperUrl = useDesktopWallpaper();
+ return (
+ <div aria-hidden data-testid="deck-floor" className="deck-floor">
+ <div className="deck-floor-echo" style={{ backgroundImage: `url(${wallpaperUrl})` }} />
+ <div className="deck-floor-sheen" />
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.css
index 7acceb8eba..e331dfacaf 100644
--- a/jarvis/ui/web/frontend/src/index.css
+++ b/jarvis/ui/web/frontend/src/index.css
@@ -2607,6 +2607,116 @@
border-right-width: 1.5px;
}
+ /*
+ * The board as a display case (lib/deckDepth.ts). The board element sets
+ * the perspective; each slot's wrapper carries its depth as custom
+ * properties and ONE transform rule turns them into a plane in front of
+ * (or behind) the wallpaper, turned toward the centre, swayed by the
+ * pointer (`--deck-px/--deck-py`, written by useDeckParallax) and scaled
+ * back so neighbours never overlap. Cards inside the case are glass slabs
+ * — a ground of the theme's card colour, blurred, with a shadow that
+ * lands on the floor — because a hairline frame alone has no depth to
+ * show. Transform, opacity and filter only: nothing here reaches layout.
+ */
+ .deck-board-3d {
+ perspective: 1400px;
+ perspective-origin: 50% 42%;
+ --deck-px: 0px;
+ --deck-py: 0px;
+ }
+ .deck-slot-3d {
+ transform: translate3d(
+ calc(var(--slot-dx, 0px) + var(--deck-px) * var(--slot-par, 1)),
+ calc(var(--slot-dy, 0px) + var(--deck-py) * var(--slot-par, 1)),
+ var(--slot-z, 0px)
+ )
+ rotateY(var(--slot-ry, 0deg)) scale(var(--slot-scale, 1));
+ transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
+ will-change: transform;
+ }
+ .deck-board-3d .deck-card {
+ background: hsl(var(--card) / 0.5);
+ backdrop-filter: blur(14px) saturate(1.05);
+ -webkit-backdrop-filter: blur(14px) saturate(1.05);
+ border-radius: 6px;
+ box-shadow:
+ 0 18px 34px -18px rgb(0 0 0 / 0.55),
+ 0 2px 0 -1px hsl(var(--primary) / 0.08) inset;
+ }
+ :root:not(.dark) .deck-board-3d .deck-card {
+ background: hsl(var(--card) / 0.62);
+ box-shadow:
+ 0 18px 30px -18px rgb(40 28 12 / 0.35),
+ 0 1px 0 0 rgb(255 255 255 / 0.5) inset;
+ }
+ /* Cards behind the wall's plane read softer, like things further away. */
+ .deck-slot-far .deck-card {
+ background: hsl(var(--card) / 0.34);
+ }
+ /* The floor: a plane laid flat, receding from the viewer to the wall. */
+ .deck-floor {
+ position: absolute;
+ left: -12%;
+ right: -12%;
+ top: 46%;
+ height: 120%;
+ transform-origin: 50% 0;
+ transform: rotateX(76deg);
+ pointer-events: none;
+ z-index: -1;
+ overflow: hidden;
+ border-radius: 50% / 6%;
+ mask-image: linear-gradient(180deg, transparent, rgb(0 0 0 / 0.85) 14%, rgb(0 0 0 / 0.5) 50%, transparent 92%);
+ -webkit-mask-image: linear-gradient(180deg, transparent, rgb(0 0 0 / 0.85) 14%, rgb(0 0 0 / 0.5) 50%, transparent 92%);
+ }
+ .deck-floor-echo {
+ position: absolute;
+ inset: 0;
+ background-position: center 0;
+ background-size: 100% auto;
+ background-repeat: no-repeat;
+ transform: scaleY(-1);
+ filter: blur(10px) saturate(0.9);
+ opacity: 0.32;
+ }
+ .deck-floor-sheen {
+ position: absolute;
+ inset: 0;
+ background:
+ radial-gradient(ellipse at 50% 0%, hsl(var(--primary) / 0.18), transparent 55%),
+ linear-gradient(180deg, hsl(var(--background) / 0.35), hsl(var(--background) / 0.75));
+ }
+ :root:not(.dark) .deck-floor-echo {
+ opacity: 0.22;
+ }
+ :root:not(.dark) .deck-floor-sheen {
+ background:
+ radial-gradient(ellipse at 50% 0%, hsl(var(--primary) / 0.1), transparent 55%),
+ linear-gradient(180deg, hsl(var(--background) / 0.45), hsl(var(--background) / 0.85));
+ }
+ /* The mascot's ground shadow: it stands on the floor, not in the air. */
+ .deck-orb-ground {
+ position: absolute;
+ left: 14%;
+ right: 14%;
+ bottom: 2%;
+ height: 9%;
+ border-radius: 50%;
+ background: radial-gradient(ellipse at 50% 50%, rgb(0 0 0 / 0.5), transparent 70%);
+ filter: blur(6px);
+ z-index: -1;
+ pointer-events: none;
+ }
+ :root:not(.dark) .deck-orb-ground {
+ background: radial-gradient(ellipse at 50% 50%, rgb(40 28 12 / 0.32), transparent 70%);
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ .deck-slot-3d {
+ transition: none;
+ }
+ }
+
@media (prefers-reduced-motion: reduce) {
.deck-ring-tick[data-ignite="true"],
.deck-ring-bezel[data-ignite="true"],
diff --git a/jarvis/ui/web/frontend/src/lib/deckDepth.test.ts b/jarvis/ui/web/frontend/src/lib/deckDepth.test.ts
new file mode 100644
index 0000000000..e5a8aac357
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/deckDepth.test.ts
@@ -0,0 +1,75 @@
+import { describe, expect, it } from "vitest";
+import {
+ DECK_PERSPECTIVE_PX,
+ PARALLAX_MAX_PX,
+ SLOT_DEPTH,
+ compensatingScale,
+ driftCompensation,
+ parallaxShift,
+ pointerOffset,
+ slotDepthVars,
+} from "@/lib/deckDepth";
+
+describe("deckDepth", () => {
+ it("keeps the centre column on the wall so the orb's travel lands where it measured", () => {
+ expect(SLOT_DEPTH["centre-top"].z).toBe(0);
+ expect(SLOT_DEPTH["centre-top"].rotateY).toBe(0);
+ });
+
+ it("puts what is acted on in front and what is looked at behind", () => {
+ expect(SLOT_DEPTH["left-top"].z).toBeGreaterThan(0); // the log
+ expect(SLOT_DEPTH["right-bottom"].z).toBeGreaterThan(0); // terminals
+ expect(SLOT_DEPTH["right-top"].z).toBeLessThan(0); // the memory map
+ });
+
+ it("turns left slots toward the centre and right slots the other way", () => {
+ expect(SLOT_DEPTH["left-top"].rotateY).toBeGreaterThan(0);
+ expect(SLOT_DEPTH["right-bottom"].rotateY).toBeLessThan(0);
+ });
+
+ it("compensates the perspective so a near plane does not grow into its neighbour", () => {
+ const z = 90;
+ const projected = DECK_PERSPECTIVE_PX / (DECK_PERSPECTIVE_PX - z);
+ expect(compensatingScale(z) * projected).toBeCloseTo(1, 3);
+ expect(compensatingScale(0)).toBe(1);
+ expect(compensatingScale(-90, 0.985) * (DECK_PERSPECTIVE_PX / (DECK_PERSPECTIVE_PX + 90))).toBeCloseTo(0.985, 3);
+ });
+
+ it("emits one custom property per transform input, as CSS strings", () => {
+ const vars = slotDepthVars("left-bottom");
+ expect(vars["--slot-z"]).toBe("90px");
+ expect(vars["--slot-ry"]).toBe("4deg");
+ expect(vars["--slot-par"]).toBe("1.1");
+ expect(Number(vars["--slot-scale"])).toBeGreaterThan(0.9);
+ expect(Number(vars["--slot-scale"])).toBeLessThan(1);
+ });
+
+ it("maps the pointer to −1…1 with the centre at zero and clamps outside the box", () => {
+ const box = { left: 100, top: 50, width: 400, height: 200 };
+ expect(pointerOffset(300, 150, box)).toEqual({ x: 0, y: 0 });
+ expect(pointerOffset(100, 50, box)).toEqual({ x: -1, y: -1 });
+ expect(pointerOffset(900, 900, box)).toEqual({ x: 1, y: 1 });
+ expect(pointerOffset(10, 10, { left: 0, top: 0, width: 0, height: 0 })).toEqual({ x: 0, y: 0 });
+ });
+
+ it("pre-translates a near plane so its centre still projects onto its slot", () => {
+ // A plane 90 px in front, centred 650 px left of the vanishing point:
+ // projected centre = (cx + dx) · p/(p−z) must equal cx.
+ const z = 90;
+ const cx = -650;
+ const { dx, dy } = driftCompensation(cx, 0, z);
+ expect(((cx + dx) * DECK_PERSPECTIVE_PX) / (DECK_PERSPECTIVE_PX - z)).toBeCloseTo(cx, 0);
+ expect(dy).toBe(0);
+ // On the wall's plane nothing drifts; behind it the shift points inward.
+ expect(driftCompensation(cx, 200, 0)).toEqual({ dx: 0, dy: 0 });
+ expect(driftCompensation(cx, 0, -90).dx).toBeLessThan(0);
+ });
+
+ it("moves the planes against the pointer, and never more than the cap", () => {
+ const shift = parallaxShift({ x: 1, y: 1 });
+ expect(shift.x).toBe(-PARALLAX_MAX_PX);
+ expect(Math.abs(shift.y)).toBeLessThan(PARALLAX_MAX_PX);
+ expect(parallaxShift({ x: 0, y: 0 })).toEqual({ x: 0, y: 0 });
+ expect(parallaxShift({ x: -0.5, y: 0 }).x).toBeGreaterThan(0);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/lib/deckDepth.ts b/jarvis/ui/web/frontend/src/lib/deckDepth.ts
new file mode 100644
index 0000000000..99d1293040
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/deckDepth.ts
@@ -0,0 +1,141 @@
+import type { BoardSlot } from "@/lib/deckStandby";
+
+/**
+ * The board's depth — the "Schaukasten" (display case).
+ *
+ * The mission deck used to be a flat grid of instruments on top of the
+ * wallpaper (maintainer, 2026-08-22: it does not look good, it is not creative).
+ * The wallpaper stays exactly what it is — the back wall — and the board
+ * gains DEPTH in front of it instead: every slot stands on its own plane at
+ * a distance from the wall, turned a few degrees toward the centre, and the
+ * whole case sways a little with the pointer so the eye reads the distances.
+ * Nothing is scenery for its own sake: near is what the person acts on most
+ * (log, terminals, outputs), far is what is looked at (the memory map, the
+ * capture), and the centre with the mascot sits ON the wall's plane so the
+ * orb's shared-layout travel from the start sequence still lands where it
+ * measured.
+ *
+ * Pure numbers, no React: MissionDeckView turns them into CSS custom
+ * properties, index.css turns those into one `transform`. The parallax is
+ * a transform too, so it runs off the main thread.
+ */
+
+/** The perspective distance, in px — the camera's distance to the wall. */
+export const DECK_PERSPECTIVE_PX = 1400;
+
+/** How far the pointer moves the nearest plane, in px, edge to edge. */
+export const PARALLAX_MAX_PX = 9;
+
+export interface SlotDepth {
+ /** Distance in front of (+) or behind (−) the wallpaper plane, in px. */
+ z: number;
+ /** Turn toward the centre, in degrees (left slots +, right slots −). */
+ rotateY: number;
+ /** Parallax factor: 1 = the full pointer travel, 0 = pinned to the wall. */
+ parallax: number;
+ /** Apparent size the slot should keep, so neighbours never overlap. */
+ apparentScale: number;
+}
+
+/**
+ * Where each slot stands. Near planes carry what the person acts on, far
+ * planes what is looked at; the centre column is on the wall so the orb's
+ * measured travel keeps landing on its mark.
+ */
+export const SLOT_DEPTH: Record<BoardSlot, SlotDepth> = {
+ "left-top": { z: 70, rotateY: 4, parallax: 1.0, apparentScale: 1.01 },
+ "right-top": { z: -90, rotateY: -3, parallax: 0.35, apparentScale: 0.985 },
+ "centre-top": { z: 0, rotateY: 0, parallax: 0.55, apparentScale: 1 },
+ "left-bottom": { z: 90, rotateY: 4, parallax: 1.1, apparentScale: 1.01 },
+ "centre-bottom": { z: -30, rotateY: 0, parallax: 0.5, apparentScale: 0.99 },
+ "right-bottom": { z: 80, rotateY: -4, parallax: 1.0, apparentScale: 1.01 },
+};
+
+/**
+ * The `scale()` a plane at depth `z` needs so it APPEARS `apparentScale`
+ * times its flat size under the deck's perspective. Without it a plane
+ * 90 px in front of the wall would render 7 % larger and run into its
+ * neighbour across a 12 px gap.
+ */
+export function compensatingScale(z: number, apparentScale = 1): number {
+ const projected = DECK_PERSPECTIVE_PX / (DECK_PERSPECTIVE_PX - z);
+ return round(apparentScale / projected, 4);
+}
+
+/**
+ * The CSS custom properties one slot's wrapper carries — everything the
+ * stylesheet's single `transform` rule reads.
+ */
+export function slotDepthVars(slot: BoardSlot): Record<`--${string}`, string> {
+ const d = SLOT_DEPTH[slot];
+ return {
+ "--slot-z": `${d.z}px`,
+ "--slot-ry": `${d.rotateY}deg`,
+ "--slot-par": `${d.parallax}`,
+ "--slot-scale": `${compensatingScale(d.z, d.apparentScale)}`,
+ };
+}
+
+/**
+ * The pre-translation a plane needs so that, at depth `z`, its centre still
+ * PROJECTS onto the place the grid gave it. Under one shared perspective a
+ * point at `(cx, cy)` from the vanishing point projects to `c · p/(p−z)` — a
+ * near plane at the board's edge drifts outward and is clipped by the board's
+ * box (seen 2026-08-22: the log's left edge and the outputs card cut off). A
+ * shift of `−c·z/p` beforehand cancels exactly that drift, so the depth
+ * shows in scale, turn, shadow and parallax, never in a card leaving its slot.
+ */
+export function driftCompensation(
+ cx: number,
+ cy: number,
+ z: number,
+): { dx: number; dy: number } {
+ const k = z / DECK_PERSPECTIVE_PX;
+ return { dx: round(-cx * k, 2) || 0, dy: round(-cy * k, 2) || 0 };
+}
+
+/**
+ * Where the board's vanishing point sits in its own box — the same place the
+ * stylesheet's `perspective-origin` names (50 % across, 42 % down: a little
+ * above the middle, where the mascot's eyes are).
+ */
+export const PERSPECTIVE_ORIGIN = { x: 0.5, y: 0.42 };
+
+/**
+ * The pointer's place on the board as −1…1 in each axis, from the event's
+ * client coordinates and the board's box — 0,0 at the centre, clamped at the
+ * edges. Pure, so the listener only has to call it.
+ */
+export function pointerOffset(
+ clientX: number,
+ clientY: number,
+ box: { left: number; top: number; width: number; height: number },
+): { x: number; y: number } {
+ if (box.width <= 0 || box.height <= 0) return { x: 0, y: 0 };
+ const x = ((clientX - box.left) / box.width) * 2 - 1;
+ const y = ((clientY - box.top) / box.height) * 2 - 1;
+ return { x: clamp(x, -1, 1), y: clamp(y, -1, 1) };
+}
+
+/**
+ * The parallax shift of the NEAREST plane for a pointer offset — planes
+ * move AGAINST the pointer (the case sways away from where you look, as a
+ * real display case would when you lean), and only a little: the distances
+ * have to read, the board must not wobble.
+ */
+export function parallaxShift(offset: { x: number; y: number }): { x: number; y: number } {
+ // `|| 0` folds −0 into 0 so a rest position never prints as "-0px".
+ return {
+ x: round(-offset.x * PARALLAX_MAX_PX, 2) || 0,
+ y: round(-offset.y * PARALLAX_MAX_PX * 0.6, 2) || 0,
+ };
+}
+
+function clamp(v: number, lo: number, hi: number): number {
+ return Math.min(hi, Math.max(lo, v));
+}
+
+function round(v: number, places: number): number {
+ const f = 10 ** places;
+ return Math.round(v * f) / f;
+}
diff --git a/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx b/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
index ada83e3fd7..1f5d04ae04 100644
--- a/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
+++ b/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
@@ -1,4 +1,12 @@
-import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";
+import {
+ useEffect,
+ useLayoutEffect,
+ useMemo,
+ useRef,
+ useState,
+ type CSSProperties,
+ type ReactNode,
+} from "react";
import { AnimatePresence, MotionConfig, motion, useReducedMotion } from "framer-motion";
import { useEventStore, type VoiceState } from "@/store/events";
import { useDeckStore } from "@/store/deck";
@@ -12,6 +20,8 @@ import { DeckOrb, type OrbReadouts } from "@/components/deck/DeckOrb";
import type { ThinkingStep } from "@/lib/thinkingSteps";
import { DeckStandby, ORB_TRAVEL } from "@/components/deck/DeckStandby";
import { DeckReveal } from "@/components/deck/DeckReveal";
+import { DeckFloor, useDeckParallax } from "@/components/deck/DeckStage3D";
+import { SLOT_DEPTH, slotDepthVars } from "@/lib/deckDepth";
import { HudLamp } from "@/components/deck/HudFrame";
import {
IdeGridCard,
@@ -29,7 +39,7 @@ import { useWakeWord } from "@/hooks/useWakeWord";
import { useVoiceCall } from "@/components/agentic/useVoiceCall";
import { useElementSize } from "@/hooks/useElementSize";
import { orbSizeFor, stageVignette, stageWashSize } from "@/lib/deckStage";
-import { HANDOFF, autoLaunchAfterMs, resolvePhase } from "@/lib/deckStandby";
+import { HANDOFF, autoLaunchAfterMs, resolvePhase, type BoardSlot } from "@/lib/deckStandby";
import { writeDeckMode } from "@/lib/deckMode";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
@@ -156,6 +166,9 @@ export function MissionDeckView({
// the first render so the wrappers never remount because the flag moved.
const mountedInto = useRef(phase);
const revealBoard = mountedInto.current !== "board";
+ // The board is a display case: the pointer sways its planes (lib/deckDepth).
+ const boardRef = useRef<HTMLDivElement>(null);
+ useDeckParallax(boardRef, phase === "board");
// While the stage waits for the first word, the board's heaviest part gets
// ready in the idle time: the WebGL probe and the 3D map's chunk. Measured
// 2026-08-19: done in the click's own task they froze the launch for half
@@ -315,11 +328,20 @@ export function MissionDeckView({
<div className="relative flex min-h-0 min-w-0 flex-1 flex-col">
{phase === "board" && (
<div
+ ref={boardRef}
data-testid="deck-board"
- className="relative grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-y-auto p-3 lg:grid-cols-[minmax(200px,3fr)_minmax(0,6fr)_minmax(240px,4fr)] lg:grid-rows-[minmax(0,1fr)_minmax(0,0.6fr)] lg:overflow-hidden"
+ className="deck-board-3d relative grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-y-auto p-3 lg:grid-cols-[minmax(200px,3fr)_minmax(0,6fr)_minmax(240px,4fr)] lg:grid-rows-[minmax(0,1fr)_minmax(0,0.6fr)] lg:overflow-hidden"
>
+ {/* The floor the case stands on — behind every plane, on the wall's side. */}
+ <DeckFloor />
+
{/* LEFT top: the log — the terminal of the session */}
- <DeckReveal slot="left-top" reveal={revealBoard} bodyClassName="flex min-h-0 flex-col">
+ <DeckReveal
+ slot="left-top"
+ reveal={revealBoard}
+ {...depthSlot("left-top")}
+ bodyClassName="flex min-h-0 flex-col"
+ >
<LogCard className="min-h-0 flex-1" />
</DeckReveal>
@@ -328,9 +350,9 @@ export function MissionDeckView({
<DeckReveal
slot="centre-top"
reveal={revealBoard}
- className="shrink-0"
+ className={cn("shrink-0", depthSlot("centre-top").className)}
bodyClassName="grid grid-cols-2 gap-3"
- style={{ height: "36%" }}
+ style={{ height: "36%", ...depthSlot("centre-top").style }}
>
<TurnCard className="min-h-0" />
<ApiStatsCard className="min-h-0" />
@@ -349,7 +371,12 @@ export function MissionDeckView({
</div>
{/* RIGHT top: the wiki, in space, tall */}
- <DeckReveal slot="right-top" reveal={revealBoard} bodyClassName="flex min-h-0 flex-col">
+ <DeckReveal
+ slot="right-top"
+ reveal={revealBoard}
+ {...depthSlot("right-top")}
+ bodyClassName="flex min-h-0 flex-col"
+ >
<WikiCard className="min-h-0 flex-1" />
</DeckReveal>
@@ -357,7 +384,8 @@ export function MissionDeckView({
<DeckReveal
slot="left-bottom"
reveal={revealBoard}
- className="min-h-[8rem]"
+ className={cn("min-h-[8rem]", depthSlot("left-bottom").className)}
+ style={depthSlot("left-bottom").style}
bodyClassName="grid grid-cols-2 gap-3"
>
<OutputsCard className="min-h-0" />
@@ -368,7 +396,8 @@ export function MissionDeckView({
<DeckReveal
slot="centre-bottom"
reveal={revealBoard}
- className="min-h-[8rem]"
+ className={cn("min-h-[8rem]", depthSlot("centre-bottom").className)}
+ style={depthSlot("centre-bottom").style}
bodyClassName="flex items-stretch justify-center"
>
<CaptureCard className="w-full max-w-[28rem]" />
@@ -378,7 +407,8 @@ export function MissionDeckView({
<DeckReveal
slot="right-bottom"
reveal={revealBoard}
- className="min-h-[8rem]"
+ className={cn("min-h-[8rem]", depthSlot("right-bottom").className)}
+ style={depthSlot("right-bottom").style}
bodyClassName="grid grid-cols-2 gap-3"
>
<TerminalsCard className="min-h-0" />
@@ -418,6 +448,19 @@ export function MissionDeckView({
type DeckMood = "ready" | "busy" | "listening" | "speaking" | "fail" | "offline";
+/**
+ * A slot's place in the display case (lib/deckDepth.ts) as the props its
+ * DeckReveal wrapper takes: the transform rule's class, the depth as custom
+ * properties, and `deck-slot-far` for planes behind the wall so their cards
+ * read softer.
+ */
+function depthSlot(slot: BoardSlot): { className: string; style: CSSProperties } {
+ return {
+ className: cn("deck-slot-3d", SLOT_DEPTH[slot].z < 0 && "deck-slot-far"),
+ style: slotDepthVars(slot) as CSSProperties,
+ };
+}
+
/**
* The board's centre: the orb on its vignetted stage with the headline under
@@ -478,6 +521,8 @@ function BoardCentre({
backgroundImage: stageVignette(orbSize),
}}
/>
+ {/* The mascot stands on the case's floor: a ground shadow under it. */}
+ <div aria-hidden data-testid="deck-orb-ground" className="deck-orb-ground" />
<motion.div layoutId="deck-orb" layoutDependency={orbSize} transition={ORB_TRAVEL}>
<DeckOrb
steps={steps}