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.

14.3 KB
Raw Blame
/* ── 3D Agent Picker ──────────────────────────────────────────────────────
   Reusable browser for public 3D agents (agent_identities). Search, sort,
   skill filters, an on-chain toggle, a live 3D preview of the agent's avatar,
   and a single selection callback. Modal overlay or inline embed.

   Uses canonical B01 tokens for consistency with the monochrome system and
   mirrors the avatar-gallery-picker layout so the two feel like one family.
   ─────────────────────────────────────────────────────────────────────── */

/* ── Overlay (modal mode) ───────────────────────────────────────────── */

.apk-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: grid;
	place-items: center;
	padding: 20px;
	opacity: 0;
	transition: opacity var(--duration-fast) var(--ease-standard);
}
.apk-overlay.apk-open { opacity: 1; }

/* ── Shell ──────────────────────────────────────────────────────────── */

.apk-shell {
	width: 100%;
	max-width: 1080px;
	max-height: calc(100vh - 40px);
	background: var(--surface-1);
	border: 1px solid var(--stroke);
	border-radius: 14px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
	transform: translateY(8px);
	transition: transform var(--duration-fast) var(--ease-standard);
}
.apk-open .apk-shell { transform: translateY(0); }

.apk-shell--inline {
	max-height: none;
	box-shadow: none;
	border-radius: 12px;
	transform: none;
}

/* ── Header ─────────────────────────────────────────────────────────── */

