@font-face {
	font-family: "PressStart2P";
	src: url("/fonts/PressStart2P-Regular.ttf") format("truetype");
}
@font-face {
	font-family: "RobotoBlack";
	src: url("/fonts/Roboto-Black.ttf") format("truetype");
}
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
button:disabled {
	opacity: 0.6;
	pointer-events: none;
	user-select: none;
}

body {
	background: transparent;
	color: #eee;
	font-family: "RobotoBlack", sans-serif;
	width: 360px;
	height: 640px;
	overflow: hidden;
}

/* GAME CONTAINER => 360x640 */
.game-container {
	position: relative;
	width: 360px;
	height: 640px;
}
#gameCanvas {
	display: block;
	width: 100%;
	height: 100%;
	background: #000;
}

/* TOP ROW => Pause/Mute & Highscore */
.top-row {
	position: absolute;
	top: 5px;
	left: 0;
	width: 100%;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	pointer-events: none;
}
.game-controls {
	display: flex;
	gap: 5px;
	pointer-events: auto;
	margin-left: 10px;
}
.game-controls button {
	font-family: "PressStart2P", sans-serif;
	font-size: 1.2rem;
	background: #fff;
	color: #000;
	border: 2px solid #000;
	border-radius: 2px;
	cursor: pointer;
	width: 40px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 3px rgba(255,255,255,0.8);
}
.game-controls button:hover {
	background: #eee;
}
#topHighscoreContainer {
	pointer-events: none;
	margin-right: 10px;
}
#topHighscoreText {
	font-family: "PressStart2P", sans-serif;
	font-size: 0.9rem;
	background: #fff;
	color: #000;
	border: 2px solid #000;
	border-radius: 2px;
	padding: 2px 6px;
	box-shadow: 0 0 3px rgba(255,255,255,0.8);
}

#stats {
	position: absolute;
	pointer-events: none;
	top: 96px;
	color: orange;
	left: 8px;
	font-size: 14px;
	text-shadow: 1px 1px black;
}

/* HUD => hearts pinned below top row */
#hud {
	position: absolute;
	top: 50px;
	left: 10px;
	display: flex;
	align-items: center;
	pointer-events: none;
}
#heartsDisplay {
	display: flex;
	gap: 4px;
	margin-right: 10px;
	width: 160px;
	height: 32px;
}
.heart-img {
	width: 32px;
	height: 32px;
}

/* SCORE, MULTIPLIER => top-right */
#inGameScoreContainer {
	position: absolute;
	top: 50px;
	right: 10px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	pointer-events: none;
}
#inGameScore {
	font-family: "PressStart2P", sans-serif;
	font-size: 2.2rem;
	text-shadow: 1px 1px 2px #000;
	margin-bottom: 4px;
}
#multiplierText {
	font-family: "PressStart2P", sans-serif;
	font-size: 1rem;
	color: cyan;
	text-shadow: 1px 1px 2px #000;
	display: none;
}

/* +1 popup => bigger ~1.6rem */
#plusOneContainer {
	position: absolute;
	top: 50px;
	right: 10px;
	pointer-events: none;
}
.plusOne {
	color: #00ff00;
	font-size: 1.6rem;
	font-family: "PressStart2P", sans-serif;
	text-shadow: 1px 1px 2px #000;
	animation: fadeUp 1s forwards;
}
@keyframes fadeUp {
	0%   {opacity:1; transform:translateY(0);}
	100% {opacity:0; transform:translateY(-30px);}
}

/* SINGLE overlay => Start + Game Over */
.overlay {
	position: absolute;
	top: 0; left: 0;
	width: 100%; height: 100%;
	background: rgba(0,0,0,0.5);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 2;
	backdrop-filter: blur(2px);
}
.overlay-content {
	color: #fff;
	text-align: center;
	display: none;
}
.overlay[data-page="start"] > #startPage, .overlay[data-page="loading"] > #loadingPage,
.overlay[data-page="lobby"] > #lobbyPage, .overlay[data-page="gameQuit"] > #gameQuitPage {
	display: block !important;
}
.overlay[data-page="game"] {
	display: none;
}

