@font-face {
	font-family: "MC";
	src: url("/minecraft.ttf") format("truetype");
	font-display: swap;
}

:root {
	--bg: #0d0a14;
	--panel: #1b1420;
	--panel-edge: #c6c6c6;
	--panel-shade: #555;
	--title: #7a1111;
	--title-text: #fff;
	--text: #f2ecef;
	--muted: #b6a9b3;
	--btn: #2f8f5b;
	--btn-dark: #1c5a39;
	--common: #ffffff;
	--uncommon: #55ff55;
	--rare: #55ffff;
	--legendary: #ffaa00;
	--shadow: #3f3f3f;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

html {
	background: var(--bg);
}

body {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.5 "MC", ui-monospace, monospace;
	-webkit-font-smoothing: none;
}

body.page {
	align-items: flex-start;
}

main {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	width: 100%;
	padding: 16px;
}

.page main {
	padding: 32px 16px 48px;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.px {
	image-rendering: pixelated;
}

img {
	pointer-events: none;
	user-select: none;
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
}

.screen {
	--u: calc(100cqw / 244);
	container-type: inline-size;
	position: relative;
	flex: none;
	width: min(976px, 100%);
	aspect-ratio: 244 / 188;
	filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.6));
}

.screen > *,
.box > *,
.slot > * {
	position: absolute;
}

.screen > * {
	left: calc(var(--x) * var(--u));
	top: calc(var(--y) * var(--u));
	width: calc(var(--w) * var(--u));
	height: calc(var(--h) * var(--u));
	margin: 0;
}

.box > img,
.slot > img {
	inset: 0;
	width: 100%;
	height: 100%;
}

.frame {
	pointer-events: none;
}

.label {
	font-family: "MC", monospace;
	font-size: calc(8 * var(--u));
	line-height: calc(10 * var(--u));
	color: #fff;
	text-shadow: var(--u) var(--u) 0 var(--shadow);
	white-space: nowrap;
	overflow-x: clip;
	overflow-y: visible;
}

.box > .label {
	left: calc(var(--tx, 0) * var(--u));
	top: calc(var(--ty) * var(--u));
	height: auto;
	width: auto;
	right: calc(3 * var(--u));
}

.center {
	text-align: center;
}

.box > .center {
	left: calc(3 * var(--u));
}

.message {
	color: #ff5555;
	text-shadow: var(--u) var(--u) 0 #3f1515;
}

.rarity {
	font-style: italic;
	overflow: visible;
}

.slots {
	display: flex;
	gap: calc(3 * var(--u));
}

.slot {
	position: relative;
	flex: none;
	width: calc(43 * var(--u));
	height: calc(73 * var(--u));
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.slot::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.25);
	opacity: 0;
}

.slot:hover::after {
	opacity: 1;
}

.slot:focus-visible {
	outline: calc(var(--u)) dashed #fff;
	outline-offset: calc(-2 * var(--u));
}

.slot.fresh {
	animation: restock 0.6s steps(6) both;
}

@keyframes restock {
	from {
		filter: brightness(3) saturate(0);
	}
	to {
		filter: none;
	}
}

.under {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 20px;
	text-align: center;
}

.under p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}

.back {
	align-self: flex-start;
	width: min(100%, 732px);
	margin: 0 auto;
	color: var(--muted);
	text-decoration: none;
}

.back:hover {
	color: var(--text);
}

.window {
	width: min(100%, 732px);
	background: var(--panel);
	border: 4px solid var(--panel-edge);
	border-right-color: var(--panel-shade);
	border-bottom-color: var(--panel-shade);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.titlebar {
	margin: 0;
	padding: 4px 12px;
	background: var(--title);
	color: var(--title-text);
	font-size: 16px;
	font-weight: normal;
	text-shadow: 2px 2px 0 #3f0808;
}

.window-body {
	padding: 16px 20px 20px;
}

.window-body > p {
	margin: 0 0 12px;
}

.window-body h2 {
	margin: 28px 0 4px;
	font-size: 16px;
	font-weight: normal;
	color: var(--legendary);
}

.hint {
	color: var(--muted);
	font-size: 14px;
}

.row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 12px 0 0;
}

.btn {
	display: inline-block;
	font: inherit;
	color: #fff;
	text-decoration: none;
	text-shadow: 2px 2px 0 var(--btn-dark);
	padding: 10px 22px;
	background: var(--btn);
	border: 0;
	cursor: pointer;
}

.btn:hover:not(:disabled) {
	filter: brightness(1.15);
}

.btn:active:not(:disabled) {
	filter: brightness(0.9);
}

.btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.btn.off {
	background: #8b1a1a;
	text-shadow: 2px 2px 0 #4a0c0c;
}

.btn.small {
	padding: 6px 14px;
	font-size: 14px;
}

.btn:focus-visible,
.pick input:focus-visible + .card {
	outline: 2px dashed #fff;
	outline-offset: 2px;
}

.tier h4 {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin: 20px 0 8px;
	font-size: 16px;
	font-weight: normal;
	font-style: italic;
}

.tier h4 span {
	font-style: normal;
	color: var(--muted);
	font-size: 14px;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
	gap: 10px;
}

.pick {
	position: relative;
	display: block;
	cursor: pointer;
}

.pick input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.card {
	display: block;
	border: 3px solid #000;
	background: #2a1f2a;
	text-align: center;
}

.card img {
	display: block;
	width: 100%;
	aspect-ratio: 43 / 73;
	object-fit: cover;
	background: url("/gui/roster_slot.png") center / cover;
	image-rendering: pixelated;
	filter: grayscale(0.85) brightness(0.6);
	transition: filter 0.15s steps(3);
}

.card span {
	display: block;
	padding: 4px 2px 6px;
	font-size: 12px;
	line-height: 1.2;
	color: var(--muted);
}

.pick:hover .card img {
	filter: grayscale(0.4) brightness(0.85);
}

.pick input:checked + .card {
	border-color: #fff;
	box-shadow: 0 0 0 2px var(--title);
}

.pick input:checked + .card img {
	filter: none;
}

.pick input:checked + .card span {
	color: #fff;
}

footer {
	max-width: 732px;
	text-align: center;
	color: var(--muted);
	font-size: 14px;
}

footer p {
	margin: 4px 0;
}

@media (prefers-reduced-motion: reduce) {
	.slot.fresh {
		animation: none;
	}

	.card img {
		transition: none;
	}
}
