:root {
	--cosmic-blue: #0A0F2C;
	--cosmic-purple: #4A154B;
	--cosmic-pink: #E033A8;
	--vibrant-pink: #FF66CC;
	--golden-light: #FFD700;
	--text-white: #FFFFFF;
	--text-dark: #E2E8F0;
	--glass-bg: rgba(10, 15, 44, 0.6);
	--glass-border: rgba(255, 102, 204, 0.3);
}

#confetti-canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 9999;
	display: none;
}

#player-names-inputs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	width: 100%;
}

#player-names-inputs .player-name-input {
	flex: 1 1 45%;
	min-width: 180px;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	margin: 0;
	padding: 0;
	color: var(--text-white);
	background: radial-gradient(circle at 50% 50%, var(--cosmic-purple) 0%, var(--cosmic-blue) 100%);
	background-size: 220% 220%;
	animation: cosmicShift 18s ease infinite;
	min-height: 100dvh;
	display: flex;
	justify-content: center;
	align-items: center;
	overflow-x: hidden;
}

body::before,
body::after {
	content: "";
	position: fixed;
	width: 420px;
	height: 420px;
	border-radius: 50%;
	filter: blur(42px);
	opacity: 0.28;
	z-index: -1;
	pointer-events: none;
}

body::before {
	top: -120px;
	left: -120px;
	background: radial-gradient(circle, var(--vibrant-pink), transparent 70%);
}

body::after {
	bottom: -140px;
	right: -100px;
	background: radial-gradient(circle, var(--golden-light), transparent 70%);
}

@keyframes cosmicShift {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

#game-container {
	background: var(--glass-bg);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid var(--glass-border);
	border-radius: 24px;
	padding: 40px;
	box-shadow: 0 0 30px rgba(224, 51, 168, 0.2), inset 0 0 24px rgba(255, 215, 0, 0.06);
	width: min(90%, 750px);
	max-width: 750px;
	text-align: center;
	max-height: 90vh;
	overflow-y: auto;
	position: relative;
	box-sizing: border-box;
}

#game-container::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 24px;
	padding: 1px;
	background: linear-gradient(140deg, rgba(255, 102, 204, 0.35), rgba(255, 215, 0, 0.22), rgba(255, 102, 204, 0.18));
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
}

h1 {
	color: var(--golden-light);
	font-size: 2.5rem;
	margin-bottom: 20px;
	text-transform: uppercase;
	letter-spacing: 2px;
	text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.controls-container {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 20px;
	margin-bottom: 30px;
	border-top: 1px solid var(--glass-border);
	border-bottom: 1px solid var(--glass-border);
	padding: 20px 0;
}

.control {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	width: 45%;
	min-width: 200px;
}

.control.full-width {
	width: 100%;
}

label {
	font-weight: 600;
	margin-bottom: 8px;
	color: var(--vibrant-pink);
	letter-spacing: 1px;
}

select, input {
	width: 100%;
	padding: 12px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: white;
	font-size: 1rem;
	outline: none;
	transition: border-color 0.3s, box-shadow 0.3s;
	box-sizing: border-box;
}

select:focus, input:focus {
	border-color: var(--vibrant-pink);
	box-shadow: 0 0 10px rgba(255, 102, 204, 0.5);
}

select option { background: var(--cosmic-blue); color: white; }
select optgroup { background: var(--cosmic-blue); color: var(--golden-light); font-weight: bold; }

.game-type-desc {
	width: 100%;
	text-align: center;
	font-size: 0.95rem;
	color: var(--text-dark);
	padding: 8px 16px;
	margin-top: -8px;
	font-style: italic;
	min-height: 1.4em;
}

.action-btn, .action-btn-secondary, .quit-btn, .next-btn, .hint-btn, .wager-btn {
	border: none;
	border-radius: 12px;
	font-weight: bold;
	cursor: pointer;
	font-size: 1.1rem;
	padding: 15px 30px;
	margin: 10px;
	transition: all 0.3s ease;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.action-btn {
	background: linear-gradient(135deg, var(--cosmic-pink), var(--vibrant-pink));
	color: white;
	box-shadow: 0 0 15px rgba(224, 51, 168, 0.4);
}

.action-btn:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 0 26px rgba(224, 51, 168, 0.75); }

.action-btn-secondary { background: rgba(255,255,255,0.1); color: var(--golden-light); border: 1px solid var(--golden-light); }
.action-btn-secondary:hover { background: rgba(255,215,0,0.2); transform: translateY(-2px); }

.quit-btn { background: rgba(255,255,255,0.1); color: #ccc; border: 1px solid #ccc; }
.quit-btn:hover { background: rgba(255,255,255,0.2); }

.next-btn { background: #00d2ff; color: #000; box-shadow: 0 0 15px rgba(0, 210, 255, 0.4); }
.next-btn:hover { transform: scale(1.05); }

.hint-btn { background: transparent; color: var(--golden-light); border: 1px dashed var(--golden-light); }
.hint-btn:hover { background: rgba(255,215,0,0.1); }

.wager-btn {
	font-size: 0.95rem;
	padding: 12px 20px;
}

/* Game Mode Banner */
.game-mode-banner {
	background: linear-gradient(135deg, rgba(255, 102, 204, 0.2), rgba(255, 215, 0, 0.15));
	border: 1px solid rgba(255, 215, 0, 0.3);
	border-radius: 12px;
	padding: 8px 20px;
	margin-bottom: 16px;
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--golden-light);
	letter-spacing: 1.5px;
	text-transform: uppercase;
}

#header {
	display: flex;
	justify-content: space-around;
	align-items: center;
	border-bottom: 1px solid var(--glass-border);
	padding-bottom: 15px;
	margin-bottom: 25px;
}

#timer-box,
#lives-box,
#score-box {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 12px;
	padding: 10px 14px;
	min-width: 130px;
}

