/* CSS Reset and Basic Setup */
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	/* Disable tap highlight on mobile */
	-webkit-tap-highlight-color: transparent;
	/* Disable text selection */
	user-select: none;
	-webkit-user-select: none;
}

html, body {
	width: 100%;
	height: 100%;
	overflow: hidden; /* Prevent scrolling */
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	background-color: rgba(0, 0, 0, 0.3); /* Background color outside game */
}

/* Main game container */
#game-container {
	width: 100%;
	max-width: 768px; /* iPad mini portrait width */
	height: 100%;
	margin: 0 auto; /* Center the container */
	display: flex;
	flex-direction: column;
	/* Sky background color */
	background: linear-gradient(to bottom, #87CEEB 0%, #ADD8E6 100%);
	position: relative; /* As root for UI components */
}

/* Top UI area (Score, Time) */
#ui-top {
	display: flex;
	justify-content: space-between; /* Keep as is, 3 items will auto-align */
	padding: 12px 15px;
	background-color: rgba(0, 0, 0, 0.3);
	color: white;
	font-size: 1.2rem;
	font-weight: bold;
	z-index: 10;
	text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Game area (SVG) */
#game-svg {
	flex-grow: 1; /* Take up all remaining space */
	width: 100%;
	overflow: hidden; /* Hide anything drawn outside */
}

/* Bottom UI area (Controls) */
#ui-bottom {
	padding: 15px;
	background-color: rgba(0, 0, 0, 0.2);
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 10px; /* Gap between power bar and button */
}

/* Power bar container with ammo display */
#power-ammo-container {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
}

/* Ammo display next to power bar */
#ammo-display {
	color: white;
	font-size: 1.1rem;
	font-weight: bold;
	text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
	white-space: nowrap;
	min-width: 80px;
}

/* Power bar */
#power-bar-container {
	flex: 1;
	height: 20px;
	background-color: #555;
	border-radius: 10px;
	border: 2px solid #333;
	overflow: hidden;
}

#power-bar {
	width: 0%; /* Start at 0 */
	height: 100%;
	background: linear-gradient(to right, #FFEB3B, #FF9800); /* Yellow -> Orange */
	border-radius: 8px;
	transition: width 0.05s linear; /* Smooth when charging */
}

/* Bottom buttons container (Fire & Pause) */
#bottom-buttons {
	display: flex;
	gap: 10px;
	width: 100%;
}

/* Fire button */
#fire-button {
	flex: 1;
	padding: 18px;
	font-size: 1.3rem;
	font-weight: bold;
	color: white;
	background-color: #F44336; /* Red */
	border: none;
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 4px 8px rgba(0,0,0,0.3);
	transition: background-color 0.1s;
}

#fire-button:active {
	background-color: #D32F2F; /* Darker red when pressed */
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Pause button in bottom UI */
#pause-button {
	padding: 18px 20px;
	color: white;
	background: rgba(255, 255, 255, 0.25);
	border: 2px solid rgba(255, 255, 255, 0.6);
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 4px 8px rgba(0,0,0,0.3);
	transition: all 0.2s ease;
	backdrop-filter: blur(5px);
	display: flex;
	align-items: center;
	justify-content: center;
}

#pause-button:active {
	background: rgba(255, 255, 255, 0.35);
	transform: scale(0.95);
}

#pause-button.paused {
	background: rgba(76, 175, 80, 0.4);
	border-color: rgba(76, 175, 80, 0.8);
}

/* Start screen */
#start-screen {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	color: white;
	display: flex; /* Visible initially */
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 200;
	text-align: center;
	gap: 30px;
	padding-left: 20px;
    padding-right: 20px;
}

#start-screen h1 {
	font-size: 3rem;
	color: #FFD700;
	text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
	animation: pulse 2s ease-in-out infinite;
}

#start-screen p {
	font-size: 1.3rem;
	max-width: 80%;
	line-height: 1.6;
}

