/* the play page: the game list, and the full-screen player with its on-screen buttons */
.pl-games {
	display: grid;
	gap: 12px;
	margin: 14px 0;
}
.pl-card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 16px;
}
.pl-card.want {
	border-color: var(--accent);
}
.pl-card h2 {
	margin: 0 0 4px;
	font-size: 1.15rem;
}
.pl-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}
.pl-nudge {
	margin: 8px 0 0;
}
.pl-help {
	max-width: 62ch;
}

/* ---- the player ---- */
body.playing {
	overflow: hidden;
	overscroll-behavior: none;
}
body.playing > header,
body.playing > main,
body.playing > footer {
	display: none;
}
.stage {
	position: fixed;
	inset: 0;
	z-index: 100;
	background: #050807;
	color: #eef3f1;
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: auto auto 1fr;
	grid-template-areas: 'bar' 'screen' 'pad';
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: transparent;
}
.stage.hidden {
	display: none;
}
.st-bar {
	grid-area: bar;
	display: flex;
	gap: 6px;
	justify-content: center;
	padding: 6px 8px;
}
.st-btn {
	font: inherit;
	font-size: 13px;
	color: #eef3f1;
	background: #13231d;
	border: 1px solid #2b3b36;
	border-radius: 999px;
	padding: 6px 12px;
	min-height: 34px;
}
.st-btn.nudge {
	border-color: #e9c46a;
	color: #e9c46a;
}
.st-screen {
	grid-area: screen;
	position: relative;
	justify-self: center;
	width: min(100vw, calc((100dvh - 56px - 250px) * 1.5));
	aspect-ratio: 3 / 2;
	background: #000;
}
.st-screen canvas {
	display: block;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}
.st-over {
	position: absolute;
	inset: 0;
	width: 100%;
	border: 0;
	background: rgba(5, 8, 7, 0.82);
	color: #eef3f1;
	font: inherit;
	font-size: 18px;
}
.st-over.hidden {
	display: none;
}
.st-pad {
	grid-area: pad;
	position: relative;
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto 1fr auto;
	grid-template-areas: 'l r' 'd ab' 'sel sta';
	align-items: center;
	justify-items: center;
	padding: 4px 14px 12px;
	min-height: 0;
}
.pb {
	font: inherit;
	font-weight: 700;
	color: #eef3f1;
	background: #1c3027;
	border: 2px solid #3a5247;
	border-radius: 14px;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}
.pb.down,
.dpad.down {
	background: #34d482;
	color: #04170d;
}
#pb-l { grid-area: l; justify-self: start; }
#pb-r { grid-area: r; justify-self: end; }
.sh {
	width: 96px;
	height: 40px;
	border-radius: 10px 10px 18px 18px;
}
.dpad {
	grid-area: d;
	position: relative;
	width: min(36vw, 150px);
	aspect-ratio: 1;
	touch-action: none;
	background: transparent;
	border-radius: 50%;
}
.dpad span {
	position: absolute;
	background: #1c3027;
	border: 2px solid #3a5247;
	border-radius: 8px;
}
.dpad .dv {
	left: 33%;
	top: 0;
	width: 34%;
	height: 100%;
}
.dpad .dh {
	top: 33%;
	left: 0;
	height: 34%;
	width: 100%;
}
.dpad.down span {
	background: #2a5a43;
}
.dpad.down {
	background: transparent;
}
.ab {
	grid-area: ab;
	position: relative;
	width: min(40vw, 170px);
	aspect-ratio: 1.15;
}
.pb.a {
	position: absolute;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	font-size: 20px;
}
#pb-a { right: 0; top: 0; }
#pb-b { left: 0; bottom: 0; }
.ss {
	min-width: 84px;
	height: 34px;
	font-size: 12px;
	letter-spacing: 0.08em;
	border-radius: 999px;
}
#pb-select { grid-area: sel; }
#pb-start { grid-area: sta; }

/* landscape: the screen in the middle at the largest whole-ish size, the pad left, the buttons right */
@media (orientation: landscape) and (max-height: 700px) {
	.stage {
		grid-template-columns: 1fr auto 1fr;
		grid-template-rows: auto 1fr;
		grid-template-areas: 'bar bar bar' 'pl screen pr';
	}
	.st-screen {
		width: min(calc((100vw - 2 * 150px)), calc((100dvh - 48px - 8px) * 1.5));
		align-self: center;
	}
	.st-pad {
		display: contents;
	}
	.dpad { grid-area: pl; justify-self: center; align-self: center; width: min(26vh, 150px); }
	.ab { grid-area: pr; justify-self: center; align-self: center; width: min(30vh, 150px); }
	#pb-l { grid-area: pl; justify-self: start; align-self: start; margin: 6px 0 0 14px; }
	#pb-r { grid-area: pr; justify-self: end; align-self: start; margin: 6px 14px 0 0; }
	#pb-select { grid-area: pl; justify-self: center; align-self: end; margin-bottom: 10px; }
	#pb-start { grid-area: pr; justify-self: center; align-self: end; margin-bottom: 10px; }
	.sh { width: 84px; height: 36px; }
}
