Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

17.4 KB
Raw Blame
/* Live trade rooms (/trade-rooms, /trade-rooms/:id).
   Built on the canonical tokens (public/tokens.css via nav.css) plus the
   leaderboard's shared button and P&L classes (src/leaderboard.css). */

.tr-shell {
	font-family: var(--font-body);
	color: var(--ink);
	max-width: 1280px;
	margin: 0 auto;
	padding: var(--space-lg) var(--space-md) var(--space-2xl);
}

.tr-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.tr-dim { color: var(--ink-dim); }
.tr-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── Lobby hero ─────────────────────────────────────────────────────────── */
.tr-hero { text-align: center; margin: var(--space-lg) auto var(--space-xl); max-width: 760px; }
.tr-kicker {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	font-family: var(--font-mono);
	font-size: var(--text-2xs);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink-dim);
	padding: var(--space-3xs) var(--space-sm);
	border: 1px solid var(--stroke);
	border-radius: var(--radius-pill);
	background: var(--surface-glass);
}
.tr-live-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--success);
	animation: tr-pulse 2.2s var(--ease-out) infinite;
}
@keyframes tr-pulse {
	0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
	70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
	100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.tr-title {
	font-family: var(--font-display);
	font-weight: var(--weight-bold);
	font-size: var(--text-3xl);
	line-height: var(--leading-tight);
	margin: var(--space-sm) 0 var(--space-xs);
	color: var(--ink-bright);
}
.tr-sub { color: var(--ink-dim); line-height: var(--leading-normal); margin: 0; }

.tr-lobby-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	margin-bottom: var(--space-sm);
}
.tr-lobby-head h2 { margin: 0; font-size: var(--text-lg); color: var(--ink-bright); }
.tr-lobby-links { display: flex; flex-wrap: wrap; gap: var(--space-xs); justify-content: flex-end; }
.tr-lobby-note {
	grid-column: 1 / -1;
	margin: 0 0 var(--space-2xs);
	padding: var(--space-xs) var(--space-sm);
	border: 1px solid var(--stroke);
	border-radius: var(--radius-md);
	background: var(--surface-glass);
	color: var(--ink-dim);
	font-size: var(--text-sm);
}

.tr-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: var(--space-sm);
}
.tr-grid--compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ── Room cards ─────────────────────────────────────────────────────────── */
.tr-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	padding: var(--space-sm);
	border: 1px solid var(--stroke);
	border-radius: var(--radius-card);
	background: var(--surface-1);
	color: var(--ink);
	text-decoration: none;
	transition: transform var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.tr-card:hover { transform: translateY(-2px); border-color: var(--stroke-strong); box-shadow: var(--shadow-2); }
.tr-card:active { transform: translateY(0); }
.tr-card:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.tr-card--live { border-color: color-mix(in srgb, var(--success) 40%, var(--stroke)); }
.tr-card-top { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; }
.tr-card-av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.tr-card-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tr-card-name { font-weight: var(--weight-semibold); color: var(--ink-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-card-stats { display: flex; flex-wrap: wrap; gap: 4px var(--space-xs); font-size: var(--text-xs); color: var(--ink-dim); }
.tr-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); margin-top: auto; }
.tr-card-cta { margin-left: auto; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--accent); }
.tr-card--compact .tr-card-av { width: 36px; height: 36px; }