.lobby-players-container {
	display: flex;
	flex-direction: column;
	row-gap: 8px;
	padding: 4px;
	margin: 8px;
}
.lobby-players {
	display: grid;
	grid-template-columns: auto auto;
	list-style-type: none;
	gap: 8px;
}
.lobby-players > li {
	position: relative;
	overflow: clip;
	width: 128px;
	height: 128px;
	border: 2px solid #444;
	border-radius: 5px;
}
.lobby-players img {
	position: absolute;
	left: -100px;
	top: -50px;
	width: 200px;
	height: 200px;
	object-fit: contain;
	image-rendering: pixelated;
}
.lobby-players p {
	position: absolute;
	bottom: 0px;
	left: 0px;
	width: 100%;
	text-align: center;
	background: #00000066;
	backdrop-filter: blur(8px);
	padding: 4px;
}

.spectate-container {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	align-items: center;
}
.spectate-title {
	color: yellow;
	font-family: "PressStart2P", sans-serif;
	font-size: 10px;
	text-shadow: 1px 1px black;
	background: #80808059;
	padding: 8px;
}
.spectate-button-container {
	display: flex;
	width: 100%;
	justify-content: space-around;
}
.spectate-button {
	width: 48px;
	height: 64px;
}

.credits-container {
	position: absolute;
	width: 100%;
	max-width: 600px;
	height: 100%;
	overflow: hidden;
}
.credits {
	display: flex;
	flex-direction: column;
	align-items: center;
	row-gap: 128px;
	animation: scroll 60s linear infinite;
}
@keyframes scroll {
	from {
		transform: translateY(640px);
	}
	to {
		transform: translateY(-100%);
	}
}
.credits > p {
	overflow: hidden;
	border-right: .15em solid orange;
	white-space: nowrap;
	margin: 0 auto;
	letter-spacing: .15em;
	animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
}
@keyframes typing {
	from { width: 0 }
	to { width: 100% }
}
@keyframes blink-caret {
	from, to { border-color: transparent }
	50% { border-color: orange; }
}
.credits-fade {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	background: linear-gradient(black, transparent 25%, transparent 75%, black);
}

#scoreText, #highScoreText {
	margin: 5px 0;
	font-size: 0.9rem;
}
#gameQuitText {
	margin: 10px 0;
	font-size: 1.2rem;
}
.game-over-options {
	display: flex;
	flex-direction: column;
}

/* Shared button styles */
.big-button, .grid-button {
	font-family: "PressStart2P", sans-serif;
	background: #444;
	color: #fff;
	border: 2px solid #000;
	border-radius: 3px;
	cursor: pointer;
}
.big-button:hover, .grid-button:hover {
	background: #666;
}
.big-button {
	font-size: 0.9rem;
	padding: 8px 18px;
	margin: 10px;
}
.button-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-template-rows: repeat(2, 1fr);
	width: 256px;
	height: 256px;
	gap: 16px;
	padding: 16px;
}
.grid-button {
	display: flex;
	justify-content: center;
	align-items: center;
	text-align: center;
}
.big-input {
	font-family: "PressStart2P", sans-serif;
	background: #444;
	color: #fff;
	border: 2px solid #000;
	border-radius: 3px;
}

/** Start page party UI */
.party-container {
	position: absolute;
	bottom: 4px;
}
.party-container > * {
	padding: 4px;
	font-size: 12px;
	margin: 0px;
	max-width: 200px;
}

/* QUOTE MARQUEE => bottom */
.quote-marquee {
	position: absolute;
	bottom: 0; left: 0;
	width: 100%; height: 30px;
	background: rgba(0,0,0,0.6);
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.quotes {
	display: flex;
	animation: quotesRoll 10s linear infinite;
}
.quote {
	min-width: 100%;
	text-align: center;
	color: #ffb347;
	font-size: 0.8rem;
	line-height: 30px;
	font-family: "RobotoBlack", sans-serif;
}
@keyframes quotesRoll {
	0%   {transform: translateX(0%); }
	25%  { transform: translateX(-100%); }
	50%  { transform: translateX(-200%); }
	75%  { transform: translateX(-300%); }
	100% { transform: translateX(0%); }
}
