::-webkit-scrollbar { 
	width: 16px;
}
::-webkit-scrollbar-track { 
	background-color: #333;
} 
::-webkit-scrollbar-thumb { 
	background-color: #424e69;
}
::-webkit-scrollbar-thumb:hover { 
	background-color: #8295d5;
}

@font-face { 
	font-family: 'Quadrit'; 
	src: url('../css/Quadrit.ttf'); 
}

* { 
	font-family: Quadrit, sans-serif;
	font-size: 20px;
	color: #fff;
}

html, body { 
	margin: 0px 0px 0px 0px;
	padding: 0px 0px 0px 0px;
	width: 100%;
	height: 100%;
}
html  { 
	background-color: #000;
}
body { 
	position: relative;
}


#score, #highscore  { 
	position: absolute;
	display: inline;
	top: 70px;
	margin: 0px;
	padding: 0px;
	width: 160px;
}
#highscore { 
	left: 180px;
}
#score h2, #score span, #highscore h2, #highscore span { 
	display: block;
	text-transform: uppercase;
	font-weight: normal;
	letter-spacing: 2px;
	font-size: 16px;
	height: 21px;
	margin: 0px;
	padding: 0px;
	text-align: right;
	padding-right: 15px;
}
#score span, #highscore span { 
	padding-right: 0px;
}
#highscore span { 
	padding-right: 40px;
}
#message { 
	position: absolute;
	display: inline;
	top: 413px;
	left: 180px;
	margin: 0px;
	padding: 0px;
	width: 210px;
	height: 30px;
	text-transform: uppercase;
	font-weight: normal;
	letter-spacing: 2px;
	font-size: 20px;
	color: #fff200;
	text-align: center;
}
#message.red { 
	color: red;
}

span.combo, span.fruits { 
	position: absolute;
	letter-spacing: 1.5px;
	font-size: 14px;
	color: #89dfff;
	font-weight: normal;
}

#panel, #home { 
	width: 550px;
	height: 690px;
	margin: auto;
	margin-top: 10px;
	left: 0px;
	right: 0px;
	position: absolute;
	padding: 5px 10px 10px 10px;
	background-color: #000;
	max-width: 100vw;
	box-sizing: border-box;
}

/* Initially hide the game panel until JavaScript shows it */
#panel {
	display: none;
}			
#board, #canvas-board, #canvas-paths, #canvas-fruits, #canvas-pacman, #canvas-bubbles, #canvas-ghost-blinky, #canvas-ghost-pinky, #canvas-ghost-inky, #canvas-ghost-clyde { 
	width: 550px;
	height: 550px;
	position: absolute;
	max-width: 100%;
	box-sizing: border-box;
}
#canvas-paths { 
	display: none;
}
#board {  
	position: relative;
}

#canvas-lifes, #canvas-level-fruits { 
	height: 30px;
	top: 670px;
	position: absolute;
	z-index: 111111;
}
#canvas-lifes { 
	width: 120px;
	left: 50px;
}
#canvas-level-fruits { 
	width: 265px;
	right: 50px;
}

#control { 
	position: absolute;
	margin: auto;
	left: 0px;
	right: 0px;
	bottom: -145px;
	width: 550px;
	height: 140px;
	background-color: #666;
	opacity: 0.7;
	display: none;
}
#control-up, #control-down, #control-up-second, #control-down-second, #control-left, #control-right, #control-up-big, #control-down-big, #control-left-big, #control-right-big { 
	position: absolute;
	margin: auto;
	background-repeat: no-repeat;
	background-position: 50% 50%;
	background-size: 64px;
	cursor: pointer;
	width: 64px;
	height: 64px;
	padding: 5px;
}
#control-up { 
	top: 0px;
	left: 70px;
	background-image: url('../img/move-up.png');
}
#control-down { 
	bottom: 0px;
	right: 70px;
	background-image: url('../img/move-down.png');
}
#control-up-second { 
	top: 0px;
	right: 70px;
	background-image: url('../img/move-up.png');
}
#control-down-second{ 
	bottom: 0px;
	left: 70px;
	background-image: url('../img/move-down.png');
}
#control-left { 
	bottom: 0px;
	top: 0px;
	left: 0px;
	background-image: url('../img/move-left.png');
}
#control-right { 
	bottom: 0px;
	top: 0px;
	right: 0px;
	background-image: url('../img/move-right.png');
}