/* ── State + presence pills ─────────────────────────────────────────────── */
.tr-state, .tr-watch, .tr-conn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font: var(--weight-semibold) var(--text-2xs) / 1 var(--font-mono);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 5px 9px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--stroke);
	background: var(--surface-glass);
	color: var(--ink-dim);
	white-space: nowrap;
	width: fit-content;
}
.tr-state-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tr-state--live { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.tr-state--live .tr-state-dot { animation: tr-pulse 2.2s var(--ease-out) infinite; }
.tr-state--warm { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.tr-state--quiet { color: var(--ink-faint); }
.tr-watch { color: var(--ink); }
.tr-conn[data-state='live'] { color: var(--success); }
.tr-conn[data-state='reconnecting'] { color: var(--warn); }
.tr-conn[data-state='paused'] { color: var(--ink-faint); }

/* ── Room layout ────────────────────────────────────────────────────────── */
.tr-crumbs { margin-bottom: var(--space-sm); }
.tr-crumbs a { color: var(--ink-dim); text-decoration: none; font-size: var(--text-sm); }
.tr-crumbs a:hover { color: var(--ink-bright); }
.tr-crumbs a:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; border-radius: 4px; }

.tr-room {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 380px;
	gap: var(--space-md);
	align-items: start;
}

.tr-stage {
	height: min(72vh, 660px);
	min-height: 360px;
	border-radius: var(--radius-card);
	overflow: hidden;
	border: 1px solid var(--stroke);
	background: radial-gradient(120% 90% at 50% 20%, #161a2b 0%, #07080d 70%);
	/* Sticky on wide screens so the room stays in view while the trade list scrolls. */
	position: sticky;
	top: calc(var(--nav-h, 64px) + var(--space-sm));
}
.tr-canvas-host { position: absolute; inset: 0; }
.tr-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.tr-stage--flat { height: auto; min-height: 0; position: relative; top: auto; }
.tr-stage--flat .tr-canvas-host { display: none; }
.tr-stage--flat .tr-hud, .tr-stage--flat .tr-stage-foot { position: relative; }
.tr-stage--loading .tr-stage-shimmer,
.tr-stage--loading .tr-canvas-host::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.05) 45%, transparent 70%);
	background-size: 200% 100%;
	animation: tr-shimmer 1.4s linear infinite;
}
@keyframes tr-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.tr-hud {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--space-xs);
	padding: var(--space-sm);
	pointer-events: none;
	z-index: 2;
}
.tr-hud > * { pointer-events: auto; }
.tr-leader-chip {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	padding: 6px 12px 6px 6px;
	border-radius: var(--radius-pill);
	background: rgba(8, 10, 18, 0.72);
	border: 1px solid rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(var(--blur-sm));
	color: #eef1f7;
	text-decoration: none;
	min-width: 0;
	max-width: 70%;
	transition: border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.tr-leader-chip:hover { border-color: rgba(255, 255, 255, 0.28); transform: translateY(-1px); }
.tr-leader-chip:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; }
.tr-leader-av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: #1c2135; }
.tr-leader-meta { display: flex; flex-direction: column; min-width: 0; }
.tr-leader-name { font-weight: var(--weight-semibold); display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-leader-sub { font-size: var(--text-2xs); color: #9aa3b4; }
.tr-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.tr-stage .tr-state, .tr-stage .tr-watch, .tr-stage .tr-conn { background: rgba(8, 10, 18, 0.72); border-color: rgba(255, 255, 255, 0.12); }
.tr-stage .tr-watch { color: #eef1f7; }

.tr-stage-foot {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-xs);
	padding: var(--space-sm);
	z-index: 2;
	pointer-events: none;
}
.tr-stage-foot > * { pointer-events: auto; }
.tr-stage-note {
	margin: 0;
	max-width: 70%;
	padding: 8px 12px;
	border-radius: var(--radius-md);
	background: rgba(8, 10, 18, 0.78);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: #cdd3e0;
	font-size: var(--text-sm);
	line-height: 1.4;
}
.tr-stage-note[hidden] { display: none; }
.tr-tool {
	margin-left: auto;
	padding: 8px 12px;
	border-radius: var(--radius-pill);
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(8, 10, 18, 0.72);
	color: #eef1f7;
	font: var(--weight-semibold) var(--text-xs) / 1 var(--font-body);
	cursor: pointer;
	transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.tr-tool:hover { border-color: rgba(255, 255, 255, 0.34); background: rgba(20, 24, 38, 0.9); }
.tr-tool:active { transform: translateY(1px); }
.tr-tool:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; }
.tr-tool[hidden] { display: none; }

.tr-stage-panel { padding: 88px var(--space-md) 72px; text-align: center; }
.tr-panel-inner { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); }
.tr-panel-title { margin: 0; font-weight: var(--weight-semibold); color: #eef1f7; font-size: var(--text-md); }
.tr-panel-body { margin: 0; color: #9aa3b4; font-size: var(--text-sm); line-height: 1.5; }
.tr-stage--flat .tr-stage-foot { display: none; }
.tr-stage--flat .tr-stage-panel { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.tr-stage--flat .tr-hud { padding-bottom: 0; }

/* The trade that just landed, big and brief, over the canvas. */
.tr-flash {
	position: absolute;
	left: 50%;
	top: 22%;
	transform: translate(-50%, 8px);
	max-width: 88%;
	padding: 10px 16px;
	border-radius: var(--radius-lg);
	font: var(--weight-bold) var(--text-md) / 1.25 var(--font-body);
	color: #07080d;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	z-index: 3;
}
.tr-flash--buy { background: #60a5fa; }
.tr-flash--win { background: #34d399; }
.tr-flash--loss { background: var(--danger); }
.tr-flash--flat { background: #cbd5e1; }
.tr-flash.is-on { animation: tr-flash 3.2s var(--ease-out) both; }
@keyframes tr-flash {
	0% { opacity: 0; transform: translate(-50%, 8px) scale(0.96); }
	10% { opacity: 1; transform: translate(-50%, 0) scale(1); }
	80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
	100% { opacity: 0; transform: translate(-50%, -6px) scale(0.98); }
}

/* ── Side column ────────────────────────────────────────────────────────── */
.tr-side { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
.tr-side > section {
	padding: var(--space-sm);
	border: 1px solid var(--stroke);
	border-radius: var(--radius-card);
	background: var(--surface-1);
}
.tr-side > section[hidden] { display: none; }
.tr-h { margin: 0 0 var(--space-xs); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink-bright); }
.tr-last { margin: 0 0 var(--space-xs); color: var(--ink); font-size: var(--text-sm); line-height: 1.45; }
.tr-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xs); margin: 0 0 var(--space-sm); }
.tr-stat { padding: 8px 10px; border-radius: var(--radius-md); background: var(--surface-2); min-width: 0; }
.tr-stat dt { font-size: var(--text-2xs); color: var(--ink-dim); margin-bottom: 2px; }
.tr-stat dd { margin: 0; font: var(--weight-semibold) var(--text-sm) / 1.3 var(--font-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tr-actions { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.tr-actions .lb-btn { flex: 1 1 auto; justify-content: center; }
.tr-copiers { margin: var(--space-xs) 0 0; font-size: var(--text-xs); }

.tr-why-line { margin: 0 0 var(--space-xs); font-size: var(--text-sm); line-height: 1.5; color: var(--ink); }
.tr-skel-line { color: var(--ink-faint); }

.tr-open-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tr-open-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-xs); font-size: var(--text-sm); }

.tr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tr-list-empty { list-style: none; }
.tr-row {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 6px var(--space-xs);
	padding: 8px 10px;
	border-radius: var(--radius-md);
	background: var(--surface-2);
	border: 1px solid transparent;
}
.tr-row.is-fresh { animation: tr-row-in 1.6s var(--ease-out); }
@keyframes tr-row-in {
	0% { opacity: 0; transform: translateY(-6px); border-color: var(--accent); }
	15% { opacity: 1; transform: translateY(0); }
	100% { border-color: transparent; }
}
.tr-badge {
	align-self: start;
	font: 800 10px / 1 var(--font-mono);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 5px 7px;
	border-radius: 6px;
	color: #07080d;
}
.tr-badge--buy { background: #60a5fa; }
.tr-badge--win { background: #34d399; }
.tr-badge--loss { background: var(--danger); }
.tr-badge--flat { background: #cbd5e1; }
.tr-row-main { min-width: 0; }
.tr-row-line { margin: 0; font-size: var(--text-sm); overflow-wrap: anywhere; }
.tr-row-line strong { color: var(--ink-bright); }
.tr-row-meta { margin: 2px 0 0; font-size: var(--text-xs); color: var(--ink-dim); }
.tr-pnl { font-family: var(--font-mono); font-weight: var(--weight-semibold); }
.tr-paper { color: var(--warn); font-weight: var(--weight-semibold); }
.tr-row-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tr-mini {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	padding: 0 12px;
	height: 32px;
	min-height: 0;
	min-width: 0;
	width: auto;
	border-radius: var(--radius-pill);
	border: 1px solid var(--stroke);
	background: var(--surface-1);
	color: var(--ink);
	font: var(--weight-semibold) var(--text-xs) / 1 var(--font-body);
	text-decoration: none;
	cursor: pointer;
	transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.tr-mini:hover { border-color: var(--stroke-strong); background: var(--surface-3); }
.tr-mini:active { transform: translateY(1px); }
.tr-mini:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 2px; }
.tr-mini[aria-expanded='true'] { border-color: var(--accent); color: var(--ink-bright); }
.tr-mini--fork { border-color: color-mix(in srgb, var(--accent) 45%, var(--stroke)); }
.tr-mini[disabled] { opacity: var(--disabled-opacity, 0.5); cursor: progress; }
.tr-receipt { grid-column: 1 / -1; }
.tr-receipt[hidden] { display: none; }
.tr-receipt-err { margin: 0; font-size: var(--text-sm); color: var(--ink-dim); display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }

.tr-others { margin-top: var(--space-xl); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
	.tr-room { grid-template-columns: minmax(0, 1fr); }
	.tr-stage { position: relative; top: auto; height: min(58vh, 520px); min-height: 300px; }
}
@media (max-width: 560px) {
	.tr-shell { padding: var(--space-sm) var(--space-sm) var(--space-xl); }
	.tr-title { font-size: var(--text-2xl); }
	.tr-stage { height: 54vh; min-height: 280px; border-radius: var(--radius-lg); }
	.tr-leader-chip { max-width: 100%; }
	.tr-hud { flex-direction: column; }
	.tr-pills { justify-content: flex-start; }
	.tr-stage-note { max-width: 100%; font-size: var(--text-xs); }
	.tr-stage-foot { flex-direction: column; align-items: stretch; }
	.tr-tool { margin-left: 0; align-self: flex-end; }
	.tr-flash { font-size: var(--text-sm); top: 36%; }
	.tr-stats { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	.tr-live-dot, .tr-state--live .tr-state-dot, .tr-row.is-fresh, .tr-stage--loading .tr-stage-shimmer,
	.tr-stage--loading .tr-canvas-host::after { animation: none; }
	.tr-card, .tr-card:hover { transform: none; }
}