@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

html,
body {
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none; 
	-ms-user-select: none; 
	user-select: none; 
}

body {
	font-family: 'Press Start 2P', cursive;
	background-color: #181a1b;
	color: #ecf0f1;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	text-align: center;
	touch-action: manipulation;
}


#app-container {
	position: relative;
	width: 100%;
	height: 100vh;
	background: #2c3e50;
	border: 6px solid #181a1b;
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
	border-radius: 15px;
	overflow: hidden;
	touch-action: manipulation;
}


@media (display-mode: standalone) {
	#app-container {
		border: none;
		border-radius: 0;
		box-shadow: none;
	}
}


@media (min-width: 768px) and (min-height: 500px) {
	#app-container {
		width: calc(100vh * (9/16));
		max-width: 100%;
		height: calc(100vw * (16/9));
		max-height: 100vh;
	}
}


@media (max-height: 500px) and (orientation: landscape) {
	#app-container {
		width: 100%;
		height: 100vh;
	}
}


.game-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
	overflow: hidden;
	touch-action: manipulation;
}


@media (display-mode: standalone) {
	.game-container {
		border: none;
		border-radius: 0;
		box-shadow: none;
	}
}


@media (min-width: 768px) and (min-height: 500px) {
	.game-container {
		width: calc(100vh * (9/16));
		max-width: 100%;
		height: calc(100vw * (16/9));
		max-height: 100vh;
	}
}


@media (max-height: 500px) and (orientation: landscape) {
	.game-container {
		width: 100%;
		height: 100vh;
	}
}

#gameCanvas {
	background: #202526;
	display: block;
	width: 100%;
	height: 100%;
	cursor: pointer;
	touch-action: manipulation;
}

#game-over-screen {
	background: transparent;
}


.ui-panel {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #202526;
	z-index: 100;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: 30px 20px 30px 20px;
	box-sizing: border-box;
}



@media (max-width: 375px) and (max-height: 667px) {
	.ui-panel {
		padding: 20px 20px 20px 20px;
	}
}


@media (min-width: 376px) and (max-width: 767px) {
	.ui-panel {
		padding: 25px 20px 25px 20px;
	}
}


@media (min-width: 768px) and (max-width: 1024px) {
	.ui-panel {
		padding: 40px 30px 40px 30px;
	}
}


@media (min-width: 1025px) {
	.ui-panel {
		padding: 50px 40px 50px 40px;
	}
}


.screen-title {
	font-size: clamp(1.8rem, 5vw, 3.5rem);
	color: #ecf0f1;
	text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.25);
	margin: 0;
	margin-top: clamp(40px, 8vh, 80px);
	margin-bottom: clamp(50px, 8vh, 100px);
	flex-shrink: 0;
}

.title-accent-color {
	color: #e74c3c;
}


.icon-buttons {
	display: flex;
	gap: clamp(15px, 4vw, 30px);
	margin-bottom: clamp(40px, 6vh, 60px);
	flex-shrink: 0;
}

.icon-button {
	width: clamp(50px, 12vw, 80px);
	height: clamp(50px, 12vw, 80px);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-family: 'Press Start 2P';
	font-size: clamp(0.8rem, 3vw, 1.4rem);
	transition: transform 0.2s ease;
}

.icon-button:active {
	transform: scale(0.9);
}

.icon-ranking {
	background-color: #f1c40f;
}

.icon-help {
	background-color: #2ecc71;
	font-size: clamp(20px, 5vw, 32px);
	line-height: 1;
}

.icon-credits {
	background-color: #1abc9c;
	font-size: clamp(18px, 4.5vw, 30px);
	line-height: 1;
}


.screen-controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(25px, 4vh, 35px);
	font-size: clamp(0.9rem, 2.5vw, 1.4rem);
	flex: 1;
	justify-content: flex-start;
	min-height: 0;
}

.sound-toggle {
	background: none;
	border: none;
	color: #bdc3c7;
	font-family: 'Press Start 2P';
	font-size: clamp(0.9rem, 2.5vw, 1.4rem);
	cursor: pointer;
	transition: transform 0.2s ease;
}

.sound-toggle:hover {
	transform: scale(1.05);
}

.sound-toggle span {
	color: #2ecc71;
	font-weight: bold;
}