#timer-box, #lives-box, #score-box { font-weight: bold; font-size: 1.2rem; color: var(--text-white); }
#timer { color: var(--vibrant-pink); text-shadow: 0 0 8px var(--vibrant-pink); }
#lives { color: #ff3366; font-size: 1.4rem; text-shadow: 0 0 8px #ff3366; }
#score { color: var(--golden-light); text-shadow: 0 0 8px var(--golden-light); }

/* Streak Bar */
#streak-bar {
	background: linear-gradient(135deg, rgba(0, 210, 255, 0.15), rgba(0, 210, 255, 0.05));
	border: 1px solid rgba(0, 210, 255, 0.3);
	border-radius: 10px;
	padding: 6px 16px;
	margin-bottom: 12px;
	font-weight: 600;
	font-size: 0.9rem;
	color: #00d2ff;
}

#streak-count {
	font-weight: 800;
	color: var(--golden-light);
}

/* Wager Panel */
#wager-panel {
	background: rgba(255, 215, 0, 0.1);
	border: 1px solid rgba(255, 215, 0, 0.3);
	border-radius: 16px;
	padding: 20px;
	margin-bottom: 20px;
}

#wager-panel p {
	font-size: 1.2rem;
	font-weight: 600;
	color: var(--golden-light);
	margin-bottom: 12px;
}

#wager-points {
	font-size: 1.4rem;
	font-weight: 800;
	color: var(--vibrant-pink);
}

/* Question Counter */
#question-counter {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	padding: 6px 16px;
	margin-top: 12px;
	font-size: 0.9rem;
	color: var(--text-dark);
}

#q-current, #q-total {
	font-weight: 700;
	color: var(--vibrant-pink);
}

#question { font-size: 1.6rem; font-weight: 600; margin-bottom: 30px; line-height: 1.4; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

#options-container { display: flex; flex-direction: column; gap: 15px; margin-bottom: 30px; }

.option-btn {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-white);
	border: 1px solid rgba(255, 255, 255, 0.2);
	padding: 15px 20px;
	border-radius: 12px;
	cursor: pointer;
	font-size: 1.1rem;
	text-align: left;
	transition: all 0.2s ease;
	position: relative;
	overflow: hidden;
}

.option-btn::after {
	content: "";
	position: absolute;
	top: -120%;
	left: -30%;
	width: 55%;
	height: 260%;
	transform: rotate(20deg);
	background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.12), rgba(255,255,255,0));
	transition: left 0.35s ease;
}

.option-btn:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.15);
	border-color: var(--vibrant-pink);
	transform: translateX(5px);
}

