/* 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 HUD (score / angle / time) */
#ui-top {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px;
	z-index: 10;
	background:
		repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 7px, transparent 7px 14px),
		linear-gradient(180deg, #4a6b32 0%, #334922 100%);
	border-bottom: 3px solid #d4b24a;
	box-shadow: 0 4px 0 #1c2810;
}

.hud-stat {
	flex: 1;
	min-width: 0;
	padding: 5px 4px 6px;
	background: rgba(0, 0, 0, 0.22);
	border: 1px dashed rgba(212, 178, 74, 0.55);
	border-radius: 10px;
	text-align: center;
}

.hud-label {
	display: block;
	font-size: 8px;
	font-weight: 800;
	letter-spacing: 1.3px;
	color: #ffe082;
}

.hud-value {
	display: block;
	margin-top: 1px;
	font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
	font-size: 18px;
	line-height: 1.1;
	color: #fff8e1;
	text-shadow: 0 1px 0 #1b3d16;
}

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

/* Bottom HUD (ammo / power / fire) */
#ui-bottom {
	padding: 10px 12px 12px;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background:
		repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 7px, transparent 7px 14px),
		linear-gradient(180deg, #334922 0%, #2a3c1c 100%);
	border-top: 3px solid #d4b24a;
	box-shadow: 0 -4px 0 #1c2810;
}

#power-ammo-container {
	display: flex;
	align-items: stretch;
	gap: 8px;
	width: 100%;
}

#ammo-display {
	min-width: 72px;
	padding: 4px 8px 5px;
	background: rgba(0, 0, 0, 0.22);
	border: 1px dashed rgba(212, 178, 74, 0.55);
	border-radius: 10px;
	text-align: center;
}

#ammo-display #ammo {
	display: block;
	font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
	font-size: 16px;
	line-height: 1.1;
	color: #fff8e1;
	text-shadow: 0 1px 0 #1b3d16;
}

#power-bar-wrap {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 3px;
}

#power-bar-container {
	height: 16px;
	background: #1c2810;
	border-radius: 9px;
	border: 2px solid #8a7028;
	overflow: hidden;
	box-shadow: inset 0 1px 3px rgba(0,0,0,0.45);
}

#power-bar {
	width: 0%;
	height: 100%;
	background: linear-gradient(to right, #FFEB3B, #FF9800);
	border-radius: 7px;
	transition: width 0.05s linear;
}

#bottom-buttons {
	display: flex;
	gap: 8px;
	width: 100%;
}

#fire-button {
	flex: 1;
	padding: 14px 12px;
	font-size: 1.15rem;
	font-weight: 900;
	letter-spacing: 0.5px;
	color: #fff;
	background: linear-gradient(180deg, #FF7043 0%, #E53935 100%);
	border: 2px solid rgba(0,0,0,0.25);
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 5px 0 rgba(0,0,0,0.28);
}

#fire-button:active {
	transform: translateY(3px);
	box-shadow: 0 2px 0 rgba(0,0,0,0.28);
}

#fire-button:disabled {
	cursor: default;
}

#pause-button {
	padding: 14px 16px;
	color: #ffe082;
	background: #3d5c2e;
	border: 2px solid #d4b24a;
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 5px 0 #1f2e14;
	display: flex;
	align-items: center;
	justify-content: center;
}

#pause-button:active {
	transform: translateY(3px);
	box-shadow: 0 2px 0 #1f2e14;
}

#pause-button.paused {
	background: #2E7D32;
	border-color: #FFE082;
}

/* === Menu overlays (Start / Pause / Game Over) === */
.menu-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 200;
	text-align: center;
	padding: 20px 16px;
	color: #f4efe2;
}

#start-screen {
	display: flex;
}

#pause-screen,
#game-over-screen {
	display: none;
	z-index: 150;
}

.menu-haze {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse at 50% 38%, rgba(62, 84, 36, 0.18) 0%, transparent 48%),
		linear-gradient(180deg, rgba(20, 28, 14, 0.55) 0%, rgba(28, 22, 12, 0.72) 100%);
	pointer-events: none;
}

.menu-overlay-over .menu-haze {
	background:
		radial-gradient(ellipse at 50% 40%, rgba(180, 40, 20, 0.28) 0%, transparent 50%),
		linear-gradient(180deg, rgba(28, 12, 10, 0.62) 0%, rgba(20, 12, 10, 0.78) 100%);
}

.menu-card {
	position: relative;
	width: min(86vw, 340px);
	padding: 22px 18px 18px;
	background:
		repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 8px, transparent 8px 16px),
		linear-gradient(180deg, #4a6b32 0%, #334922 58%, #2a3c1c 100%);
	border: 3px solid #d4b24a;
	border-radius: 18px;
	box-shadow:
		0 0 0 3px #2b3a18,
		0 12px 0 #1c2810,
		0 18px 28px rgba(0, 0, 0, 0.35);
	z-index: 1;
}

