/* Game-like craft popup used by the Wiki craft section. */
.wiki-model-stage { position: relative; width: 100%; height: 320px; touch-action: none; }
.wiki-model-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.wiki-model-stage canvas:active { cursor: grabbing; }
.wiki-model-stage img { width: 100%; height: 100%; object-fit: contain; }
.wiki-model-stage img[hidden] { display: none; }
.craft-game-modal.is-boss .game-craft-body,
.craft-game-modal.is-boss .game-craft-footer { display: none; }
.craft-game-modal.is-boss .game-craft-window { min-height: 0; background: #151917; border: 3px ridge #82785e; border-radius: 4px; }
.craft-game-modal.is-boss .game-craft-titlebar { height: 42px; margin: 6px; border: 2px ridge #94836a; background: linear-gradient(#742321, #340e12); font-size: 16px; padding: 0 34px; text-align: center; }
.craft-game-modal.is-boss .game-shop-products { max-height: 75vh; padding: 12px; }
.boss-target-layout { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 12px; align-items: start; }
.boss-target-model { min-width: 0; border: 3px ridge #82785e; background: #0b100e; padding: 8px; }
.boss-target-model .wiki-model-stage, .boss-target-model > .boss-target-portrait { height: 350px; margin: 0; }
.boss-target-details { min-width: 0; padding: 10px; border: 1px solid #82785e; background: #101512; }
.boss-target-details > h3 { text-align: center; }
.boss-target-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, auto); gap: 2px 10px; margin: 10px 0; font-size: 12px; line-height: 1.35; color: #e7dfc9; }
.boss-target-stats dt { font-weight: 400; overflow-wrap: anywhere; }
.boss-target-stats dd { margin: 0; text-align: right; color: #fff; overflow-wrap: anywhere; }
.boss-target-details .boss-target-info { padding: 8px 0; margin: 0 0 10px; border-bottom: 1px solid #514934; line-height: 1.4; }
.boss-target-item-info { min-height: 38px; margin: 0; white-space: pre-line; color: #eee4c9; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
 .boss-target-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
 .boss-target-model .wiki-model-stage, .boss-target-model > .boss-target-portrait { height: 230px; }
}
.boss-target-info { color: #e7dfc9; font-size: 13px; text-align: center; min-height: 34px; white-space: pre-line; overflow-wrap: anywhere; }
.boss-target-portrait { display: block; width: 100%; height: 280px; object-fit: contain; margin-bottom: 16px; }
.boss-target-fallback { display: block; max-width: 100%; height: auto; margin: auto; }
.craft-game-modal.is-boss .game-shop-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 3px; margin-bottom: 10px; }
.craft-game-modal.is-boss .game-shop-slot { max-height: 70px; }
.game-shop-products[hidden] { display: none; }
.is-shop .game-craft-body { display: none; }
.is-shop .game-craft-window { min-height: 0; }
.is-shop .game-craft-actions { display: none; }
.game-shop-products { padding: 16px; max-height: 65vh; overflow-y: auto; }
.game-shop-products h3 { font-size: 14px; color: #e8d9b8; margin: 0 0 12px; overflow-wrap: anywhere; letter-spacing: 0; }
.game-shop-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 16px; }
.game-shop-slot { position: relative; aspect-ratio: 1; min-width: 0; padding: 4px; border: 1px solid #897650; border-radius: 2px; background: #101313; color: #fff; }
.game-shop-slot:hover, .game-shop-slot:focus-visible { outline: 2px solid #dfc684; outline-offset: 1px; background: #26332f; }
.game-shop-slot img { width: 100%; height: 100%; object-fit: contain; }
.game-shop-slot span { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: bold; text-shadow: 0 1px 2px #000; }
.is-shop .game-craft-footer { display: block; min-height: 64px; }
.is-shop .game-craft-info { width: 100%; overflow-wrap: anywhere; }
.craft-game-modal.is-shop .game-craft-window { border: 3px ridge #908574; border-radius: 5px; background: #171a19; box-shadow: inset 0 0 0 2px #080909, 0 12px 40px #000; }
.craft-game-modal.is-shop .game-craft-titlebar { height: 34px; margin: 4px; border: 2px ridge #8a7961; font-size: 13px; background: linear-gradient(#793811, #351708); }
.craft-game-modal.is-shop .game-shop-products { padding: 5px 10px; max-height: 70vh; }
.craft-game-modal.is-shop .game-shop-products h3 { text-align: center; margin: 2px 0 8px; font-size: 15px; }
.craft-game-modal.is-shop .game-shop-grid { gap: 2px; margin-bottom: 6px; }
.craft-game-modal.is-shop .game-shop-slot { border: 2px ridge #75684d; background: linear-gradient(135deg, #1c201e, #080a09); border-radius: 0; padding: 5px; box-shadow: inset 0 0 8px #000; }
.craft-game-modal.is-shop .game-shop-slot.is-selected { border-color: #ddcb87; background: #28312b; }
.craft-game-modal.is-shop .game-shop-slot.is-empty { pointer-events: none; }
.craft-game-modal.is-shop .game-craft-footer { padding: 8px 12px; border-top: 2px ridge #756d60; background: #191c1b; }
.craft-game-modal.is-shop .game-craft-info-line { color: #eee4c9; font-size: 13px; }
.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;
	}
}

@media (max-width: 640px) {
	.craft-game-modal .modal-dialog {
		width: calc(100vw - 8px);
		max-width: none;
		margin: 4px auto;
	}

	.craft-game-modal .modal-content {
		max-height: calc(100dvh - 8px);
		overflow: hidden;
	}

	.game-craft-window {
		max-height: calc(100dvh - 8px);
		border-width: 1px;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.game-craft-body {
		display: flex;
		flex-direction: column;
	}

	.game-craft-search {
		position: sticky;
		top: 0;
		z-index: 3;
		background: rgba(22, 13, 7, 0.96);
	}

	.game-craft-list {
		height: min(154px, 30dvh);
	}

	.game-craft-stage {
		min-height: 330px;
		padding: 14px 10px;
	}

	.game-craft-circle {
		width: min(244px, 70vw);
	}

	.game-craft-materials {
		width: min(274px, calc(100% - 18px));
		gap: 10px;
	}

	.game-craft-actions {
		grid-template-columns: 34px minmax(0, 1fr) 34px 52px;
		width: 100%;
	}

	.game-craft-quantity {
		min-width: 0;
	}
}

@media (max-width: 380px) {
	.game-craft-titlebar {
		gap: 6px;
		padding: 0 8px;
	}

	.game-craft-stage {
		min-height: 304px;
	}

	.game-craft-circle {
		width: min(214px, 68vw);
	}

	.game-craft-materials {
		width: min(248px, calc(100% - 14px));
	}

	.game-craft-node-icon,
	.game-craft-output-icon {
		width: 40px;
		height: 40px;
	}

	.game-craft-output-icon {
		width: 48px;
		height: 48px;
	}

	.game-craft-actions {
		grid-template-columns: 32px minmax(0, 1fr) 32px;
	}

	.game-craft-produce {
		grid-column: 1 / -1;
	}
}
