:root {
	--aspect-ratio: 1;
	--window-width: 800;
	--window-height: 600;
	--inv-window-width: 0.00125;
	--inv-window-height: 0.0016667;
	--box-scale: 1;
}

@font-face {
	font-family: "Courier Prime";
	font-style: normal;
	font-weight: 400;
	src: url("fonts/CourierPrime-Regular.ttf") format("truetype");
}

@font-face {
	font-family: "Courier Prime";
	font-style: italic;
	font-weight: 400;
	src: url("fonts/CourierPrime-Italic.ttf") format("truetype");
}

@font-face {
	font-family: "Courier Prime";
	font-style: normal;
	font-weight: 700;
	src: url("fonts/CourierPrime-Bold.ttf") format("truetype");
}

@font-face {
	font-family: "Courier Prime";
	font-style: italic;
	font-weight: 700;
	src: url("fonts/CourierPrime-BoldItalic.ttf") format("truetype");
}

@font-face {
	font-family: "04b_03";
	src: url("https://static.itch.io/fonts/04b03.eot");
	src: url("https://static.itch.io/fonts/04b03.eot?#iefix") format("embedded-opentype"), url("https://static.itch.io/fonts/04b03.woff2") format("woff2"), url("https://static.itch.io/fonts/04b03.woff") format("woff"), url("https://static.itch.io/fonts/04b03.ttf") format("truetype");
	font-weight: normal;
	font-style: normal
}

@font-face {
	font-family: "nes";
	src: url("fonts/Pixel_NES.ttf") format("truetype");
}

* {
	box-sizing: border-box;
}

html {
	height: 100%;
}

body {
	margin: 0;
	overflow: clip;
	display: flex;
	flex-direction: column;
	height: 100%;
}

#screen {
	width: 100%;
	height: 100%;
	position: relative;
	background-color: #2867b9;
	color: #f4f5de;
	font-family: "Courier Prime";
	font-style: italic;

	overflow: clip;

	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: start;
}


button {
	pointer-events: auto;
}

@keyframes scroll {
	from {
		background-position-x: 0, 0;
	}

	to {
		background-position-x: -128px, 128px;
	}
}

#mainTitle {
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	color: #f6ffd4;
	width: 100%;
}

#mainTitle h1 {
	font-size: 4rem;
	margin: 0 1em;
	text-align: center;
	text-shadow: 0.2em 0.2em 0.2em black;
}

#mainTitle h2 {
	font-size: 1.4rem;
	margin: 0 1em;
	text-align: center;
	text-shadow: 0.2em 0.2em 0.2em black;
}

#games {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-content: center;
	flex-grow: 1;
	gap: 2em;
	padding: 1rem;

	background: url("images/cabinet.png"), url("images/cabinet.png");
	background-position-y: 0, 128px;
	animation: 8s infinite scroll linear;
}

.gameButton {
	box-sizing: content-box;
	border: 2px solid black;
	border-radius: 1rem;
	background-color: #a0b0c0;
	overflow: clip;
	box-shadow: 0.25em 0.25em .5em black;
	cursor: pointer;
	transition: 0.1s box-shadow;

	pointer-events: auto;

	width: calc(16em * var(--box-scale));
}

.gameButton:hover {
	box-shadow: 0.5em 0.5em 1em black;
}

.gameButton h3 {
	user-select: none;
	margin: 0;
	padding: 0;
	font-size: 1.25rem;
	padding-top: 0.125em;
	padding-left: 0.5em;
	background-color: rgb(29, 99, 139);
	border-bottom: 2px solid black;
	text-shadow: 0.15em 0.1em 0.3em black;

	transition: 0.05s background-color;
}

.gameButton:hover h3 {
	background-color: rgb(52, 127, 170);
}

.gamePreview {
	height: calc(16em * var(--aspect-ratio) * var(--box-scale));
}


.game {
	overflow: clip;
	z-index: 10;
	cursor: default;
	background-color: #a0b0c0;
	contain: strict;
}

.game.open {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	z-index: 10;
	pointer-events: auto;
}

.game:not(.open) {
	pointer-events: none !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	width: calc(1px * var(--window-width));
	height: calc(1px * var(--window-height));
	transform: translate(-50%, -50%) scale(calc(256 * var(--inv-window-width) * var(--box-scale))) translate(50%, 50%);
}

.game:not(.open) * {
	pointer-events: none !important;
	user-select: none !important;
	-webkit-user-select: none !important;
}

