@font-face{
	font-family: 'display-font';
	src: url('../resource/fonts/oceanic_drift/oceanicdriftcondital.ttf');
}
@font-face{
	font-family: 'type-font';
	src: url('../resource/fonts/Zekton.otf');
}

*{
	box-sizing: border-box;
}

img{
	max-width: 100%;
}

body {
    font-family: sans-serif;

    height: 100vh;
    margin: 0;
	background: #0c0c0c;
	background: #272727;
	background: black;
}

:root {
    --square-size: 50px;
}

@media (max-width: 500px) {
    :root {
        --square-size: 11.5vw;
    }
    .square {
        font-size: 1.5rem !important;
    }
    .ghost-piece {
        font-size: 1.5rem !important;
    }
}
body.home{
    place-content: center;	
	display: grid;
    grid-template-columns: repeat(8, var(--square-size));
    grid-template-rows: repeat(8, var(--square-size));
}
body.game{
	background: grey;
	background: #515151;
}

#bg-img{
	position: fixed;
	pointer-events: none;
	left: 0;
	bottom: 0;
	display: inline-block;
	width: 100vw;
	height: 100vh;
	background: url(../resource/attempt1.png);
	background-size: 90%;
	background-position: 51% 49%;
	opacity: .4;
	background-repeat: no-repeat;
}

.disabled {
    pointer-events: none;
    opacity: .5;
}

.ai-mode-wrap {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    text-align: center;
}

.ai-mode-wrap h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ffd700;
}

.ai-btn {
    display: inline-block;
    margin: 5px;
    min-width: 80px;
}

input.input{
	padding: 5px;
}

#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    color: white;
    padding: 10px;
	user-select: none;
    display: none;
    pointer-events: none;
}

#header-toggle {
	position: fixed;
    cursor: pointer;
    font-size: 3.5rem;
    display: none;
	z-index: 99;
	right: auto;
	left: 10px;
}

#header.mobile-menu-open{
	display: inline-block;
    pointer-events: auto;
}

#app-grid{
    display: grid;
    place-content: center;	
}

#app {
    display: grid;
    grid-template-columns: repeat(8, var(--square-size));
    grid-template-rows: repeat(8, var(--square-size));
}
.game #app{
    border: 4px solid #8c6b6b;
	box-shadow: 0px 0px 15px black;
	border-radius: 4px;
}
.home #app{
	border: 1px solid;
	width: calc(var(--square-size) * 8);
	height: calc(var(--square-size) * 8);

	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, .6);
	z-index: 9;
}
.game .square.white{
	text-shadow: 0px 0px 3px black;
}

.square.light{
	background: lightgrey;
}
.square.dark{
	background: grey;
}
.square{
	text-align: center;
	padding-top: calc(var(--square-size) * 0.2);
	user-select: none;
	font-size: 2rem;
	border: 2px solid transparent;
}
.square:hover{
	border: 2px solid #545454;
}

#alert-contain{
	position:fixed;
	z-index: 999999;
	bottom: 50px;
	left: 20px;
	text-align: left;
	width: 70%;
	pointer-events: none;
	padding-top: 10px;
}
.alert-wrap{
	transition: .5s;
}
.alert-msg{
	position: relative;
	background: rgba(0, 0, 0, .9);
	color: lightgrey;
	font-size: 13px;
	display: inline-block;
	margin: 1px 0;
	padding: 8px 40px 7px 20px;
/* 	border: 1px solid grey; */
    pointer-events: initial;
    font-weight: bold;
	padding-right: 50px;
/* 	box-shadow: 0px 0px 5px black; */
}
.alert-msg a{
	color: lightblue;
}
.alert-msg pre{
	max-height: 80vh;
    overflow-y: auto;
}
.alert-msg span{
	color: orange
}
.alert-icon, 
.alert-close{
	height: 100%;
	width: 30px;

	display: flex;
	justify-content: center;
	align-items: center;

	background: grey;
	color: black;
}

.alert-icon{
	position: absolute;
	top: 0px;
	left: 0px;
	width: 12px;
}