.sound-toggle.sound-off span {
	color: #e74c3c;
}

.best-score-display {
	color: #bdc3c7;
	text-align: center;
}

.best-score-display .hi-score-text {
	color: #f1c40f;
	display: inline-block;
}


.game-over-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(25px, 4vh, 35px); 
	font-size: clamp(0.9rem, 2.5vw, 1.4rem);
	flex: 1;
	justify-content: flex-start;
	min-height: 0;
}


.game-over-card {
	background-color: #1abc9c;
	color: #233432;
	padding: clamp(20px, 4vh, 30px);
	border-radius: 12px;
	text-align: center;
	border: none;
	margin: 0;
	margin-bottom: clamp(30px, 5vh, 45px) !important; 
	flex-shrink: 0;
}

.game-over-card h2 {
	margin: 0 0 15px 0;
	font-size: clamp(1.1rem, 3vw, 1.8rem);
}

.game-over-card p {
	margin: 0;
	font-size: clamp(1.3rem, 4vw, 2.5rem);
}


.play-button {
	background-color: rgba(26, 188, 156, 0.1);
	border: none;
	color: #1abc9c;
	font-family: 'Press Start 2P', cursive;
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	cursor: pointer;
	padding: clamp(15px, 3vh, 25px) clamp(30px, 6vw, 60px);
	border-radius: 10px;
	transition: all 0.2s ease;
	flex-shrink: 0;
	margin-top: auto;
	margin-bottom: clamp(30px, 5vh, 50px);
}

.play-button:hover {
	background-color: rgba(26, 188, 156, 0.2);
	transform: scale(1.02);
}

.play-button:active {
	transform: scale(0.98);
}


.back-button {
	position: absolute;
	top: 20px;
	left: 20px;
	background: none;
	border: none;
	color: #1abc9c;
	font-family: 'Press Start 2P', cursive;
	font-size: clamp(0.8rem, 2.5vw, 1.2rem);
	cursor: pointer;
	transition: transform 0.2s ease;
	z-index: 10;
}

.back-button:hover {
	transform: scale(1.05);
}


.version-display {
	font-size: clamp(0.5rem, 1.5vw, 0.7rem);
	color: #7f8c8d;
	text-shadow: none;
	line-height: 1;
	flex-shrink: 0;
	margin-top: 0;
	margin-bottom: clamp(10px, 2vh, 20px);
}


.score-container {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 5;
	text-align: right;
}

.score-display {
	font-size: clamp(1.2rem, 4vw, 2rem);
	color: #ecf0f1;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hi-score-display {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 5px;
	margin-bottom: 1.5rem;
}

.hi-score-display svg {
	width: clamp(20px, 4.5vw, 26px);
	height: clamp(20px, 4.5vw, 26px);
	filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .5));
}

.hi-score-text {
	font-size: clamp(1rem, 3.5vw, 1.5rem);
	color: #bdc3c7;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.new-high-score-color {
	color: #f1c40f !important;
}


#comboDisplay,
#bonusDisplay {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.6);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.25s ease-out;
	line-height: 1.35;
	text-align: center;
	white-space: normal;
}

#comboDisplay {
	top: 25%;
	color: #1abc9c;
}

#bonusDisplay {
	top: 40%;
	color: #f1c40f;
}


.user-id-container {
	position: absolute;
	bottom: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	gap: 5px;
}

.user-id-display {
	font-size: 0.7rem;
	color: #7f8c8d;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.copy-button {
	padding: 5px;
	background-color: #34495e;
	color: #ecf0f1;
	border: none;
	border-radius: 5px;
	font-family: 'Press Start 2P', cursive;
	cursor: pointer;
	font-size: 0.6rem;
}


.button {
	padding: 10px 20px;
	background-color: #f1c40f;
	color: #2c3e50;
	border: none;
	border-radius: 5px;
	font-family: 'Press Start 2P', cursive;
	cursor: pointer;
	font-size: 1rem;
	transition: transform 0.2s, box-shadow 0.2s;
	box-shadow: 0 4px #c0392b;
}

.button:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px #c0392b;
}

.button:active {
	transform: translateY(2px);
	box-shadow: 0 2px #c0392b;
}

.small-button {
	padding: 8px 12px;
	font-size: .7rem;
}


