body {
	margin: 0;
	overflow: hidden;
	background: #111;
	touch-action: none;
	font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif;
	user-select: none;
	color: #fff
}

canvas {
	display: block
}

#game-over,
#menu,
#settings-menu {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .95);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 20
}

#game-over,
#settings-menu {
	display: none
}

input[type=text] {
	padding: 15px;
	text-align: center;
	margin-bottom: 15px;
	background: #333;
	min-width: 280px
}

button,
input[type=text] {
	font-size: 20px;
	border-radius: 8px;
	border: none;
	color: #fff
}

button {
	padding: 15px 40px;
	background: #27ae60;
	cursor: pointer;
	margin: 5px;
	min-width: 200px;
	transition: background .2s
}

button:hover {
	background: #2ecc71
}

button.red {
	background: #c0392b
}

button.red:hover {
	background: #e74c3c
}

.setting-col {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	max-height: 400px;
	overflow-y: auto;
	padding: 15px;
	border: 1px solid #444;
	border-radius: 8px;
	margin-bottom: 15px;
	width: 300px;
	background: rgba(0, 0, 0, .3)
}

.setting-row {
	margin: 5px 0;
	font-size: 16px;
	display: flex;
	align-items: center;
	gap: 10px
}

input[type=checkbox] {
	width: 20px;
	height: 20px;
	cursor: pointer
}

h3 {
	margin: 10px 0 5px;
	color: #f1c40f
}

#ui-layer {
	pointer-events: none;
	position: absolute;
	inset: 0
}

#hud-top {
	left: 0;
	right: 0;
	text-align: center;
	font-weight: 700;
	text-shadow: 0 2px 2px #000;
	color: #fff
}

#gear-btn,
#hud-top {
	position: absolute;
	top: 10px;
	font-size: 24px
}

#gear-btn {
	left: 10px;
	cursor: pointer;
	pointer-events: auto;
	opacity: .5;
	transition: opacity .2s
}

#gear-btn:hover {
	opacity: 1
}

#leaderboard {
	right: 10px;
	padding: 10px;
	border-radius: 5px;
	text-align: right;
	min-width: 150px;
	font-size: 14px;
	border: 1px solid #444
}

#debug-panel,
#leaderboard {
	position: absolute;
	top: 50px;
	background: rgba(0, 0, 0, .7)
}

#debug-panel {
	left: 10px;
	padding: 8px;
	border-radius: 4px;
	font-family: monospace;
	font-size: 12px;
	color: #0f0;
	pointer-events: none;
	display: none;
	border: 1px solid #080
}

.dbg-line {
	margin-bottom: 2px
}

#chat-box {
	position: absolute;
	bottom: 20px;
	right: 20px;
	height: 200px;
	pointer-events: auto
}

#chat-msgs {
	background: rgba(0, 0, 0, .5);
	margin-bottom: 5px;
	border-radius: 5px;
	font-size: 14px;
	text-shadow: 1px 1px 0 #000
}

#chat-input {
	width: 100%;
	padding: 8px;
	box-sizing: border-box;
	background: rgba(0, 0, 0, .7);
	border: 1px solid #555;
	border-radius: 5px;
	font-size: 16px
}

.msg-name {
	color: #f1c40f
}

#upgrades {
	position: absolute;
	bottom: 20px;
	left: 20px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	pointer-events: auto
}

.stat-row {
	gap: 8px;
	background: rgba(0, 0, 0, .6);
	padding: 4px 8px;
	border-radius: 4px;
	width: 200px;
	height: 24px;
	font-size: 12px;
	border: 1px solid transparent;
	transition: border-color .2s
}

.stat-row:hover {
	border-color: #2ecc71
}

.stat-bar {
	flex-grow: 1;
	height: 8px;
	background: #333;
	border-radius: 4px
}

.stat-fill {
	width: 0
}

.c-spd {
	background: #3498db
}

.c-hp {
	background: #9b59b6
}

.hidden {
	opacity: .3;
	pointer-events: none
}

.mobile-ctrl {
	position: absolute;
	bottom: 40px;
	border-radius: 50%;
	pointer-events: auto
}

#joy-zone {
	left: 40px;
	background: hsla(0, 0%, 100%, .05);
	border: 2px solid hsla(0, 0%, 100%, .1)
}

