/* Reset and Base Styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	overflow-x: hidden;
	width: 100%;
	max-width: 100vw;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
	background: linear-gradient(135deg, #384fc8 0%, #4f93d4 25%, #3b14b4 100%);
	min-height: 100vh;
	color: white;
	overflow-x: hidden;
	width: 100%;
	max-width: 100vw;
	position: relative;
}

/* 防止所有图片造成水平溢出 */
img {
	max-width: 100%;
	height: auto;
}

/* 通用防护：防止任何元素造成水平溢出 */
* {
	max-width: 100%;
}

/* 确保所有直接子元素不会溢出 */
#app {
	width: 100%;
	max-width: 100vw;
	overflow-x: hidden;
}

/* Loading Animation Styles */
.loading-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
	min-height: 200px;
}

.loading-spinner {
	width: 50px;
	height: 50px;
	border: 4px solid rgba(255, 255, 255, 0.2);
	border-top: 4px solid white;
	border-radius: 50%;
	animation: loading-spin 1s linear infinite;
	margin-bottom: 20px;
}

.loading-text {
	color: white;
	font-size: 18px;
	font-weight: 500;
	text-align: center;
	opacity: 0.9;
}

@keyframes loading-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.loading-container.hidden {
	display: none;
}

/* Games Content Styles */
.games-content {
	opacity: 1;
	transition: opacity 0.3s ease-in-out;
}

.games-content.hidden {
	display: none;
}

.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
	width: 100%;
	max-width: 100vw;
	overflow-x: hidden;
	box-sizing: border-box;
}

/* Header Styles */
.header {
	padding: 15px 0;
	position: relative;
	width: 100%;
	max-width: 100vw;
	overflow-x: hidden;
}

.header-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo {
	display: flex;
	align-items: center;
	gap: 10px;
}

.logo-img,
.logo-img-mobile {
	width: 76px;
	height: 46px;
}

.logo-img-mobile {
	display: none;
}

.logo-text {
	font-size: 24px;
	font-weight: bold;
	color: white;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 200px;
}

.nav-desktop {
	display: flex;
	gap: 30px;
	align-items: center;
}

.nav-link {
	display: flex;
	align-items: center;
	gap: 8px;
	color: white;
	text-decoration: none;
	font-size: 16px;
	transition: opacity 0.3s;
}

.nav-link:hover {
	opacity: 0.8;
}

.nav-link.active {
	opacity: 1;
}

.nav-link img {
	width: 16px;
	height: 16px;
}

.header-actions {
	display: flex;
	gap: 15px;
	align-items: center;
}

.menu-btn,
.search-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
}

.menu-btn img,
.search-btn img {
	width: 24px;
	height: 24px;
}

/* Mobile Navigation */
.nav-mobile {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: rgba(56, 79, 200, 0.95);
	backdrop-filter: blur(10px);
	padding: 20px;
	border-radius: 0 0 15px 15px;
	z-index: 1000;
}

.nav-mobile.active {
	display: block;
}

.nav-header {
	font-size: 18px;
	font-weight: bold;
	margin-bottom: 15px;
	color: white;
}

.nav-mobile .nav-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-mobile .nav-link:last-child {
	border-bottom: none;
}

/* Main Content */
.main {
	padding: 10px 0;
	width: 100%;
	max-width: 100vw;
	overflow-x: hidden;
}

/* Game Grid Layouts */
.game-grid {
	display: grid;
	gap: 20px;
	margin: 20px 0;
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
}

.featured-grid {
	grid-template-columns: repeat(3, 1fr);
	gap: 15px;
}

.regular-grid {
	grid-template-columns: repeat(4, 1fr);
	gap: 15px;
}

.best-games {
	grid-template-columns: repeat(3, 1fr);
	gap: 15px;
}

.latest-games,
.popular-games {
	grid-template-columns: repeat(8, 1fr);
	gap: 10px;
}

