@font-face {
	font-family: "RacingSansOne";
	src: url("fonts/RacingSansOne-Regular.ttf") format("truetype");
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg-color: #0d1117;
	--surface-color: #161b22;
	--surface-elevated: #1c2128;
	--text-color: #e6edf3;
	--text-secondary: #8b949e;
	--primary-color: #1f6feb;
	--accent-color: #7c3aed;
	--energy-color: #00d4ff;
	--success-color: #3fb950;
	--error-color: #f85149;
	--grid-cell-size: 48px;
	--border-radius: 12px;
	--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
	--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
	--shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
	--shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html, body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
	background: linear-gradient(135deg, var(--bg-color) 0%, #0a0d14 100%);
	color: var(--text-color);
	overflow: hidden;
	width: 100%;
	height: 100vh;
	max-width: 100vw;
	user-select: none;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
	/* Remove tap highlight and selection */
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
}

.app {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: -webkit-fill-available; /* iOS Safari fix for viewport height */
	max-height: 100vh;
	padding: 12px;
	gap: 12px;
	overflow: hidden; /* Prevent page scrolling */
	width: 100%;
	max-width: 100vw;
	background: linear-gradient(135deg, #0a0d14 0%, #0d1117 50%, #0a0d14 100%);
	/* Ensure app uses full viewport height */
	min-height: 100vh;
	min-height: -webkit-fill-available; /* iOS Safari fix */
	box-sizing: border-box;
	/* Force hardware acceleration for better rendering on iOS */
	transform: translateZ(0);
	-webkit-transform: translateZ(0);
}

.header {
	text-align: center;
	padding: 4px;
	backdrop-filter: blur(10px);
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.header h1 {
	font-family: "RacingSansOne", sans-serif;
	font-size: 32px;
	font-weight: normal;
	letter-spacing: 1px;
	margin: 0;
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 35%, #00d4ff 70%, #7c3aed 100%);
	background-size: 200% 200%;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: header-gradient-shift 4s ease infinite;
	text-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
	position: relative;
	flex: 1;
}

.header h1::before {
	content: "HashHunter";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 35%, #00d4ff 70%, #7c3aed 100%);
	background-size: 200% 200%;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: header-gradient-shift 4s ease infinite;
	filter: blur(4px);
	opacity: 0.4;
	z-index: -1;
}

@keyframes header-gradient-shift {
	0%, 100% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
}

.music-toggle {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	width: 24px;
	height: 24px;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	line-height: 1;
	z-index: 1000;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	pointer-events: auto;
	user-select: none;
}

.music-toggle:hover {
	transform: translateY(-50%) scale(1.15);
	opacity: 0.8;
}

.music-toggle-muted {
	opacity: 0.5;
}

.hud {
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.95) 0%, rgba(22, 27, 34, 0.95) 100%);
	padding: 10px 12px;
	border-radius: 10px 10px 0 0;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
	position: relative;
	backdrop-filter: blur(10px);
	overflow: hidden;
	width: 100%;
	min-width: 0;
	flex-shrink: 0;
}

.hud::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: url('images/hud-bg.png') center/cover no-repeat;
	opacity: 0.2;
	border-radius: 8px;
	pointer-events: none;
	z-index: 0;
}

.hud-top-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	position: relative;
	z-index: 1;
	width: 100%;
	min-width: 0;
	flex-shrink: 0;
}

