body {
	background-color: tan;
}

.menuPanel {
	background-color: beige;
	border: 2px solid white;
	box-sizing: border-box;
	display: flex;
	gap: 18px;
	left: 50%;
	max-width: 920px;
	padding: 20px;
	position: absolute;
	top: 24px;
	transform: translateX(-50%);
	width: calc(100% - 64px);
}

.menuControls {
	flex: 1;
	min-width: 0;
}

.menuControls h1 {
	color: #2f2b22;
	font: bold 32px Arial, sans-serif;
	margin: 0 0 22px;
}

.menuField {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.menuField label,
.menuPanel select,
.menuPanel button {
	font: 18px Arial, sans-serif;
}

.menuPanel button {
	cursor: pointer;
}

.menuPanel button:disabled,
.menuPanel select:disabled {
	cursor: default;
	opacity: 0.45;
}

.menuActions {
	display: flex;
	gap: 12px;
	margin-top: 8px;
}

.menuActions button {
	font-size: 22px;
	font-weight: bold;
	padding: 8px 18px;
}

.menuSectionTitle {
	color: #2f2b22;
	font: bold 20px Arial, sans-serif;
}

.playSectionTitle {
	margin-top: 22px;
}

.puzzlesSectionTitle {
	border-top: 2px solid #b8ad88;
	margin-top: 22px;
	padding-top: 14px;
}

.menuMateActions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	margin-top: 10px;
	max-width: 620px;
}

.matePuzzleRow {
	align-items: center;
	display: grid;
	gap: 8px;
	grid-template-columns: minmax(0, 1fr) auto auto;
	width: 100%;
}

.matePuzzleLabel {
	color: #2f2b22;
	font: bold 16px Arial, sans-serif;
	grid-column: 1 / -1;
	white-space: nowrap;
}

.matePuzzleSelect {
	box-sizing: border-box;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	width: 100%;
}

.menuCardPanel {
	display: flex;
	flex: 0 0 260px;
	flex-direction: column;
	min-height: 0;
}

.cardPickerHeader {
	color: #4b4638;
	cursor: pointer;
	font: bold 18px Arial, sans-serif;
}

.cardPicker {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: min(680px, calc(100vh - 126px));
	margin-top: 8px;
	overflow-y: auto;
	padding-right: 6px;
}

.cardToggle {
	align-items: flex-start;
	aspect-ratio: 23 / 14;
	background-color: lightgrey;
	background-position: center;
	background-size: cover;
	border: 3px solid white;
	box-sizing: border-box;
	cursor: pointer;
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
	min-height: 82px;
	overflow: hidden;
	padding: 8px;
	position: relative;
}

.cardToggle input {
	height: 18px;
	margin: 0;
	position: relative;
	width: 18px;
	z-index: 2;
}

.cardToggleCheckmark {
	background: linear-gradient(90deg, rgba(0,0,0,0.7), rgba(0,0,0,0));
	inset: 0;
	position: absolute;
	z-index: 1;
}

.cardToggleName {
	color: white;
	font: bold 14px Arial, sans-serif;
	position: relative;
	text-shadow: 0 1px 3px black;
	z-index: 2;
}

.cardToggle:has(input:not(:checked)) {
	filter: grayscale(0.9);
	opacity: 0.45;
}

.cardToggle.shake {
	animation: shakeCard 220ms ease-in-out;
	border-color: gold;
}

.cardToggle.locked:active {
	animation: shakeCard 220ms ease-in-out;
	border-color: gold;
}

@keyframes shakeCard {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-7px); }
	40% { transform: translateX(7px); }
	60% { transform: translateX(-5px); }
	80% { transform: translateX(5px); }
}

#homeButton,
#takeBackButton,
#switchSidesButton {
	background-color: beige;
	border: 2px solid white;
	cursor: pointer;
	font: 18px Arial, sans-serif;
	padding: 8px 14px;
	position: absolute;
	top: 20px;
	z-index: 200;
}

#homeButton {
	left: 20px;
}

#takeBackButton {
	left: 102px;
}

#switchSidesButton {
	left: 226px;
}

#takeBackButton:disabled,
#switchSidesButton:disabled {
	cursor: default;
	opacity: 0.45;
}

#customBeginButton {
	background-color: beige;
	border: 2px solid white;
	cursor: pointer;
	font: bold 18px Arial, sans-serif;
	padding: 8px 16px;
	position: absolute;
	z-index: 220;
}

#customBeginButton:disabled {
	cursor: default;
	opacity: 0.45;
}

#boardStartButton {
	background-color: #1f1f1f;
	border: 3px solid white;
	box-shadow: 0 4px 12px rgba(0,0,0,0.35);
	color: white;
	cursor: pointer;
	font: bold 22px Arial, sans-serif;
	height: 72px;
	left: 664px;
	position: absolute;
	text-transform: uppercase;
	top: 414px;
	width: 172px;
	z-index: 250;
}

