:root {
	/* Apple-inspired color palette */
	--apple-blue: #007AFF;
	--apple-light-blue: #64D2FF;
	--apple-gray: #8E8E93;
	--apple-light-gray: #E5E5EA;
	--apple-green: #34C759;
	--apple-red: #FF3B30;
	--apple-yellow: #FFCC00;
	--apple-orange: #FF9500;
	--apple-purple: #AF52DE;
	--apple-pink: #FF2D55;
	--apple-background: #F2F2F7;
	--apple-card-background: #FFFFFF;
	--apple-text: #1C1C1E;
	--apple-secondary-text: #6C6C70;
}

html {
	box-sizing: border-box;
}

*,
*::before,
*::after {
	box-sizing: inherit;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-weight: 500;
	color: var(--apple-text);
}

body {
	background: var(--apple-background);
	font-size: 16px;
	line-height: 1.5;
}

.container {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

/* 顶部标题区域样式优化 */
header {
	width: 100%;
	max-width: 720px;
	padding: 2rem;
	margin-bottom: 2rem;
	position: relative;
	background: var(--apple-card-background);
	border-radius: 16px;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	text-align: center;
}

header::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 5px;
	background: linear-gradient(90deg, var(--apple-blue), var(--apple-purple), var(--apple-pink));
}

/* 游戏标题样式优化 */
h1 {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-weight: 800;
	font-size: 3rem;
	color: var(--apple-text);
	margin-bottom: 0.8rem;
	text-align: center;
	position: relative;
	display: inline-block;
	transition: transform 0.3s ease, text-shadow 0.3s ease;
}

h1:hover {
	transform: scale(1.02);
	text-shadow: 0 2px 10px rgba(0, 122, 255, 0.2);
}

h2 {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-weight: 600;
	font-size: 1.8rem;
	color: var(--apple-text);
	margin: 1.5rem 0 1rem;
}

/* 添加装饰性卡片元素 */
.header-cards {
	position: absolute;
	top: 20px;
	width: 100%;
	display: flex;
	justify-content: space-between;
	pointer-events: none;
	z-index: 0;
}

.header-card {
	width: 40px;
	height: 60px;
	background: var(--apple-blue);
	border-radius: 8px;
	transform: rotate(var(--rotation));
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
	opacity: 0.8;
}

.header-card.left {
	--rotation: -15deg;
	margin-left: 40px;
}

.header-card.right {
	--rotation: 15deg;
	margin-right: 40px;
}

/* 标语样式优化 */
.tagline {
	text-align: center;
	font-size: 1.4rem;
	font-weight: 600;
	margin-bottom: 1.5rem;
	color: var(--apple-blue);
	position: relative;
	z-index: 1;
	transition: color 0.3s ease;
}

.tagline:hover {
	color: var(--apple-purple);
}

/* 语言选择器样式 */
.language-selector {
	margin: 0 auto 1.5rem;
	text-align: center;
	position: relative;
	z-index: 2;
	width: 120px;
}

#language-select {
	background-color: var(--apple-card-background);
	border: 1px solid var(--apple-light-gray);
	border-radius: 8px;
	padding: 0.4rem 0.8rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 0.9rem;
	color: var(--apple-text);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007AFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
	background-repeat: no-repeat;
	background-position: right 0.7rem top 50%;
	background-size: 0.65rem auto;
	width: 100%;
	transition: all 0.3s ease;
}

#language-select:hover, #language-select:focus {
	border-color: var(--apple-blue);
	box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
	outline: none;
}