#joy-knob {
	width: 50px;
	height: 50px;
	background: hsla(0, 0%, 100%, .3);
	top: 35px;
	left: 35px
}

#fire-btn {
	right: 40px;
	width: 90px;
	height: 90px;
	background: rgba(231, 76, 60, .4);
	border: 3px solid rgba(231, 76, 60, .6)
}

#mobile-upgrades {
	position: absolute;
	bottom: 180px;
	left: 20px;
	gap: 10px;
	pointer-events: auto
}

.mob-up {
	border: 2px solid #fff;
	font-size: 20px;
	font-weight: 700;
	opacity: .8;
	cursor: pointer;
	transition: opacity .2s
}

.mob-up:hover {
	opacity: 1
}

#server-browser {
	width: 400px;
	max-width: 90vw;
	height: 300px;
	background: rgba(0, 0, 0, .5);
	border: 1px solid #444;
	border-radius: 8px;
	overflow-y: auto;
	margin-top: 10px;
	padding: 10px
}

#server-browser h3 {
	color: #ccc;
	margin: 0 0 10px;
	text-align: center
}

#server-list {
	min-height: 100px
}

.server-item {
	background: #222;
	padding: 10px;
	margin-bottom: 8px;
	border-radius: 4px;
	cursor: pointer;
	transition: .2s;
	border: 1px solid #333;
	text-align: left
}

.server-item:hover {
	background: #333;
	border-color: #27ae60
}

.sv-name {
	font-weight: 700;
	color: #2ecc71;
	font-size: 18px
}

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

.sv-ip {
	font-size: 10px;
	color: #555;
	margin-top: 5px
}

#chat-box {
	position: fixed;
	bottom: 10px;
	left: 10px;
	width: 300px;
	height: 150px;
	background: rgba(0, 0, 0, .5);
	display: flex;
	flex-direction: column;
	font-size: 14px
}

#chat-msgs {
	flex-grow: 1;
	overflow-y: auto;
	padding: 5px;
	color: #fff
}

#chat-input {
	border: none;
	padding: 5px;
	background: #333;
	color: #fff;
	display: none
}

.msg-name {
	font-weight: 700;
	color: #3498db
}

#upgrades {
	position: fixed;
	left: 10px;
	bottom: 170px;
	background: rgba(0, 0, 0, .7);
	padding: 10px;
	border-radius: 5px;
	color: #fff
}

.stat-row {
	cursor: pointer;
	margin-bottom: 5px;
	display: flex;
	align-items: center
}

.stat-bar {
	width: 100px;
	height: 15px;
	background: #555;
	margin-left: 10px;
	border-radius: 3px;
	overflow: hidden
}

.stat-fill {
	height: 100%
}

.c-dmg {
	background: #e74c3c
}

.c-rel {
	background: #f1c40f
}

.c-spd {
	background: #2ecc71
}

.c-hp {
	background: #3498db
}

.hidden {
	display: none !important
}

#mobile-upgrades {
	position: fixed;
	right: 10px;
	bottom: 150px;
	display: none;
	flex-direction: column
}

.mob-up {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	margin-bottom: 10px;
	color: #fff;
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center
}

.mobile-ctrl {
	display: none
}

#joy-zone {
	position: fixed;
	left: 20px;
	bottom: 20px;
	width: 120px;
	height: 120px;
	background: hsla(0, 0%, 100%, .2);
	border-radius: 50%
}

#joy-knob {
	position: absolute;
	left: 40px;
	top: 40px;
	width: 40px;
	height: 40px;
	background: hsla(0, 0%, 100%, .5);
	border-radius: 50%
}

#fire-btn {
	right: 20px;
	width: 80px;
	height: 80px;
	background: rgba(231, 76, 60, .5)
}

#chat-btn,
#fire-btn {
	position: fixed;
	bottom: 20px;
	border-radius: 50%
}

#chat-btn {
	right: 110px;
	width: 60px;
	height: 60px;
	background: rgba(52, 152, 219, .5);
	font-size: 30px;
	text-align: center;
	line-height: 60px
}

#weapon-selector button,
#weapon-upgrades button {
	display: block;
	width: 100%;
	margin-top: 5px;
	padding: 5px;
	cursor: pointer;
	border: none;
	background: #555;
	color: #fff
}

#weapon-selector .active {
	background: #27ae60;
	font-weight: 700
}
