@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800&display=swap');

* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	overflow: hidden;
	height: 100%;
	width: 100%;
	position: relative;
	font-family: 'Outfit', sans-serif;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	background-color: #1a1a2e;
	color: #ffffff;
}

#container {
	width: 100%;
	height: 100%;
	position: relative;
}

#container #game {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
}

/* Sound Button */
#sound-btn {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.2);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	cursor: pointer;
	z-index: 50;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
	transition: transform 0.2s ease, background 0.2s ease;
}

#sound-btn:hover {
	transform: scale(1.1);
	background: rgba(255, 255, 255, 0.35);
}

/* Score Display */
#container #score {
	position: absolute;
	top: 25px;
	width: 100%;
	text-align: center;
	font-size: 11vh;
	font-weight: 800;
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	color: #333344;
	transform: translateY(-200px);
	z-index: 10;
	pointer-events: none;
	text-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Combo Popup */
#combo-popup {
	position: absolute;
	top: 18vh;
	width: 100%;
	text-align: center;
	font-size: 28px;
	font-weight: 800;
	color: #ff4757;
	text-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
	z-index: 15;
	pointer-events: none;
	opacity: 0;
	transform: scale(0.5);
	transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#combo-popup.show {
	opacity: 1;
	transform: scale(1.2);
}

/* Instructions */
#container #instructions {
	position: absolute;
	width: 100%;
	top: 25vh;
	left: 0;
	text-align: center;
	transition: opacity 0.5s ease;
	color: #4a4a5a;
	opacity: 0;
	z-index: 10;
	pointer-events: none;
	font-size: 18px;
	font-weight: 600;
	letter-spacing: 1px;
}

#container #instructions.hide {
	opacity: 0 !important;
}

/* Title Card & Start Screen */
#container .game-ready {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 40px;
	z-index: 20;
}

.title-card {
	text-align: center;
	animation: floatTitle 3s ease-in-out infinite alternate;
}

.title-card h1 {
	font-size: 48px;
	font-weight: 800;
	margin: 0;
	color: #2f3542;
	letter-spacing: 2px;
}

.title-card p {
	font-size: 18px;
	color: #747d8c;
	margin-top: 8px;
}

@keyframes floatTitle {
	from { transform: translateY(0); }
	to { transform: translateY(-10px); }
}

#container .game-ready #start-button {
	transition: all 0.3s ease;
	opacity: 0;
	transform: translateY(30px);
	border: none;
	padding: 16px 40px;
	background: #333344;
	color: #ffffff;
	font-size: 24px;
	font-weight: 800;
	border-radius: 50px;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(51, 51, 68, 0.4);
	letter-spacing: 1px;
}

#container .game-ready #start-button:hover {
	transform: scale(1.05) translateY(0);
	background: #57606f;
	box-shadow: 0 15px 35px rgba(87, 96, 111, 0.5);
}

/* Game Over Screen */
#container .game-over {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 20;
	pointer-events: none;
	background: rgba(26, 26, 46, 0.4);
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.5s ease;
}

#container .game-over * {
	transition: opacity 0.5s ease, transform 0.5s ease;
	opacity: 0;
	transform: translateY(-30px);
	color: #ffffff;
}

#container .game-over h2 {
	margin: 0 0 15px 0;
	font-size: 52px;
	font-weight: 800;
	color: #ff4757;
	text-shadow: 0 4px 20px rgba(255, 71, 87, 0.4);
}

.score-card {
	background: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(15px);
	border: 1px solid rgba(255, 255, 255, 0.25);
	padding: 20px 40px;
	border-radius: 20px;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.score-card p {
	margin: 8px 0;
	font-size: 24px;
	font-weight: 600;
	color: #ffffff !important;
}

.restart-hint {
	margin-top: 30px !important;
	font-size: 18px !important;
	color: #ced6e0 !important;
	animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
	from { opacity: 0.6; }
	to { opacity: 1; }
}

/* State Handlers */
#container.playing #score,
#container.resetting #score {
	transform: translateY(0px);
}

#container.playing #instructions {
	opacity: 1;
}

#container.ready .game-ready #start-button {
	opacity: 1;
	transform: translateY(0);
}

#container.ended #score {
	transform: translateY(-200px);
}

#container.ended .game-over {
	pointer-events: auto;
	opacity: 1;
}

#container.ended .game-over * {
	opacity: 1;
	transform: translateY(0);
}