/* 游戏描述样式优化 */
.game-description {
	max-width: 800px;
	margin: 0 auto 0.5rem;
	text-align: center;
	line-height: 1.7;
	font-size: 1.1rem;
	color: var(--apple-secondary-text);
	position: relative;
	z-index: 1;
	padding: 0.8rem 1.2rem;
	border-radius: 10px;
	background-color: rgba(242, 242, 247, 0.6);
	transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.game-description p {
	margin: 0.4rem 0;
	text-align: center;
	line-height: 1.6;
	opacity: 0.9;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.game-description p:hover {
	opacity: 1;
	transform: scale(1.02);
	color: var(--apple-text);
}

.game-description:hover {
	background-color: rgba(242, 242, 247, 0.9);
	transform: translateY(-2px);
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}

/* 添加动画效果 */
@keyframes float {
	0% {
		transform: translateY(0px) rotate(var(--rotation));
	}
	50% {
		transform: translateY(-10px) rotate(var(--rotation));
	}
	100% {
		transform: translateY(0px) rotate(var(--rotation));
	}
}

.header-card.left {
	animation: float 6s ease-in-out infinite;
}

.header-card.right {
	animation: float 6s ease-in-out infinite reverse;
}

/* Card Styles */
.deck {
	width: 100%;
	max-width: 720px;
	background: var(--apple-card-background);
	padding: 1rem;
	border-radius: 12px;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
	align-items: center;
	margin: 0 0 3em;
}

.deck .card {
	height: 90px;
	width: 90px;
	margin: 0.5rem;
	background: var(--apple-blue);
	color: #ffffff;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	justify-content: center;
	align-items: center;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, background-color 0.3s ease;
}

/* 添加卡片背面样式 */
.deck .card i {
	font-size: 0; /* 默认隐藏图标 */
	transition: font-size 0.2s;
}

.deck .card.open {
	transform: rotateY(0);
	background: var(--apple-light-blue);
	cursor: default;
	animation-name: flipInY;
	-webkit-backface-visibility: visible;
	backface-visibility: visible;
	animation-duration: .75s;
}

.deck .card.show {
	font-size: 33px;
}

.deck .card.show i {
	font-size: 33px; /* 显示图标 */
}

.deck .card.match {
	cursor: default;
	background: var(--apple-green);
	font-size: 33px;
	animation-name: rubberBand;
	-webkit-backface-visibility: visible;
	backface-visibility: visible;
	animation-duration: .75s;
}

/* 保证匹配卡片的图标可见 */
.deck .card.match i {
	font-size: 33px;
}

.deck .card.unmatched {
	animation-name: pulse;
	-webkit-backface-visibility: visible;
	backface-visibility: visible;
	animation-duration: .75s;
	background: var(--apple-red);
}

.deck .card.disabled {
	pointer-events: none;
	opacity: 0.8;
}

/* Score Panel Styles */
.score-panel {
	width: 100%;
	max-width: 720px;
	background: var(--apple-card-background);
	border-radius: 12px;
	padding: 1rem;
	margin-bottom: 1.5rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.score-panel-inner {
	display: flex;
	align-items: center;
}

.score-panel .stars {
	margin: 0;
	padding: 0;
	display: inline-block;
	margin-right: 15px;
}

.score-panel .stars li {
	list-style: none;
	display: inline-block;
}

.score-panel .restart {
	cursor: pointer;
	color: var(--apple-blue);
	font-size: 1.5rem;
	transition: transform 0.2s ease;
}

.score-panel .restart:hover {
	transform: rotate(180deg);
}

.fa-star {
	color: var(--apple-yellow);
}

.timer {
	display: inline-block;
	margin: 0 1rem;
	color: var(--apple-secondary-text);
}

.moves {
	color: var(--apple-secondary-text);
}

/* Congratulations Panel Styles */
.overlay {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.7);
	transition: opacity 300ms;
	visibility: hidden;
	opacity: 0;
	z-index: 1000;
}

.overlay:target {
	visibility: visible;
	opacity: 1;
}
  
.popup {
	margin: 70px auto;
	padding: 30px;
	background: var(--apple-card-background);
	border-radius: 16px;
	width: 90%;
	max-width: 500px;
	position: relative;
	transition: all 0.3s ease-in-out;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
  
.popup h2 {
	margin-top: 0;
	color: var(--apple-text);
	font-size: 2rem;
}

.popup .close {
	position: absolute;
	top: 20px;
	right: 30px;
	transition: all 200ms;
	font-size: 30px;
	font-weight: bold;
	text-decoration: none;
	color: var(--apple-secondary-text);
}

.popup .close:hover {
	color: var(--apple-blue);
}

.popup .content-1,
.content-2 {
	max-height: 30%;
	overflow: auto;
	text-align: center;
	margin-bottom: 1.5rem;
}

.show {
	visibility: visible !important;
	opacity: 1 !important;
}

#starRating li {
	display: inline-block;
}

#play-again {
	background-color: var(--apple-blue);
	padding: 0.8rem 1.5rem;
	font-size: 1.1rem;
	display: block;
	margin: 0 auto;
	width: auto;
	min-width: 200px;
	color: #ffffff;
	border-radius: 10px;
	border: none;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

#play-again:hover {
	background-color: #0064D2;
}

#share-result {
	background-color: var(--apple-green);
	padding: 0.8rem 1.5rem;
	font-size: 1.1rem;
	display: block;
	margin: 0 auto 1rem;
	width: auto;
	min-width: 200px;
	color: #ffffff;
	border-radius: 10px;
	border: none;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

#share-result:hover {
	background-color: #2aa147;
	transform: translateY(-2px);
	box-shadow: 0 4px 10px rgba(52, 199, 89, 0.3);
}

/* 分享图样式 */
.share-container {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	z-index: 1100;
	justify-content: center;
	align-items: center;
	flex-direction: column;
}

.share-image-container {
	position: relative;
	max-width: 500px;
	margin: 0 auto;
	text-align: center;
}