.alert-close,
.modal-close{
	position: absolute;
	right: 0px;
	top: 0px;
	pointer-events: initial;
	cursor: pointer;
	padding: 2px 5px 0px 5px;
	font-size: 1.5rem;
	background: lightgrey;
	border-radius: 0 7px 0 0 ;
}
.alert-close:hover{
	background: rgba(250, 50, 55, .4);
}
.alert-icon{
	background: lightgrey;
}
.alert-icon.type-success{
	background: rgba(100, 245, 100, .7);
}
.alert-icon.type-error,
.alert-icon.type-warning{
	background: red;
}
.hal .alert-icon{
	background: rgb(255 235 0)
}

.ghost-piece{
	position: absolute;
	pointer-events: none; 
	font-size: 2rem;
	z-index: 100;
}
.ghost-piece.dropping{
	transition: left 0.15s ease-out, top 0.15s ease-out;
}
.ghost-piece.white{
    color: white;
    text-shadow: 0px 0px 3px black;
}

.checkmate-highlight {
    background: radial-gradient(circle, rgba(255,0,0,0.8) 0%, rgba(255,0,0,0.2) 80%);
    box-shadow: inset 0 0 10px rgba(255,0,0,0.5);
    border: 2px solid red !important;
}

.button,
input,
p,
span,
div{
	font-family: 'type-font', monospace;
}

h1,
h2,
h3,
h4,
h5,
h6{
	font-family: 'display-font', monospace;
}

.button{
	background: #b8b8b8;
	border: 1px solid black;
	color: black;
	padding: 10px 20px;
	display: inline-block;
	width: auto;
	max-width: auto;
	text-align: center;
	vertical-align: top;
	user-select: none;
	cursor: pointer;
	

}
.button:active{
	background: grey;
}
.button.selected{
	background: lightgreen;
}
a.button{
	text-decoration: none;
}

#matchmaker,
#create-game,
#play-with-bot {
	margin: 10px 0;
	width: 200px;
}

#auth{
	background: grey;
	max-width: 210px;
	padding: 10px;
	position: fixed;
	right: 20px;
	top: 20px;
}

.auth-view{
	display: none;
}
.auth-view.selected{
	display: inline-block;
}
#auth .input{
	margin: 5px 0;
}
#forgot{
	margin: 10px 0;
	text-align: right;
	cursor: pointer;
}
#forgot:hover{
	color: #3a3a3a;
}
#current-user{
	background: #3a3737;
	color: white;
	padding: 5px;
	margin-bottom: 30px;
}

#account-actions{
	text-align: right;
}
#account-actions>*{
	display: inline-block;
	vertical-align: bottom;
}

#logo{
	position: fixed;
	top: 0;
	left: 0;
	padding: 20px;
	color: lightgrey;
	max-width: 200px;
	max-width: 170px;
}

.square.white{
	color: white;
}

#turn-status{
	border: 1px solid;
	background: white;
    color: black;

	display: inline-block;
	margin: 10px 0;
	padding: 20px;
	left: 20px;
	margin-top: 20px;
	margin-left: 20px;
	/* position: absolute; */
}

#turn-status.searching {
    background: #1a1a2e;
    color: #00ff88;
    border-color: #00ff88;
    animation: searchPulse 2s ease-in-out infinite;
    font-weight: bold;
}

@keyframes searchPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.7); }
}

.user-portrait img{
	max-width: 100px;
}

#change-profile{
	padding: 5px;
	font-size: .9rem;
	color: black;
}

.profile-box{
	cursor: pointer;
	display: inline-block;
	border: 3px solid transparent;
	margin: 10px;
	text-align: center;
}
.profile-box.white-border {
    border-color: white;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}
.profile-box.black-border {
    border-color: black;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
.profile-box:hover{
	background: rgba(0, 0, 0, .2);
}

.profile-box img{
	/* border: 2px solid; */
	max-width: 80px;
	height: 80px;
}

#back-home{
	position: fixed;
	bottom: 20px;
	left: 20px;
}

#resign-btn {
    position: fixed;
    bottom: 20px;
    left: 200px; /* Adjust based on #back-home width */
    background: #dc3545; /* Red theme */
    color: white;
    border-color: #a71d2a;
}
#resign-btn:hover {
    background: #c82333;
}
#resign-btn:active {
    background: #bd2130;
}