.hud-energy-section {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.hud-stats-toggle {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
	border: 1px solid rgba(124, 58, 237, 0.4);
	border-radius: 8px;
	padding: 4px 6px;
	cursor: pointer;
	transition: all 0.2s;
	z-index: 10;
	flex-shrink: 0;
	box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
	align-self: center;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hud-stats-toggle:hover {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
	border-color: rgba(124, 58, 237, 0.6);
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.hud-button-icon {
	width: 26px;
	height: 26px;
	object-fit: contain;
	display: block;
}

.hud-stats-row {
	display: flex;
	gap: 6px;
	align-items: center;
	justify-content: space-around;
	flex-wrap: wrap;
	position: relative;
	z-index: 1;
	width: 100%;
	min-width: 0;
}

.hud-ores-section {
	display: flex;
	align-items: center;
}

.hud-label {
	font-size: 10px;
	font-weight: 600;
	opacity: 0.9;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--text-secondary);
	text-align: center;
}

.hud-energy {
	position: relative;
	flex: 1;
	min-width: 0;
	height: 18px !important;
	min-height: 18px !important;
	max-height: 18px !important;
	background: rgba(0, 0, 0, 0.7);
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.3);
	flex-shrink: 0;
}

.hud-energy-bar {
	height: 18px !important;
	min-height: 18px !important;
	width: 0%;
	min-width: 2px;
	background: linear-gradient(90deg, #00d4ff 0%, #00b8e6 50%, #0099cc 100%);
	transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	border-radius: 6px;
	box-shadow: 0 0 12px rgba(0, 212, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	overflow: hidden;
}

.hud-energy-bar::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
	pointer-events: none;
}

.hud-energy-value {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 10px;
	font-weight: 800;
	color: #ffffff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 1), 0 0 8px rgba(0, 212, 255, 0.7);
	z-index: 2;
	white-space: nowrap;
	pointer-events: none;
	width: 100%;
	text-align: center;
	letter-spacing: 0.3px;
}

.hud-energy-regen {
	font-size: 9px;
	color: var(--energy-color);
	opacity: 0.85;
	text-align: center;
	font-weight: 600;
	text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
	letter-spacing: 0.3px;
}

.hud-energy-bar.energy-growing {
	animation: energy-glow 0.5s ease-out;
}

@keyframes energy-glow {
	0% {
		box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
	}
	50% {
		box-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
	}
	100% {
		box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
	}
}

.hud-stat {
	font-size: 13px;
	font-weight: 700;
	padding: 6px 10px;
	display: flex;
	align-items: center;
	gap: 5px;
	transition: all 0.2s;
	flex: 1;
	min-width: 0;
	justify-content: center;
	background: rgba(255, 255, 255, 0.06);
	cursor: pointer;
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 6px;
}

.hud-stat-icon {
	width: 16px;
	height: 16px;
	object-fit: contain;
	flex-shrink: 0;
}


.hud-stat-value {
	font-weight: 800;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.hud-ores {
	font-size: 12px;
	color: var(--text-secondary);
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
	padding: 6px 10px;
	min-height: 30px;
	width: 100%;
	justify-content: center;
	font-weight: 500;
}

.hud-ores-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 6px;
	transition: all 0.2s ease;
	cursor: pointer;
}

.hud-ores-item:hover {
	background: rgba(255, 255, 255, 0.12);
	transform: translateY(-1px);
	box-shadow: var(--shadow-sm);
}

.hud-ores-item .ore-icon {
	width: 14px;
	height: 14px;
	object-fit: contain;
}

.hud-ores-item .ore-amount {
	font-weight: 600;
	font-size: 12px;
}

/* Ore Details Popup Container */
.ore-details-popup-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 3000;
	pointer-events: none;
	display: flex;
	justify-content: center;
	align-items: center;
}

/* Ore Details Popup */
.ore-details-popup {
	position: relative;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	text-align: center;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	opacity: 0;
	transition: opacity 0.2s ease;
	min-width: 280px;
	max-width: 360px;
	pointer-events: all;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.ore-details-popup.show {
	opacity: 1;
}

.ore-details-popup.hide {
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* Ore Details Popup Header */
.ore-details-popup-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 22px 28px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.25);
	border-radius: 18px 18px 0 0;
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, rgba(124, 58, 237, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
	position: relative;
	z-index: 2;
}

/* Ore Details Popup Icon */
.ore-details-popup-icon {
	margin: 0 auto 12px;
	display: block;
	width: 64px;
	height: 64px;
	object-fit: contain;
	animation: popup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
	position: relative;
}

/* Ore Name */
.ore-details-popup-name {
	font-size: 26px;
	font-weight: 800;
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	background: linear-gradient(135deg, #ffffff 0%, rgba(168, 85, 247, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

/* Ore Details Popup Content */
.ore-details-popup-content {
	padding: 24px 28px;
	text-align: center;
	position: relative;
	z-index: 2;
}

/* Amount Display */
.ore-details-popup-amount {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	padding: 16px 20px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border: 1px solid rgba(124, 58, 237, 0.2);
	border-radius: 12px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	color: var(--text-color);
	animation: fadeInUp 0.4s ease-out;
}

.ore-details-amount-label {
	font-size: 13px;
	font-weight: 500;
	opacity: 0.8;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.ore-details-amount-value {
	font-size: 24px;
	font-weight: 800;
	color: var(--energy-color);
	text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Stat Details Popup Container */
.stat-details-popup-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 3000;
	pointer-events: none;
	display: flex;
	justify-content: center;
	align-items: center;
}

/* Stat Details Popup */
.stat-details-popup {
	position: relative;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	text-align: center;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	opacity: 0;
	transition: opacity 0.2s ease;
	min-width: 280px;
	max-width: 360px;
	pointer-events: all;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.stat-details-popup.show {
	opacity: 1;
}

.stat-details-popup.hide {
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* Stat Details Popup Header */
.stat-details-popup-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 22px 28px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.25);
	border-radius: 18px 18px 0 0;
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, rgba(124, 58, 237, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
	position: relative;
	z-index: 2;
}

/* Stat Details Popup Icon */
.stat-details-popup-icon {
	margin: 0 auto 12px;
	display: block;
	width: 64px;
	height: 64px;
	object-fit: contain;
	animation: popup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
	position: relative;
}

/* Stat Name */
.stat-details-popup-name {
	font-size: 26px;
	font-weight: 800;
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	background: linear-gradient(135deg, #ffffff 0%, rgba(168, 85, 247, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

/* Stat Details Popup Content */
.stat-details-popup-content {
	padding: 24px 28px;
	text-align: center;
	position: relative;
	z-index: 2;
}

/* Value Display */
.stat-details-popup-value {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	padding: 16px 20px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border: 1px solid rgba(124, 58, 237, 0.2);
	border-radius: 12px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	color: var(--text-color);
	animation: fadeInUp 0.4s ease-out;
}

.stat-details-value-label {
	font-size: 13px;
	font-weight: 500;
	opacity: 0.8;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.stat-details-value-number {
	font-size: 24px;
	font-weight: 800;
	color: var(--energy-color);
	text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Additional Info */
.stat-details-popup-info {
	margin-top: 16px;
	text-align: left;
}

.stat-details-xp-progress {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
	border: 1px solid rgba(124, 58, 237, 0.15);
	border-radius: 8px;
}

.stat-details-progress-label {
	font-size: 12px;
	font-weight: 600;
	opacity: 0.9;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.stat-details-progress-bar {
	width: 100%;
	height: 8px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	overflow: hidden;
	position: relative;
}

.stat-details-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--energy-color) 0%, var(--accent-color) 100%);
	border-radius: 4px;
	transition: width 0.3s ease;
	box-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.stat-details-progress-text {
	font-size: 11px;
	font-weight: 600;
	opacity: 0.8;
	text-align: center;
}

.game-grid-container {
	flex: 1;
	position: relative;
	/* Container takes available space but can accommodate larger grid */
	width: 100%;
	height: 100%;
	height: -webkit-fill-available; /* iOS Safari fix */
	min-width: 0;
	min-height: 0;
	/* Hide overflow to prevent scrollbars - grid can extend beyond edges */
	overflow: hidden;
	/* The grid will be absolutely centered within this container */
	/* Even if grid is larger than container, it stays centered */
	/* Add top and bottom gradient overlays using box-shadow inset */
	box-shadow: 
		inset 0 30px 30px -30px rgba(13, 17, 23, 1),
		inset 0 -30px 30px -30px rgba(13, 17, 23, 1);
	/* Force recalculation on iOS */
	transform: translateZ(0);
	-webkit-transform: translateZ(0);
}

/* All 4 sides field borders for continuous field effect */
.game-grid-container::before,
.game-grid-container::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 40px; /* Wider gradient to cover overflow area */
	z-index: 5;
	pointer-events: none;
}

.game-grid-container::before {
	left: 0;
	/* More transparent gradient to allow overflow to be visible behind screen */
	background: linear-gradient(to right, rgba(13, 17, 23, 0.95) 0%, rgba(13, 17, 23, 0.7) 25%, rgba(13, 17, 23, 0.4) 50%, transparent 75%);
}

.game-grid-container::after {
	right: 0;
	/* More transparent gradient to allow overflow to be visible behind screen */
	background: linear-gradient(to left, rgba(13, 17, 23, 0.95) 0%, rgba(13, 17, 23, 0.7) 25%, rgba(13, 17, 23, 0.4) 50%, transparent 75%);
}

/* Movement controls overlay - centered around player */
.movement-controls {
	position: absolute;
	/* Position will be set by JavaScript to center over player cell */
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: repeat(3, 1fr);
	gap: 18px;
	width: 180px;
	height: 180px;
	z-index: 100;
	pointer-events: none;
	/* Hide until positioned */
	opacity: 0;
	transition: opacity 0.2s;
}

.movement-btn {
	background: rgba(255, 255, 255, 0.5);
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	pointer-events: auto;
	padding: 0;
	margin: 0;
	font-size: 0;
	line-height: 0;
	transform: scale(1);
	border: 1px solid rgba(0, 0, 0, 0.4);
	outline: none;
}

.movement-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

.movement-btn:active {
	background: rgba(255, 255, 255, 0.3);
	transform: scale(0.95);
}

.movement-btn:disabled,
.movement-btn.disabled {
	opacity: 0.25;
	cursor: not-allowed;
	pointer-events: none;
}

.movement-btn:disabled:hover,
.movement-btn.disabled:hover {
	background: rgba(255, 255, 255, 0.1);
	transform: scale(1);
}

.arrow-icon {
	width: 24px;
	height: 24px;
	user-select: none;
	/* Make SVG color match theme text color - convert black to white */
	/*filter: brightness(0) invert(1);*/
	transition: all 0.2s ease;
	object-fit: contain;
}

/* Rotate icons for different directions */
.movement-btn-up .arrow-icon {
	transform: rotate(0deg);
}

.movement-btn-right .arrow-icon {
	transform: rotate(90deg);
}

.movement-btn-down .arrow-icon {
	transform: rotate(180deg);
}

.movement-btn-left .arrow-icon {
	transform: rotate(-90deg);
}

/* Position buttons in cross pattern */
.movement-btn-up {
	grid-column: 2;
	grid-row: 1;
}

.movement-btn-right {
	grid-column: 3;
	grid-row: 2;
}

.movement-btn-down {
	grid-column: 2;
	grid-row: 3;
}

.movement-btn-left {
	grid-column: 1;
	grid-row: 2;
}

.game-grid {
	display: grid;
	gap: 0;
	padding: 0;
	background: linear-gradient(135deg, var(--surface-color) 0%, var(--surface-elevated) 100%);
	border-radius: var(--border-radius);
	position: absolute;
	/* Perfectly center the grid within its container */
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%) translateZ(0);
	-webkit-transform: translate(-50%, -50%) translateZ(0);
	transform-origin: center center;
	z-index: 1;
	pointer-events: none;
	box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.08);
	overflow: visible;
	/* Fixed size based on 11x11 grid: (11 cells * cell-size) */
	/* Use explicit calculation to force recalculation on iOS */
	width: calc(11 * var(--grid-cell-size));
	height: calc(11 * var(--grid-cell-size));
	/* Grid maintains its natural size, never stretches */
	min-width: calc(11 * var(--grid-cell-size));
	max-width: calc(11 * var(--grid-cell-size));
	/* Force repaint on iOS Safari */
	will-change: transform;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

/* Subtle checkerboard pattern layer */
.game-grid::before {
	content: "";
	position: absolute;
	inset: 12px;
	z-index: 0;
	opacity: 0.03;
	background-image: 
		linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%),
		linear-gradient(-45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.1) 75%),
		linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.1) 75%);
	background-size: 20px 20px;
	background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
	pointer-events: none;
	border-radius: var(--border-radius);
}

.grid-cell {
	width: var(--grid-cell-size);
	height: var(--grid-cell-size);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	/*
	TODO: Uncomment this when we have a proper background for the grid cells
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border: 1px solid rgba(255, 255, 255, 0.1);
	*/
	border-radius: 0;
	margin: 0;
	cursor: pointer;
	transition: none;
	pointer-events: auto;
	position: relative;
	z-index: 20;
	overflow: hidden;
	/* Remove all selection and focus indicators */
	outline: none !important;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	/* Prevent text selection highlighting */
	-webkit-user-drag: none;
	-khtml-user-drag: none;
	-moz-user-drag: none;
	-o-user-drag: none;
}

/* Prevent text selection on grid cells and their children */
.grid-cell::selection,
.grid-cell *::selection {
	background: transparent;
	color: inherit;
}

.grid-cell::-moz-selection,
.grid-cell *::-moz-selection {
	background: transparent;
	color: inherit;
}

/* Cell animation (bat, creeper, etc.) */
.cell-animation {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	z-index: 30;
	pointer-events: none;
	transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cell-animation img {
	width: 32px;
	height: 32px;
	object-fit: contain;
	display: block;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}

.grid-cell:focus,
.grid-cell:active,
.grid-cell:focus-visible {
	outline: none !important;
}

.grid-cell::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 0;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
	opacity: 0;
	transition: none;
	pointer-events: none;
	display: none;
}

.grid-cell:hover::before {
	opacity: 0;
	display: none;
}

.grid-cell.hidden {
	background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.25) 100%);
}

.grid-cell.hidden:hover {
	background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.25) 100%);
	transform: none;
}

.grid-cell.mined {
	position: relative;
	cursor: pointer;
	/* Reset transform and box-shadow to prevent lingering effects */
	transform: scale(1) !important;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-cell.mined:hover {
	transform: scale(1) !important;
}

.grid-cell.mined:focus,
.grid-cell.mined:active,
.grid-cell.mined:focus-visible {
	outline: none !important;
	transform: scale(1) !important;
}

.grid-cell.hidden:focus,
.grid-cell.hidden:active,
.grid-cell.hidden:focus-visible {
	outline: none !important;
}

.grid-cell.player-cell:focus,
.grid-cell.player-cell:active,
.grid-cell.player-cell:focus-visible {
	outline: none !important;
}

/* Tiny icon on mined cells (history icons) */
.grid-cell-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	transform-origin: center center;
	opacity: 0.4 !important;
	pointer-events: none;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)), grayscale(100%);
	z-index: 10 !important;
	margin: 0;
	padding: 0;
	display: block;
	line-height: 0;
}

/* Tier-based glow effects for mined cell icons */
.grid-cell-icon-common {
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)) grayscale(100%) drop-shadow(0 0 3px rgba(74, 144, 226, 0.4)) drop-shadow(0 0 6px rgba(74, 144, 226, 0.2));
}

.grid-cell-icon-rare {
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)) grayscale(100%) drop-shadow(0 0 3px rgba(80, 200, 120, 0.4)) drop-shadow(0 0 6px rgba(80, 200, 120, 0.2));
}

