*{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

#app {
	background: #0a0a1e;
	font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0 0 20px 0;
	margin-top: 0;
}

.board-container {
	width: 640px;
	max-width: 94%;
	justify-content: center;
	margin: 0;
	margin-left: auto;
	margin-right: auto;
	position: relative;
	background: #16213e;
	padding: 25px 20px 20px;
	border-radius: 28px;
	box-shadow: 0 20px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
}

.semataries {
	width: 100%;
	margin: 12px auto 0;
	display: flex;
	justify-content: center;
	gap: 10px;
	padding: 0 4px;
}

.sematary {
	width: 50%;
	background: #333448;
	border-radius: 18px;
	padding: 10px 12px;
	min-height: 52px;
	backdrop-filter: blur(12px);
	box-shadow: inset 0 1px 4px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
	border: 1px solid rgba(255,255,255,0.05);
}

#blackSematary {
	text-align: right;
}

#board{
	aspect-ratio: 1 / 1;
	margin: auto;
	border: 6px solid #2c2c3a;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 0 0 4px #0f0f1a, 0 18px 30px rgba(0,0,0,0.7);
	background: #262636;
}

#board div div{
	float: left;
	width: calc(100% / 8);
	aspect-ratio: 1 / 1;
	box-sizing: border-box;
	border: 1px solid rgba(0,0,0,0.25);
	transition: all 0.12s ease;
}

#board .even div:nth-child(even){
	background: #e8e6d9;
}

#board .even div:nth-child(odd){
	background: #6d8a6b;
}

#board .odd div:nth-child(even){
	background: #6d8a6b;
}

#board .odd div:nth-child(odd){
	background: #e8e6d9;
}

.animate{
	animation: rotateBoard 0.9s cubic-bezier(0.4, 0.0, 0.2, 1);
	animation-fill-mode: both;
}

@keyframes rotateBoard { 
	0% {
		transform: rotateZ(0);
		box-shadow: 0 0 0 4px #0f0f1a, 0 18px 30px rgba(0,0,0,0.7);
	}
	100%{
		transform: rotateZ(-180deg);
		box-shadow: 0 0 0 4px #0f0f1a, 0 18px 30px rgba(0,0,0,0.7);
	}
}

.forward{
	transform: rotateZ(-180deg);
	transition: transform 0.2s ease;
}

.backward{
	transform: rotateZ(0);
	transition: transform 0.2s ease;
}

.animate-backward{
	animation: rotateBoardBackward 0.9s cubic-bezier(0.4, 0.0, 0.2, 1);
	animation-fill-mode: both;
}

@keyframes rotateBoardBackward { 
	0% {
		transform: rotateZ(-180deg);
		box-shadow: 0 0 0 4px #0f0f1a, 0 18px 30px rgba(0,0,0,0.7);
	}
	100%{
		transform: rotateZ(0);
		box-shadow: 0 0 0 4px #0f0f1a, 0 18px 30px rgba(0,0,0,0.7);
	}
}

img.piece{
	width: 100%;
	height: 100%;
	float: left;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
	transition: transform 0.18s ease;
	cursor: pointer;
}

img.piece:hover {
	transform: scale(1.05);
	filter: drop-shadow(0 4px 8px rgba(0,0,0,0.7));
}

.allowed{
	opacity: 0.9;
	background: radial-gradient(circle at center, #5b7a4a 5%, #2d4a2a 85%)!important;
	border: 2px solid #f5e56c !important;
	box-shadow: inset 0 0 18px #e9d84b;
}

.last-move {
	background: #8fbc5e !important;
	box-shadow: inset 0 0 20px #ffe484;
	border: 1px solid #e0b643 !important;
}

.clicked-square{
	background: radial-gradient(circle at 30% 30%, #3a5a3a, #1f321f)!important;
	border: 2px solid #f0d050 !important;
	box-shadow: inset 0 0 24px #ccaa30;
}

.sematary img {
	transform: rotateZ(0);
	width: 2rem;
	height: 2rem;
	filter: drop-shadow(0 2px 5px rgba(0,0,0,0.6));
	margin: 3px 2px;
}

#blackSematary div{
	overflow-y: auto;
	margin-bottom: 2px;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	gap: 4px;
}

#whiteSematary div {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
}