.home #player-status,
.home #lobby-status {
    margin-top: 10px;
    padding: 10px;
    background: #333;
    border-radius: 5px;
    color: white;
}

#lobby-status{
    position: relative;
    z-index: 99;
	background: #474545;
	display: inline-block;
	padding: 10px;
	box-shadow: 0px 0px 10px black;
	border-radius: 7px;
    pointer-events: auto;
}

.lobby-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.lobby-btns {
    display: flex;
    gap: 10px;
}

.lobby-wrap .player-details {
    width: 100%;
    margin-top: 10px;
    border-top: 1px solid #555;
    padding-top: 10px;
}

.lobby-wrap .button {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.accept-btn {
    background-color: #28a745;
}

.decline-btn {
    background-color: #dc3545;
}



#player-status{
	padding-top: 100px;
	padding-left: 10px;
	padding-right: 10px;
	position: relative;
	/* border: 1px solid; */
}

.player-wrap{
	position:absolute;
	top: 100px;
    pointer-events: auto;
}
.player-wrap:nth-of-type(2){
	right: 10px;
}

.history-wrap{
	display: inline-block;
	width: 300px;
	margin-top: 20px;
}
.piece-history-row{
	display: inline-block;
	width: 300px;
}
.piece-history{
	position: relative;
	display: inline-block;
	width: 30px;
	vertical-align: top;
	height: 30px;
}
.piece-history{
	background: grey;
	text-align: center;
	padding-top: 8px;
	
}
.piece-history-row:nth-of-type(odd) .piece-history:nth-of-type(odd){
	background: lightgrey;
}
.piece-history-row:nth-of-type(even) .piece-history:nth-of-type(even){
	background: lightgrey;
}
.piece-history:nth-of-type(odd){
}
.piece-history-count{
	position: absolute;
	top: 0;
	right: 0;
	font-size: .7rem;
}

.game-link{
	margin: 20px 0;
	font-size: 1.5rem;
}
.game-link a{
	
	color: lightgrey;
}

.row{
	font-size: 0px;
	width: 100%;
}
.column{
    position: relative;
	font-size: initial;
	display: inline-block;
	vertical-align: top;
	width: 100%;
}
.column-2{
	max-width: 50%;
}
.column-3{
	max-width: 33%;
}
.column-4{
	max-width: 25%;
}
.column-5{
	max-width: 20%;
}


.match-row:hover{
	background: rgba(0, 0, 0, .1);
}


.piece-history.retrieving {
    cursor: wait;
    opacity: 0.5;
    background: black !important;
}

.timer-box {
    background: #333;
    color: #00ff00;
    font-family: 'type-font', monospace;
    font-size: 1.5rem;
    padding: 5px 10px;
    border: 2px solid #555;
    border-radius: 4px;
    text-align: center;
    margin-top: 5px;
    box-shadow: inset 0 0 5px #000;
}

.timer-box.expired {
    color: #ff0000;
    border-color: #ff0000;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}


@media (max-width: 800px) {
    #header{
	    background: #333;
	}
	#header-toggle {
        display: block;
        position: fixed;
        top: 10px;
		left: auto;
        right: 10px;
        z-index: 1000;
    }

    #header-content {
        /* display: none; */
    }

    header.mobile-menu-open #header-content {
        display: block;
    }
	#logo{
		max-width: 140px;
	}

	.game #header{
		padding-top: 100px;
	}
	#auth{
		position: relative;
	}
	
}
#leaderboard-wrap{
	top: 20px;
    position: fixed;
	width: 100%;
	text-align: center;
}
#leaderboard {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border: 1px solid #444;
    border-radius: 8px;
	display: inline-block;
	text-align: left;
}

#leaderboard h3 {
    margin-top: 0;
    text-align: center;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
    color: #b8b8b8;
}

#leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
    border-bottom: 1px solid #333;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 20px;
    font-weight: bold;
    color: #888;
}

.leaderboard-portrait {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.leaderboard-name {
    flex-grow: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-wins {
    font-weight: bold;
    color: #4caf50;
}

@media (max-width: 1200px) {
    #leaderboard {
        position: relative;
        right: auto;
        top: auto;
        margin: 20px auto;
        width: 100%;
        max-width: 400px;
    }
}