#start-button {
	padding: 20px 50px;
	font-size: 1.5rem;
	font-weight: bold;
	color: white;
	background: linear-gradient(135deg, #FFEB3B, #FF8E53);
	border: none;
	border-radius: 15px;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,0.3);
	transition: transform 0.2s, box-shadow 0.2s;
}

#start-button:active {
	transform: scale(0.95);
	box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

@keyframes pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}

/* Game Over screen */
#game-over-screen {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	color: white;
	display: none; /* Hidden initially */
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 100;
	text-align: center;
	gap: 20px;
}

#game-over-screen h2 {
	font-size: 3rem;
	color: #F44336;
}

#game-over-screen p {
	font-size: 1.5rem;
}

#restart-button {
	padding: 15px 30px;
	font-size: 1.2rem;
	font-weight: bold;
	color: #333;
	background-color: #4CAF50; /* Green */
	border: none;
	border-radius: 10px;
	cursor: pointer;
}

/* Pause screen */
#pause-screen {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.85);
	color: white;
	display: none; /* Hidden initially */
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 100;
	text-align: center;
	gap: 30px;
	backdrop-filter: blur(5px);
}

#pause-screen h2 {
	font-size: 3.5rem;
	color: #FFD700;
	text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
	animation: pulse 2s ease-in-out infinite;
}

#resume-button {
	padding: 20px 50px;
	font-size: 1.5rem;
	font-weight: bold;
	color: white;
	background: linear-gradient(135deg, #4CAF50, #45a049);
	border: none;
	border-radius: 15px;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,0.3);
	transition: transform 0.2s, box-shadow 0.2s;
}

#resume-button:hover {
	background: linear-gradient(135deg, #45a049, #3d8b40);
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

#resume-button:active {
	transform: scale(0.95);
	box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* === Boss Indicator Animation === */
@keyframes bossAppear {
	0% {
		transform: translate(-50%, -50%) scale(0) rotate(-10deg);
		opacity: 0;
	}
	30% {
		transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
		opacity: 1;
	}
	50% {
		transform: translate(-50%, -50%) scale(1.1) rotate(-2deg);
		opacity: 1;
	}
	70% {
		transform: translate(-50%, -50%) scale(1.2) rotate(1deg);
		opacity: 1;
	}
	100% {
		transform: translate(-50%, -50%) scale(0) rotate(0deg);
		opacity: 0;
	}
}

/* === Combo Indicator Animation === */
@keyframes comboAppear {
	0% {
		transform: translate(-50%, -50%) scale(0);
		opacity: 0;
	}
	20% {
		transform: translate(-50%, -50%) scale(1.4);
		opacity: 1;
	}
	40% {
		transform: translate(-50%, -50%) scale(1.1);
		opacity: 1;
	}
	60% {
		transform: translate(-50%, -50%) scale(1.2);
		opacity: 1;
	}
	100% {
		transform: translate(-50%, -50%) scale(0.8);
		opacity: 0;
	}
}

/* === Lightning Flash Animation === */
@keyframes lightningFlash {
	0% {
		opacity: 0.8;
	}
	50% {
		opacity: 0.6;
	}
	100% {
		opacity: 0;
	}
}

/* === Icon Buttons (SVG buttons) === */
.icon-button {
	background: rgba(255, 255, 255, 0.25);
	border: 2px solid rgba(255, 255, 255, 0.6);
	color: white;
	padding: 10px;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.2s ease;
	backdrop-filter: blur(5px);
	display: flex;
	align-items: center;
	justify-content: center;
}

.icon-button:active {
	background: rgba(255, 255, 255, 0.35);
	transform: scale(0.95);
}

.icon-button svg {
	display: block;
}

/* === Sound Toggle Buttons (in Start/Pause screens) === */
.sound-toggle {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 10;
}

.sound-toggle.muted {
	opacity: 0.6;
}