#control-up-big, #control-down-big, #control-left-big, #control-right-big { 
	position: absolute;
	opacity: 0.2;
	margin: auto;
	padding: 0px;
	display: none;
	background-size: 98px;
	z-index: 999999;
}
#control-up-big { 
	bottom: 10px;
	left: 0px;
	right: 0px;
	width: 125px;
	height: 125px;
	background-image: url('../img/move-up-big.png');
}
#control-down-big { 
	bottom: -120px;
	left: 0px;
	right: 0px;
	width: 125px;
	height: 125px;
	background-image: url('../img/move-down-big.png');
}
#control-left-big { 
	left: 80px;
	bottom: -90px;
	width: 125px;
	height: 175px;
	background-image: url('../img/move-left-big.png');
}
#control-right-big { 
	right: 80px;
	bottom: -90px;
	width: 125px;
	height: 175px;
	background-image: url('../img/move-right-big.png');
}



h1 { 
	margin: 0px 0px 74px 0px;
	padding: 0px;
	font-size: 24px;
	letter-spacing: 3px;
	color: #fff;
	text-transform: uppercase;
	font-style: normal;
}
h3 { 
	margin: 0px;
	padding: 0px;
	font-size: 20px;
	letter-spacing: 2px;
	color: #fff;
	text-transform: uppercase;
	font-style: normal;
}

.sound { 
	position: absolute;
}
.sound img { 
	height: 28px;
}
#home .sound { 
	bottom: 0px;
	right: 5px;
}
#panel .sound { 
	top: 77px;
	right: 5px;
}

.github { 
	position: absolute;
	bottom: 0px;
	left: 5px;
}

.putchu { 
	position: absolute;
	top: 450px;
	left: 130px;
	background-color: #4c6441;
	padding: 10px 25px 40px 95px;
	text-transform: uppercase;
}
.putchu img { 
	position: absolute; 
	bottom: -5px;
	left: 5px;
}
#panel .putchu { 
	top: 0px;
	right: 5px;	
	left: auto;
	font-size: 16px;
	padding: 10px 25px 30px 65px;
}

.help-button { 
	position: absolute;
	text-align: center;
	bottom: 8px;
	right: 55px;
	margin: auto;
	font-size: 14px;
	font-weight: bold;
	text-transform: lowercase;
	letter-spacing: 0.5px;
	cursor: pointer;
	color: #78abf7;
	transition: color 1.5s;
}
.help-button.yo { 
	color: #333;
}
#panel .help-button { 
	top: -510px;
	height: 25px;
}

#help h2 { 
	margin: 0px 0px 10px 0px;
	color: #d43b3b;
	text-transform: uppercase;
	font-weight: bold;
	font-size: 26px;
}
#help { 
	position: absolute;
	width: 420px;
	height: 265px;
	top: 290px;
	left: 0px;
	right: 0px;
	margin: auto;
	padding-top: 15px;
	text-align: center;
	z-index: 999999;
	background-color: #222;
	border: solid 1px #193fff;
	text-transform: uppercase;
	opacity: 0.9;
	display: none;
	cursor: pointer;
}
#help  table  tr  td { 
	font-size: 16px;
	letter-spacing: 1px;
}
#help  table  tr  td:first-child { 
	color: #f4c030;
	font-weight: bold;
	text-align: right;
}
#help  table  tr  td:last-child { 
	text-align: left;
}

#sound { 
	position: absolute;
}

.ui-mobile {
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-ms-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: rgba(0,0,0,0);
}



@media screen and (min-height:1200px), screen and (min-device-height : 1200px) { 
	#panel, #home { 
		zoom: 135%;
	}
}