.menu-card-over {
	background:
		repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 8px, transparent 8px 16px),
		linear-gradient(180deg, #6a3328 0%, #4a221c 58%, #321814 100%);
	border-color: #e07a3a;
	box-shadow:
		0 0 0 3px #3a1812,
		0 12px 0 #24100c,
		0 18px 28px rgba(0, 0, 0, 0.4);
}

.menu-card-pause {
	background:
		repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 8px, transparent 8px 16px),
		linear-gradient(180deg, #3d5a72 0%, #2b4154 58%, #223444 100%);
	border-color: #8ec8d8;
	box-shadow:
		0 0 0 3px #1c2c38,
		0 12px 0 #152028,
		0 18px 28px rgba(0, 0, 0, 0.35);
}

.menu-rivet {
	position: absolute;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #ffe58a, #c9a227 55%, #7a6414);
	box-shadow: inset 0 -1px 1px rgba(0,0,0,0.35);
}

.menu-rivet-tl { top: 8px; left: 8px; }
.menu-rivet-tr { top: 8px; right: 8px; }
.menu-rivet-bl { bottom: 8px; left: 8px; }
.menu-rivet-br { bottom: 8px; right: 8px; }

.menu-hero {
	margin: 0 auto 6px;
	filter: drop-shadow(0 4px 0 rgba(0,0,0,0.18));
}

.menu-kicker {
	margin: 0 0 4px;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 2.4px;
	color: #ffe082;
	text-shadow: 0 1px 0 #2a3c1c;
}

.menu-kicker-alert {
	color: #ffcc80;
	text-shadow: 0 1px 0 #3a1812;
}

.menu-overlay h1,
.menu-overlay h2 {
	margin: 0;
	font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
	font-weight: 900;
	line-height: 0.9;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.menu-overlay h1 {
	font-size: clamp(42px, 13vw, 58px);
	color: #FFE082;
	text-shadow:
		0 3px 0 #2E7D32,
		0 6px 0 #1b3d16,
		0 10px 16px rgba(0,0,0,0.35);
	animation: titlePulse 2.2s ease-in-out infinite;
}

.menu-overlay h2 {
	font-size: clamp(36px, 11vw, 48px);
	margin-bottom: 10px;
}

#pause-screen h2 {
	color: #E3F2FD;
	text-shadow: 0 3px 0 #1c2c38, 0 6px 0 #101820;
}

#game-over-screen h2 {
	color: #FF8A65;
	text-shadow: 0 3px 0 #5d1c14, 0 6px 0 #2a100c;
}

.menu-tag {
	margin: 10px 0 0;
	font-size: 13px;
	font-weight: 700;
	color: rgba(255, 248, 225, 0.82);
}

.menu-stats {
	display: flex;
	gap: 8px;
	margin: 4px 0 16px;
}

.menu-stat {
	flex: 1;
	padding: 8px 6px 10px;
	background: rgba(0, 0, 0, 0.22);
	border: 1px dashed rgba(255, 204, 128, 0.45);
	border-radius: 10px;
}

.menu-stat-label {
	display: block;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 1.4px;
	color: rgba(255, 224, 178, 0.75);
}

.menu-stat-value {
	display: block;
	margin-top: 2px;
	font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
	font-size: 26px;
	line-height: 1;
	color: #FFE082;
}

.start-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-top: 16px;
}

.menu-btn {
	width: 100%;
	padding: 14px 18px;
	border: 2px solid rgba(0,0,0,0.25);
	border-radius: 12px;
	font-size: 1.15rem;
	font-weight: 900;
	letter-spacing: 0.6px;
	cursor: pointer;
	color: #fff;
	box-shadow: 0 5px 0 rgba(0,0,0,0.28);
}

.menu-btn:active {
	transform: translateY(3px);
	box-shadow: 0 2px 0 rgba(0,0,0,0.28);
}

