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.1 KB
Raw Blame
/*
 * /converter — crypto ⇄ crypto ⇄ fiat converter widget.
 * Loaded AFTER /src/coin-pages.css: reuses its design tokens (--cv-*), card
 * system, skeletons, spinner, empty state, and pills. Everything here is
 * specific to the converter's two-sided input + asset picker.
 */

/* ── Presets ─────────────────────────────────────────────────────────────── */

.cvt-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}
.cvt-preset {
	appearance: none;
	cursor: pointer;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--cv-text-2);
	background: var(--cv-surface-2);
	border: 1px solid var(--cv-border);
	border-radius: 999px;
	padding: 0.375rem 0.875rem;
	font-variant-numeric: tabular-nums;
	transition:
		background var(--duration-fast),
		color var(--duration-fast),
		border-color var(--duration-fast),
		transform var(--duration-instant);
}
.cvt-preset:hover {
	background: var(--cv-surface-3);
	color: var(--cv-text);
	border-color: var(--cv-border-hover);
}
.cvt-preset:active {
	transform: translateY(1px);
}
.cvt-preset:focus-visible {
	outline: 2px solid var(--cv-accent);
	outline-offset: 2px;
}
.cvt-preset.is-active {
	color: var(--cv-accent);
	border-color: color-mix(in srgb, var(--cv-accent) 55%, transparent);
	background: color-mix(in srgb, var(--cv-accent) 12%, transparent);
}
.cvt-preset[disabled] {
	cursor: default;
	opacity: 0.45;
}
.cvt-preset[disabled]:hover {
	background: var(--cv-surface-2);
	color: var(--cv-text-2);
	border-color: var(--cv-border);
}

/* ── Widget shell ────────────────────────────────────────────────────────── */

.cvt-app {
	position: relative;
	max-width: 40rem;
}

.cvt-card {
	padding: 1.25rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
}
@media (min-width: 560px) {
	.cvt-card {
		padding: 1.75rem;
	}
}

/*
 * min-width:0 is load-bearing: as a grid item .cvt-side defaults to
 * min-width:auto, which floors it at the amount input's intrinsic width and
 * pushed the asset buttons off-screen at 320px.
 */
.cvt-side {
	min-width: 0;
	background: var(--cv-surface-2);
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius-lg);
	padding: 1rem 1.125rem;
	transition: border-color var(--duration-fast);
}
/* The amount input is deliberately borderless, so the side card carries its
   focus indicator. A border shade alone was too faint to read as focus; this
   matches the ring the picker's search box uses. */
.cvt-side:focus-within {
	border-color: var(--cv-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--cv-accent) 20%, transparent);
}

.cvt-label {
	display: block;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cv-text-3);
	margin-bottom: 0.5rem;
}

.cvt-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

/* Amount input: big, mono, borderless (the side card is the frame). */
.cvt-amount {
	flex: 1 1 0;
	width: 0;
	min-width: 0;
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--cv-text);
	font-family: var(--cv-font-mono);
	font-variant-numeric: tabular-nums;
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.1;
	padding: 0;
}
.cvt-amount:focus {
	outline: none;
}
.cvt-amount::placeholder {
	color: var(--cv-text-3);
}

/* Result: same visual weight as the input, read-only. */
.cvt-result {
	display: block;
	flex: 1 1 0;
	width: 0;
	min-width: 0;
	color: var(--cv-text);
	font-family: var(--cv-font-mono);
	font-variant-numeric: tabular-nums;
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.cvt-result-empty {
	color: var(--cv-text-3);
}

/* Small phones: shrink the display type and side padding so the amount and the
   asset button both stay legible on one row instead of ellipsing. */
@media (max-width: 24.9375rem) {
	.cvt-side {
		padding: 0.875rem;
	}
	.cvt-amount,
	.cvt-result {
		font-size: 1.375rem;
	}
	.cvt-asset {
		padding: 0.3125rem 0.5rem 0.3125rem 0.375rem;
		gap: 0.3125rem;
	}
	.cvt-asset-code {
		font-size: 0.875rem;
	}
}

/* Below ~360px the asset button leaves too little room beside the number, and a
   converted amount the reader cannot finish is a broken result. Stack it so the
   figure gets the full row width. */
@media (max-width: 22.5rem) {
	.cvt-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}
	.cvt-amount,
	.cvt-result {
		width: 100%;
		flex: 0 0 auto;
	}
}