.share-image-container img {
	max-width: 100%;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.share-actions {
	margin-top: 20px;
	display: flex;
	gap: 10px;
}

.share-actions button {
	background-color: var(--apple-card-background);
	color: var(--apple-blue);
	border: 1px solid var(--apple-blue);
	padding: 0.6rem 1.2rem;
	border-radius: 8px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.share-actions button:hover {
	background-color: var(--apple-blue);
	color: white;
}

.share-close {
	position: absolute;
	top: 15px;
	right: 15px;
	color: white;
	font-size: 2rem;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.share-close:hover {
	transform: scale(1.1);
}

.stats-item {
	font-size: 1.2rem;
	margin: 0.5rem 0;
	color: var(--apple-text);
}

.stats-highlight {
	font-weight: 600;
	color: var(--apple-blue);
}

/* Card Animation Keyframes */
@keyframes flipInY {
	from {
		transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
		animation-timing-function: ease-in;
		opacity: 0;
	}

	40% {
		transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
		animation-timing-function: ease-in;
	}

	60% {
		transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
		opacity: 1;
	}

	80% {
		transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
	}

	to {
		transform: perspective(400px);
	}
}

@keyframes rubberBand {
	from {
		transform: scale3d(1, 1, 1);
	}

	30% {
		transform: scale3d(1.25, 0.75, 1);
	}

	40% {
		transform: scale3d(0.75, 1.25, 1);
	}

	50% {
		transform: scale3d(1.15, 0.85, 1);
	}

	65% {
		transform: scale3d(.95, 1.05, 1);
	}

	75% {
		transform: scale3d(1.05, .95, 1);
	}

	to {
		transform: scale3d(1, 1, 1);
	}
}

@keyframes pulse {
	from {
		transform: scale3d(1, 1, 1);
	}

	50% {
		transform: scale3d(1.2, 1.2, 1.2);
	}

	to {
		transform: scale3d(1, 1, 1);
	}
}

/* Features section */
.features {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 20px;
	margin: 2rem 0;
}

.feature-card {
	background: var(--apple-card-background);
	border-radius: 12px;
	padding: 1.5rem;
	width: 300px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	text-align: center;
}

.feature-icon {
	font-size: 2.5rem;
	color: var(--apple-blue);
	margin-bottom: 1rem;
}

.feature-title {
	font-weight: 600;
	font-size: 1.3rem;
	margin-bottom: 0.5rem;
}

/* How to play section */
.how-to-play {
	background: var(--apple-card-background);
	border-radius: 12px;
	padding: 2rem;
	margin: 2rem 0;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	max-width: 800px;
}

.steps {
	list-style-type: none;
	padding: 0;
	margin: 1rem 0;
}

.step {
	display: flex;
	align-items: center;
	margin-bottom: 1rem;
	padding: 0.5rem 0;
}

.step-number {
	background: var(--apple-blue);
	color: white;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-right: 1rem;
	font-weight: 600;
}

/* Footer */
.page-footer {
	width: 100%;
	padding: 2rem 0;
	text-align: center;
	color: var(--apple-secondary-text);
	margin-top: 3rem;
	background: var(--apple-card-background);
	border-top: 1px solid var(--apple-light-gray);
}

.footer-logo {
	display: inline-block;
	margin: 0 auto;
}

.footer-logo img {
	width: 40px;
	height: 40px;
	border-radius: 8px;
}

.copyright {
	margin-top: 1rem;
	font-size: 0.9rem;
}

/* Media Queries */
@media (max-width: 768px) {
	.container {
		padding: 15px;
	}

	header {
		padding: 1.5rem 1rem;
	}

	h1 {
		font-size: 2.2rem;
	}

	.tagline {
		font-size: 1.2rem;
	}

	.game-description {
		font-size: 1rem;
		padding: 0.6rem 1rem;
	}

	.game-description p {
		margin: 0.3rem 0;
		font-size: 0.95rem;
	}

	.header-card {
		width: 30px;
		height: 45px;
	}

	.header-card.left {
		margin-left: 20px;
	}

	.header-card.left + .header-card.left {
		margin-left: 80px;
	}

	.header-card.right {
		margin-right: 20px;
	}

	.header-card.right + .header-card.right {
		margin-right: 80px;
	}

	h2 {
		font-size: 1.5rem;
	}

	.deck {
		padding: 0.8rem;
	}
	
	.deck .card {
		height: 70px;
		width: 70px;
		margin: 0.4rem;
	}

	.score-panel {
		flex-direction: column;
		gap: 10px;
	}

	.score-panel-inner {
		width: 100%;
		justify-content: space-between;
	}

	.features {
		flex-direction: column;
		align-items: center;
	}

	.feature-card {
		width: 100%;
		max-width: 320px;
	}
}

@media (max-width: 480px) {
	.deck .card {
		height: 60px;
		width: 60px;
		margin: 0.3rem;
	}

	.deck .card.show {
		font-size: 28px;
	}

	.popup {
		padding: 20px;
	}
}

@media (min-width: 1024px) {
	.deck .card {
		height: 110px;
		width: 110px;
	}
}