/* Game Cards */
.game-card {
	background: rgba(255, 255, 255, 0.1);
	border-radius: 15px;
	overflow: hidden;
	cursor: pointer;
	transition: transform 0.3s, box-shadow 0.3s;
	position: relative;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.game-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-card.featured {
	aspect-ratio: 16/9;
}

.game-card.horizontal {
	display: flex;
	align-items: center;
	padding: 15px;
	gap: 15px;
}

.game-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 游戏图片懒加载样式 */
.game-img {
	transition: opacity 0.3s ease-in-out, filter 0.3s ease-in-out;
	opacity: 0.7;
	filter: blur(2px);
}

.game-img-loaded {
	opacity: 1;
	filter: blur(0px);
}

.game-card.horizontal img {
	width: 60px;
	height: 60px;
	border-radius: 10px;
	flex-shrink: 0;
}

.game-card.horizontal .game-img {
	transition: opacity 0.3s ease-in-out, filter 0.3s ease-in-out;
	opacity: 0.7;
	filter: blur(2px);
}

.game-card.horizontal .game-img-loaded {
	opacity: 1;
	filter: blur(0px);
}

.game-info {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
	padding: 20px 15px 15px;
	color: white;
}

.game-card.horizontal .game-info {
	position: static;
	background: none;
	padding: 0;
	flex: 1;
}

.game-info h3 {
	font-size: 16px;
	font-weight: bold;
	margin-bottom: 5px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	word-break: break-word;
}

.category {
	background: rgba(79, 147, 212, 0.8);
	padding: 4px 8px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 500;
	display: inline-block;
}

/* Section Styles */
.section {
	margin: 40px 0;
}

.section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.section-header h2 {
	font-size: 28px;
	font-weight: bold;
	color: white;
}

.more-link {
	color: #5ebfd1;
	text-decoration: none;
	font-size: 16px;
	font-weight: 500;
}

.more-link:hover {
	text-decoration: underline;
}

/* Candy Crush Banner */
.candy-crush-banner {
	margin: 20px 0;
	border-radius: 20px;
	overflow: hidden;
	width: 100%;
	max-width: 100%;
}

.candy-crush-banner img {
	width: 100%;
	height: auto;
	display: block;
	max-width: 100%;
	object-fit: cover;
}

/* Footer Styles */
.footer {
	background: rgba(0, 0, 0, 0.2);
	padding: 40px 0 20px;
	margin-top: 60px;
	width: 100%;
	max-width: 100vw;
	overflow-x: hidden;
}

.subscription-section {
	margin-bottom: 30px;
}

.subscription-section h3 {
	font-size: 18px;
	font-weight: bold;
	margin-bottom: 15px;
	color: white;
}

.subscription-form {
	display: flex;
	gap: 10px;
	max-width: 500px;
	width: 100%;
	overflow-x: hidden;
}

.email-input {
	flex: 1;
	padding: 12px 15px;
	border: none;
	border-radius: 25px;
	background: rgba(255, 255, 255, 0.1);
	color: white;
	font-size: 14px;
	max-width: 100%;
	box-sizing: border-box;
}

.email-input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.submit-btn {
	background: #5ebfd1;
	color: white;
	border: none;
	padding: 12px 25px;
	border-radius: 25px;
	font-weight: bold;
	cursor: pointer;
	transition: background-color 0.3s;
}

.submit-btn:hover {
	background: #4fa9bb;
}

.footer-content {
	margin-bottom: 20px;
}

.footer-content p {
	color: rgba(255, 255, 255, 0.8);
	line-height: 1.6;
	font-size: 14px;
	word-wrap: break-word;
	overflow-wrap: break-word;
	hyphens: auto;
}

.footer-links {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 15px;
	flex-wrap: wrap;
}

.footer-links a {
	color: white;
	text-decoration: none;
	font-size: 14px;
}

.footer-links a:hover {
	text-decoration: underline;
}

.footer-links span {
	color: rgba(255, 255, 255, 0.5);
}

.copyright p {
	color: rgba(255, 255, 255, 0.6);
	font-size: 14px;
	text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
	.container {
		padding: 0 20px;
	}

	.featured-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.regular-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.best-games {
		grid-template-columns: repeat(2, 1fr);
	}

	.latest-games,
	.popular-games {
		grid-template-columns: repeat(4, 1fr);
		gap: 8px;
	}
}

@media (max-width: 768px) {
	.nav-desktop {
		display: none;
	}

	.logo-img {
		display: none;
	}

	.logo-img-mobile {
		display: block;
	}

	.logo-text {
		font-size: 20px;
	}

	.featured-grid {
		gap: 12px;
	}

	.regular-grid {
		gap: 12px;
	}

	.best-games {
		gap: 12px;
	}

	.latest-games,
	.popular-games {
		gap: 8px;
	}

	.game-card.horizontal {
		flex-direction: column;
		text-align: center;
		padding: 12px;
	}

	.game-card.horizontal img {
		width: 70px;
		height: 70px;
	}

	.subscription-form {
		flex-direction: column;
		gap: 8px;
	}

	.footer-links {
		justify-content: center;
		gap: 8px;
	}

	.game-info h3 {
		font-size: 14px;
	}

	.section-header h2 {
		font-size: 24px;
	}
}

@media (max-width: 600px) {
	.latest-games,
	.popular-games {
		grid-template-columns: repeat(3, 1fr);
		gap: 6px;
	}

	.game-info h3 {
		font-size: 13px;
	}

	.logo-text {
		font-size: 20px;
	}
}

@media (max-width: 480px) {
	.container {
		padding: 0 8px;
	}

	.header {
		padding: 10px 0;
	}

	.featured-grid {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.regular-grid,
	.best-games {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.latest-games,
	.popular-games {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.section-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.section-header h2 {
		font-size: 20px;
	}

	.game-info h3 {
		font-size: 12px;
		line-height: 1.2;
	}

	.category {
		font-size: 10px;
		padding: 2px 6px;
	}

	.game-info {
		padding: 15px 10px 10px;
	}

	.nav-mobile {
		padding: 15px;
	}

	.footer {
		padding: 30px 0 15px;
	}

	.subscription-section h3 {
		font-size: 16px;
	}

	.email-input,
	.submit-btn {
		padding: 10px 12px;
		font-size: 14px;
	}
}

@media (max-width: 360px) {
	.container {
		padding: 0 6px;
	}

	.featured-grid,
	.regular-grid,
	.best-games,
	.latest-games,
	.popular-games {
		gap: 6px;
	}

	.game-info h3 {
		font-size: 11px;
	}

	.logo-text {
		font-size: 20px;
		max-width: 150px;
	}

	.section-header h2 {
		font-size: 18px;
	}

	.main {
		padding: 15px 0;
	}

	.section {
		margin: 25px 0;
	}

	.footer-content p {
		font-size: 12px;
	}

	.candy-crush-banner {
		margin: 15px 0;
	}

	/* Loading Animation Mobile Styles */
	.loading-container {
		padding: 40px 15px;
		min-height: 150px;
	}

	.loading-spinner {
		width: 40px;
		height: 40px;
		border-width: 3px;
		margin-bottom: 15px;
	}

	.loading-text {
		font-size: 16px;
	}
}
