* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
}

:root {
	--menu-font-size: clamp(26px, 3vmin, 32px);
}

html,
body,
#app {
	min-height: 100vh;
	min-height: 100dvh;
}

#app {
	position: relative;
	isolation: isolate;
}

body {
	font-family: Arial, Roboto, sans-serif;
	font-size: 24px;
	background: #3d1a3d;
}

.last-moved {
	filter: drop-shadow(0 0 5px #8800bb) !important;
}

#spaceCanvas {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	pointer-events: none;
}

#menu {
	z-index: 1000000;
	position: relative;
	padding: 10px 20px 32px;
	gap: 20px;
	font-size: var(--menu-font-size);
	display: flex;
	justify-content: flex-start;
}

#menu > * {
	cursor: pointer;
}

#gameSelector {
	width: 100%;
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	position: absolute;
	color: #fff;
	font-size: var(--menu-font-size);
}

#gameSelector h2,
#gameSelector h3 {
	font-size: inherit;
	font-weight: normal;
}

#gameSelector .game {
	cursor: pointer;
}

.table {
	display: inline-flex;
	gap: 16px;
	padding: 0 16px 16px;
}

.holder {
	flex-shrink: 0;
	width: calc(var(--psize) * var(--sc) * 3 + 13px * 2);
}

.board {
	flex-shrink: 0;
	width: calc(var(--bsize) * var(--sc));
	height: calc(var(--bsize) * var(--sc));
}

.el {
	transition: all .1s linear, transform .2s linear, filter 0s linear;
	position: absolute;
	overflow: hidden;
}

.el .img {
	background-position: 0 0;
	transform-origin: top left;
	background-repeat: no-repeat;
}

.p {
	width: calc(var(--psize) * var(--sc));
	height: calc(var(--psize) * var(--sc));
	cursor: pointer;
}

.p .img {
	width: var(--psize);
	height: var(--psize);
	transform: scale(calc(1 * var(--sc)));
}

.b {
	width: calc(var(--bsize) * var(--sc));
	height: calc(var(--bsize) * var(--sc));
}

.b .img {
	width: var(--bsize);
	height: var(--bsize);
	transform: scale(calc(1 * var(--sc)));
}

.c {
	cursor: pointer;
	width: calc(var(--csize) * var(--sc));
	height: calc(var(--csize) * var(--sc));
}

.c .img {
	width: var(--csize);
	height: var(--csize);
	transform: scale(calc(1 * var(--sc)));
}

.shake {
	animation: shakeAnimation 0.5s ease-in-out;
}

.flip {
	animation: flipAnimation 0.5s forwards;
	transform-style: preserve-3d;
}

.modal {
	color: #000;
	font-size: 16px;
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 99999999;
}

.modal-inner {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	max-height: 95%;
	max-width: 95%;
	width: 800px;
	overflow-y: auto;
	border-radius: 5px;
	display: flex;
	flex-direction: column;
}

.modal-header {
	display: flex;
	justify-content: space-between;
}

.modal-content {
	padding: 0 16px 32px;
	flex-grow: 1;
	overflow: auto;
	line-height: 1.3;
	gap: 8px;
	display: flex;
	flex-direction: column;
}

.modal h2 {
	padding: 16px;
}

.modal-hide {
	font-size: 24px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 16px;
}

ol, ul {
	padding-left: 1.5em;
}

.t {
	position: fixed;
	inset: 0;
	opacity: .1;
	transition: background .2s linear;
}

@keyframes flipAnimation {
	from {
		transform: rotateX(0deg);
	}

	to {
		transform: rotateX(180deg);
	}

}

@keyframes shakeAnimation {
	0% {
		transform: translateX(0);
	}

	20% {
		transform: translateX(-5px);
	}

	40% {
		transform: translateX(5px);
	}

	60% {
		transform: translateX(-5px);
	}

	80% {
		transform: translateX(5px);
	}

	100% {
		transform: translateX(0);
	}

}

.portrait .table {
	flex-direction: column;
}

.portrait .holder[data-side="0"] {
	order: 3;
}

.portrait .board {
	order: 2;
}

.portrait .holder[data-side="1"] {
	order: 1;
}
