@font-face {
    font-family: 'DS-Digital';
    src: url('fonts/ds-digital.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body, .square, button{
    touch-action: manipulation;    
}

body {
    background-color: #302e2b;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.player-hud {
    width: 400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

/* --- BOARD LAYOUT --- */
#gameboard {
    width: 400px;
    height: 400px;
    background-color: #eeeed2;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 5px solid #5a5a5a;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.square {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.square:hover::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    z-index: 2; 
    pointer-events: none;
}

.highlight {
    background-color: rgba(155, 199, 0, 0.41) !important;
}

/* Square Colors */
.beige {
    background-color: #eeeed2;
    color: black;
}

.brown {
    background-color: #769656;
    color: black;
}

/* --- PIECES --- */
.piece {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    z-index: 3;
}

/* --- CAPTURED AREAS --- */
.captured-area {
    flex: 1;
    min-height: 40px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 2px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 4px;
    border: none;
}

#captured-by-black {
    border-bottom: 2px solid #555;
}

#captured-by-white {
    border-top: 2px solid #555;
}

.captured-piece {
    height: 20px;
    width: 20px;
}

/* --- CONTROLS --- */
.controls-container {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    background-color: #4a4a4a;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background 0.2s;
}

button:hover {
    background-color: #6a6a6a;
}

/* --- HIGHLIGHTS --- */
.selected {
    background-color: rgba(255, 255, 0, 0.5) !important;
}

.check {
    background-color: rgba(255, 0, 0, 0.6) !important;
}

/* --- PROMOTION --- */
.promotion-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    border: 1px solid black;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.promotion-option {
    flex: 1;
    cursor: pointer;
    background: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
}

.promotion-option:hover {
    background: #ccc;
}

/*-- MOVE HISTORY --*/
.history-container{
    width: 400px;
    height: 36px;
    background-color: #262421;
    border-radius: 4px;
    padding: 8px 12px;
    box-sizing: border-box;
}

.move-history-box{
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 12px;
    font-size: 14px;
    color: #eeeeee;
    align-items: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.move-history-box::-webkit-scrollbar {
    display: none;
}

.move-record{
    display: inline-block;
}

.move-number {
    color: #888;
    margin-right: 2px;
}

/* --- Timer --- */
.timer-container{
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.timer {
    background-color: #262421;
    color: #888;
    font-size: 24px;
    font-family: "DS-Digital";
    padding: 8px 12px;
    border-radius: 4px;
    border: 2px solid transparent;
    min-width: 75px;
    text-align: center;
}

.active-timer{
    color: #fff;
    background-color: #333;
    border-color: #5c5c5c;
}

.time-selector {
    background-color: #262421;
    color: #eeeeee;
    border: 1px solid #5c5c5c;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.time-selector:hover {
    background-color: #333;
}