* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: "Microsoft YaHei", "SimHei", Arial, sans-serif;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	min-height: 100vh;
	color: #333;
	overflow-x: hidden;
}

.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

header {
	text-align: center;
	margin-bottom: 30px;
}

header h1 {
	color: white;
	font-size: 2.5rem;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
	animation: bounce 2s ease-in-out infinite alternate;
}

@keyframes bounce {
	0% {
		transform: translateY(0px);
	}
	100% {
		transform: translateY(-10px);
	}
}

.game-area {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 40px;
}

.flashcard {
	width: 600px;
	height: 400px;
	perspective: 1000px;
	margin-bottom: 50px;
	/* cursor: pointer; 已停用點擊功能 */
}

.flashcard-inner {
	position: relative;
	width: 100%;
	height: 100%;
	text-align: center;
	transition: transform 0.6s;
	transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
	transform: rotateY(180deg);
}

.card-front,
.card-back {
	position: absolute;
	width: 100%;
	height: 100%;
	backface-visibility: hidden;
	border-radius: 20px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	border: 4px solid white;
}

.card-front {
	background: linear-gradient(45deg, #667eea, #764ba2);
	color: white;
}

.card-back {
	background: linear-gradient(45deg, #4ecdc4, #44a08d);
	color: white;
	transform: rotateY(180deg);
}

.question-text {
	font-size: 2rem;
	font-weight: bold;
	margin-bottom: 10px;
}

.hint {
	font-size: 1.2rem;
	opacity: 0.8;
}

.word-text {
	font-size: 2rem;
	font-weight: bold;
	text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
	margin-bottom: 20px;
	line-height: 1.1;
}

.word-text-front {
	font-size: 5rem;
	font-weight: bold;
	color: white;
	text-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.6),
		2px 2px 4px rgba(0, 0, 0, 0.9);
	margin-bottom: 25px;
	line-height: 1.1;
	letter-spacing: 2px;
	text-align: center;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
}

.word-text-front::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 50%;
	transform: translateX(-50%);
	width: calc(100% + 40px);
	height: calc(100% + 20px);
	background: linear-gradient(
		45deg,
		rgba(255, 255, 255, 0.1) 0%,
		rgba(255, 255, 255, 0.05) 50%,
		transparent 100%
	);
	border-radius: 20px;
	z-index: -1;
}

.word-text-front::after {
	content: "";
	position: absolute;
	bottom: -5px;
	left: 50%;
	transform: translateX(-50%);
	width: 80%;
	height: 3px;
	background: linear-gradient(
		90deg,
		transparent 0%,
		rgba(255, 255, 255, 0.6) 50%,
		transparent 100%
	);
	border-radius: 2px;
}

.speech-container {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	position: relative;
	padding: 20px;
}

.speech-icon {
	font-size: 5rem;
	margin-bottom: 20px;
	animation: pulse 2s ease-in-out infinite;
}

.speech-text {
	font-size: 1.5rem;
	color: white;
	margin-bottom: 30px;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.speech-controls {
	display: flex;
	gap: 15px;
	flex-wrap: wrap;
	justify-content: center;
}

.btn-speak {
	padding: 12px 20px;
	font-size: 1rem;
	font-weight: bold;
	border: none;
	border-radius: 25px;
	cursor: pointer;
	transition: all 0.3s ease;
	background: rgba(255, 255, 255, 0.2);
	color: white;
	border: 2px solid rgba(255, 255, 255, 0.5);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
	backdrop-filter: blur(10px);
}

.btn-speak:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-speak:active {
	transform: translateY(0);
}

.btn-speak.speaking {
	background: rgba(255, 255, 255, 0.4);
	animation: speakingPulse 1s ease-in-out infinite;
}

@keyframes speakingPulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
	}
	50% {
		box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
	}
}

@keyframes pulse {
	0%, 100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.1);
		opacity: 0.8;
	}
}

.speech-hint {
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.7);
	margin-top: 15px;
}