/* Inline validation for the amount field. */
.cvt-hint {
	margin: 0.5rem 0 0;
	font-size: 0.8125rem;
	color: var(--cv-warn, #f59e0b);
}

.cvt-subline .dim {
	color: var(--cv-text-3);
}

.cvt-subline {
	margin: 0.5rem 0 0;
	font-size: 0.8125rem;
	color: var(--cv-text-3);
	min-height: 1.125rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ── Asset button ────────────────────────────────────────────────────────── */

.cvt-asset {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 0.4375rem;
	appearance: none;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	color: var(--cv-text);
	background: var(--cv-surface);
	border: 1px solid var(--cv-border);
	border-radius: 999px;
	padding: 0.375rem 0.625rem 0.375rem 0.5rem;
	transition:
		border-color var(--duration-fast),
		background var(--duration-fast);
}
.cvt-asset:hover {
	border-color: var(--cv-border-hover);
	background: var(--cv-surface-3);
}
.cvt-asset:focus-visible {
	outline: 2px solid var(--cv-accent);
	outline-offset: 2px;
}
.cvt-asset img {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--cv-surface-3);
	flex: 0 0 auto;
}
.cvt-asset svg {
	color: var(--cv-text-3);
	flex: 0 0 auto;
}
.cvt-asset-code {
	font-size: 0.9375rem;
	letter-spacing: 0.01em;
}
.cvt-asset-glyph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--cv-surface-3);
	color: var(--cv-text-2);
	font-size: 0.75rem;
	font-weight: 700;
	flex: 0 0 auto;
}
.cvt-asset-glyph.fiat {
	background: color-mix(in srgb, var(--cv-accent) 16%, transparent);
	color: var(--cv-accent);
}
.cvt-asset-load {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
}
.cvt-asset-load .cv-spinner {
	width: 0.875rem;
	height: 0.875rem;
	color: var(--cv-text-3);
}

/* ── Swap button ─────────────────────────────────────────────────────────── */

.cvt-swap-wrap {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 0;
	position: relative;
	z-index: 2;
	margin: -0.25rem 0;
}
.cvt-swap {
	appearance: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.375rem;
	height: 2.375rem;
	border-radius: 50%;
	background: var(--cv-surface);
	color: var(--cv-text-2);
	border: 1px solid var(--cv-border);
	box-shadow: var(--cv-shadow-card);
	transition:
		color var(--duration-fast),
		border-color var(--duration-fast),
		transform var(--duration-base),
		background var(--duration-fast);
}
.cvt-swap:hover {
	color: var(--cv-accent);
	border-color: var(--cv-accent);
	background: var(--cv-surface-2);
	transform: rotate(180deg);
}
.cvt-swap:active {
	transform: rotate(180deg) scale(0.94);
}
.cvt-swap:focus-visible {
	outline: 2px solid var(--cv-accent);
	outline-offset: 2px;
}

/* ── Rate line + retry ───────────────────────────────────────────────────── */

.cvt-rate {
	margin: 0.375rem 0 0;
	font-size: 0.9375rem;
	color: var(--cv-text-2);
	font-variant-numeric: tabular-nums;
	text-align: center;
}
.cvt-rate strong {
	color: var(--cv-text);
	font-weight: 600;
}
.cvt-rate .dim {
	color: var(--cv-text-3);
}

/* ── Footer: freshness stamp + share ─────────────────────────────────────── */

.cvt-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem 0.875rem;
	margin-top: 0.25rem;
}
.cvt-card .cv-updated {
	text-align: center;
	margin: 0;
}

.cvt-copy {
	appearance: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--cv-text-2);
	background: var(--cv-surface-2);
	border: 1px solid var(--cv-border);
	border-radius: 999px;
	padding: 0.3125rem 0.75rem;
	transition:
		background var(--duration-fast),
		color var(--duration-fast),
		border-color var(--duration-fast);
}
.cvt-copy:hover {
	color: var(--cv-text);
	background: var(--cv-surface-3);
	border-color: var(--cv-border-hover);
}
.cvt-copy:active {
	transform: translateY(1px);
}
.cvt-copy:focus-visible {
	outline: 2px solid var(--cv-accent);
	outline-offset: 2px;
}
.cvt-copy.is-copied {
	color: var(--cv-accent);
	border-color: color-mix(in srgb, var(--cv-accent) 55%, transparent);
	background: color-mix(in srgb, var(--cv-accent) 12%, transparent);
}
.cvt-copy svg {
	flex: 0 0 auto;
}