.menu-btn-fire {
	background: linear-gradient(180deg, #FF7043 0%, #E53935 100%);
}

.menu-btn-green {
	background: linear-gradient(180deg, #66BB6A 0%, #2E7D32 100%);
}

.menu-btn-gold {
	color: #3e2a10;
	background: linear-gradient(180deg, #FFE082 0%, #F9A825 100%);
}

.over-actions {
	width: 100%;
	gap: 14px;
	margin-top: 2px;
}

.hangar-actions {
	display: flex;
	flex-direction: column;
	width: 100%;
	gap: 20px;
}

#challenge-button.is-posted,
#challenge-button:disabled {
	opacity: 0.4;
	filter: grayscale(0.5);
	cursor: default;
	pointer-events: none;
	box-shadow: 0 2px 0 rgba(0,0,0,0.18);
	font-size: 1rem;
}

.challenge-post {
	width: 100%;
}

.challenge-posted-note {
	margin-top: 8px;
	padding: 8px 10px;
	text-align: center;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.22);
	color: #FFE082;
}

.challenge-posted-note strong {
	display: block;
	font-size: 0.95rem;
	font-weight: 800;
	letter-spacing: 0.3px;
}

.challenge-posted-note span {
	display: block;
	margin-top: 4px;
	font-size: 0.72rem;
	font-weight: 600;
	line-height: 1.35;
	color: rgba(255, 248, 225, 0.78);
}

.hangar-skins {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	width: 100%;
	margin: 10px 0 14px;
}
.hangar-skin {
	padding: 10px 8px;
	border-radius: 10px;
	border: 2px solid rgba(255,255,255,0.18);
	background: rgba(0,0,0,0.28);
	color: #fff;
	font-weight: 800;
	font-size: 0.78rem;
	letter-spacing: 0.4px;
}
.hangar-skin.is-on {
	border-color: #FFE082;
	color: #FFE082;
}

#start-screen .music-credit,
#game-over-screen .music-credit {
	margin: 0 auto;
	width: 100%;
	max-width: 260px;
	text-align: center;
	font-size: 10px;
	line-height: 1.35;
	font-weight: 400;
	color: rgba(255, 248, 225, 0.42);
	pointer-events: none;
}

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

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

/* === In-game FX banners (BOSS / COMBO) === */
.fx-banner {
	position: absolute;
	left: 50%;
	z-index: 80;
	pointer-events: none;
	min-width: 168px;
	padding: 10px 16px 12px;
	text-align: center;
	border-radius: 14px;
	transform: translate(-50%, -50%) scale(0);
}

.fx-kicker {
	display: block;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 2px;
}

.fx-title {
	display: block;
	margin-top: 2px;
	font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif;
	font-size: 34px;
	line-height: 0.95;
	letter-spacing: 1px;
}

.fx-banner-boss {
	top: 48%;
	background: linear-gradient(180deg, #6a3328 0%, #321814 100%);
	border: 3px solid #e07a3a;
	box-shadow: 0 0 0 2px #3a1812, 0 8px 0 #24100c;
	animation: bossAppear 1.5s ease-out forwards;
}

.fx-banner-boss .fx-kicker { color: #ffcc80; }
.fx-banner-boss .fx-title {
	color: #FF8A65;
	text-shadow: 0 3px 0 #5d1c14;
}

.fx-banner-combo {
	top: 32%;
	background: linear-gradient(180deg, #4a6b32 0%, #2a3c1c 100%);
	border: 3px solid #d4b24a;
	box-shadow: 0 0 0 2px #2b3a18, 0 8px 0 #1c2810;
	animation: comboAppear 0.8s ease-out forwards;
}

.fx-banner-combo .fx-kicker { color: #ffe082; }
.fx-banner-combo .fx-title {
	color: #FFE082;
	text-shadow: 0 3px 0 #1b3d16;
}

.fx-combo-3 {
	border-color: #FF9800;
}
.fx-combo-3 .fx-title { color: #FFCC80; }

.fx-combo-5 {
	background: linear-gradient(180deg, #6a3328 0%, #4a221c 100%);
	border-color: #FF80AB;
}
.fx-combo-5 .fx-title { color: #FF80AB; text-shadow: 0 3px 0 #4a1028; }

@keyframes bossAppear {
	0% { transform: translate(-50%, -50%) scale(0) rotate(-8deg); opacity: 0; }
	28% { transform: translate(-50%, -50%) scale(1.12) rotate(3deg); opacity: 1; }
	70% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
	100% { transform: translate(-50%, -50%) scale(0.86) rotate(0deg); opacity: 0; }
}

@keyframes comboAppear {
	0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
	22% { transform: translate(-50%, -50%) scale(1.16); opacity: 1; }
	62% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
	100% { transform: translate(-50%, -50%) scale(0.88); 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;
}

/* === Audio toggles (SFX + BGM, pinned top-right) === */
#start-screen .audio-toggles,
#pause-screen .audio-toggles {
	position: absolute;
	top: 68px;
	right: 12px;
	left: auto;
	z-index: 20;
	display: flex;
	flex-direction: row;
	gap: 8px;
}

.menu-overlay .audio-toggles .icon-button {
	background: #3d5c2e;
	border: 2px solid #d4b24a;
	color: #ffe082;
	box-shadow: 0 3px 0 #1f2e14;
}

#pause-screen .audio-toggles .icon-button {
	background: #2b4154;
	border-color: #8ec8d8;
	color: #e3f2fd;
	box-shadow: 0 3px 0 #152028;
}

.audio-toggles .icon-button.muted {
	opacity: 0.55;
}