.grid-cell-icon-epic {
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)) grayscale(100%) drop-shadow(0 0 4px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
}

.grid-cell-icon-legendary {
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)) grayscale(100%) drop-shadow(0 0 5px rgba(0, 255, 255, 0.6)) drop-shadow(0 0 10px rgba(0, 255, 255, 0.4)) drop-shadow(0 0 15px rgba(0, 255, 255, 0.2));
}

/* Image icons - when grid-cell-icon is an img element itself */
.grid-cell-icon[src],
img.grid-cell-icon {
	width: 20px;
	height: 20px;
	object-fit: contain;
	margin: 0;
	padding: 0;
	display: block;
	line-height: 0;
	vertical-align: top;
}

/* Emoji icons */
.grid-cell-icon-emoji {
	font-size: 20px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
	margin: 0;
	padding: 0;
	display: inline-block;
	vertical-align: middle;
	text-align: center;
}

/* Player cell icon - centered on player, clickable, 2x smaller than history icons */
.grid-cell-icon.player-cell-icon {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	opacity: 0.25 !important;
	pointer-events: auto !important;
	cursor: pointer;
	z-index: 25 !important;
}

.grid-cell-icon.player-cell-icon img,
.grid-cell-icon.player-cell-icon[src] {
	width: 10px;
	height: 10px;
	object-fit: contain;
}

.grid-cell-icon.player-cell-icon.grid-cell-icon-emoji {
	font-size: 10px;
}

/* Player icon */
.player-icon {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 20;
	object-fit: contain;	
}

@keyframes player-pickaxe-swing {
	0%, 100% {
		transform: rotate(-8deg);
	}
	50% {
		transform: rotate(8deg);
	}
}

.grid-cell.mined:hover .grid-cell-icon {
	opacity: 0.4 !important;
	transform: translate(-50%, -50%);
	transition: none;
}

/* Hidden cell icon (stone.png for unmined cells) */
.hidden-cell-icon {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Opacity is set dynamically via JavaScript for deterministic variation */
	z-index: 1;
	border-radius: inherit;
}

/* Empty cell icon (empty.png full background fill, like stone.png) */
.empty-cell-icon {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.8;
	z-index: 1;
	border-radius: inherit;
}

.grid-cell.player-cell {
	background: linear-gradient(135deg, var(--accent-color) 0%, #8b5cf6 100%);
	border: 2px solid var(--energy-color);
	box-shadow: 0 0 20px rgba(124, 58, 237, 0.6), 0 0 40px rgba(0, 212, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
	animation: player-pulse 2s ease-in-out infinite;
	position: relative;
	z-index: 25;
	border-radius: 10px;
	transform: scale(1.2);
}

.grid-cell.player-cell::after {
	content: "";
	position: absolute;
	inset: -2px;
	border-radius: 0;
	background: linear-gradient(135deg, var(--accent-color), var(--energy-color));
	opacity: 0.3;
	z-index: -1;
	animation: player-glow 2s ease-in-out infinite;
	filter: blur(8px);
}

@keyframes player-pulse {
	0%, 100% {
		transform: scale(1.1);
		box-shadow: 0 0 20px rgba(124, 58, 237, 0.6), 0 0 40px rgba(0, 212, 255, 0.4);
	}
	50% {
		transform: scale(1.2);
		box-shadow: 0 0 30px rgba(124, 58, 237, 0.8), 0 0 60px rgba(0, 212, 255, 0.6);
	}
}

@keyframes player-glow {
	0%, 100% {
		opacity: 0.3;
		transform: scale(1);
	}
	50% {
		opacity: 0.5;
		transform: scale(1.1);
	}
}

.grid-cell.mining {
	animation: mining-pulse 0.5s ease;
}

.grid-cell.highlight {
	box-shadow: 0 0 15px var(--energy-color);
	transform: scale(1.1);
}

@keyframes mining-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.2);
		box-shadow: 0 0 20px var(--energy-color);
	}
}


.loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--bg-color) url("images/splash-screen.jpg") center center / cover no-repeat;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.loader::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(180deg, rgba(13, 17, 23, 0.85) 0%, rgba(13, 17, 23, 0.6) 50%, rgba(13, 17, 23, 0.85) 100%);
	z-index: 1;
}

.loader.active {
	opacity: 1;
	pointer-events: all;
}

.loader-particles-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
	pointer-events: none;
	overflow: hidden;
}

.loading-particle {
	position: absolute;
	pointer-events: none;
	will-change: transform, opacity;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
}

.loading-particle img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
	animation: particle-glow 2s ease-in-out infinite;
}

@keyframes particle-glow {
	0%, 100% {
		filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 4px rgba(124, 58, 237, 0.3));
	}
	50% {
		filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 8px rgba(124, 58, 237, 0.6));
	}
}

.loader-header {
	position: absolute;
	top: 40px;
	left: 0;
	right: 0;
	z-index: 2;
	width: 100%;
	padding: 40px 20px 20px;
	text-align: center;
}

.loader-title {
	font-family: "RacingSansOne", sans-serif;
	font-size: 48px;
	font-weight: normal;
	letter-spacing: 2px;
	margin: 0;
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 30%, #00d4ff 60%, #7c3aed 100%);
	background-size: 200% 200%;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: gradient-shift 3s ease infinite, title-pulse 2s ease-in-out infinite;
	text-shadow: 0 0 40px rgba(124, 58, 237, 0.6);
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
	position: relative;
}

.loader-title::before {
	content: "HashHunter";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 30%, #00d4ff 60%, #7c3aed 100%);
	background-size: 200% 200%;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: gradient-shift 3s ease infinite;
	filter: blur(8px);
	opacity: 0.5;
	z-index: -1;
}

@keyframes gradient-shift {
	0%, 100% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
}

@keyframes title-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

.loader-content {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 30px;
}