.apk-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	border-bottom: 1px solid var(--stroke);
	flex-shrink: 0;
}
.apk-title {
	font-size: 15px;
	font-weight: 600;
	color: var(--ink);
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.apk-close {
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	background: transparent;
	border: 1px solid var(--stroke);
	border-radius: 8px;
	color: var(--ink-dim);
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
	flex-shrink: 0;
}
.apk-close:hover {
	background: var(--surface-2);
	color: var(--ink);
	border-color: var(--stroke-strong);
}

/* ── Toolbar ────────────────────────────────────────────────────────── */

.apk-toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px;
	flex-shrink: 0;
	flex-wrap: wrap;
}
.apk-search {
	flex: 1 1 220px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: var(--surface-1);
	border: 1px solid var(--stroke);
	border-radius: 10px;
	transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.apk-search:focus-within {
	border-color: var(--stroke-strong);
	background: var(--surface-2);
}
.apk-search svg { flex-shrink: 0; color: var(--ink-dim); }
.apk-search input {
	flex: 1;
	background: transparent;
	border: 0;
	outline: 0;
	color: var(--ink);
	font: inherit;
	font-size: 13px;
	min-width: 0;
}
.apk-search input::placeholder { color: var(--ink-dim); }
.apk-search-clear {
	background: transparent;
	border: 0;
	color: var(--ink-dim);
	cursor: pointer;
	padding: 2px 4px;
	font-size: 14px;
	line-height: 1;
	transition: color var(--duration-fast) var(--ease-standard);
}
.apk-search-clear:hover { color: var(--ink); }
.apk-status {
	font-size: 12px;
	color: var(--ink-dim);
	flex-shrink: 0;
	white-space: nowrap;
}

/* Sort segmented control + on-chain toggle */
.apk-sort {
	display: flex;
	gap: 3px;
	background: #000;
	border: 1px solid var(--stroke);
	border-radius: 9px;
	padding: 3px;
	flex-shrink: 0;
}
.apk-sort-btn {
	padding: 6px 11px;
	border-radius: 7px;
	font: inherit;
	font-size: 12px;
	color: var(--ink-dim);
	background: transparent;
	border: 0;
	cursor: pointer;
	transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
	white-space: nowrap;
}
.apk-sort-btn.active { background: var(--surface-2); color: var(--ink); }
.apk-sort-btn:hover:not(.active) { color: var(--ink); }

.apk-onchain-toggle {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 12px;
	color: var(--ink-dim);
	cursor: pointer;
	user-select: none;
	flex-shrink: 0;
	padding: 6px 4px;
}
.apk-onchain-toggle input { accent-color: var(--accent); cursor: pointer; }
.apk-onchain-toggle:hover { color: var(--ink); }

/* ── Skill filter chips ─────────────────────────────────────────────── */

.apk-skills {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	padding: 0 18px 10px;
	flex-shrink: 0;
	min-height: 0;
}
.apk-skill {
	background: var(--surface-1);
	color: var(--ink-dim);
	border: 1px solid var(--stroke);
	border-radius: 999px;
	padding: 4px 10px;
	font: inherit;
	font-size: 11.5px;
	cursor: pointer;
	transition: all var(--duration-fast) var(--ease-standard);
}
.apk-skill:hover { border-color: var(--stroke-strong); color: var(--ink); }
.apk-skill.active {
	background: var(--accent);
	color: var(--on-accent);
	border-color: var(--accent);
}

/* ── Body ───────────────────────────────────────────────────────────── */

.apk-body {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 0;
	overflow: hidden;
}

.apk-grid-col {
	overflow-y: auto;
	padding: 12px 18px 18px;
	border-right: 1px solid var(--stroke);
}
.apk-grid {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Card ───────────────────────────────────────────────────────────── */

.apk-card {
	background: var(--surface-2);
	border: 1.5px solid var(--stroke);
	border-radius: var(--radius-card, 14px);
	overflow: hidden;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	text-align: left;
	color: inherit;
	font: inherit;
	padding: 0;
	transition: border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.apk-card:hover {
	border-color: var(--stroke-strong);
	transform: translateY(-1px);
	box-shadow: var(--shadow-2, 0 4px 24px rgba(0, 0, 0, 0.4));
}
.apk-card:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
.apk-card.selected {
	border-color: var(--accent);
	box-shadow: 0 0 0 1px var(--accent) inset, 0 4px 20px rgba(255, 255, 255, 0.06);
}
.apk-card-thumb {
	aspect-ratio: 1 / 1;
	background: var(--surface-3);
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.apk-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.apk-card-ph {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--surface-3) 0%, var(--surface-2) 100%);
	display: flex;
	align-items: center;
	justify-content: center;
}
.apk-card-ph svg { width: 32px; height: 32px; color: var(--ink-dim); opacity: 0.5; }
/* On-chain badge floats top-right of the thumbnail */
.apk-card-badge {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 1;
}
.apk-card-body { padding: 8px 10px 10px; }
.apk-card-name {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ink);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin: 0 0 3px;
}
.apk-card-desc {
	font-size: 11px;
	color: var(--ink-dim);
	line-height: 1.4;
	margin: 0 0 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.apk-card-meta {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}
.apk-card-chip {
	font-size: 10px;
	color: var(--ink-dim);
	background: var(--surface-1);
	border-radius: 999px;
	padding: 1px 6px;
}

/* ── Preview column ─────────────────────────────────────────────────── */

.apk-preview-col {
	display: flex;
	flex-direction: column;
	padding: 14px;
	gap: 12px;
	overflow-y: auto;
}
.apk-preview-stage {
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	overflow: hidden;
	background: #000;
	border: 1px solid var(--stroke);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	position: relative;
}
.apk-preview-stage model-viewer {
	width: 100%;
	height: 100%;
	--poster-color: transparent;
	background: #000;
}
.apk-preview-empty {
	color: var(--ink-dim);
	font-size: 12.5px;
	text-align: center;
	padding: 0 16px;
	line-height: 1.5;
}
.apk-preview-spinner {
	position: absolute;
	width: 22px;
	height: 22px;
	border: 2px solid var(--stroke);
	border-top-color: var(--ink-dim);
	border-radius: 50%;
	animation: apk-spin 0.8s linear infinite;
}
.apk-preview-head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.apk-preview-name {
	font-size: 15px;
	font-weight: 600;
	color: var(--ink);
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
}
.apk-preview-sub {
	color: var(--ink-dim);
	font-size: 12px;
	margin: -4px 0 0;
}
.apk-preview-desc {
	color: var(--ink-dim);
	font-size: 12.5px;
	line-height: 1.5;
	margin: 0;
	max-height: 96px;
	overflow-y: auto;
}
.apk-preview-skills {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}
.apk-preview-skill {
	font-size: 10.5px;
	color: var(--ink-dim);
	background: var(--surface-1);
	border: 1px solid var(--stroke);
	border-radius: 999px;
	padding: 2px 8px;
}
.apk-preview-profile {
	font-size: 12px;
	color: var(--ink-dim);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	transition: color var(--duration-fast) var(--ease-standard);
	align-self: flex-start;
}
.apk-preview-profile:hover { color: var(--ink); text-decoration: underline; }

.apk-spacer { flex: 1; min-height: 4px; }

/* ── CTA button ─────────────────────────────────────────────────────── */

.apk-cta {
	background: var(--accent);
	color: var(--on-accent);
	border: 0;
	border-radius: 9px;
	padding: 10px 14px;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	width: 100%;
	transition: opacity var(--duration-fast) var(--ease-standard);
}
.apk-cta:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Loading / empty / error ────────────────────────────────────────── */

@keyframes apk-spin { to { transform: rotate(360deg); } }

.apk-empty, .apk-error {
	grid-column: 1 / -1;
	padding: 36px 16px;
	text-align: center;
	color: var(--ink-dim);
	border: 1.5px dashed var(--stroke);
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.5;
}
.apk-error { color: var(--danger); border-color: rgba(248, 113, 113, 0.2); }
.apk-empty-cta {
	display: inline-block;
	margin-top: 12px;
	padding: 8px 16px;
	background: var(--accent);
	color: var(--on-accent);
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: none;
}

/* ── Skeleton cards ─────────────────────────────────────────────────── */

.apk-skel {
	background: var(--surface-2);
	border: 1.5px solid var(--stroke);
	border-radius: 10px;
	overflow: hidden;
}
.apk-skel-thumb {
	aspect-ratio: 1 / 1;
	background: linear-gradient(110deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%);
	background-size: 200% 100%;
	animation: apk-shimmer 1.4s ease-in-out infinite;
}
.apk-skel-bar {
	height: 10px;
	margin: 8px 10px;
	border-radius: 4px;
	background: var(--surface-3);
}
.apk-skel-bar:last-child { width: 55%; margin-top: 4px; }
@keyframes apk-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 860px) {
	.apk-body { grid-template-columns: 1fr; }
	.apk-grid-col {
		border-right: 0;
		border-bottom: 1px solid var(--stroke);
		max-height: 50vh;
	}
	.apk-preview-col { max-height: 50vh; }
	.apk-preview-stage { aspect-ratio: auto; height: 240px; }
	.apk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
	.apk-shell { max-height: calc(100vh - 20px); border-radius: 10px; }
	.apk-overlay { padding: 10px; }
	.apk-header { padding: 10px 14px; }
	.apk-toolbar { padding: 8px 14px; }
	.apk-skills { padding: 0 14px 8px; }
	.apk-grid-col { padding: 10px 14px 14px; }
	.apk-preview-col { padding: 10px; }
	.apk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* ── Interactive states (QB-07) ────────────────────────────────────────────
   The primary CTA carried an opacity transition and no hover to run it, so the
   main action of the picker looked inert under the pointer. */
.apk-cta:hover:not(:disabled) {
	background: var(--btn-primary-bg-hover, #ffffff);
}

.apk-cta:active:not(:disabled) {
	transform: translateY(1px);
}

.apk-onchain-toggle input {
	transition: transform var(--duration-fast) var(--ease-standard);
}

.apk-onchain-toggle input:hover {
	transform: scale(1.12);
}