@media screen and (max-width:1024px), screen and (min-device-width : 768px) and (max-device-width : 1024px) { 
	#home .help-button, #panel .help-button, #home .github, #sound, .sound { 
		display: none;
	}
	#panel, #home { 
		zoom: 105%;
	}
	#control-up-big, #control-down-big, #control-left-big, #control-right-big { 
		display: inline; 
	} 
	#mobile-controls {
		display: block;
	}
}

/* Mobile phones and small screens */
@media screen and (max-width: 768px) {
	#panel, #home {
		width: 100vw;
		max-width: 100vw;
		margin: 0;
		padding: 5px;
		box-sizing: border-box;
		zoom: 1;
		transform: none;
	}
	
	#board, #canvas-board, #canvas-paths, #canvas-fruits, #canvas-pacman, #canvas-bubbles, #canvas-ghost-blinky, #canvas-ghost-pinky, #canvas-ghost-inky, #canvas-ghost-clyde {
		width: calc(100vw - 10px);
		max-width: calc(100vw - 10px);
		height: calc(100vw - 10px);
		max-height: calc(100vw - 10px);
		aspect-ratio: 1;
		margin: 0 auto;
		display: block;
	}
	
	/* Keep paths hidden on mobile */
	#canvas-paths {
		display: none !important;
	}
	
	#control-up-big, #control-down-big, #control-left-big, #control-right-big { 
		display: inline; 
	}
	
	#mobile-controls {
		display: block;
		position: fixed;
		bottom: 20px;
		left: 50%;
		transform: translateX(-50%);
		width: 180px;
		height: 180px;
		z-index: 1000;
	}
	
	#home .help-button, #panel .help-button, #home .github, #sound, .sound { 
		display: none;
	}
	
	#score, #highscore {
		position: absolute;
		top: 10px;
		width: 120px;
		font-size: 14px;
	}
	
	#score {
		left: 10px;
	}
	
	#highscore {
		right: 10px;
		left: auto;
	}
	
	#message {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: 80%;
		text-align: center;
		z-index: 500;
	}
}
@media screen and (max-height:640px), screen and (min-device-height : 480px) and (max-device-height : 640px) and (-webkit-device-pixel-ratio: 3) { 
	#panel, #home { 
		zoom: 60%;
	}
	#control-up-big, #control-down-big, #control-left-big, #control-right-big { 
		display: inline; 
	} 
	#home .help-button, #panel .help-button, #home .github, #sound, .sound { 
		display: none;
	}
	h1, #canvas-panel-title-pacman { 
		visibility: hidden;
	}
}
@media screen and (max-height:480px), screen and (min-device-height : 320px) and (max-device-height : 480px) { 
	#panel, #home { 
		zoom: 55%;
	}
	#control-up-big, #control-down-big, #control-left-big, #control-right-big { 
		display: inline; 
	} 
	h1, #canvas-panel-title-pacman, #control-up-second, #control-down-second, #home .help-button, #panel .help-button, #home .github, #sound, .sound { 
		display: none;
	}
	#score, #highscore { 
		top: 0px;
	}
	#panel { 
		padding-top: 50px;
	}
	#canvas-lifes, #canvas-level-fruits { 
		top: 607px;
	}
	#control { 
		bottom: 50px;
		width: 550px;
		height: 55px;
	}
	#control-up, #control-down, #control-left, #control-right { 
		top: 0px;
		bottom: 0px;
		background-size: 48px;
		width: 48px;
		height: 48px;
		padding: 5px;
	}
	#message { 
		top: 347px;
	}
}

/* Leaderboard Side Panel */
#leaderboard-panel {
	position: fixed;
	top: 0;
	right: -350px;
	width: 350px;
	height: 100vh;
	background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
	border-left: 3px solid #ffff00;
	transition: right 0.3s ease-in-out;
	z-index: 500;
	overflow-y: auto;
	box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
	display: none;
}

#leaderboard-panel.open {
	right: 0;
	display: block;
}

