loporail-livery {
	display: block;
	container-type: inline-size;
}

loporail-livery *,
loporail-livery *::before,
loporail-livery *::after {
	box-sizing: border-box;
}

.lr-livery {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
	border: 1px solid var(--border, #2a2c32);
	border-radius: var(--radius-lg, 18px);
	background: var(--surface, #141519);
	overflow: hidden;
	box-shadow: var(--shadow-2, 0 24px 60px rgba(0, 0, 0, .28));
}

.lr-livery__stage {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 18px;
	background:
		linear-gradient(color-mix(in oklch, var(--fg, #f4f4f4) 5%, transparent) 1px, transparent 1px),
		linear-gradient(90deg, color-mix(in oklch, var(--fg, #f4f4f4) 5%, transparent) 1px, transparent 1px),
		radial-gradient(80% 90% at 70% 60%, color-mix(in oklch, var(--accent, #d86cff) 13%, transparent), transparent 65%),
		var(--bg, #0b0c0f);
	background-size: 32px 32px, 32px 32px, auto, auto;
}

.lr-livery__stage-top,
.lr-livery__stage-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 10px;
	line-height: 1.3;
	letter-spacing: .11em;
	text-transform: uppercase;
	color: var(--muted, #9a9ca3);
}

.lr-livery__kicker {
	margin: 0;
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 10px;
	letter-spacing: .11em;
	text-transform: uppercase;
	color: var(--muted, #9a9ca3);
}

.lr-livery__stage-meta {
	color: color-mix(in oklch, var(--muted, #9a9ca3) 72%, transparent);
	white-space: nowrap;
}

.lr-livery__stage-foot {
	margin-top: 10px;
	padding-top: 12px;
	border-top: 1px solid color-mix(in oklch, var(--fg, #f4f4f4) 10%, transparent);
}

.lr-livery__stage-name {
	font-size: 11.5px;
	letter-spacing: .06em;
	color: var(--fg, #f4f4f4);
}

.lr-livery__stage-code {
	font-size: 9.5px;
	color: var(--muted, #9a9ca3);
}

.lr-livery__art {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
	min-height: 260px;
	padding: 18px 0 10px;
}

.lr-livery__art svg {
	display: block;
	width: 100%;
	max-width: 1080px;
	margin: 0 auto;
	height: auto;
	max-height: 420px;
	overflow: visible;
}

.lr-livery__loading {
	padding: 28px;
	font-size: 13px;
	color: var(--muted, #9a9ca3);
}

.lr-livery__loading.is-error {
	max-width: 34ch;
	color: var(--warn, #f2c300);
}

.lr-livery__panel {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
	padding: 20px;
	background: var(--surface, #141519);
	border-left: 1px solid var(--border, #2a2c32);
}

.lr-livery__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--border, #2a2c32);
}

.lr-livery__title {
	margin: 5px 0 3px;
	font-family: var(--font-display, inherit);
	font-size: 23px;
	line-height: 1.08;
	letter-spacing: -.025em;
	color: var(--fg, #f4f4f4);
}

.lr-livery__era {
	margin: 0;
	font-size: 12px;
	line-height: 1.45;
	color: var(--muted, #9a9ca3);
}

.lr-livery__badge {
	flex: 0 0 auto;
	padding: 5px 8px;
	border: 1px solid color-mix(in oklch, var(--accent, #d86cff) 35%, transparent);
	border-radius: 999px;
	background: color-mix(in oklch, var(--accent, #d86cff) 9%, transparent);
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 8.5px;
	line-height: 1.2;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--accent, #d86cff);
}

.lr-livery__swatches {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.lr-livery__swatch {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 62px;
	padding: 9px 10px;
	border: 1px solid var(--border, #2a2c32);
	border-radius: 11px;
	background: transparent;
	color: var(--fg, #f4f4f4);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.lr-livery__swatch:hover {
	border-color: color-mix(in oklch, var(--fg, #f4f4f4) 28%, transparent);
	background: color-mix(in oklch, var(--fg, #f4f4f4) 4%, transparent);
}

.lr-livery__swatch.is-selected {
	border-color: color-mix(in oklch, var(--accent, #d86cff) 62%, transparent);
	background: color-mix(in oklch, var(--accent, #d86cff) 8%, transparent);
}

.lr-livery__swatch:focus-visible {
	outline: 2px solid var(--accent, #d86cff);
	outline-offset: 2px;
}

.lr-livery__dots {
	display: flex;
	flex: 0 0 auto;
	gap: 3px;
}

.lr-livery__dot {
	display: block;
	width: 12px;
	height: 30px;
	border: 1px solid color-mix(in oklch, var(--fg, #f4f4f4) 22%, transparent);
	border-radius: 3px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.lr-livery__swatch-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	gap: 2px;
}

.lr-livery__swatch-body b {
	display: -webkit-box;
	overflow: hidden;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.22;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.lr-livery__swatch-body small {
	overflow: hidden;
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 8.5px;
	line-height: 1.3;
	color: var(--muted, #9a9ca3);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lr-livery__sub {
	margin: 4px 0 -2px;
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 9px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted, #9a9ca3);
}

.lr-livery__palette {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.lr-livery__colour {
	display: grid;
	grid-template-columns: 12px minmax(0, 1fr) auto;
	align-items: center;
	gap: 8px;
	min-height: 38px;
	padding: 4px 0;
	border-bottom: 1px solid color-mix(in oklch, var(--fg, #f4f4f4) 7%, transparent);
}

.lr-livery__colour:last-child {
	border-bottom: 0;
}

.lr-livery__colour .lr-livery__dot {
	width: 12px;
	height: 22px;
}

.lr-livery__colour-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.lr-livery__colour-text b {
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
}

.lr-livery__colour-text small {
	overflow: hidden;
	font-size: 9.5px;
	line-height: 1.35;
	color: var(--muted, #9a9ca3);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lr-livery__hex {
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 9px;
	color: var(--muted, #9a9ca3);
}

.lr-livery__layers {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.lr-livery__layer {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 7px;
	border: 1px solid var(--border, #2a2c32);
	border-radius: 999px;
	font-size: 9.5px;
	line-height: 1.2;
	color: var(--muted, #9a9ca3);
}

.lr-livery__layer code {
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: 8.5px;
	color: var(--fg, #f4f4f4);
}

.lr-livery.is-compact .lr-livery__panel {
	padding: 14px;
	gap: 9px;
}

.lr-livery.is-compact .lr-livery__art {
	min-height: 170px;
	padding-block: 8px;
}

.lr-livery.is-compact .lr-livery__title {
	font-size: 19px;
}

.lr-livery.is-compact .lr-livery__swatch {
	min-height: 48px;
	padding: 7px 8px;
}

.lr-livery.is-compact .lr-livery__palette,
.lr-livery.is-compact .lr-livery__layers {
	display: none;
}

@container (max-width: 860px) {
	.lr-livery {
		grid-template-columns: minmax(0, 1fr);
	}
	.lr-livery__panel {
		border-left: 0;
		border-top: 1px solid var(--border, #2a2c32);
	}
	.lr-livery__art {
		min-height: 190px;
	}
}

@media (max-width: 540px) {
	.lr-livery__stage {
		padding: 13px;
	}
	.lr-livery__panel {
		padding: 14px;
	}
	.lr-livery__art {
		min-height: 150px;
		padding: 4px 0;
	}
	.lr-livery__stage-meta {
		display: none;
	}
	.lr-livery__swatches {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.lr-livery__swatch {
		min-height: 54px;
		padding: 8px;
	}
	.lr-livery__swatch-body b {
		font-size: 10.5px;
	}
	.lr-livery__title {
		font-size: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lr-livery__swatch {
		transition: none;
	}
}
