:root {
	color-scheme: dark;
	font:
		16px / 1.45 ui-rounded,
		"Trebuchet MS",
		system-ui,
		sans-serif;
	color: #fff5dc;
	background: #0b192b;
}
* {
	box-sizing: border-box;
}
body {
	margin: 0;
	background: radial-gradient(ellipse at 30% 0, #223c4e, transparent 62%);
	min-height: 100svh;
}
header,
footer,
main {
	max-width: 1060px;
	margin: auto;
}
header,
footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 22px 16px;
}
header b,
small {
	font-size: 0.74rem;
	letter-spacing: 0.16em;
	font-weight: 900;
	color: #ffda91;
}
button {
	font: inherit;
	font-weight: 800;
	background: #21394a;
	color: inherit;
	border: 1px solid #ffffff35;
	border-radius: 12px;
	padding: 11px 18px;
	cursor: pointer;
}
button:hover {
	filter: brightness(1.13);
}
main {
	display: grid;
	grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
	gap: 20px;
	padding: 0 16px;
}
.cabinet,
.gift,
.board {
	border-radius: 24px;
	border: 1px solid #587377;
	overflow: hidden;
}
.cabinet {
	position: relative;
	height: clamp(480px, 76svh, 730px);
	background: #152c45;
	isolation: isolate;
}
canvas {
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
}
#scene {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	pointer-events: none;
}
.overlay {
	background: linear-gradient(#10273bd9, #0d2338f7);
	padding: 22px;
	border: 1px solid #f9d38a75;
	border-radius: 24px;
	width: min(87%, 390px);
	pointer-events: auto;
	box-shadow: 0 18px 60px #04162366;
}
.overlay button {
	display: block;
	margin: 9px auto;
	width: 100%;
}
.play {
	background: #bf4438;
	border-color: #ffb093;
	box-shadow: 0 3px 0 #733121;
	color: #fff9e8;
}
h1 {
	font:
		900 clamp(2.8rem, 7vw, 5rem) / 0.91 Georgia,
		serif;
	letter-spacing: -0.065em;
	margin: 15px 0;
	color: #fff0ca;
	text-shadow: 2px 4px #994a35;
}
h2 {
	font:
		700 2rem / 1.12 Georgia,
		serif;
	letter-spacing: -0.035em;
	margin: 10px 0;
}
p {
	margin: 12px 0;
	color: #d8e3de;
}
aside {
	display: flex;
	flex-direction: column;
	gap: 18px;
}
.gift,
.board {
	padding: 26px;
	background: #142d3c;
}
.gift {
	background: radial-gradient(ellipse at top right, #345d4a, #193e35 70%);
	border-color: #628369;
}
em {
	color: #ffe0a0;
}
#clock {
	font-variant-numeric: tabular-nums;
	color: #ffe5b1;
}
.board {
	flex: 1;
}
#leaders {
	margin: 20px 0;
	padding: 18px 0;
	border-block: 1px solid #49606a;
}
.row {
	display: flex;
	justify-content: space-between;
	gap: 14px;
	padding: 7px;
}
.mine {
	color: #ffda91;
}
#hud {
	position: absolute;
	inset: 10px 10px auto;
	text-align: center;
	background: #0c2134df;
	padding: 8px;
	border-radius: 10px;
	font-weight: bold;
	pointer-events: none;
}
footer {
	color: #a4b9c3;
	font-size: 0.85rem;
}
dialog {
	background: #153042;
	color: #fff4d9;
	border: 1px solid #687f89;
	border-radius: 18px;
	max-width: min(530px, 92vw);
	max-height: 85svh;
}
dialog::backdrop {
	background: #03111ccd;
}
input {
	font: inherit;
	padding: 10px;
	border-radius: 8px;
	width: 100%;
}
body.playing {
	overflow: hidden;
	overscroll-behavior: none;
}
.playing .cabinet {
	position: fixed;
	inset: 0;
	margin: auto;
	z-index: 5;
	height: 100dvh;
	width: min(100%, 680px);
	border: 0;
	border-radius: 0;
}
.playing #hud {
	top: max(10px, env(safe-area-inset-top));
}
@media (max-width: 680px) {
	main {
		grid-template-columns: 1fr;
		padding: 0 10px;
	}
	.cabinet {
		height: min(68svh, 560px);
		min-height: 390px;
	}
	header {
		padding: 12px;
	}
	.gift,
	.board {
		padding: 20px;
	}
	aside {
		gap: 12px;
	}
}

#timer {
	display: block;
	width: 100%;
	height: 4px;
	margin-top: 6px;
	border: 0;
	accent-color: #ffd98c;
}
#banner:not(:empty) {
	position: absolute;
	left: 50%;
	top: 23%;
	transform: translateX(-50%);
	background: #462f55;
	color: #fff0cf;
	border: 1px solid #f1c778;
	padding: 8px 16px;
	border-radius: 14px;
	font-weight: 900;
	text-transform: capitalize;
	white-space: nowrap;
}
.playing #sound {
	position: fixed;
	right: 10px;
	bottom: max(8px, env(safe-area-inset-bottom));
	z-index: 6;
	font-size: 0.8rem;
}