#turn{
	text-align: center;
	font-size: 20px;
	font-weight: 600;
	margin: 16px 0 6px;
	color: #eae3c6;
	background: rgba(22, 24, 40, 0.8);
	padding: 10px 24px;
	border-radius: 40px;
	display: inline-block;
	width: auto;
	margin-left: auto;
	margin-right: auto;
	backdrop-filter: blur(16px);
	border: 1px solid rgba(255,255,200,0.2);
	letter-spacing: 0.5px;
}

.winning-sign {
	margin-top: 200px;
}

.winning-sign:first-letter{
	text-transform: uppercase;
}

.flip-board{
	padding: 12px 28px;
	border-radius: 40px !important;
	outline: 0;
	background: #2c3e50;
	color: #f0e9d5;
	border: 1px solid rgba(255,255,220,0.25);
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: 0.4px;
	box-shadow: 0 8px 18px rgba(0,0,0,0.5);
	transition: all 0.2s;
	cursor: pointer;
	backdrop-filter: blur(8px);
}

.flip-board:hover {
	background: #3e5368;
	border-color: #e6dba0;
	transform: translateY(-2px);
	box-shadow: 0 14px 24px rgba(0,0,0,0.6);
}

input[type="radio"] {
	display: none;
}

label {
	background-color: #2d2d44;
	position: relative;
	font-family: "Poppins", "Segoe UI", sans-serif;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.8em;
	padding: 0.9em 2.2em;
	border-radius: 3em;
	font-size: 22px;
	font-weight: 500;
	color: #cdcddd;
	border: 1px solid rgba(255,255,255,0.08);
	transition: all 0.2s;
	box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

input[type="radio"]:checked + label {
	background-color: #3b5f8a;
	color: #ffffff;
	border-color: #c4b15c;
	box-shadow: 0 0 18px #3b6390;
}

.button {
	background-color: #2d2d44;
	border-radius: 50px;
	border: 1px solid rgba(255,255,200,0.15);
	color: #f2edd8;
	padding: 18px 44px;
	text-align: center;
	text-decoration: none;
	display: inline-block;
	font-size: 22px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s;
	box-shadow: 0 8px 20px rgba(0,0,0,0.5);
	letter-spacing: 0.6px;
	background: linear-gradient(145deg, #2e2e48, #1f1f33);
}

.button:hover, label:hover {
	background-color: #3d3d5c;
	border-color: #e6d78c;
	transform: translateY(-2px);
	box-shadow: 0 14px 24px rgba(0,0,0,0.7);
}

.button-big {
	padding: 28px 64px;
	font-size: 28px;
	background: linear-gradient(145deg, #3b4a5c, #1f2b33);
	border-color: #b89b40;
}

/* additional polished details */
#board .square {
	position: relative;
}

#blackSematary .pawn::before,
#blackSematary .knight::before,
#blackSematary .bishop::before,
#blackSematary .rook::before,
#blackSematary .queen::before {
	color: #c0b28a;
}

.scene {
	width: 100%;
	position: relative;
	opacity: 0;
	display: none;
	z-index: 100;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.overlay {
	position: fixed;
	width: 100%;
	height: 130vh;
	background: #1a1a1a;
	opacity: .8;
	z-index: 1;
}

.scene .scene-content {
	position: fixed;
	color: #f0ede0;
	z-index: 2;
	width: 100%;
	text-align: center;
	font-size: 44px;
	height: 100vh;
	text-shadow: 0 4px 18px rgba(0,0,0,0.7);
	letter-spacing: 0.02em;
	top: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.scene-content-box {
    background: #1a1f24;
    max-width: 500px;
    padding: 40px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: none;
    letter-spacing: 1px;
    margin-right: auto;
    margin-left: auto;
    margin-bottom: 30px;
    width: 90%;
    box-sizing: border-box;
}

.scene-content h2 {
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 2.2rem;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

.scene-selector {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.scene-selector input[type="radio"] {
    display: none;
}

.option-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border 0.2s;
    border: 2px solid transparent; 
    min-height: 100px;
    box-sizing: border-box;
}

.option-card .icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 10px;
    transition: filter 0.2s, color 0.2s;
}

.option-card span {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.blue-card { 
    background: #1d4a80; 
    color: #ffffff;
}
.blue-card .icon { filter: brightness(0) invert(1); }

.purple-card { 
    background: #5e2f7e; 
    color: #ffffff;
}


.white-card { 
    background: #3b424a; 
    color: #a0aec0; 
}
.white-card .icon { color: #a0aec0; }

.black-card { 
    background: #252a30; 
    color: #718096; 
}
.black-card .icon { color: #718096; }

.option-card:hover:not(input:checked + .option-card) {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

input[type="radio"]:checked + .option-card {
    border: 2px solid rgba(255, 255, 255, 0.6);
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

input#humanColorWhite:checked + .white-card {
    background: #f7fafc; 
    border-color: #ffffff;
}
input#humanColorWhite:checked + .white-card .icon,
input#humanColorWhite:checked + .white-card span {
    color: #1a202c; 
}

input#humanColorBlack:checked + .black-card {
    background: #111111; 
    border-color: #718096;
}
input#humanColorBlack:checked + .black-card .icon,
input#humanColorBlack:checked + .black-card span {
    color: #ffffff; 
}

.start-game-container {
    margin-top: 10px;
}

#start-game-button:disabled {
	opacity: .8;
	cursor: initial;
}

.button-big {
    background: #2b8341;
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    padding: 18px 60px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(43, 131, 65, 0.4);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 400px;
}

.button-big:not(button:disabled):hover {
    background: #349a4e;
    transform: scale(1.02);
    box-shadow: 0 6px 15px rgba(43, 131, 65, 0.6);
}

.button-big:active {
    transform: scale(0.98);
}

@media screen and (max-width: 600px) {
	.scene-content h2 {
		font-size: 1.8rem;
        margin-bottom: 20px;
	}
    .scene-content-box {
        padding: 25px 20px;
    }
    .option-card {
        padding: 15px 5px;
        min-height: 80px;
    }
    .option-card .icon {
        font-size: 2.2rem;
    }
    .option-card span {
        font-size: 0.85rem;
    }
    .button-big {
        font-size: 1.2rem;
        padding: 15px 30px;
    }
}

.hidden {
    display: none !important;
}

.show {
	display: block !important;
	animation: showMessage 0.7s ease-out;
	animation-fill-mode: both;
}

@keyframes showMessage { 
	0% {
		opacity: 0;
		transform: translateY(12px);
	}
	100%{
		opacity: 1;
		transform: translateY(0);
	}
}

.color-fade-in {
    display: block !important;
    overflow: hidden; /* Prevents content from spilling during animation */
    animation: expandSmooth 0.55s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    /* Added extra top-margin during animation to blend in */
    margin-top: 25px; 
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 25px;
}

@keyframes expandSmooth {
    0% {
        max-height: 0;
        opacity: 0;
        transform: translateY(-8px);
        padding-top: 0;
        border-top-width: 0;
        margin-top: 0; /* Removes margin in the beginning to prevent jump */
    }
    40% {
        opacity: 1;
        border-top-width: 1px;
    }
    100% {
        max-height: 400px; /* Large enough to contain the buttons */
        opacity: 1;
        transform: translateY(0);
        margin-top: 25px; /* Restores margin at the end */
        padding-top: 25px;
        border-top-width: 1px;
    }
}