.top-left-controls {
	position: absolute;
	top: 20px;
	left: 20px;
	padding-right: 20px;
	padding-bottom: 20px;
	z-index: 30;
	border-radius: 12px;
}


.pause-button {
	width: clamp(28px, 5vmin, 40px);
	height: clamp(28px, 5vmin, 40px);
	background: rgba(255, 255, 255, 0.15);
	border: none;
	border-radius: 8px;
	position: relative;
	cursor: pointer;
	outline: none;
}

.pause-button::before,
.pause-button::after {
	content: "";
	position: absolute;
	top: 20%;
	width: 18%;
	height: 60%;
	background: #ffffff;
	border-radius: 2px;
	opacity: 0.9;
}

.pause-button::before { left: 22%; }
.pause-button::after { right: 22%; }
.pause-button:hover { background: rgba(255, 255, 255, 0.22); }


.pause-shade {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 20;
}

.pause-countdown {
	color: #ecf0f1;
	font-family: 'Press Start 2P', cursive;
	font-size: clamp(2rem, 8vw, 4rem);
	text-align: center;
	text-shadow: 3px 3px 6px rgba(0,0,0,0.6);
	line-height: 1.25;
	padding: 0 12px;
}


@keyframes flash {
	0%, 100% {
		transform: translateX(-50%) scale(1);
		filter: brightness(1);
	}
	50% {
		transform: translateX(-50%) scale(1.1);
		filter: brightness(1.5);
	}
}



@keyframes flash-scale-only {
	0%, 100% {
		transform: scale(1);
		
		filter: brightness(1);
		color: inherit; 
	}
	50% {
		transform: scale(1.1);
		filter: brightness(1.0); 
		
		
		
		color: #f1c40f; 
	}
}

.flashing {
	animation: flash 0.5s infinite;
}

.flashing-score {
	animation: flash-scale-only 0.5s infinite;
}

.flashing-final {
	animation: flash-scale-only 1s infinite;
}


.controls-hint {
	position: absolute;
	bottom: 10px;
	left: 10px;
	font-size: 0.6rem;
	color: #7f8c8d;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
	display: none;
}

@media (min-width: 768px) {
	.controls-hint {
		display: block;
	}
}



@media (max-width: 320px) {
	.ui-panel {
		padding: 15px;
	}

	.screen-title {
		font-size: 1.5rem !important;
		margin-top: 30px !important;
		margin-bottom: 40px !important;
	}

	.icon-buttons {
		gap: 10px !important;
		margin-bottom: 30px !important;
	}

	.icon-button {
		width: 45px !important;
		height: 45px !important;
		font-size: 0.7rem !important;
	}

	.play-button {
		margin-bottom: 20px !important;
	}

	.game-over-card {
		margin-bottom: 25px !important; 
	}
}


@media (min-height: 900px) {
	.screen-title {
		margin-top: 100px !important;
		margin-bottom: 120px !important;
	}

	.icon-buttons {
		margin-bottom: 80px !important;
	}

	.screen-controls,
	.game-over-content {
		gap: 40px !important;
	}

	.play-button {
		margin-bottom: 60px !important;
	}

	.game-over-card {
		margin-bottom: 55px !important; 
	}
}



@media (max-height: 500px) and (orientation: landscape) {
	.ui-panel {
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		padding: 10px 20px;
	}

	.screen-title {
		margin: 0 !important;
		font-size: 1.5rem !important;
	}

	.icon-buttons {
		margin: 0 !important;
		flex-direction: column;
		gap: 10px !important;
	}

	.icon-button {
		width: 40px !important;
		height: 40px !important;
	}

	.screen-controls,
	.game-over-content {
		margin: 0 !important;
		gap: 15px !important;
	}

	.play-button {
		font-size: 1.2rem !important;
		padding: 10px 20px !important;
		margin: 0 !important;
	}

	.version-display {
		margin: 0 !important;
	}

	.game-over-card {
		margin: 0 0 15px 0 !important; 
	}
}




.glowing-card {
	animation: pulse-glow 1.8s ease-in-out infinite;
}


