/* The avatar builder. It takes the page's own ink, paper and line colours
   where it has them (the arcade), and plain greys where it does not (wp-admin). */

.avb {
	--avb-ink: var(--ink, #1d2327);
	--avb-paper: var(--paper, #ffffff);
	--avb-line: var(--line, #dcdcde);
	--avb-mute: var(--mute, #646970);
	display: grid;
	grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
	gap: 22px;
	align-items: start;
	color: var(--avb-ink);
}

.avb-stage {
	position: sticky;
	top: 12px;
	display: grid;
	gap: 12px;
	justify-items: center;
}

/* A manga sunburst behind the preview, like the team cards. */
.avb-preview {
	width: 100%;
	max-width: 300px;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border: 2px solid var(--avb-ink);
	border-radius: 18px;
	background: repeating-conic-gradient(from 4deg at 50% 58%, #ff8f33 0deg 9deg, #ff7414 9deg 18deg);
}

.avb-preview svg {
	display: block;
	width: 100%;
	height: 100%;
}

.avb-tools,
.avb-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.avb-tabs {
	margin-bottom: 14px;
}

.avb-tool,
.avb-tab {
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--avb-line);
	border-radius: 999px;
	background: var(--avb-paper);
	color: var(--avb-ink);
	font: inherit;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	cursor: pointer;
}

.avb-tool {
	border-color: var(--avb-ink);
}

.avb-tool:hover,
.avb-tab:hover {
	border-color: var(--avb-ink);
}

.avb-tool:hover,
.avb-tab[aria-selected="true"] {
	border-color: var(--avb-ink);
	background: var(--avb-ink);
	color: var(--avb-paper);
}

.avb-pane {
	display: grid;
	gap: 16px;
}

.avb-group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.avb-legend {
	margin-bottom: 8px;
	padding: 0;
	color: var(--avb-mute);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.avb-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.avb-choice {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	width: 86px;
	padding: 6px 4px 7px;
	border: 1px solid var(--avb-line);
	border-radius: 10px;
	background: var(--avb-paper);
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.avb-choice:hover {
	border-color: var(--avb-ink);
	transform: translateY(-1px);
}

.avb-choice input,
.avb-swatch input[type="radio"] {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.avb-choice:has(input:checked) {
	border-color: var(--avb-ink);
	box-shadow: inset 0 0 0 1px var(--avb-ink);
}

.avb-choice:has(input:focus-visible),
.avb-swatch:has(input:focus-visible) .avb-chip {
	outline: 2px solid var(--avb-ink);
	outline-offset: 2px;
}

.avb-art {
	display: block;
	width: 74px;
	height: 58px;
	overflow: hidden;
	border-radius: 6px;
	background: #f6efe2;
}

.avb-art svg {
	display: block;
	width: 100%;
	height: 100%;
}

.avb-name {
	font-size: 0.74rem;
	font-weight: 600;
	line-height: 1.2;
}

.avb-swatch {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.avb-chip {
	width: 30px;
	height: 30px;
	border: 2px solid var(--avb-line);
	border-radius: 50%;
	box-shadow: inset 0 0 0 2px var(--avb-paper);
}

.avb-chip-none {
	background: linear-gradient(135deg, transparent 44%, var(--avb-ink) 44% 56%, transparent 56%), var(--avb-paper);
}

.avb-swatch:has(input:checked) .avb-chip {
	border-color: var(--avb-ink);
	box-shadow: inset 0 0 0 3px var(--avb-paper);
}

.avb-own input[type="color"] {
	width: 30px;
	height: 30px;
	padding: 0;
	border: 2px dashed var(--avb-ink);
	border-radius: 50%;
	background: none;
	cursor: pointer;
}

.avb-own input[type="color"]::-webkit-color-swatch-wrapper {
	padding: 2px;
}

.avb-own input[type="color"]::-webkit-color-swatch {
	border: 0;
	border-radius: 50%;
}

.avb-own input[type="color"]::-moz-color-swatch {
	border: 0;
	border-radius: 50%;
}

.avb-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	cursor: pointer;
}

.avb-toggle input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--avb-ink);
}

.avb-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

@media (max-width: 720px) {
	.avb {
		grid-template-columns: 1fr;
	}

	.avb-stage {
		position: static;
	}

	.avb-preview {
		max-width: 240px;
	}

	.avb-choice {
		width: 78px;
	}

	.avb-art {
		width: 66px;
		height: 52px;
	}
}
