:root {
	--color-bg: #181616;
	--color-text: #514a48;
	--color-bright: #6c6360;
}

body {
	background: var(--color-bg);
	color: #fff;
	font-family: "Assistant", sans-serif;
	font-weight: 300;
	margin: 0;
	padding: 0;
	touch-action: none;
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
	overflow: hidden;
}

#colSelector {
	position: absolute;
	right: .6em;
	top: 100%;
	cursor: pointer;
	display: flex;
	gap: 0;
	margin-top: .6em;
	z-index: 20;
}
.colorInner {
	width: 20px;
	height: 20px;
}
.colSelectorButton {
	background-color: transparent;
	padding: 12px;
	border-top: 1px solid var(--color-bright);
	border-bottom: 1px solid var(--color-bright);
	border-left: 1px solid var(--color-bright);
}
.colSelectorButton:hover {
	background-color: var(--color-text);
}
.colSelectorButton:first-of-type {
	border-radius: 12px 0 0 12px;
}
.colSelectorButton:last-of-type {
	border-radius: 0 12px 12px 0;
	border-right: 1px solid var(--color-bright);
}

#colGray {
	background-color: #aaa;
}
#colGreen {
	background-color: #8b956d;
}
#colAutumn {
	background-color: #dca456;
}

p {
	font-style: italic;
	font-weight: 600;
	color: var(--color-text);
	margin-block-start: .5em;
	margin-left: .5em;
	margin-right: .5em;
	margin-bottom: 0;
	position: relative;
	z-index: 10;
}

a {
	color: var(--color-bright);
	font-weight: bold;
}

#game {
	display: flex;
	position: relative;
	flex-direction: column;
	width: 100%;
	touch-action: none;
	box-shadow: 0px 20px 60px rgba(0, 0, 0, .8);
}

#game canvas {
	object-fit: contain;
	image-rendering: -moz-crisp-edges;
	image-rendering: -webkit-crisp-edges;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

main {
	display: block;
}

#controlsLegend {
	display: none;
}

#controller {
	display: none;
	position: fixed;
	bottom: 0px;
	height: 210px;
	width: 100%;
	touch-action: none;
	opacity: 0.8;
}

#controller_dpad {
	position: absolute;
	bottom: 0px;
	left: 0px;
	width: 184px;
	height: 184px;
}

#controller_dpad:before {
	content: "";
	display: block;
	width: 48px;
	height: 48px;
	background: transparent;
	position: absolute;
	left: 68px;
	top: 68px;
}

#controller_left {
	position: absolute;
	left: 20px;
	top: 68px;
	width: 48px;
	height: 48px;
	background: transparent;
	border-top: 1px solid var(--color-bright);
	border-left: 1px solid var(--color-bright);
	border-bottom: 1px solid var(--color-bright);
	border-top-left-radius: 4px;
	border-bottom-left-radius: 4px;
}

#controller_right {
	position: absolute;
	left: 117px;
	top: 68px;
	width: 48px;
	height: 48px;
	background: transparent;
	border-top: 1px solid var(--color-bright);
	border-right: 1px solid var(--color-bright);
	border-bottom: 1px solid var(--color-bright);
	border-top-right-radius: 4px;
	border-bottom-right-radius: 4px;
}

#controller_up {
	position: absolute;
	left: 68px;
	top: 20px;
	width: 48px;
	height: 48px;
	background: transparent;
	border-top: 1px solid var(--color-bright);
	border-left: 1px solid var(--color-bright);
	border-right: 1px solid var(--color-bright);
	border-top-left-radius: 4px;
	border-top-right-radius: 4px;
}

#controller_down {
	position: absolute;
	left: 68px;
	top: 118px;
	width: 48px;
	height: 48px;
	background: transparent;
	border-bottom: 1px solid var(--color-bright);
	border-left: 1px solid var(--color-bright);
	border-right: 1px solid var(--color-bright);
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
}

#controller_a {
	position: absolute;
	bottom: 110px;
	right: 20px;
}

#controller_b {
	position: absolute;
	bottom: 80px;
	right: 100px;
}

.roundBtn {
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 32px;
	color: var(--color-bright);
	line-height: 64px;
	width: 64px;
	height: 64px;
	border: 1px solid var(--color-bright);
	border-radius: 64px;
	background: transparent;
	box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.2);
}

.capsuleBtn {
	font-weight: bold;
	font-size: 10px;
	color: var(--color-bright);
	display: flex;
	justify-content: center;
	align-items: center;
	line-height: 40px;
	text-transform: uppercase;
	width: 64px;
	height: 32px;
	border: 1px solid var(--color-bright);
	border-radius: 40px;
	background: transparent;
	box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.2);
}

#controller_start {
	position: absolute;
	bottom: 20px;
	right: 15px;
}

#controller_select {
	position: absolute;
	bottom: 20px;
	right: 100px;
}

.btnPressed {
	opacity: 0.5;
}

@media (orientation: portrait) {
	#colSelector, #info {
		visibility: hidden;
	}
}

@media (min-height: 650px) {
    #colSelector, #info {
        visibility: visible;
    }
}

@media only screen and (max-device-width: 320px) and (orientation: portrait) {
	#controller_dpad {
		left: -5px;
		bottom: -5px;
	}

	#controller_a {
		right: 5px;
		bottom: 95px;
	}

	#controller_b {
		right: 80px;
	}

	#controller_start {
		right: 5px;
	}

	#controller_select {
		right: 80px;
	}
}

@media only screen and (max-width: 500px) and (max-height: 400px) {
	#controller {
		display: none;
	}
}

/* Small devices in landscape */
@media only screen and (max-device-width: 300px) and (orientation: landscape) {
	html,
	body {
		height: 100%;
	}
	body {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	#game:after {
		content: "PLEASE ROTATE ↻";
		font-size: 24px;
		font-weight: bold;
		color: #fff;
	}

	#game canvas {
		display: none;
		max-width: 480px;
	}

	#controller {
		display: none;
	}
}

/* Devices large enough for landscape */
@media only screen and (min-width: 300px) and (orientation: landscape) {
	main {
		width: 100vw;
		height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 32px;
	}
	#game {
		width: 80vh;
		position: relative;
	}
	#controlsLegend {
		position: absolute;
		left: -200px;
		bottom: 0;
		align-items: center;
		display: flex;
		gap: 16px;
	}
	legend {
		color: var(--color-text);
		font-size: 20pt;
	}
	#colSelectorAnchor {
		width: 640px;
	}
	#controlsLegendLeft {
		text-align: right;
	}
	#controlsLegendRight {
		font-weight: bold;
	}
	p {
		display: none;
	}
	#controller {
		bottom: 50%;
		transform: translateY(50%);
		opacity: 0.5;
	}
}

@media only screen and (min-width: 1024px) {
	main {
		margin-top: 0;
		justify-content: center;
	}
	#game {
		width: 640px;
		position: relative;
	}
	p {
		margin-left: 0;
		margin-right: 0;
		max-width: 620px;
		display: block;
	}

}