#boardStartButton:hover,
#boardStartButton:focus {
	background-color: #333333;
	outline: 3px solid gold;
}

.boardSquare {
	background-color: beige;
	border: 2px solid white;
	position:absolute;
	width: 100px;
	height:100px;
}

.evalBar {
	background-color: #f1ead4;
	border: 2px solid white;
	box-shadow: 0 2px 8px rgba(0,0,0,0.25);
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	position: absolute;
	width: 28px;
	z-index: 150;
}

.evalBarFill {
	box-sizing: border-box;
	flex-grow: 0;
	flex-shrink: 0;
	min-height: 0;
}

.evalBarRed {
	background-color: red;
}

.evalBarBlue {
	background-color: blue;
}

.lastMoveFromSquare {
	background-color: #e6d8ff;
}

.lastMoveToSquare {
	background-color: #d8f5d0;
}

.coordinateLabel {
	border: none;
	background: transparent;
	box-shadow: none;
	color: #4b4638;
	font: bold 14px Arial, sans-serif;
	pointer-events: none;
	position: absolute;
	z-index: 1;
}

.fileLabel {
	bottom: 4px;
	right: 6px;
}

.rankLabel {
	left: 6px;
	top: 4px;
}

.redTemple {
	border-bottom-color: red;
	border-left-color: red;
	border-right-color: red;
	z-index: 100;

}
.blueTemple {
	border-top-color: blue;
	border-left-color: blue;
	border-right-color: blue;
	z-index: 100;
}

.cardSlot {
	width: 230px;
	height: 140px;
	background-color:lightgrey;
	border:5px solid white;
	position:absolute;
	background-size:230px 140px;
	color:transparent;
}

.customSetupMode #takeBackButton,
.customSetupMode #switchSidesButton {
	display: none;
}

.customSetupMode .boardSquare,
.customSetupMode .cardSlot,
.customSetupMode .piece,
.customCardChoice {
	cursor: pointer;
}

.customCardPanel {
	background-color: beige;
	border: 2px solid white;
	box-sizing: border-box;
	display: none;
	height: 504px;
	left: 780px;
	padding: 10px;
	position: absolute;
	top: 200px;
	width: 230px;
	z-index: 180;
}

.customCardPanelHeader {
	color: #4b4638;
	font: bold 18px Arial, sans-serif;
	margin-bottom: 8px;
}

.customCardPicker {
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: calc(100% - 30px);
	overflow-y: auto;
	padding-right: 4px;
}

.customCardChoice {
	aspect-ratio: 23 / 14;
	background-color: lightgrey;
	background-position: center;
	background-size: cover;
	border: 3px solid white;
	box-sizing: border-box;
	color: white;
	flex: 0 0 auto;
	font: bold 14px Arial, sans-serif;
	overflow: hidden;
	padding: 8px;
	position: relative;
	text-align: left;
	text-shadow: 0 1px 3px black;
}

.customCardChoice::before {
	background: linear-gradient(90deg, rgba(0,0,0,0.7), rgba(0,0,0,0));
	content: "";
	inset: 0;
	position: absolute;
}

.customCardChoice span {
	position: relative;
	z-index: 1;
}

.customCardChoice.selected {
	border-color: gold;
}

.customCardChoice.used:not(.selected) {
	filter: grayscale(0.5);
	opacity: 0.6;
}

.cardSlot.customEmptySlot {
	background-image: none;
	border-style: dashed;
	opacity: 0.35;
}

.cardSlot.customFilledSlot {
	opacity: 1;
}

.piece.customSelectedPiece {
	outline: 4px solid gold;
}

#pBc1 {
	top:25px;
	left:510px;
	transform:rotate(180deg);

}

#pBc2 {
	top:25px;
	left:760px;
	transform:rotate(180deg);

}


#pRc1 {
	top:730px;
	left:510px;
}

#pRc2 {
	top:730px;
	left:760px;
}

#neutralBlue {
	top:380px;
	left:250px;
	transform:rotate(180deg);
}
#neutralRed {
	top:380px;
	left:1020px;
}

.piece {
	border-radius: 50%;
	border:4px solid silver;
	margin: 5px;
	position: relative;
	z-index: 2;
}

.red {
	background-color: red;
}

.blue {
	background-color: blue;
}

.pawn {
	width:80px;
	height:80px;
}

.aiThinkingIndicator {
	height: 58px;
	left: 50%;
	pointer-events: none;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 58px;
	z-index: 3;
}

.master {
	border-radius: 15%;
	border: 4px solid gold;
	width:80px;
	height:80px;
}

@media (max-width: 760px) {
	.menuPanel {
		flex-direction: column;
	}

	.menuCardPanel {
		flex-basis: auto;
	}

	.cardPicker {
		max-height: 420px;
	}

	.matePuzzleRow {
		grid-template-columns: 1fr 1fr;
	}

	.matePuzzleSelect {
		grid-column: 1 / -1;
	}

	.matePuzzleRow button {
		width: 100%;
	}
}
