html, body {
	touch-action: manipulation;
}

body {
	font-family: Arial, sans-serif;
	margin: 0;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
	overflow: hidden;
}

canvas {
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 0;
}

#intro {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: url('intro-preload.jpg') no-repeat center top;
	background-size: contain;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding-top: 44%;
	z-index: 2;
}

#startBtn,
#readyBtn {
	padding: 12px 30px;
	font-size: 24px;
	cursor: pointer;
	border: #000000 2px solid;
	border-radius: 8px;
	opacity: 0.80;
	display: none;
	margin-top: 20px;
}

#loadingBarContainer {
	width: 200px;
	height: 20px;
	background: #ccc;
	border: 3px solid white;
	border-radius: 5px;
	margin-top: 20px;
}

#loadingBar {
	width: 0%;
	height: 100%;
	background: #4CAF50;
	transition: width 0.3s;
}

#loadingText {
	color: white;
	font-size: 16px;
	margin-top: 10px;
}

#damageBar {
	position: absolute;
	top: 10px;
	left: 50%;
	transform: translateX(-50%);
	width: 200px;
	height: 14px;
	background: #90EE90;
	border: 2px solid white;
	border-radius: 5px;
	padding: 2px;
	box-sizing: content-content;
	display: none;
	z-index: 2;
	position: relative;
}

#damageFill {
	height: 100%;
	background: red;
	width: 0%;
	transition: width 0.3s;
}

#damageText {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: black;
	font-size: 12px;
	text-align: center;
}

#gameOver {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: white;
	font-size: 48px;
	display: none;
	text-align: center;
	z-index: 2;
}

#score {
	position: absolute;
	top: 45px;
	left: 10px;
	color: white;
	font-size: 20px;
	display: none;
	z-index: 2;
}

#bestScore {
	color: white;
	font-size: 16px;
}

@keyframes flash {
	0%,
	100% {
		opacity: 1;
		color: white;
	}

	50% {
		opacity: 0;
		color: yellow;
	}
}

.flash-score {
	animation: flash 0.5s ease-in-out 6;
}

#muteBtn,
#musicMuteBtn, #cameraBtn {
	position: absolute;
	top: 7px;
	font-size: 24px;
	background: none;
	border: none;
	color: white;
	cursor: pointer;
	z-index: 2;
	text-shadow: 1px 1px 1px black, -1px -1px 1px black, 1px -1px 1px black, -1px 1px 1px black;
}

#muteBtn {
	right: 28px;
}

#musicMuteBtn {
	right: 7px;
}

#cameraBtn{
	left: 3px;
	display: none;
}

#musicMuteBtn.muted {
	opacity: 0.4;
}

#privacyBtn{
	position: fixed;
	bottom:10px;
	/*top: 90vh;*/
	font-size: 14px;
	background: none;
	border: none;
	color: rgb(99, 128, 255);
	cursor: pointer;
	z-index: 2;
	text-shadow: 1px 1px 1px black, -1px -1px 1px black, 1px -1px 1px black, -1px 1px 1px black;
	
}


#instructionsBtn,
#creditsBtn, #leaderboardBtn {
	padding: 8px 20px;
	font-size: 20px;
	cursor: pointer;
	border: #000000 2px solid;
	border-radius: 8px;
	opacity: 0.75;
	display: none;
	margin-top: 10px;
}

#startBtn,
#instructionsBtn,
#creditsBtn,
#leaderboardBtn {
	flex: 0 0 auto;
	/* Prevents shrinking or growing beyond content */
	width: 100%;
	max-width: 200px;
	font-weight: bold;
}


.popup {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	z-index: 3;
	justify-content: center;
	align-items: center;
}

.popup-content {
	background: #fff;
	padding: 20px;
	border-radius: 10px;
	max-width: 90%;
	max-height: 80vh;
	overflow-y: auto;
	position: relative;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.popup-content h2 {
	margin: 0px;
	color: #333;
	text-align: center;
	font-size: 170%;
}

.popup-content p {
	margin: 10px 0;
	color: #666;
}

.popup-content a {
	color: #0066cc;
	text-decoration: none;
}

.popup-content a:hover {
	text-decoration: underline;
}

.closeBtn {
	padding: 8px 16px;
	font-size: 16px;
	cursor: pointer;
	background: #4CAF50;
	color: white;
	border: none;
	border-radius: 5px;
	margin-top: 15px;
	display: block;
	margin-left: auto;
}

.closeBtn:hover {
	background: #45a049;
}

#privacyPopup h4, #privacyPopup ul {
	margin-bottom: 8px;
	margin-top: 8px;
}


#leaderboardPopup {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	z-index: 3;
	justify-content: center;
	align-items: center;
}

#leaderboardPopup .popup-content {
    max-height: 85vh;
    overflow-y: auto; /* Enable scrolling for the entire table */
}

#leaderboardTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    border: 2px solid #075d00;
    box-shadow: #20a700 0px 0px 10px;
	display: grid;
}

#leaderboardTable th, #leaderboardTable td {
    padding: 4px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #ddd;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide overflowing text */
    text-overflow: ellipsis; /* Add ellipsis for overflowing text */
}

#leaderboardBody {
    max-height: 25vh; /* Limit table height */
    overflow-y: auto; /* Enable vertical scrolling */
	font-size: 80%;
}

#leaderboardTable thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #4CAF50;
    color: white;
}

#leaderboardTable thead th:nth-child(1) { width: 5%; }/* adjust width of each heading */
#leaderboardTable thead th:nth-child(2) { width: 36%;}
#leaderboardTable thead th:nth-child(3) { width: 39%; }
#leaderboardTable thead th:nth-child(4) { width: 20%; }

#leaderboardTable td:nth-child(1) {/* 1st column */
    background-color: #9deb9f;
    color: #000;
}


#entryForm {
	margin-top: 15px;
	display: none;
	flex-direction: column;
    align-content: center;
    align-items: stretch;
}

#entryForm p {
	font-size: 120%;
	font-weight: bold;
}

#entryForm h2 {
	font-size: 150%;
}
#entryForm input {
	padding: 3px;
	margin: 1px 0;
	width: 100%;
	max-width: 200px;
	font-size: 120%;
	font-family: monospace;
}

#submitScoreBtn {
	font-size: 120%;
	padding: 8px 16px;
	background: #4CAF50;
	color: white;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	align-self: center;
	width: 100%;
	max-width: 200px;
	margin: 5px 0px;
}

.submitNote {
	font-size: 14px;
	font-style: italic;
	align-self: center;
}

#entryForm .form-row {
    display: flex;
    align-items: center;
    margin-top: 6px; 
}

#entryForm .form-row label {
    min-width: 70px; /* Ensure labels take at least this width */
    margin-right: 10px; /* Consistent space between label and input */
    text-align: right; /* Optional: right-align labels for clarity */
}

#entryForm .form-row input {
    width: 200px; /* Consistent input width */
}

.errorPopup {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	padding: 20px;
	border-radius: 10px;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	z-index: 4;
	text-align: center;
}

.errorPopup button {
	margin-top: 10px;
	padding: 5px 10px;
	background: #4CAF50;
	color: white;
	border: none;
	border-radius: 5px;
	cursor: pointer;
}