.panel-header {
	background: linear-gradient(135deg, #ffff00 0%, #fff200 100%);
	color: #000;
	padding: 20px;
	position: sticky;
	top: 0;
	z-index: 501;
}

.panel-header h2 {
	margin: 0;
	font-size: 24px;
	text-align: center;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.close-panel {
	position: absolute;
	top: 15px;
	right: 20px;
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
	color: #000;
	background: none;
	border: none;
	padding: 5px;
	line-height: 1;
}

.close-panel:hover {
	opacity: 0.7;
	transform: scale(1.1);
}

#leaderboard-list {
	padding: 20px;
	color: #fff;
}

#leaderboard-list ol {
	list-style: none;
	padding: 0;
	margin: 0;
}

#leaderboard-list li {
	padding: 15px;
	margin: 10px 0;
	background: rgba(255, 255, 0, 0.1);
	border: 1px solid rgba(255, 255, 0, 0.3);
	border-radius: 8px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: all 0.2s ease;
}

#leaderboard-list li:hover {
	background: rgba(255, 255, 0, 0.2);
	transform: translateX(-5px);
}

#leaderboard-list li:first-child {
	background: linear-gradient(135deg, rgba(255, 255, 0, 0.3) 0%, rgba(255, 242, 0, 0.3) 100%);
	border: 2px solid #ffff00;
	box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

#leaderboard-list li:first-child::before {
	content: "👑 ";
	margin-right: 5px;
}

.rank-info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.rank-number {
	font-size: 14px;
	color: #ffff00;
	font-weight: bold;
}

.player-name {
	font-size: 18px;
	font-weight: bold;
	margin-top: 2px;
}

.player-country {
	font-size: 12px;
	color: #ccc;
	margin-top: 2px;
}

.player-score {
	font-size: 20px;
	font-weight: bold;
	color: #ffff00;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.loading-message {
	text-align: center;
	padding: 40px 20px;
	color: #ffff00;
	font-size: 16px;
}

.empty-message {
	text-align: center;
	padding: 40px 20px;
	color: #888;
	font-size: 16px;
}

/* Overlay for mobile */
.panel-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 499;
	display: none;
}

.panel-overlay.show {
	display: block;
}

.menu-button {
	cursor: pointer;
	text-align: center;
	padding: 5px 10px;
	margin: 5px 0;
	border: 1px solid #ffff00;
	color: #ffff00;
	background: #000;
	font-family: inherit;
	font-size: 12px;
	position: absolute;
	bottom: -25px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 200;
}

/* Mobile Controls Above Leaderboard */
#mobile-controls {
	position: absolute;
	bottom: 25px;
	left: 50%;
	transform: translateX(-50%);
	display: none;
	width: 160px;
	height: 160px;
	z-index: 300;
}

#mobile-controls .mobile-btn {
	position: absolute;
	width: 55px;
	height: 55px;
	background: rgba(255, 255, 0, 0.9);
	border: 3px solid #ffff00;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	color: #000;
	font-weight: bold;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: transparent;
	transition: all 0.1s ease;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

#mobile-controls .mobile-btn:active {
	background: #fff200;
	transform: scale(0.9);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#mobile-controls .mobile-btn.up {
	top: 0;
	left: 50%;
	transform: translateX(-50%);
}

#mobile-controls .mobile-btn.up:active {
	transform: translateX(-50%) scale(0.9);
}

#mobile-controls .mobile-btn.down {
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
}

#mobile-controls .mobile-btn.down:active {
	transform: translateX(-50%) scale(0.9);
}

#mobile-controls .mobile-btn.left {
	top: 50%;
	left: 0;
	transform: translateY(-50%);
}

#mobile-controls .mobile-btn.left:active {
	transform: translateY(-50%) scale(0.9);
}

#mobile-controls .mobile-btn.right {
	top: 50%;
	right: 0;
	transform: translateY(-50%);
}

#mobile-controls .mobile-btn.right:active {
	transform: translateY(-50%) scale(0.9);
}

.menu-button:hover {
	background: #ffff00;
	color: #000;
}
