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.

8.7 KB
Raw Blame
/* Economy UI (W04) — the general store and bank/ATM modals opened from an
 * NPC walk-up. Styled to the same monochrome tokens as coin-buy.css /
 * play-systems.css (dark glass, white ink, 4px radii) so a walk-up counter
 * reads like part of the same world as the wardrobe and the trade widget. */

.ec-overlay {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: grid;
	place-items: center;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity var(--duration-fast) var(--ease-standard);
	padding: 16px;
}
.ec-overlay.ec-on { opacity: 1; }

.ec-card {
	width: min(420px, 100%);
	max-height: min(640px, 88vh);
	display: flex;
	flex-direction: column;
	background: var(--cc-panel-solid);
	border: 1px solid var(--cc-edge);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	color: var(--cc-text);
	transform: translateY(10px) scale(0.98);
	transition: transform var(--duration-fast) var(--ease-standard);
	overflow: hidden;
}
.ec-overlay.ec-on .ec-card { transform: none; }

.ec-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--cc-edge-soft);
	flex: none;
}
.ec-title { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.ec-x {
	width: 28px; height: 28px; display: grid; place-items: center;
	background: transparent; border: 1px solid var(--cc-edge); border-radius: var(--cc-radius-sm);
	color: var(--cc-dim); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.ec-x:hover { color: var(--cc-text); background: rgba(255, 255, 255, 0.08); border-color: var(--cc-edge-hi); }
.ec-x:focus-visible { outline: 2px solid var(--cc-edge-hi); outline-offset: 2px; }

.ec-tabs { display: flex; gap: 6px; padding: 10px 16px 0; flex: none; }
.ec-tab {
	flex: 1; padding: 8px 0; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
	text-transform: uppercase; color: var(--cc-dim); background: transparent; border: 1px solid var(--cc-edge);
	border-radius: var(--cc-radius-sm); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.ec-tab:hover { color: var(--cc-text); border-color: var(--cc-edge-hi); }
.ec-tab.ec-on { color: var(--cc-ink); background: #fff; border-color: #fff; }
.ec-tab:focus-visible { outline: 2px solid var(--cc-edge-hi); outline-offset: 2px; }

.ec-purse {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	margin: 12px 16px 0; padding: 10px 12px; background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--cc-edge-soft); border-radius: var(--cc-radius-sm);
	font-variant-numeric: tabular-nums; font-size: 12px; color: var(--cc-dim);
}
.ec-purse b { color: var(--cc-text); font-size: 13px; }

.ec-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; }

.ec-row {
	display: flex; align-items: center; gap: 10px; padding: 9px 10px;
	background: rgba(255, 255, 255, 0.03); border: 1px solid var(--cc-edge-soft); border-radius: var(--cc-radius-sm);
}
.ec-row-glyph { font-size: 18px; width: 24px; text-align: center; flex: none; }
.ec-row-main { flex: 1; min-width: 0; }
/* Item labels come from the server's vocabulary, so a long or unbroken name has
   to fold inside the row instead of pushing the price and the button off it. */
.ec-row-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ec-row-sub { font-size: 11px; color: var(--cc-dim); margin-top: 2px; overflow-wrap: anywhere; }
.ec-row-btn {
	flex: none; padding: 7px 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
	background: #fff; color: var(--cc-ink); border: none; border-radius: var(--cc-radius-sm); cursor: pointer;
	transition: transform var(--duration-instant) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
}
.ec-row-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ec-row-btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
.ec-row-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ec-row-btn:focus-visible { outline: 2px solid var(--cc-edge-hi); outline-offset: 2px; }

.ec-empty { padding: 22px 10px; text-align: center; color: var(--cc-dim); font-size: 12px; line-height: 1.5; }

.ec-bank-amount { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.ec-bank-input {
	flex: 1; min-width: 0; padding: 10px 12px; font-size: 15px; font-variant-numeric: tabular-nums;
	background: rgba(255, 255, 255, 0.05); border: 1px solid var(--cc-edge); border-radius: var(--cc-radius-sm);
	color: var(--cc-text); font-family: inherit;
}
.ec-bank-input:focus-visible { outline: 2px solid var(--cc-edge-hi); outline-offset: 1px; }
.ec-bank-presets { display: flex; gap: 6px; margin-bottom: 10px; }
.ec-bank-preset {
	flex: 1; padding: 6px 0; font-size: 11px; font-weight: 700; background: transparent; color: var(--cc-dim);
	border: 1px solid var(--cc-edge); border-radius: var(--cc-radius-sm); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.ec-bank-preset:hover:not(:disabled) { color: var(--cc-text); border-color: var(--cc-edge-hi); }
.ec-bank-preset:active:not(:disabled) { transform: scale(0.97); }
.ec-bank-preset:focus-visible { outline: 2px solid var(--cc-edge-hi); outline-offset: 2px; }
.ec-bank-preset:disabled { opacity: 0.35; cursor: not-allowed; }
.ec-bank-actions { display: flex; gap: 8px; }
.ec-bank-actions .ec-row-btn { flex: 1; }
.ec-bank-actions .ec-row-btn.ec-secondary { background: transparent; color: var(--cc-text); border: 1px solid var(--cc-edge); }

.ec-status { padding: 0 16px 14px; font-size: 12px; color: var(--cc-dim); min-height: 16px; }
.ec-status[data-kind="err"] { color: #ff8a8a; }
.ec-status[data-kind="ok"] { color: #9effa6; }

/* Waiting for the first server snapshot. The placeholder rows are laid out like
   real ones so the panel does not resize or jump when the catalog arrives. */
.ec-skel { display: flex; flex-direction: column; gap: 8px; }
.ec-skel-row {
	display: flex; align-items: center; gap: 10px; padding: 9px 10px;
	background: rgba(255, 255, 255, 0.03); border: 1px solid var(--cc-edge-soft); border-radius: var(--cc-radius-sm);
}
.ec-skel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ec-skel-glyph, .ec-skel-line, .ec-skel-btn {
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.12) 37%, rgba(255, 255, 255, 0.05) 63%);
	background-size: 400% 100%;
	animation: ec-shimmer 1.4s ease infinite;
	border-radius: 3px;
}
.ec-skel-glyph { width: 24px; height: 18px; flex: none; }
.ec-skel-line { height: 9px; width: 62%; }
.ec-skel-line-sm { height: 8px; width: 34%; }
.ec-skel-btn { width: 52px; height: 26px; flex: none; border-radius: var(--cc-radius-sm); }

@keyframes ec-shimmer {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

/* A balance we have not read yet reads as unknown, never as a confident zero. */
.ec-pending-val { color: var(--cc-dim); opacity: 0.7; letter-spacing: 0.08em; }

/* The world stopped answering: say so, and give the one button that retries. */
.ec-error { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ec-error-glyph { font-size: 26px; line-height: 1; opacity: 0.75; }
.ec-error-title { font-size: 13px; font-weight: 700; color: var(--cc-text); }
.ec-error-retry { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
	.ec-overlay, .ec-card { transition: none; }
	.ec-skel-glyph, .ec-skel-line, .ec-skel-btn { animation: none; }
}

@media (max-width: 480px) {
	/* Fixed height, not content height. The card is centred, so every time its
	   body swapped a five-row skeleton for a full jobs board it grew and its top
	   edge climbed: measured at 320px, that one swap was a 0.246 layout shift,
	   almost all of the page's CLS. At this width the panel is effectively a
	   sheet, so giving it the full height it was going to reach anyway costs
	   nothing and the body scrolls inside it instead of resizing it. */
	.ec-card { width: 100%; height: min(640px, 88vh); }
	/* Thumb-sized targets on a phone: the WCAG 2.5.5 bar is 44px, and these are
	   the controls a player taps mid-session with one hand. */
	.ec-x { width: 40px; height: 40px; }
	/* Padding alone landed this a hair under 40px. */
	.ec-tab { padding: 12px 0; min-height: 40px; }
	/* Padding alone left this at 36px, under the 40px bar: the jobs board's
	   Accept button is the one control a player taps most in a run. */
	.ec-row-btn { padding: 11px 14px; min-height: 40px; }
	.ec-bank-preset { padding: 11px 0; }
}