.loader-spinner {
	position: relative;
	width: 80px;
	height: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.spinner-ring {
	position: absolute;
	width: 100%;
	height: 100%;
	border: 3px solid transparent;
	border-radius: 50%;
	border-top-color: var(--energy-color);
	animation: spin-ring 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
	width: 80px;
	height: 80px;
	border-top-color: var(--energy-color);
	animation-delay: 0s;
	box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.spinner-ring:nth-child(2) {
	width: 60px;
	height: 60px;
	border-top-color: var(--accent-color);
	animation-delay: -0.3s;
	box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

.spinner-ring:nth-child(3) {
	width: 40px;
	height: 40px;
	border-top-color: #a855f7;
	animation-delay: -0.6s;
	box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

@keyframes spin-ring {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.loader-text {
	font-size: 18px;
	font-weight: 500;
	color: var(--text-color);
	opacity: 0.9;
	position: relative;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
	animation: text-fade 2s ease-in-out infinite;
	letter-spacing: 1px;
}

@keyframes text-fade {
	0%, 100% {
		opacity: 0.7;
	}
	50% {
		opacity: 1;
	}
}

.loader-character {
	position: absolute;
	bottom: 0;
	left: 50%;
	z-index: 3;
	pointer-events: none;
	transform-origin: center bottom;
	opacity: 0;
	animation: character-enter 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, character-idle 2s ease-in-out 1.4s infinite;
}

.character-image {
	display: block;
	height: auto;
	max-width: 300px;
	width: auto;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

@keyframes character-enter {
	0% {
		opacity: 0;
		transform: translateX(50%) translateY(60%) rotate(2deg);
	}
	100% {
		opacity: 1;
		transform: translateX(-50%) translateY(60%) rotate(2deg);
	}
}

@keyframes character-idle {
	0%, 100% {
		transform: translateX(-50%) translateY(60%) rotate(2deg);
	}
	50% {
		transform: translateX(-50%) translateY(calc(60% - 6px)) rotate(2deg);
	}
}

/* Character popup container */
.character-popup-container {
	position: fixed;
	bottom: 0;
	right: 0;
	width: 100%;
	height: 100%;
	z-index: 3500;
	pointer-events: none;
	display: flex;
	justify-content: flex-end;
	align-items: flex-end;
	overflow: hidden;
}

/* Character popup */
.character-popup {
	position: relative;
	bottom: 0;
	right: 25px;
	z-index: 3501;
	pointer-events: none;
	transform-origin: right bottom;
	opacity: 0;
	transform: translateY(calc(50% - 20px));
	transition: opacity 0.4s ease;
}

.character-popup.show {
	opacity: 1;
	transform: translateY(calc(50% - 20px));
	animation: character-popup-enter 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, character-popup-idle 2s ease-in-out 1.4s infinite;
}

.character-popup.hide {
	opacity: 0 !important;
	animation: none !important;
}

.character-popup-image {
	display: block;
	height: auto;
	max-width: 150px;
	width: auto;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

@keyframes character-popup-enter {
	0% {
		opacity: 0;
		transform: translateY(100%) rotate(2deg);
	}
	100% {
		opacity: 1;
		transform: translateY(calc(50% - 20px)) rotate(2deg);
	}
}

@keyframes character-popup-idle {
	0%, 100% {
		transform: translateY(calc(50% - 20px)) rotate(2deg);
	}
	50% {
		transform: translateY(calc(50% - 26px)) rotate(2deg);
	}
}

.toast-container {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 2000;
	display: flex;
	flex-direction: column;
	gap: 10px;
	pointer-events: none;
}

.toast {
	background: linear-gradient(135deg, var(--surface-elevated) 0%, var(--surface-color) 100%);
	color: var(--text-color);
	padding: 14px 18px;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow-lg);
	border: 1px solid rgba(255, 255, 255, 0.1);
	opacity: 0;
	transform: translateX(100%);
	transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: all;
	max-width: 320px;
	backdrop-filter: blur(10px);
}

.toast.show {
	opacity: 1;
	transform: translateX(0);
}

.toast-success {
	border-left: 4px solid var(--success-color);
}

.toast-error {
	border-left: 4px solid var(--error-color);
}

.toast-info {
	border-left: 4px solid var(--energy-color);
}

.reward-popup {
	animation: reward-bounce 1s ease;
}

@keyframes reward-bounce {
	0%, 100% {
		transform: scale(1);
	}
	25% {
		transform: scale(1.2);
	}
	50% {
		transform: scale(0.9);
	}
}

/* Prevent horizontal scroll on mobile */
/* Mining popup container */
.mining-popup-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 3000;
	pointer-events: none;
	display: flex;
	justify-content: center;
	align-items: center;
}

/* Mining popup */
.mining-popup {
	position: relative;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	pointer-events: all;
	cursor: pointer;
	text-align: center;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	min-width: 280px;
	max-width: 360px;
	pointer-events: all;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.mining-popup.show {
	opacity: 1;
	transform: scale(1) translateY(0);
	animation: popupEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mining-popup.hide {
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.3s ease;
}

/* Mining popup header */
.mining-popup-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 22px 28px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.25);
	border-radius: 18px 18px 0 0;
	/*background: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, rgba(124, 58, 237, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);*/
	position: relative;
	z-index: 2;
}

/* Popup icon */
.mining-popup-icon {
	margin: 0 auto 12px;
	display: block;
	animation: popup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
	position: relative;
}

.mining-popup-icon img,
.mining-popup-icon[src] {
	width: 48px;
	height: 48px;
	object-fit: contain;
	display: block;
	margin: 0 auto;
}

.mining-popup-icon:not(img):not([src]) {
	font-size: 48px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
	display: block;
	margin: 0 auto;
}

@keyframes popup-bounce {
	0% {
		transform: scale(0);
	}
	50% {
		transform: scale(1.2);
	}
	100% {
		transform: scale(1);
	}
}

@keyframes energy-popup-tired-swing {
	0%, 100% {
		transform: rotate(-3deg);
	}
	50% {
		transform: rotate(3deg);
	}
}

/* Tier name */
.mining-popup-tier {
	font-size: 26px;
	font-weight: 800;
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	background: linear-gradient(135deg, #ffffff 0%, rgba(168, 85, 247, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

/* Mining popup content */
.mining-popup-content {
	padding: 24px 28px;
	text-align: center;
	position: relative;
	z-index: 2;
}

/* Rewards list */
.mining-popup-rewards {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 0;
	padding-top: 0;
}

.mining-popup-reward-item {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 12px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border: 1px solid rgba(124, 58, 237, 0.2);
	border-radius: 12px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	color: var(--text-color);
	animation: fadeInUp 0.4s ease-out backwards;
}

/* If there's an odd number of items, make the last one span both columns */
.mining-popup-reward-item:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}

.mining-popup-reward-item:hover {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.06) 100%);
	border-color: rgba(124, 58, 237, 0.4);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mining-popup-reward-item:nth-child(1) { animation-delay: 0.1s; }
.mining-popup-reward-item:nth-child(2) { animation-delay: 0.2s; }
.mining-popup-reward-item:nth-child(3) { animation-delay: 0.3s; }
.mining-popup-reward-item:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.reward-icon {
	width: 16px;
	height: 16px;
	object-fit: contain;
}

.reward-value {
	font-weight: 600;
}

/* Tier-specific styles */
.mining-popup-empty {
	border-color: rgba(136, 136, 136, 0.5);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(136, 136, 136, 0.2),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
}

.mining-popup-empty .mining-popup-header {
	border-bottom-color: rgba(136, 136, 136, 0.25);
	background: linear-gradient(180deg, rgba(136, 136, 136, 0.08) 0%, rgba(136, 136, 136, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
}

.mining-popup-empty .mining-popup-icon img,
.mining-popup-empty .mining-popup-icon[src] {
	width: 48px;
	height: 48px;
}

.mining-popup-empty .mining-popup-icon:not(img):not([src]) {
	font-size: 48px;
}

.mining-popup-empty .mining-popup-icon {
	opacity: 0.6;
}

.mining-popup-empty .mining-popup-tier {
	background: linear-gradient(135deg, #ffffff 0%, #888 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
	font-size: 20px;
}

.mining-popup-common {
	border-color: rgba(74, 144, 226, 0.5);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(74, 144, 226, 0.2),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3),
		0 0 40px rgba(74, 144, 226, 0.3);
}

.mining-popup-common .mining-popup-header {
	border-bottom-color: rgba(74, 144, 226, 0.25);
	background: linear-gradient(180deg, rgba(74, 144, 226, 0.08) 0%, rgba(74, 144, 226, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
}

.mining-popup-common .mining-popup-tier {
	background: linear-gradient(135deg, #ffffff 0%, #4A90E2 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

.mining-popup-rare {
	border-color: rgba(80, 200, 120, 0.5);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(80, 200, 120, 0.2),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3),
		0 0 40px rgba(80, 200, 120, 0.3);
	animation: rare-glow 2s ease-in-out infinite;
}

.mining-popup-rare .mining-popup-header {
	border-bottom-color: rgba(80, 200, 120, 0.25);
	background: linear-gradient(180deg, rgba(80, 200, 120, 0.08) 0%, rgba(80, 200, 120, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
}

.mining-popup-rare .mining-popup-tier {
	background: linear-gradient(135deg, #ffffff 0%, #50C878 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

.mining-popup-epic {
	border-color: rgba(255, 215, 0, 0.6);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(255, 215, 0, 0.3),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3),
		0 0 50px rgba(255, 215, 0, 0.4);
	animation: epic-glow 1.5s ease-in-out infinite;
}

.mining-popup-epic .mining-popup-header {
	border-bottom-color: rgba(255, 215, 0, 0.25);
	background: linear-gradient(180deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 215, 0, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
}

.mining-popup-epic .mining-popup-tier {
	background: linear-gradient(135deg, #ffffff 0%, #FFD700 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.mining-popup-legendary {
	border-color: rgba(0, 255, 255, 0.7);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(0, 255, 255, 0.3),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3),
		0 8px 50px rgba(0, 255, 255, 0.5);
	animation: legendary-glow 1s ease-in-out infinite;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99), rgba(22, 27, 34, 0.99), rgba(0, 255, 255, 0.1));
}

.mining-popup-legendary .mining-popup-header {
	border-bottom-color: rgba(0, 255, 255, 0.25);
	background: linear-gradient(180deg, rgba(0, 255, 255, 0.08) 0%, rgba(0, 255, 255, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
}

.mining-popup-legendary .mining-popup-icon img,
.mining-popup-legendary .mining-popup-icon[src] {
	width: 64px;
	height: 64px;
}

.mining-popup-legendary .mining-popup-icon:not(img):not([src]) {
	font-size: 64px;
}

.mining-popup-legendary .mining-popup-icon {
	animation: legendary-spin 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), legendary-pulse 2s ease-in-out infinite;
	filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.8));
}

.mining-popup-legendary .mining-popup-tier {
	background: linear-gradient(135deg, #ffffff 0%, #00FFFF 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
	font-size: 28px;
	animation: legendary-text 1.5s ease-in-out infinite;
}

@keyframes rare-glow {
	0%, 100% {
		box-shadow: 
			0 25px 70px rgba(0, 0, 0, 0.9),
			0 0 0 1px rgba(80, 200, 120, 0.2),
			inset 0 1px 2px rgba(255, 255, 255, 0.08),
			inset 0 -1px 2px rgba(0, 0, 0, 0.3),
			0 0 40px rgba(80, 200, 120, 0.3);
	}
	50% {
		box-shadow: 
			0 25px 70px rgba(0, 0, 0, 0.9),
			0 0 0 1px rgba(80, 200, 120, 0.2),
			inset 0 1px 2px rgba(255, 255, 255, 0.08),
			inset 0 -1px 2px rgba(0, 0, 0, 0.3),
			0 0 50px rgba(80, 200, 120, 0.5);
	}
}

@keyframes epic-glow {
	0%, 100% {
		box-shadow: 
			0 25px 70px rgba(0, 0, 0, 0.9),
			0 0 0 1px rgba(255, 215, 0, 0.3),
			inset 0 1px 2px rgba(255, 255, 255, 0.08),
			inset 0 -1px 2px rgba(0, 0, 0, 0.3),
			0 0 50px rgba(255, 215, 0, 0.4);
	}
	50% {
		box-shadow: 
			0 25px 70px rgba(0, 0, 0, 0.9),
			0 0 0 1px rgba(255, 215, 0, 0.3),
			inset 0 1px 2px rgba(255, 255, 255, 0.08),
			inset 0 -1px 2px rgba(0, 0, 0, 0.3),
			0 0 60px rgba(255, 215, 0, 0.8);
	}
}

@keyframes legendary-glow {
	0%, 100% {
		box-shadow: 
			0 25px 70px rgba(0, 0, 0, 0.9),
			0 0 0 1px rgba(0, 255, 255, 0.3),
			inset 0 1px 2px rgba(255, 255, 255, 0.08),
			inset 0 -1px 2px rgba(0, 0, 0, 0.3),
			0 8px 50px rgba(0, 255, 255, 0.5);
		border-color: rgba(0, 255, 255, 0.7);
	}
	50% {
		box-shadow: 
			0 25px 70px rgba(0, 0, 0, 0.9),
			0 0 0 1px rgba(0, 255, 255, 0.3),
			inset 0 1px 2px rgba(255, 255, 255, 0.08),
			inset 0 -1px 2px rgba(0, 0, 0, 0.3),
			0 8px 70px rgba(0, 255, 255, 1);
		border-color: rgba(0, 255, 255, 1);
	}
}

@keyframes legendary-spin {
	0% {
		transform: scale(0) rotate(0deg);
	}
	50% {
		transform: scale(1.3) rotate(180deg);
	}
	100% {
		transform: scale(1) rotate(360deg);
	}
}

@keyframes legendary-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.1);
	}
}

@keyframes legendary-text {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

/* Energy popup container */
.energy-popup-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 3000;
	pointer-events: none;
	display: none;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(8px);
	padding: 20px;
	box-sizing: border-box;
}

.energy-popup-container:has(.energy-popup) {
	display: flex;
	pointer-events: all;
}

/* Energy popup */
.energy-popup {
	position: relative;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	pointer-events: all;
	cursor: pointer;
	text-align: center;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	min-width: 280px;
	max-width: 400px;
	width: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.energy-popup.show {
	opacity: 1;
	transform: scale(1) translateY(0);
	animation: popupEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.energy-popup.hide {
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.3s ease;
}

/* Energy popup character container - aligned to show top half */
.energy-popup-character {
	position: relative;
	width: 100%;
	height: 220px;
	overflow: hidden;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 0;
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, rgba(124, 58, 237, 0.03) 50%, rgba(13, 17, 23, 0.01) 100%);
}

.energy-popup-character-image {
	display: block;
	height: 300px;
	margin-top: 20px;
	width: auto;
	max-width: 280px;
	object-fit: cover;
	object-position: top center;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
	transform-origin: center bottom;
	animation: energy-popup-tired-swing 2s ease-in-out infinite;
}

/* Energy popup header */
.energy-popup-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 24px 28px;
	border-top: 1px solid rgba(124, 58, 237, 0.25);
	position: relative;
	z-index: 2;
}

.energy-popup-title {
	font-size: 26px;
	font-weight: 800;
	margin: 0 0 12px 0;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	background: linear-gradient(135deg, #ffffff 0%, rgba(255, 100, 100, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

.energy-popup-message {
	font-size: 15px;
	font-weight: 500;
	color: var(--text-color);
	opacity: 0.85;
	line-height: 1.5;
}

/* Cell info popup */
.cell-info-popup-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 4000;
	pointer-events: none;
	display: none;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(12px);
	animation: backdropFadeIn 0.3s ease-out;
}

.cell-info-popup-container:has(.cell-info-popup) {
	display: flex;
	pointer-events: all;
}

.cell-info-popup {
	position: relative;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	min-width: 300px;
	max-width: 380px;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	pointer-events: all;
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	text-align: center;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.cell-info-popup::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, 
		rgba(124, 58, 237, 0.8) 0%, 
		rgba(168, 85, 247, 0.8) 50%, 
		rgba(124, 58, 237, 0.8) 100%);
	background-size: 200% 100%;
	animation: shimmer 3s linear infinite;
	z-index: 1;
	border-radius: 24px 24px 0 0;
	opacity: 0;
}

.cell-info-popup.show {
	opacity: 1;
	transform: scale(1) translateY(0);
	animation: popupEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cell-info-header {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 22px 28px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.25);
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.12) 0%, rgba(124, 58, 237, 0.05) 50%, transparent 100%);
	position: relative;
	z-index: 2;
}

.cell-info-header-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	flex: 1;
}

.cell-info-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	font-size: 18px;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	line-height: 1;
	font-weight: 400;
	z-index: 20;
	overflow: hidden;
	flex-shrink: 0;
	/* Hide close button by default, temporarily */
	opacity: 0;
	display: none;
}

.cell-info-close::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	transition: width 0.3s, height 0.3s;
}

.cell-info-close:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
	color: var(--text-color);
	transform: scale(1.05);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cell-info-close:hover::before {
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	transform: none;
}

.cell-info-close:active {
	transform: scale(0.95);
}

.cell-info-popup-content {
	padding: 24px 28px;
	text-align: center;
	position: relative;
	z-index: 2;
	background: linear-gradient(180deg, rgba(13, 17, 23, 0.5) 0%, rgba(13, 17, 23, 0.8) 100%);
}

.cell-info-icon-container {
	position: relative;
	text-align: center;
	margin: 0 auto 12px;
	display: inline-block;
}

.cell-info-icon {
	text-align: center;
	display: inline-block;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
	animation: popup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
	position: relative;
}

.cell-info-icon img,
.cell-info-icon[src] {
	width: 48px;
	height: 48px;
	object-fit: contain;
}

.cell-info-icon:not(img):not([src]) {
	font-size: 48px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}

.cell-info-stamp {
	position: absolute;
	bottom: 4px;
	right: -2px;
	background: linear-gradient(135deg, rgba(220, 38, 38, 0.75) 0%, rgba(185, 28, 28, 0.75) 100%);
	color: #ffffff;
	font-size: 9px;
	font-weight: 900;
	letter-spacing: 1px;
	padding: 2px 4px;
	border: 2px solid rgba(255, 255, 255, 0.7);
	border-radius: 3px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
	transform: rotate(-12deg);
	opacity: 0.8;
	z-index: 20;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
	white-space: nowrap;
	pointer-events: none;
	animation: stamp-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes stamp-appear {
	0% {
		opacity: 0;
		transform: rotate(-12deg) scale(0.3);
	}
	100% {
		opacity: 1;
		transform: rotate(-12deg) scale(1);
	}
}

.cell-info-tier {
	font-size: 26px;
	font-weight: 800;
	text-align: center;
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	background: linear-gradient(135deg, #ffffff 0%, rgba(168, 85, 247, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

.cell-info-rewards {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 0;
	padding-top: 0;
}

.cell-info-reward-item {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 12px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border: 1px solid rgba(124, 58, 237, 0.2);
	border-radius: 12px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	color: var(--text-color);
}

/* If there's an odd number of items, make the last one span both columns */
.cell-info-reward-item:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}

.cell-info-reward-item:hover {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.06) 100%);
	border-color: rgba(124, 58, 237, 0.4);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cell-info-reward-item .reward-icon {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.cell-info-no-rewards {
	text-align: center;
	font-size: 12px;
	opacity: 0.6;
	font-style: italic;
}

/* Tier-specific popup styles */
.cell-info-popup-common {
	border-color: rgba(74, 144, 226, 0.5);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(74, 144, 226, 0.2),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		0 0 40px rgba(74, 144, 226, 0.3);
}

.cell-info-popup-common .cell-info-header {
	border-bottom-color: rgba(74, 144, 226, 0.25);
	background: linear-gradient(180deg, rgba(74, 144, 226, 0.12) 0%, rgba(74, 144, 226, 0.05) 50%, transparent 100%);
}

.cell-info-popup-common .cell-info-tier {
	background: linear-gradient(135deg, #ffffff 0%, #4A90E2 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

.cell-info-popup-rare {
	border-color: rgba(80, 200, 120, 0.5);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(80, 200, 120, 0.2),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		0 0 40px rgba(80, 200, 120, 0.3);
	animation: rare-glow 2s ease-in-out infinite;
}

.cell-info-popup-rare .cell-info-header {
	border-bottom-color: rgba(80, 200, 120, 0.25);
	background: linear-gradient(180deg, rgba(80, 200, 120, 0.12) 0%, rgba(80, 200, 120, 0.05) 50%, transparent 100%);
}

.cell-info-popup-rare .cell-info-tier {
	background: linear-gradient(135deg, #ffffff 0%, #50C878 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
}

.cell-info-popup-epic {
	border-color: rgba(255, 215, 0, 0.6);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(255, 215, 0, 0.3),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		0 0 50px rgba(255, 215, 0, 0.4);
	animation: epic-glow 1.5s ease-in-out infinite;
}

.cell-info-popup-epic .cell-info-header {
	border-bottom-color: rgba(255, 215, 0, 0.25);
	background: linear-gradient(180deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 215, 0, 0.05) 50%, transparent 100%);
}

.cell-info-popup-epic .cell-info-tier {
	background: linear-gradient(135deg, #ffffff 0%, #FFD700 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.cell-info-popup-legendary {
	border-color: rgba(0, 255, 255, 0.7);
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(0, 255, 255, 0.3),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		0 8px 50px rgba(0, 255, 255, 0.5);
	animation: legendary-glow 1s ease-in-out infinite;
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99), rgba(22, 27, 34, 0.99), rgba(0, 255, 255, 0.1));
}

.cell-info-popup-legendary .cell-info-header {
	border-bottom-color: rgba(0, 255, 255, 0.25);
	background: linear-gradient(180deg, rgba(0, 255, 255, 0.12) 0%, rgba(0, 255, 255, 0.05) 50%, transparent 100%);
}

.cell-info-popup-legendary .cell-info-tier {
	background: linear-gradient(135deg, #ffffff 0%, #00FFFF 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.cell-info-popup-legendary .cell-info-icon img,
.cell-info-popup-legendary .cell-info-icon[src] {
	width: 64px;
	height: 64px;
}

.cell-info-popup-legendary .cell-info-icon:not(img):not([src]) {
	font-size: 64px;
}

.cell-info-popup-legendary .cell-info-icon {
	animation: legendary-spin 2s ease-in-out infinite, popup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 600px) {
	:root {
		--grid-cell-size: 48px;
	}

	.grid-cell {
		font-size: 18px;
	}

	.header h1 {
		font-size: 24px;
		letter-spacing: 0.5px;
	}

	.loader-title {
		font-size: 36px;
		letter-spacing: 1px;
	}

	.loader-header {
		padding: 30px 20px 15px;
	}

	.loader-spinner {
		width: 60px;
		height: 60px;
	}

	.spinner-ring:nth-child(1) {
		width: 60px;
		height: 60px;
	}

	.spinner-ring:nth-child(2) {
		width: 45px;
		height: 45px;
	}

	.spinner-ring:nth-child(3) {
		width: 30px;
		height: 30px;
	}

	.loader-text {
		font-size: 16px;
	}

	.loader-content {
		padding-bottom: 50px;
		gap: 25px;
	}

	.app {
		padding: 3px;
		gap: 3px;
	}

	.header {
		padding: 2px;
	}

	.header h1 {
		font-size: 18px;
	}

	.hud {
		padding: 5px 6px;
		gap: 5px;
	}

	.hud-top-row {
		gap: 5px;
	}

	.hud-stats-row {
		gap: 3px;
	}

	.hud-stat {
		padding: 3px 5px;
		font-size: 12px;
	}

	.hud-stat-icon {
		width: 12px;
		height: 12px;
	}

	.game-grid-container {
		padding: 1px;
	}

	.game-grid {
		/* Use absolute positioning like desktop */
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		transform-origin: center center;
		padding: 0;
		gap: 0;
		/* Recalculate size without padding/gap */
		width: calc(11 * var(--grid-cell-size));
		height: calc(11 * var(--grid-cell-size));
		min-width: calc(11 * var(--grid-cell-size));
		max-width: calc(11 * var(--grid-cell-size));
	}
}

/* iPhone and very small screens - still use large cells */
@media (max-width: 400px) {
	:root {
		--grid-cell-size: 44px;
	}

	.app {
		padding: 2px;
		gap: 2px;
	}

	.header h1 {
		font-size: 16px;
	}

	.hud {
		padding: 4px 5px;
		gap: 4px;
	}

	.game-grid {
		padding: 0;
		gap: 0;
		/* Recalculate size without padding/gap */
		width: calc(11 * var(--grid-cell-size));
		height: calc(11 * var(--grid-cell-size));
		min-width: calc(11 * var(--grid-cell-size));
		max-width: calc(11 * var(--grid-cell-size));
	}

	.movement-controls {
		width: 120px;
		height: 120px;
		gap: 12px;
	}

	.arrow-icon {
		width: 18px;
		height: 18px;
	}
}

@media (max-width: 600px) {
	.movement-controls {
		width: 180px;
		height: 180px;
		gap: 22px;
		/* Position set by JavaScript */
	}

	.arrow-icon {
		width: 20px;
		height: 20px;
	}

	.mining-popup {
		padding: 20px 24px;
		min-width: 180px;
	}

	.mining-popup-icon {
		font-size: 48px;
	}

	.mining-popup-tier {
		font-size: 18px;
	}

	.mining-popup-legendary .mining-popup-tier {
		font-size: 20px;
	}

	.stats-panel-content {
		min-width: 280px;
		max-width: 90vw;
		padding: 24px 20px;
		max-height: 90vh;
	}

	.stats-panel-header {
		margin-bottom: 20px;
		padding-bottom: 14px;
	}

	.stats-panel-header h2 {
		font-size: 22px;
	}

	.stats-panel-icon {
		font-size: 22px;
	}

	.stats-panel-close {
		width: 32px;
		height: 32px;
		font-size: 20px;
	}

	.stats-section {
		margin-bottom: 20px;
	}

	.stats-section-title {
		font-size: 16px;
		margin-bottom: 12px;
		padding-bottom: 8px;
	}

	.stats-section-icon {
		font-size: 16px;
	}

	.stats-item {
		padding: 12px 14px;
		margin-bottom: 8px;
	}

	.stats-item-icon {
		font-size: 16px;
	}

	.stats-label {
		font-size: 13px;
	}

	.stats-value {
		font-size: 15px;
	}

	.stats-value-accent {
		font-size: 16px;
	}

	.stats-upgrade-bar {
		height: 5px;
	}
}


/* Stats Panel */
.stats-panel {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 5000;
	display: none;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(12px);
	pointer-events: none;
	animation: backdropFadeIn 0.3s ease-out;
}

.stats-panel.show {
	display: flex;
	pointer-events: all;
}

.stats-panel-content {
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	min-width: 320px;
	max-width: 420px;
	max-height: 85vh;
	overflow: hidden;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	position: relative;
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	margin: 0;
	align-self: center;
	display: flex;
	flex-direction: column;
}

.stats-panel-content::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, 
		rgba(124, 58, 237, 0.8) 0%, 
		rgba(168, 85, 247, 0.8) 50%, 
		rgba(124, 58, 237, 0.8) 100%);
	background-size: 200% 100%;
	animation: shimmer 3s linear infinite;
	z-index: 1;
}

.stats-panel.show .stats-panel-content {
	opacity: 1;
	transform: scale(1) translateY(0);
	animation: popupEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Custom scrollbar for stats panel */
.stats-panel-content::-webkit-scrollbar {
	width: 8px;
}

.stats-panel-content::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

.stats-panel-content::-webkit-scrollbar-thumb {
	background: rgba(124, 58, 237, 0.4);
	border-radius: 4px;
}

.stats-panel-content::-webkit-scrollbar-thumb:hover {
	background: rgba(124, 58, 237, 0.6);
}

.stats-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 22px 28px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.25);
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.12) 0%, rgba(124, 58, 237, 0.05) 50%, transparent 100%);
	position: relative;
	z-index: 2;
}

.stats-panel-header-title {
	display: flex;
	align-items: center;
	gap: 10px;
}

.stats-panel-icon {
	font-size: 24px;
	line-height: 1;
}

.stats-panel-header h2 {
	font-size: 26px;
	font-weight: 800;
	background: linear-gradient(135deg, #ffffff 0%, rgba(168, 85, 247, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	margin: 0;
	text-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
	letter-spacing: 0.8px;
}

.stats-panel-close {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	font-size: 18px;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	line-height: 1;
	font-weight: 400;
	position: relative;
	overflow: hidden;
}

.stats-panel-close::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	transition: width 0.3s, height 0.3s;
}

.stats-panel-close:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
	color: var(--text-color);
	transform: scale(1.05);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stats-panel-close:hover::before {
	width: 100%;
	height: 100%;
}

.stats-panel-close:active {
	transform: scale(0.95);
}

.stats-panel-content {
	display: flex;
	flex-direction: column;
}

/* Scrollable wrapper for all sections after header */
.stats-panel-scroll-wrapper {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 24px 28px;
	background: linear-gradient(180deg, rgba(13, 17, 23, 0.5) 0%, rgba(13, 17, 23, 0.8) 100%);
}

.stats-panel-scroll-wrapper::-webkit-scrollbar {
	width: 8px;
}

.stats-panel-scroll-wrapper::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

.stats-panel-scroll-wrapper::-webkit-scrollbar-thumb {
	background: rgba(124, 58, 237, 0.4);
	border-radius: 4px;
}

.stats-panel-scroll-wrapper::-webkit-scrollbar-thumb:hover {
	background: rgba(124, 58, 237, 0.6);
}

/* Make sections have proper spacing when in scrollable area */
.stats-panel-scroll-wrapper > .stats-section {
	margin-bottom: 24px;
}

.stats-panel-scroll-wrapper > .stats-section:last-child {
	margin-bottom: 0;
}

.stats-section {
	margin-bottom: 24px;
}

.stats-section:last-child {
	margin-bottom: 0;
}

.stats-section-title {
	font-size: 17px;
	font-weight: 700;
	color: var(--text-color);
	margin: 0 0 14px 0;
	padding-bottom: 10px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.2);
	display: flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.stats-section-icon {
	font-size: 18px;
	line-height: 1;
	-webkit-text-fill-color: initial;
	color: var(--accent-color);
	filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.5));
}

.stats-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 16px;
	margin-bottom: 10px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
}

.stats-item::before {
	content: "";
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.1), transparent);
	transition: left 0.5s;
}