@keyframes pulse-glow {
	0% {
		
		box-shadow: 0 0 20px rgba(26, 188, 156, 0.7);
	}
	50% {
		
		box-shadow: 0 0 45px rgba(26, 188, 156, 1);
	}
	100% {
		
		box-shadow: 0 0 20px rgba(26, 188, 156, 0.7);
	}
}


.leaderboard-container {
	width: 100%;
	max-width: 500px;
	flex-grow: 1;
	overflow-y: auto; 
	padding: 0 clamp(10px, 3vw, 20px);
	box-sizing: border-box;
}

#leaderboard-list {
	list-style: none;
	padding: 0;
	margin: 0;
	font-size: clamp(0.8rem, 2.5vw, 1.2rem);
	color: #ecf0f1;
}

#leaderboard-list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: clamp(10px, 2vh, 15px) 5px;
	border-bottom: 2px solid #34495e;
	line-height: 1.4;
}

#leaderboard-list li:last-child {
	border-bottom: none;
}


.player-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis; 
	padding-right: 15px;
}


.player-score {
	font-weight: bold;
	color: #f1c40f; 
	flex-shrink: 0; 
}


.leaderboard-message {
	text-align: center;
	color: #7f8c8d;
	margin-top: 40px;
	font-size: clamp(0.8rem, 2.5vw, 1.1rem);
}



.name-prompt-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 200; 
	font-family: 'Press Start 2P', cursive;
}

.name-prompt-box {
	background-color: #2c3e50;
	padding: clamp(20px, 5vw, 40px);
	border-radius: 15px;
	border: 4px solid #1abc9c;
	text-align: center;
	width: 90%;
	max-width: 400px;
	box-shadow: 0 0 30px rgba(26, 188, 156, 0.5);
}

.name-prompt-box h2 {
	font-size: clamp(1.1rem, 4vw, 1.8rem);
	color: #f1c40f;
	margin: 0 0 15px 0;
}

.name-prompt-box p {
	font-size: clamp(0.7rem, 2.5vw, 1rem);
	color: #ecf0f1;
	margin: 0 0 25px 0;
	line-height: 1.5;
}

#name-input-field {
	font-family: 'Press Start 2P', cursive;
	background-color: #202526;
	border: 2px solid #7f8c8d;
	color: #ecf0f1;
	padding: 10px;
	width: 80%;
	text-align: center;
	font-size: clamp(1rem, 4vw, 1.5rem);
	border-radius: 8px;
	margin-bottom: 25px;
	outline: none;
}

#name-input-field:focus {
	border-color: #f1c40f;
}


#submit-name-button {
	font-size: clamp(1.2rem, 3.5vw, 2rem) !important;
	padding: clamp(12px, 2.5vh, 20px) clamp(25px, 5vw, 50px) !important;
	margin: 0 !important; 
}



#palette-selector {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-bottom: clamp(25px, 4vh, 35px);
	
	color: #bdc3c7;
}

.palette-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(10px, 3vw, 20px);
}

.palette-arrow {
	background: none;
	border: none;
	color: #1abc9c;
	font-family: 'Press Start 2P', cursive;
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	cursor: pointer;
	padding: 5px;
	transition: transform 0.2s ease;
}

.palette-arrow:hover {
	transform: scale(1.1);
}

.palette-arrow:active {
	transform: scale(0.95);
}

#palette-display {
	width: 150px; 
	text-align: center;
}

#palette-display-text {
	color: #ecf0f1;
	font-weight: bold;
}

#palette-preview {
	display: flex;
	justify-content: center;
	gap: 4px;
	margin-top: 8px;
	height: 12px; 
}

.palette-swatch {
	width: 22px;
	height: 22px;
	
	border-radius: 2px;
	transition: opacity 0.3s ease-in-out;
	
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	transform: translateZ(0);

}



#leaderboard-list li.current-user {
	background-color: rgba(241, 196, 15, 0.1); 
	border-left: 4px solid #f1c40f; 
	padding-left: 10px;
}

#leaderboard-list li.current-user .player-name,
#leaderboard-list li.current-user .player-score {
	
	animation: pulse-text-glow 2s ease-in-out infinite;
}


@keyframes pulse-text-glow {
	0% {
		
		text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
	}
	50% {
		
		text-shadow: 0 0 15px rgba(241, 196, 15, 1);
	}
	100% {
		
		text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
	}
}
