/* Chest reward popup (seefood "Rewards" carousel): a scrollable "item card"
 * region so a chest that yields many items wraps and scrolls inside the
 * popup instead of overflowing it horizontally. Mirrors the reward-card /
 * reward-item language already used by the battle victory loot panel
 * (packages/ui/Battle/reward.css) and the --color-{rarity} accent
 * convention used by Stats (packages/ui/Hero/gearStats.tsx). */

.rewards-card {
	width: 100%;
	max-width: 42rem;
	margin-inline: auto;
	background: var(--color-base-200);
	border-radius: var(--radius-box, 1rem);
	box-shadow: 0 1px 3px color-mix(in oklch, black 12%, transparent);
	padding-block: 1rem 1.25rem;
}

.rewards-heading {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rewards-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 9999px;
	background: var(--color-base-300);
	color: var(--color-base-content);
	font-size: 0.72rem;
	font-weight: 700;
}

.chest-rarity-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 9999px;
	font-size: 0.72rem;
	font-weight: 700;
	color: oklch(var(--accent));
	background: color-mix(in oklch, oklch(var(--accent)) 15%, transparent);
	border: 1px solid color-mix(in oklch, oklch(var(--accent)) 35%, transparent);
}

.chest-icon {
	transition:
		transform 0.15s ease,
		filter 0.15s ease;
}

.chest-icon--closed {
	cursor: pointer;
}

.chest-icon--closed:hover {
	transform: translateY(-2px) scale(1.03);
	filter: drop-shadow(
		0 6px 16px color-mix(in oklch, oklch(var(--accent)) 55%, transparent)
	);
}

.chest-icon--opened {
	cursor: pointer;
	opacity: 0.92;
}

.chest-icon--opened:hover {
	opacity: 1;
}

/* Scroll region for the loot popup's contents -- caps the popup's height so
 * a big haul wraps into rows and scrolls in place rather than pushing the
 * popup off-screen or spilling items past its edges. */
.loot-popup {
	display: flex;
	flex-direction: column;
	max-height: min(78vh, 620px);
	overflow-y: auto;
	overflow-x: hidden;
	padding: 2px 2px 4px;
	scrollbar-width: thin;
}

.loot-popup__section {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 14px 4px 12px;
}

.loot-popup__rule {
	flex: 1;
	height: 1px;
	background: linear-gradient(to right, transparent, var(--color-base-300));
}

.loot-popup__section .loot-popup__rule:last-child {
	background: linear-gradient(to left, transparent, var(--color-base-300));
}

.loot-popup__title {
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--color-base-content);
	opacity: 0.75;
	white-space: nowrap;
}

/* Top-right close button, inside the popup's bounds -- the previous
 * bottom-edge placement straddled the popup border and got clipped by its
 * overflow-hidden. */
.loot-popup__close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 26px;
	width: 26px;
	border-radius: 9999px;
	color: var(--color-base-content);
	background: color-mix(in oklch, var(--color-base-300) 70%, transparent);
	cursor: pointer;
	transition:
		transform 0.15s ease,
		background 0.15s ease;
}

.loot-popup__close:hover {
	background: var(--color-base-300);
	transform: scale(1.08);
}

.loot-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-content: flex-start;
	gap: 10px;
	padding: 2px 4px 10px;
}

.loot-item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	flex: 0 0 auto;
	border-radius: 0.75rem;
	cursor: pointer;
	background-color: color-mix(
		in oklch,
		oklch(var(--accent)) 10%,
		var(--color-base-200)
	);
	box-shadow:
		inset 0 0 0 2px color-mix(in oklch, oklch(var(--accent)) 55%, transparent),
		0 2px 8px color-mix(in oklch, oklch(var(--accent)) 20%, transparent);
	transition:
		transform 0.15s ease,
		box-shadow 0.15s ease;
}

.loot-item__sprite {
	width: 100%;
	height: 100%;
}

.loot-item:hover,
.loot-item--selected {
	transform: translateY(-2px);
	box-shadow:
		inset 0 0 0 2px oklch(var(--accent)),
		0 4px 14px color-mix(in oklch, oklch(var(--accent)) 45%, transparent);
}

.loot-item__stack {
	position: absolute;
	right: -6px;
	bottom: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9999px;
	background: var(--color-base-100);
	border: 1px solid var(--color-base-300);
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
}