.option-btn:hover:not(:disabled)::after {
	left: 90%;
}

.correct { background: rgba(40, 167, 69, 0.8) !important; border-color: #28a745 !important; box-shadow: 0 0 15px rgba(40, 167, 69, 0.5); }
.incorrect { background: rgba(220, 53, 69, 0.8) !important; border-color: #dc3545 !important; box-shadow: 0 0 15px rgba(220, 53, 69, 0.5); }

.scramble-input {
	width: 100%;
	padding: 15px 20px;
	font-size: 1.2rem;
	border-radius: 12px;
	border: 2px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-white);
	outline: none;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
	box-sizing: border-box;
}
.scramble-input:focus {
	border-color: var(--vibrant-pink);
	box-shadow: 0 0 10px rgba(255, 102, 204, 0.3);
}
.scramble-input:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.scramble-input.correct {
	border-color: #28a745 !important;
	box-shadow: 0 0 12px rgba(40, 167, 69, 0.5);
}
.scramble-input.incorrect {
	border-color: #dc3545 !important;
	box-shadow: 0 0 12px rgba(220, 53, 69, 0.5);
}

.scramble-submit {
	margin-top: 10px;
	padding: 12px 30px;
	font-size: 1.1rem;
	border-radius: 12px;
	border: none;
	background: linear-gradient(135deg, var(--cosmic-pink), var(--vibrant-pink));
	color: var(--text-white);
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.scramble-submit:hover:not(:disabled) {
	opacity: 0.9;
	transform: scale(1.03);
}
.scramble-submit:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.scramble-answer {
	padding: 15px 20px;
	border-radius: 12px;
	font-size: 1.15rem;
	font-weight: 600;
	margin-top: 12px;
	text-align: center;
}
.scramble-answer.correct {
	background: rgba(40, 167, 69, 0.25);
	border: 1px solid #28a745;
	color: #7dffaa;
}
.scramble-answer.incorrect {
	background: rgba(220, 53, 69, 0.25);
	border: 1px solid #dc3545;
	color: #ff8a95;
}

#scripture-verse {
	background: rgba(0,0,0,0.3);
	border-left: 4px solid var(--golden-light);
	padding: 15px;
	margin-top: 25px;
	font-size: 1.1rem;
	line-height: 1.6;
	font-style: italic;
	border-radius: 0 8px 8px 0;
}

#game-stats {
	font-size: 0.95rem;
	color: var(--text-dark);
	margin-bottom: 8px;
}

#leaderboard-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

#leaderboard-table th,
#leaderboard-table td {
	padding: 8px 6px;
	word-break: break-word;
}

@media (max-width: 768px) {
	body {
		align-items: flex-start;
		padding: 12px 0;
	}

	#game-container {
		width: min(96vw, 750px);
		max-height: calc(100dvh - 24px);
		padding: 22px 14px;
		border-radius: 18px;
	}

	h1 {
		font-size: 1.6rem;
		letter-spacing: 1px;
	}

	.controls-container {
		gap: 12px;
		padding: 14px 0;
		margin-bottom: 20px;
	}

	.control {
		width: 100%;
		min-width: 0;
	}

	#header {
		gap: 8px;
		flex-wrap: wrap;
	}

	#timer-box,
	#lives-box,
	#score-box {
		min-width: 0;
		flex: 1 1 30%;
		font-size: 1rem;
		padding: 8px 10px;
	}

	#question {
		font-size: 1.15rem;
		margin-bottom: 18px;
	}

	.option-btn {
		font-size: 1rem;
		padding: 12px 12px;
	}

	.action-btn,
	.action-btn-secondary,
	.quit-btn,
	.next-btn,
	.hint-btn,
	.wager-btn {
		font-size: 0.95rem;
		padding: 12px 14px;
		margin: 8px 4px;
	}

	.game-mode-banner {
		font-size: 0.85rem;
		padding: 6px 14px;
	}
}

@media (max-width: 420px) {
	#game-container {
		padding: 16px 10px;
	}

	h1 {
		font-size: 1.35rem;
	}

	#question {
		font-size: 1.05rem;
	}

	#leaderboard-table th,
	#leaderboard-table td {
		font-size: 0.92rem;
		padding: 6px 4px;
	}
}

.hidden { display: none !important; }