.stats-item:hover {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(168, 85, 247, 0.08) 100%);
	border-color: rgba(124, 58, 237, 0.4);
	transform: translateX(6px);
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.stats-item:hover::before {
	left: 100%;
}

.stats-item:last-child {
	margin-bottom: 0;
}

.stats-item-left {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
}

.stats-item-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	min-width: 100px;
}

.stats-item-icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	object-fit: contain;
	filter: drop-shadow(0 0 3px rgba(124, 58, 237, 0.4));
}

.stats-label {
	font-size: 14px;
	color: var(--text-secondary);
	font-weight: 500;
	letter-spacing: 0.2px;
}

.stats-value {
	font-size: 16px;
	font-weight: 700;
	color: var(--text-color);
	text-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
	white-space: nowrap;
}

.stats-value-highlight {
	color: #fbbf24;
	text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.stats-value-accent {
	color: var(--accent-color);
	text-shadow: 0 0 12px rgba(124, 58, 237, 0.6);
	font-size: 17px;
}

.stats-value-energy {
	color: var(--energy-color);
	text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Upgrade items with progress bars */
.stats-item-upgrade {
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
}

.stats-item-upgrade .stats-item-left {
	width: 100%;
}

.stats-item-upgrade .stats-item-right {
	width: 100%;
	align-items: flex-start;
}

.stats-upgrade-bar {
	width: 100%;
	height: 6px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 3px;
	overflow: hidden;
	margin-top: 4px;
	position: relative;
}

.stats-upgrade-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent-color) 0%, #a855f7 100%);
	border-radius: 3px;
	transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
	position: relative;
}