.backButton {
	position: absolute;
	right: 0.5rem;
	bottom: 0.5rem;
	font-size: 1.5rem;
	transition: 0.5s opacity;
}

.game:not(.open) .backButton {
	opacity: 0;
}

.game iframe {
	position: absolute;
	width: 100%;
	height: 100%;
	border: 0;
}

#screen.gameOpened .game:not(.open){
	display: none;
}

#loading_block {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	background: #2867b9;
	z-index: 1000;
	font-size: 10vmin;
	display:flex;
	justify-content: center;
	align-items: center;
	pointer-events: auto;
}


/* Snake */
#game_snake {
	background-color: #202020;
	background-image: url("images/superText.png");
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding-top: 160px;
}

#snake_screen {
	position: absolute;
	top: 0;
}
#snake_board {
	position: relative;
	height: 70.71%;
	aspect-ratio: 1;
	background-image: linear-gradient(#404040, black);
	transform: rotate(0);
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
}
#snake_score {
	position: absolute;
	width: 100%;
	height: 100%;
	font-style: normal;
	font-family: "Comic Sans MS", sans-serif;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}
#snake_board .snake_square{
	width: 100%;
	height: 100%;
	position: absolute;
	left: 0;
	top: 0;
	background-color: white;
	transform-origin: top left;
	transform: translate(0,0);
}

/* AIRT */
#game_airt .backButton {
	display: none;
}

/* Tetris */
#tetris_overflow {
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none !important;
	flex-grow: 1;
	overflow: hidden;
	position: relative;
}

#tetris_overflow_inner {
	position: absolute;
	inset: 0;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
}

#game_tetris {
	justify-content: center;
	align-items: stretch;
	font-family: "nes";
	font-style: normal;
	color: #FCFCFC;
	font-size: 8px;
	text-align: center;
	line-height: 1;
	display: flex;
	user-select: none;
	-webkit-user-select: none;
	background: url("images/tetris_logo.png");
}

#tetris_screen {
	background-color: #7F7F7F;
	padding: 0 1em;
	border: 2px solid black;
	border-top: none;
	border-bottom: none;
	transform: scale(4);
	transform-origin: top;
	height: 25%;
	display: flex;
}

.tetris_box {
	border: 5px solid;
	border-image: url("images/tetris_border.png") fill 5 / auto;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
	padding: 0.125em 0.5em;
	box-sizing: content-box;
}

.tetris_box2 {
	border: 7px solid;
	border-image: url("images/tetris_border2.png") fill 7 / auto;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
	box-sizing: content-box;
}

#tetris_screen > div {
	display: flex;
	flex-direction: column;
}

.tetris_col1 {
	align-items: center;
	padding-top: 8px;
}

.tetris_col3 {
	align-items: start;
}

#tetris_linecount {
	text-align: right;
}

#tetris_statsbox {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-bottom: 0.5em;
}

#tetris_statsbox > span {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	color: #E05000;
}

#tetris_board {
	flex-grow: 1;
	width: 80px;
	position: relative;
	text-align: left;
	padding-left: 1px;
	padding-top: 1px;
	overflow: clip;
}

#tetris_scorebox {
	text-align: left;
}

#tetris_scorebox > div {
	margin: 0.5em 0;
}

#tetris_nextbox {
	display: flex;
	flex-direction: column;
	padding: 0 0.25em 0.5em;
	gap: 0.5em;
	text-align: center;
	justify-content: center;
	align-items: center;
}

.tetris_block {
	position: absolute;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
}




/* Pinball */

#game_pinball {
	background: black;
	display: flex;
	justify-content: center;
	align-items: center;
}
#pinball_board {
	background-image: url("images/pinball_board.png");
	min-width: 365px;
	min-height: 428px;
	transform: scale(min(calc(var(--window-width) / 857), calc(var(--window-height) / 475)));
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
}
#pinball_board .entity {
	user-select: none;
	-webkit-user-select: none;
	pointer-events: none;
	display: block;
	position: absolute;
}
.pinball_panel {
	position: absolute;
	background-image:url("images/pinball_panel.png");
	width: 203px;
	height: 394px;
	left: 100%;
	padding: 14px;
	padding-top: 290px;
}
.pinball_overlay {
	top: 0;
}

@media (width: 960px) {
	/* inside itch.io embed */
	#screen {
		max-height: 720px;
	}
}

@media (min-width: 2300px) {
	/* wide fullscreens */
	:root {
		--box-scale: 2;
	}
}
@media (max-width: 1167px){
	/* narrow */
	:root {
		--box-scale: 0.75;
	}
}