/* Screen-reader-only announcement region for the copy result. */
.cvt-sr-status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.cvt-retry {
	appearance: none;
	cursor: pointer;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	color: #fff;
	background: var(--cv-accent);
	border: 0;
	border-radius: var(--cv-radius-md);
	padding: 0.5rem 1.25rem;
	transition: background var(--duration-fast);
}
.cvt-retry:hover {
	background: var(--cv-accent-hover);
}
.cvt-retry:focus-visible {
	outline: 2px solid var(--cv-accent);
	outline-offset: 2px;
}

/* ── Asset picker popover ────────────────────────────────────────────────── */

.cvt-picker {
	position: fixed;
	z-index: 60;
	display: flex;
	flex-direction: column;
	/* Set per-open by positionPicker() from the space left under (or over) the
	   anchor, so the list scrolls inside the popover instead of off-screen. */
	max-height: var(--cvt-pick-max, 26rem);
	width: min(22rem, calc(100vw - 2rem));
	background: var(--cv-surface);
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius-lg);
	box-shadow: var(--cv-shadow-dropdown);
	overflow: hidden;
	animation: cvtPickIn 0.14s ease-out;
}
@keyframes cvtPickIn {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
@media (prefers-reduced-motion: reduce) {
	.cvt-picker {
		animation: none;
	}
}

.cvt-pick-search {
	position: relative;
	flex: 0 0 auto;
	padding: 0.625rem;
	border-bottom: 1px solid var(--cv-border);
}
.cvt-pick-search .mag {
	position: absolute;
	left: 1.125rem;
	top: 50%;
	transform: translateY(-50%);
	width: 1rem;
	height: 1rem;
	color: var(--cv-text-3);
	pointer-events: none;
}
.cvt-pick-search input {
	width: 100%;
	appearance: none;
	background: var(--cv-surface-2);
	border: 1px solid var(--cv-border);
	border-radius: var(--cv-radius-md);
	color: var(--cv-text);
	font: inherit;
	font-size: 0.875rem;
	padding: 0.5rem 0.75rem 0.5rem 2.125rem;
	transition:
		border-color var(--duration-fast),
		box-shadow var(--duration-fast);
}
.cvt-pick-search input::placeholder {
	color: var(--cv-text-3);
}
.cvt-pick-search input:focus {
	outline: none;
	border-color: var(--cv-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--cv-accent) 20%, transparent);
}

.cvt-pick-list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 0.375rem;
}

.cvt-pick-head {
	margin: 0.375rem 0.5rem 0.25rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cv-text-3);
}
.cvt-pick-group + .cvt-pick-group {
	margin-top: 0.25rem;
}

.cvt-pick-item {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.625rem;
	appearance: none;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: var(--cv-text);
	background: transparent;
	border: 0;
	border-radius: var(--cv-radius-md);
	padding: 0.4375rem 0.5rem;
	transition: background var(--duration-fast);
}
.cvt-pick-item:hover,
.cvt-pick-item:focus-visible,
.cvt-pick-item.is-active {
	background: var(--cv-surface-2);
	outline: none;
}
/* Keyboard highlight is stronger than hover: the search box keeps DOM focus, so
   this ring is the only cue for where Enter would land. */
.cvt-pick-item.is-active {
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cv-accent) 55%, transparent);
}
.cvt-pick-item img {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--cv-surface-3);
	flex: 0 0 auto;
}
.cvt-pick-glyph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--cv-surface-3);
	color: var(--cv-text-2);
	font-size: 0.75rem;
	font-weight: 700;
	flex: 0 0 auto;
}
.cvt-pick-glyph.fiat {
	background: color-mix(in srgb, var(--cv-accent) 16%, transparent);
	color: var(--cv-accent);
}
.cvt-pick-name {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.875rem;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.cvt-pick-code {
	color: var(--cv-text-3);
	text-transform: uppercase;
	font-size: 0.75rem;
	flex: 0 0 auto;
}
.cvt-pick-rank {
	color: var(--cv-text-3);
	font-size: 0.75rem;
	flex: 0 0 auto;
}

.cvt-pick-note {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 0.625rem;
	color: var(--cv-text-3);
	font-size: 0.8125rem;
}
.cvt-pick-note .cv-spinner {
	width: 0.875rem;
	height: 0.875rem;
}

/* ── Cross-links ─────────────────────────────────────────────────────────── */

.cvt-links {
	margin-top: 1.75rem;
}