/* Game-like craft popup used by the Wiki craft section. */
.craft-game-modal .modal-dialog {
	width: min(var(--craft-modal-width, 920px), calc(100vw - 28px));
	max-width: none;
}

.craft-game-modal .modal-content {
	background: transparent;
	border: 0;
}

.game-craft-window {
	--craft-border: #1d1710;
	--craft-gold: #b98245;
	--craft-orange: #d45f27;
	--craft-panel: rgba(16, 15, 13, 0.96);
	width: 100%;
	min-height: 640px;
	color: #d7d0bd;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 80px),
		radial-gradient(circle at 64% 43%, rgba(185, 130, 69, 0.13), transparent 34%),
		linear-gradient(135deg, #0d0d0d, #1a1712 52%, #0c0c0b);
	border: 2px solid #3b3329;
	box-shadow:
		0 28px 80px rgba(0, 0, 0, 0.65),
		inset 0 0 0 2px #0b0a08,
		inset 0 0 0 4px rgba(150, 95, 48, 0.22);
	position: relative;
	overflow: hidden;
	font-family: "Inter", sans-serif;
}

.game-craft-window::before {
	content: "";
	position: absolute;
	inset: 8px;
	border: 1px solid rgba(255, 179, 94, 0.16);
	pointer-events: none;
}

.game-craft-titlebar {
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	background:
		linear-gradient(180deg, #8f3f18, #4d2010 48%, #22130d);
	border-bottom: 1px solid #0a0705;
	box-shadow: inset 0 1px rgba(255, 187, 105, 0.45), inset 0 -1px rgba(0, 0, 0, 0.75);
	color: #f7dfb8;
	font-size: 0.8rem;
	text-shadow: 0 1px 2px #000;
}

.game-craft-close {
	position: absolute;
	top: 5px;
	right: 7px;
	width: 22px;
	height: 22px;
	border: 1px solid #6a5a46;
	border-radius: 2px;
	background: linear-gradient(180deg, #54493c, #171410);
	color: #fff2d6;
	line-height: 18px;
	font-size: 1rem;
}

.game-craft-body {
	display: grid;
	grid-template-columns: 304px minmax(0, 1fr);
	min-height: 532px;
	border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.game-craft-sidebar {
	border-right: 1px solid rgba(179, 133, 80, 0.26);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
		rgba(10, 10, 9, 0.7);
	padding: 8px 8px 0;
}

.game-craft-search {
	display: grid;
	grid-template-columns: 1fr 34px;
	gap: 4px;
	margin-bottom: 8px;
}

.game-craft-search input,
.game-craft-search button {
	height: 34px;
	border: 1px solid #3a332a;
	background: #11100e;
	color: #cfc4ae;
}

.game-craft-search input {
	padding: 0 10px;
	font-size: 0.78rem;
	outline: none;
}

.game-craft-search button {
	display: grid;
	place-items: center;
	color: #d0a575;
}

.game-craft-group {
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 11px;
	margin-bottom: 5px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.26)),
		#171511;
	border: 1px solid #42382b;
	color: #f0ddbd;
	font-size: 0.82rem;
}

.game-craft-group i {
	color: #ddad72;
}

.game-craft-list-group {
	width: 100%;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 0 12px;
	margin: 10px 0 5px;
	border: 1px solid #7b6143;
	border-left: 4px solid #d7a15e;
	background:
		linear-gradient(90deg, rgba(214, 124, 46, 0.32), rgba(64, 44, 29, 0.7) 38%, rgba(18, 15, 12, 0.94)),
		linear-gradient(180deg, rgba(255, 222, 166, 0.16), rgba(0, 0, 0, 0.28)),
		#2a2118;
	color: #ffe0af;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.1px;
	text-align: left;
	text-shadow: 0 1px 2px #000;
	box-shadow:
		inset 0 1px rgba(255, 230, 179, 0.24),
		inset 0 -1px rgba(0, 0, 0, 0.6),
		0 2px 8px rgba(0, 0, 0, 0.28);
}

.game-craft-list-group:first-child {
	margin-top: 0;
}

.game-craft-list-group span {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.game-craft-list-group i {
	color: #ffd18d;
	filter: drop-shadow(0 0 4px rgba(255, 159, 65, 0.35));
}

.game-craft-list-group span i {
	width: 24px;
	height: 24px;
	display: inline-grid;
	place-items: center;
	border-radius: 3px;
	background: linear-gradient(180deg, #6b563d, #211912);
	border: 1px solid rgba(255, 215, 156, 0.35);
}

.game-craft-list {
	height: 410px;
	overflow-y: auto;
	padding-right: 4px;
	scrollbar-width: thin;
	scrollbar-color: #a7a7a7 #1a1815;
}

.game-craft-list::-webkit-scrollbar {
	width: 13px;
}

.game-craft-list::-webkit-scrollbar-track {
	background: #191713;
	border-left: 1px solid #0b0a08;
}

.game-craft-list::-webkit-scrollbar-thumb {
	background:
		linear-gradient(90deg, #bdbdbd, #707070);
	border: 2px solid #191713;
	border-radius: 8px;
}

.game-craft-item {
	width: 100%;
	height: 38px;
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 0 9px;
	margin-bottom: 4px;
	border: 1px solid #332c23;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.22)),
		#191713;
	color: #bbb19d;
	font-size: 0.78rem;
	text-align: left;
	transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.game-craft-list-group[hidden],
.game-craft-item[hidden] {
	display: none !important;
}

.game-craft-item:hover,
.game-craft-item.is-active {
	border-color: #8a5731;
	background:
		linear-gradient(180deg, rgba(180, 105, 47, 0.22), rgba(0, 0, 0, 0.12)),
		#221914;
	color: #f0dfc0;
}

.game-craft-item-icon,
.game-craft-node-icon,
.game-craft-output-icon {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	border: 1px solid rgba(255, 202, 122, 0.36);
	background:
		radial-gradient(circle at 35% 30%, rgba(255, 236, 164, 0.85), transparent 20%),
		linear-gradient(135deg, var(--item-a, #a56c31), var(--item-b, #312015));
	box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.45), 0 0 12px rgba(218, 128, 49, 0.18);
	color: #17100b;
	text-shadow: 0 1px rgba(255, 255, 255, 0.35);
	overflow: hidden;
}

.game-craft-item-icon {
	width: 23px;
	height: 23px;
	border-radius: 5px;
	font-size: 0.72rem;
}

.game-craft-item-icon img,
.game-craft-node-icon img,
.game-craft-output-icon img {
	display: block;
	width: 82%;
	height: 82%;
	object-fit: contain;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

.game-craft-stage {
	position: relative;
	min-height: 532px;
	background:
		radial-gradient(circle at 50% 44%, rgba(221, 177, 106, 0.18), transparent 30%),
		radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.035), transparent 44%),
		linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.18));
	overflow: hidden;
}

.game-craft-stage-title {
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 1px solid rgba(165, 124, 72, 0.22);
	color: #efe2cc;
	font-size: 0.78rem;
}

.game-craft-circle {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 330px;
	aspect-ratio: 1;
	transform: translate(-50%, -52%);
	border-radius: 50%;
	background:
		repeating-conic-gradient(from 12deg, rgba(255, 225, 163, 0.18) 0 8deg, transparent 8deg 18deg),
		radial-gradient(circle, transparent 0 31%, rgba(248, 212, 150, 0.18) 33%, transparent 36%),
		radial-gradient(circle, rgba(225, 179, 105, 0.34), rgba(174, 118, 61, 0.14) 42%, transparent 67%);
	filter: drop-shadow(0 0 28px rgba(234, 179, 99, 0.28));
	animation: craftCircleSpin 18s linear infinite;
}

.game-craft-circle::before,
.game-craft-circle::after {
	content: "";
	position: absolute;
	inset: 42px;
	border-radius: 50%;
	border: 2px solid rgba(244, 216, 160, 0.2);
}

.game-craft-circle::after {
	inset: 88px;
	border-style: dashed;
}

.game-craft-materials {
	position: absolute;
	left: 50%;
	top: 50%;
	width: min(390px, calc(100% - 44px));
	aspect-ratio: 1;
	transform: translate(-50%, -52%);
	z-index: 2;
}

.game-craft-node,
.game-craft-output {
	position: absolute;
	display: grid;
	justify-items: center;
	gap: 5px;
	transform: translate(-50%, -50%);
	z-index: 2;
}

.game-craft-materials .game-craft-node {
	z-index: 3;
}

.game-craft-node-icon,
.game-craft-output-icon {
	width: 54px;
	height: 54px;
	border-radius: 50%;
	font-size: 1.15rem;
}

.game-craft-output-icon {
	width: 62px;
	height: 62px;
	font-size: 1.35rem;
	border-color: rgba(255, 229, 171, 0.7);
}

.game-craft-materials.is-dense .game-craft-node-icon {
	width: 46px;
	height: 46px;
	font-size: 1rem;
}

.game-craft-materials.is-dense .game-craft-count {
	min-width: 38px;
	height: 18px;
	font-size: 0.66rem;
}

.game-craft-materials.is-ultra-dense .game-craft-node-icon {
	width: 40px;
	height: 40px;
	font-size: 0.9rem;
}

.game-craft-materials.is-ultra-dense .game-craft-count {
	min-width: 34px;
	height: 17px;
	font-size: 0.62rem;
}

.game-craft-count {
	min-width: 44px;
	height: 20px;
	display: grid;
	place-items: center;
	background: #080806;
	border: 1px solid #514335;
	color: #b7e2c8;
	font-size: 0.72rem;
	line-height: 1;
}

.game-craft-count.is-missing {
	color: #ff9081;
}

.game-craft-node--result { left: 50%; top: 86%; }
.game-craft-output { left: 50%; top: 46%; }

.game-craft-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 74px;
	padding: 8px 12px;
	border-top: 1px solid rgba(155, 112, 63, 0.35);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.14)),
		#17140f;
}

.game-craft-info {
	display: grid;
	gap: 4px;
	min-width: 0;
	padding-right: 12px;
	color: #e8d7b8;
	font-size: 0.78rem;
}

.game-craft-info-line {
	color: #f5d29e;
	text-shadow: 0 1px 2px #000;
}

.game-craft-detail {
	max-width: 540px;
	color: #a99f8c;
	line-height: 1.45;
}

.game-craft-detail strong {
	color: #d4b27d;
	margin-right: 5px;
}

.game-craft-actions {
	display: grid;
	grid-template-columns: 28px 58px 28px 42px;
	gap: 5px;
	align-items: center;
}

.game-craft-step,
.game-craft-max,
.game-craft-produce {
	height: 30px;
	border: 1px solid #5b4937;
	background: linear-gradient(180deg, #2d271f, #100f0d);
	color: #ead8b9;
}

.game-craft-step,
.game-craft-max {
	display: grid;
	place-items: center;
}

.game-craft-qty {
	height: 30px;
	display: grid;
	place-items: center;
	background: #0b0a08;
	border: 1px solid #5b4937;
	color: #fff;
	font-size: 0.78rem;
}

.game-craft-produce {
	grid-column: 1 / -1;
}

@keyframes craftCircleSpin {
	to {
		transform: translate(-50%, -52%) rotate(360deg);
	}
}

@media (max-width: 820px) {
	.craft-game-modal .modal-dialog {
		width: calc(100vw - 16px);
		margin-right: auto;
		margin-left: auto;
	}

	.game-craft-window {
		min-height: 0;
		max-height: calc(100dvh - 16px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.game-craft-body {
		grid-template-columns: 1fr;
		min-height: 0;
	}

	.game-craft-sidebar {
		border-right: 0;
		border-bottom: 1px solid rgba(179, 133, 80, 0.26);
	}

	.game-craft-list {
		height: 220px;
	}

	.game-craft-stage {
		min-height: 430px;
	}

	.game-craft-circle {
		width: min(300px, 78vw);
	}

	.game-craft-footer {
		gap: 10px;
		align-items: stretch;
		flex-direction: column;
	}

	.game-craft-info {
		padding-right: 0;
	}
}

@media (max-width: 520px) {
	.craft-game-modal .modal-dialog {
		width: calc(100vw - 10px);
		margin-top: 5px;
		margin-bottom: 5px;
	}

	.game-craft-titlebar {
		height: 30px;
		font-size: 0.74rem;
	}

	.game-craft-sidebar {
		padding: 7px 7px 0;
	}

	.game-craft-list {
		height: 168px;
	}

	.game-craft-item {
		height: 36px;
		font-size: 0.74rem;
	}

	.game-craft-stage {
		min-height: 350px;
	}

	.game-craft-circle {
		width: min(238px, 72vw);
	}

	.game-craft-materials {
		width: min(292px, calc(100% - 22px));
	}

	.game-craft-node-icon,
	.game-craft-output-icon {
		width: 44px;
		height: 44px;
	}

	.game-craft-output-icon {
		width: 52px;
		height: 52px;
	}

	.game-craft-count {
		min-width: 34px;
		height: 18px;
		font-size: 0.64rem;
	}

	.game-craft-footer {
		padding: 8px;
	}

	.game-craft-actions {
		grid-template-columns: 32px minmax(52px, 1fr) 32px 48px;
	}
}