.stats-upgrade-bar-fill::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
	animation: shimmer 2s infinite;
}

@keyframes shimmer {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(100%);
	}
}

/* Effect items */
.stats-item-effect {
	border-color: rgba(124, 58, 237, 0.2);
}

.stats-item-effect:hover {
	border-color: rgba(124, 58, 237, 0.5);
}

.stats-perks-list {
	margin-top: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.stats-perk-item {
	padding: 10px 14px;
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(168, 85, 247, 0.15) 100%);
	border: 1px solid rgba(124, 58, 237, 0.4);
	border-radius: 10px;
	font-size: 13px;
	color: var(--text-color);
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
	transition: all 0.2s;
	position: relative;
	overflow: hidden;
}

.stats-perk-item::before {
	content: "✨";
	position: absolute;
	left: 10px;
	opacity: 0.3;
}

.stats-perk-item:hover {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(168, 85, 247, 0.2) 100%);
	border-color: rgba(124, 58, 237, 0.6);
	transform: translateX(4px);
	box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.stats-no-perks {
	padding: 12px;
	font-size: 13px;
	color: var(--text-secondary);
	font-style: italic;
	text-align: center;
	background: rgba(255, 255, 255, 0.03);
	border-radius: 10px;
	border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Ensure no scrollbars anywhere */
html, body {
	overflow: hidden;
}

/* Container can extend beyond viewport, but no scrollbars */
.game-grid-container {
	/* Container can be larger than viewport - grid will be centered within it */
	overflow: hidden;
	/* Prevent any scrollbars */
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.game-grid-container::-webkit-scrollbar {
	display: none;
}

/* Shop Button */
.hud-shop-toggle {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
	border: 1px solid rgba(124, 58, 237, 0.4);
	border-radius: 8px;
	padding: 5px 6px;
	cursor: pointer;
	transition: all 0.2s;
	z-index: 10;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hud-shop-toggle:hover {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
	border-color: rgba(124, 58, 237, 0.6);
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* Shop Panel */
.shop-panel {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 5000;
	display: none;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(12px);
	pointer-events: none;
	animation: backdropFadeIn 0.3s ease-out;
}

@keyframes backdropFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.shop-panel.show {
	display: flex;
	pointer-events: all;
}

.shop-panel-content {
	background: linear-gradient(135deg, rgba(13, 17, 23, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
	border: 1px solid rgba(124, 58, 237, 0.3);
	border-radius: 24px;
	padding: 0;
	min-width: 420px;
	max-width: 90vw;
	max-height: 85vh;
	overflow: hidden;
	box-shadow: 
		0 25px 70px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(124, 58, 237, 0.15),
		inset 0 1px 2px rgba(255, 255, 255, 0.08),
		inset 0 -1px 2px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(25px);
	position: relative;
	opacity: 0;
	transform: scale(0.92) translateY(-15px);
	transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	display: flex;
	flex-direction: column;
}

.shop-panel-content::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, 
		rgba(124, 58, 237, 0.8) 0%, 
		rgba(168, 85, 247, 0.8) 50%, 
		rgba(124, 58, 237, 0.8) 100%);
	background-size: 200% 100%;
	animation: shimmer 3s linear infinite;
	z-index: 1;
}

@keyframes shimmer {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

.shop-panel.show .shop-panel-content {
	opacity: 1;
	transform: scale(1) translateY(0);
	animation: popupEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupEnter {
	0% {
		opacity: 0;
		transform: scale(0.92) translateY(-15px);
	}
	60% {
		transform: scale(1.02) translateY(2px);
	}
	100% {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.shop-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 22px 28px;
	border-bottom: 1px solid rgba(124, 58, 237, 0.25);
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.12) 0%, rgba(124, 58, 237, 0.05) 50%, transparent 100%);
	position: relative;
	z-index: 2;
}

.shop-panel-header h2 {
	font-size: 26px;
	font-weight: 800;
	background: linear-gradient(135deg, #ffffff 0%, rgba(168, 85, 247, 0.95) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	margin: 0;
	text-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
	letter-spacing: 0.8px;
	position: relative;
}

.shop-panel-close {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	font-size: 18px;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	line-height: 1;
	font-weight: 400;
	position: relative;
	overflow: hidden;
}

.shop-panel-close::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	transition: width 0.3s, height 0.3s;
}

.shop-panel-close:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
	color: var(--text-color);
	transform: scale(1.05);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.shop-panel-close:hover::before {
	width: 100%;
	height: 100%;
}

.shop-panel-close:active {
	transform: scale(0.95);
}

.shop-tabs {
	display: flex;
	gap: 0;
	padding: 0;
	border-bottom: 2px solid rgba(124, 58, 237, 0.3);
	background: rgba(0, 0, 0, 0.2);
	position: relative;
	z-index: 2;
}

.shop-tab {
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	border-radius: 0;
	padding: 14px 24px;
	cursor: pointer;
	font-size: 15px;
	font-weight: 600;
	color: var(--text-secondary);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	flex: 1;
	text-align: center;
	letter-spacing: 0.3px;
}

.shop-tab::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.15) 0%, transparent 100%);
	opacity: 0;
	transition: opacity 0.3s;
}

.shop-tab:hover::before {
	opacity: 1;
}

.shop-tab:hover {
	color: var(--text-color);
	background: rgba(124, 58, 237, 0.1);
}

.shop-tab.active {
	color: #ffffff;
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.25) 0%, rgba(124, 58, 237, 0.1) 100%);
	border-bottom-color: rgba(168, 85, 247, 0.9);
	box-shadow: 0 -2px 10px rgba(124, 58, 237, 0.2);
}

