.mg-game,
.mg-game * {
	box-sizing: border-box;
}
.mg-game {
	width: 100%;
	margin: 1em auto;
}
.mg-status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em 1.5em;
	margin-bottom: 0.75em;
}
.mg-board {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-template-rows: repeat(4, 1fr);
	gap: 8px;
	width: 100%;
}
.mg-card {
	appearance: none;
	-webkit-appearance: none;
	display: block;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	perspective: 800px;
	-webkit-tap-highlight-color: transparent;
}
.mg-inner {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform 0.45s;
}
.mg-card.is-flipped .mg-inner,
.mg-card.is-matched .mg-inner {
	transform: rotateY(180deg);
}
.mg-face {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 6px;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}
.mg-back {
	background: #2b5d8a;
	color: #fff;
	font-size: clamp(1rem, 5vw, 2.2rem);
	font-weight: 700;
}
.mg-front {
	background: #fff;
	border: 1px solid #d0d7de;
	transform: rotateY(180deg);
}
.mg-card.is-matched .mg-front {
	border: 3px solid #3a9d5d;
}
.mg-game .mg-front img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
}
.mg-card:focus-visible {
	outline: 3px solid #f0a000;
	outline-offset: 2px;
}
.mg-win {
	margin: 0.75em 0 0;
	font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
	.mg-inner {
		transition: none;
	}
}