.speech-hint.warning {
	color: #ffeb3b;
	font-weight: bold;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.speech-hint.info {
	color: #4fc3f7;
	font-weight: bold;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-speak.test {
	background: rgba(255, 152, 0, 0.3);
	border-color: rgba(255, 152, 0, 0.7);
}

.btn-speak.test:hover {
	background: rgba(255, 152, 0, 0.5);
}

.controls {
	display: flex;
	gap: 15px;
	flex-wrap: wrap;
	justify-content: center;
}

.btn-next,
.btn-prev {
	padding: 12px 25px;
	font-size: 1.1rem;
	font-weight: bold;
	border: none;
	border-radius: 25px;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-next {
	background: linear-gradient(45deg, #4facfe, #00f2fe);
	color: white;
}

.btn-prev {
	background: linear-gradient(45deg, #43e97b, #38f9d7);
	color: white;
}

.btn-next:hover,
.btn-prev:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-next:active,
.btn-prev:active {
	transform: translateY(0);
}

.order-controls {
	display: flex;
	align-items: center;
	gap: 15px;
	margin-top: 20px;
	justify-content: center;
	flex-wrap: wrap;
}

.btn-order {
	padding: 10px 20px;
	font-size: 1rem;
	font-weight: bold;
	border: none;
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.3s ease;
	background: linear-gradient(45deg, #9c27b0, #673ab7);
	color: white;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-order:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-order:active {
	transform: translateY(0);
}

.btn-order.sequential {
	background: linear-gradient(45deg, #4caf50, #45a049);
}

.order-status {
	color: rgba(255, 255, 255, 0.9);
	font-size: 1rem;
	font-weight: bold;
}

#currentOrder {
	color: #ffd700;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.progress-bar {
	background: rgba(255, 255, 255, 0.3);
	border-radius: 15px;
	height: 30px;
	margin: 30px auto;
	max-width: 600px;
	position: relative;
	overflow: visible;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
}

.progress {
	background: linear-gradient(90deg, #ffd89b, #19547b);
	height: 100%;
	border-radius: 15px;
	width: 0%;
	transition: width 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 2px; /* 確保進度條至少可見 */
	position: relative;
}

.progress-handle {
	display: none;
}

.progress-bar.dragging {
	cursor: grabbing;
}

.progress-text {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-weight: bold;
	color: white;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
	pointer-events: none;
	z-index: 5;
}

.management-section {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 1000;
}

.btn-manage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	padding: 0;
	background: rgba(255, 255, 255, 0.15);
	color: white;
	text-decoration: none;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	font-size: 1.2rem;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	backdrop-filter: blur(5px);
	opacity: 0.7;
}

.btn-manage:hover {
	opacity: 1;
	transform: translateY(-2px);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
	background: rgba(255, 255, 255, 0.25);
}

.manage-hint {
	display: none;
}

footer {
	text-align: center;
	color: white;
	font-size: 1.2rem;
	margin-top: 40px;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

	header h1 {
		font-size: 2rem;
	}

	.flashcard {
		width: 90%;
		height: 350px;
	}

	.word-text {
		font-size: 2rem;
	}

	.question-text {
		font-size: 1.5rem;
	}

	.controls {
		flex-direction: row;
		width: 100%;
		max-width: 400px;
		gap: 20px;
		justify-content: center;
	}

	.btn-prev,
	.btn-next {
		flex: 1;
	}

	.order-controls {
		flex-direction: row;
		width: 100%;
		max-width: 400px;
		gap: 20px;
		justify-content: center;
	}

	.btn-order {
		flex: 1;
		min-width: 120px;
		max-width: 180px;
		padding: 10px 15px;
		font-size: 0.9rem;
	}

	.order-status {
		font-size: 0.9rem;
		flex: 1;
		text-align: center;
		min-width: 100px;
	}

	#wordList {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	}
}

@media (max-width: 480px) {
	.flashcard {
		width: 90%;
		height: 300px;
	}

	.word-text {
		font-size: 2rem;
	}

	.order-controls {
		flex-direction: row;
		gap: 10px;
	}

	.btn-order {
		max-width: 140px;
		font-size: 0.8rem;
		padding: 8px 12px;
	}

	.order-status {
		font-size: 0.8rem;
		min-width: 80px;
	}

	.add-word-form {
		flex-direction: column;
	}

	#newWordInput {
		min-width: auto;
	}

	/* word-text-front 響應式設計 */
	@media (max-width: 768px) {
		.word-text-front {
			font-size: 4rem;
			min-height: 100px;
			letter-spacing: 1px;
		}

		.word-text-front::before {
			width: calc(100% + 30px);
			height: calc(100% + 15px);
		}
	}

	@media (max-width: 480px) {
		.word-text-front {
			font-size: 3.5rem;
			min-height: 90px;
			letter-spacing: 0.5px;
		}

		.word-text-front::before {
			width: calc(100% + 20px);
			height: calc(100% + 10px);
		}

		.word-text-front::after {
			width: 70%;
		}
	}
}