.shop-tab.active::before {
	opacity: 1;
	background: linear-gradient(180deg, rgba(124, 58, 237, 0.3) 0%, rgba(124, 58, 237, 0.15) 100%);
}

.shop-tab.active {
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
	border-color: rgba(124, 58, 237, 0.5);
	color: var(--text-color);
}

.shop-content {
	flex: 1;
	overflow-y: auto;
	padding: 24px;
	background: linear-gradient(180deg, rgba(13, 17, 23, 0.5) 0%, rgba(13, 17, 23, 0.8) 100%);
	position: relative;
}

.shop-content::-webkit-scrollbar {
	width: 8px;
}

.shop-content::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

.shop-content::-webkit-scrollbar-thumb {
	background: rgba(124, 58, 237, 0.4);
	border-radius: 4px;
}

.shop-content::-webkit-scrollbar-thumb:hover {
	background: rgba(124, 58, 237, 0.6);
}

.shop-section {
	min-height: 200px;
	animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.shop-loading {
	text-align: center;
	padding: 40px 20px;
	color: var(--text-secondary);
	font-size: 14px;
}

.shop-items-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 12px;
}

.shop-item {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
	border: 1px solid rgba(124, 58, 237, 0.2);
	border-radius: 14px;
	padding: 16px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	gap: 12px;
	position: relative;
	overflow: hidden;
}

.shop-item::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(168, 85, 247, 0.05) 100%);
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.shop-item:hover {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.06) 100%);
	border-color: rgba(124, 58, 237, 0.4);
	transform: translateY(-3px);
	box-shadow: 
		0 8px 20px rgba(0, 0, 0, 0.4),
		0 0 0 1px rgba(124, 58, 237, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.shop-item:hover::before {
	opacity: 1;
}

.shop-item-unaffordable {
	opacity: 0.6;
}

.shop-item-max,
.shop-item-owned {
	border-color: rgba(124, 58, 237, 0.5);
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
	box-shadow: 
		0 4px 12px rgba(124, 58, 237, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.shop-item-max::before,
.shop-item-owned::before {
	opacity: 1;
}

.shop-item-header {
	display: flex;
	gap: 10px;
	align-items: flex-start;
}

.shop-item-icon {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.shop-item-icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.shop-item-info {
	flex: 1;
	min-width: 0;
}

.shop-item-title-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 4px;
}

.shop-item-name {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-color);
	margin: 0;
	flex: 1;
}

.shop-item-level-badge {
	display: inline-block;
	background: rgba(255, 255, 255, 0.1);
	color: var(--text-secondary);
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 10px;
	font-weight: 600;
	white-space: nowrap;
}

.shop-item-owned-badge {
	display: inline-block;
	background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
	color: white;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 10px;
	font-weight: 600;
	white-space: nowrap;
}

.shop-item-description {
	font-size: 12px;
	color: var(--text-secondary);
	margin: 0 0 4px 0;
	line-height: 1.4;
}

.shop-item-expires {
	font-size: 11px;
	color: rgba(124, 58, 237, 0.8);
	margin-top: 2px;
}

.shop-item-timer {
	font-size: 11px;
	color: rgba(124, 58, 237, 0.9);
	margin-top: 4px;
	font-weight: 600;
	font-family: 'Courier New', monospace;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.shop-item-timer::before {
	content: "⏱";
	font-size: 12px;
}

.shop-item-timer.shop-timer-warning {
	color: #ffa500;
	animation: pulse-warning 2s ease-in-out infinite;
}

.shop-item-timer.shop-timer-expired {
	color: #ff4444;
}

@keyframes pulse-warning {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.6;
	}
}

.shop-item-cost {
	margin: 8px 0;
	min-height: 24px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.shop-cost {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-color);
}

.shop-cost-item {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-color);
}

.shop-cost-icon {
	width: 16px;
	height: 16px;
	object-fit: contain;
}

.shop-cost-disabled {
	color: var(--text-secondary);
	font-size: 14px;
}

.shop-item-buy {
	background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
	border: none;
	border-radius: 10px;
	padding: 12px 16px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	color: white;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	margin-top: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	box-shadow: 
		0 4px 12px rgba(124, 58, 237, 0.3),
		inset 0 1px 0 rgba(255, 255, 255, 0.2);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	position: relative;
	overflow: hidden;
}

.shop-item-buy::before {
	content: "";
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
	transition: left 0.5s;
}

.shop-item-buy:hover:not(.disabled) {
	transform: translateY(-2px);
	box-shadow: 
		0 6px 20px rgba(124, 58, 237, 0.5),
		inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.shop-item-buy:hover:not(.disabled)::before {
	left: 100%;
}

.shop-item-buy.disabled {
	background: rgba(255, 255, 255, 0.1);
	color: var(--text-secondary);
	cursor: not-allowed;
	opacity: 0.5;
}

.shop-buy-text {
	white-space: nowrap;
}

.shop-buy-text.shop-timer-text {
	font-family: 'Courier New', monospace;
	font-weight: 700;
	font-size: 13px;
	color: #ffffff;
	letter-spacing: 0.5px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.shop-item-buy.disabled .shop-buy-text.shop-timer-text {
	color: #ffffff;
	opacity: 0.9;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.shop-buy-text.shop-timer-text.shop-timer-warning {
	color: #ffd700;
	text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.5);
	animation: pulse-warning 2s ease-in-out infinite;
}

.shop-buy-text.shop-timer-text.shop-timer-expired {
	color: #3fb950;
	font-weight: 600;
	text-shadow: 0 0 6px rgba(63, 185, 80, 0.6), 0 1px 3px rgba(0, 0, 0, 0.5);
}

.shop-cost-inline {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.shop-cost-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}

.shop-cost-icon-small {
	width: 14px;
	height: 14px;
	object-fit: contain;
}

@media (max-width: 600px) {
	.shop-panel-content {
		min-width: 90vw;
		max-height: 90vh;
	}

	.shop-items-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.shop-panel-header {
		padding: 16px 20px;
	}

	.shop-panel-header h2 {
		font-size: 20px;
	}

	.shop-content {
		padding: 16px 20px;
	}

	.shop-tabs {
		padding: 10px 20px;
	}

	.shop-item {
		padding: 10px;
	}

	.shop-item-icon {
		width: 36px;
		height: 36px;
	}

	.shop-item-name {
		font-size: 14px;
	}

	.shop-item-description {
		font-size: 11px;
	}

	.shop-item-buy {
		padding: 8px 10px;
		font-size: 12px;
	}
}

/* Purchase animations */
.shop-item-purchasing {
	position: relative;
	overflow: visible;
}

.shop-item-purchasing::before {
	content: "";
	position: absolute;
	top: -2px;
	left: -2px;
	right: -2px;
	bottom: -2px;
	border-radius: 12px;
	background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
	opacity: 0;
	animation: purchase-glow 1s ease-in-out infinite;
	z-index: -1;
}

.shop-item-success {
	position: relative;
	overflow: visible;
	animation: purchase-success-bounce 0.6s ease-out;
}

.shop-item-success::before {
	content: "";
	position: absolute;
	top: -4px;
	left: -4px;
	right: -4px;
	bottom: -4px;
	border-radius: 14px;
	background: linear-gradient(135deg, rgba(50, 205, 50, 0.4) 0%, rgba(124, 252, 0, 0.4) 100%);
	opacity: 0;
	animation: purchase-success-glow 0.8s ease-out;
	z-index: -1;
}

.shop-item-error {
	animation: purchase-error-shake 0.5s ease-out;
}

.shop-item-buy.purchasing {
	opacity: 0.7;
	cursor: wait;
	position: relative;
}

.shop-item-buy.purchasing::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	margin: -8px 0 0 -8px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: white;
	border-radius: 50%;
	animation: purchase-spin 0.6s linear infinite;
}

@keyframes purchase-glow {
	0%, 100% {
		opacity: 0;
		transform: scale(1);
	}
	50% {
		opacity: 0.6;
		transform: scale(1.02);
	}
}

@keyframes purchase-pulse {
	0%, 100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.1);
		opacity: 0.8;
	}
}

@keyframes purchase-success {
	0% {
		transform: scale(1);
		filter: brightness(1);
	}
	50% {
		transform: scale(1.2) rotate(5deg);
		filter: brightness(1.5) drop-shadow(0 0 20px rgba(50, 205, 50, 0.8));
	}
	100% {
		transform: scale(1);
		filter: brightness(1);
	}
}

@keyframes purchase-success-bounce {
	0% {
		transform: scale(1);
	}
	30% {
		transform: scale(1.05);
	}
	60% {
		transform: scale(0.98);
	}
	100% {
		transform: scale(1);
	}
}

@keyframes purchase-success-glow {
	0% {
		opacity: 0;
		transform: scale(0.8);
	}
	50% {
		opacity: 0.8;
		transform: scale(1.1);
	}
	100% {
		opacity: 0;
		transform: scale(1.3);
	}
}

@keyframes purchase-error-shake {
	0%, 100% {
		transform: translateX(0);
	}
	10%, 30%, 50%, 70%, 90% {
		transform: translateX(-4px);
	}
	20%, 40%, 60%, 80% {
		transform: translateX(4px);
	}
}

@keyframes purchase-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Particle effects */
.shop-particle {
	position: fixed;
	width: 8px;
	height: 8px;
	background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
	border-radius: 50%;
	pointer-events: none;
	z-index: 3000;
	box-shadow: 0 0 10px rgba(124, 58, 237, 0.8);
	transform: translate(0, 0) scale(1);
	opacity: 1;
	transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mining particles */
.mining-particle {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
	z-index: 501;
	will-change: transform, opacity;
	backface-visibility: hidden;
	animation: particle-pulse 0.6s ease-in-out infinite;
}

.mining-particle-sparkle {
	background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, transparent 70%);
	box-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 0 16px rgba(255, 255, 255, 0.6);
	animation: particle-pulse 0.3s ease-in-out infinite, particle-sparkle 0.8s ease-in-out infinite;
}

@keyframes particle-pulse {
	0%, 100% {
		transform: translate(-50%, -50%) scale(1);
	}
	50% {
		transform: translate(-50%, -50%) scale(1.2);
	}
}

@keyframes particle-sparkle {
	0%, 100% {
		opacity: 1;
		filter: brightness(1);
	}
	50% {
		opacity: 0.7;
		filter: brightness(1.5);
	}
}

/* Mining indicator - shows when waiting for server response */
.mining-indicator {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2500;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.mining-indicator.active {
	opacity: 1;
}

.mining-pickaxe {
	width: 64px;
	height: 64px;
	object-fit: contain;
	transform-origin: left bottom;
	animation: mining-pickaxe-swing 0.8s ease-in-out infinite;
	filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	position: relative;
	display: none; /* Hidden by default, shown when mining */
}

.mining-minecart {
	width: 64px;
	height: 64px;
	object-fit: contain;
	transform-origin: bottom center;
	animation: mining-minecart-ride 0.6s ease-in-out infinite;
	filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	position: relative;
	display: none; /* Hidden by default, shown when moving */
}

/* Glowing effect behind pickaxe */
.mining-pickaxe::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80px;
	height: 80px;
	background: radial-gradient(circle, rgba(0, 212, 255, 0.4) 0%, rgba(0, 212, 255, 0.2) 40%, transparent 70%);
	border-radius: 50%;
	z-index: -1;
	animation: mining-glow-pulse 1.2s ease-in-out infinite;
	pointer-events: none;
}

/* Additional outer glow ring */
.mining-pickaxe::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 100px;
	height: 100px;
	background: radial-gradient(circle, rgba(0, 212, 255, 0.3) 0%, transparent 60%);
	border-radius: 50%;
	z-index: -2;
	animation: mining-glow-expand 1.6s linear infinite;
	pointer-events: none;
}

@keyframes mining-pickaxe-swing {
	0% {
		transform: rotateZ(-15deg);
		filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	}
	50% {
		transform: rotateZ(15deg);
		filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	}
	100% {
		transform: rotateZ(-15deg);
		filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	}
}

/* Glowing effect behind minecart */
.mining-minecart::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80px;
	height: 80px;
	background: radial-gradient(circle, rgba(255, 200, 0, 0.4) 0%, rgba(255, 200, 0, 0.2) 40%, transparent 70%);
	border-radius: 50%;
	z-index: -1;
	animation: mining-glow-pulse 1.2s ease-in-out infinite;
	pointer-events: none;
}

/* Additional outer glow ring for minecart */
.mining-minecart::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 100px;
	height: 100px;
	background: radial-gradient(circle, rgba(255, 200, 0, 0.3) 0%, transparent 60%);
	border-radius: 50%;
	z-index: -2;
	animation: mining-glow-expand 1.6s linear infinite;
	pointer-events: none;
}

@keyframes mining-minecart-ride {
	0% {
		transform: rotateZ(-8deg);
		filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	}
	50% {
		transform: rotateZ(8deg);
		filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	}
	100% {
		transform: rotateZ(-8deg);
		filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.8)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
	}
}

@keyframes mining-glow-pulse {
	0%, 100% {
		opacity: 0.6;
		transform: translate(-50%, -50%) scale(0.9);
	}
	50% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1.1);
	}
}

@keyframes mining-glow-expand {
	0%, 100% {
		opacity: 0.3;
		transform: translate(-50%, -50%) scale(0.8);
	}
	50% {
		opacity: 0.6;
		transform: translate(-50%, -50%) scale(1.2);
	}
}

