body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #333;
    color: #fff;
}

h1 {
    margin-bottom: 20px;
}

#game-container {
    display: flex;
    gap: 30px;
    align-items: center;
}

#chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 640px;
    height: 640px;
    border: 5px solid #4a2d1e;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background-color: #555;
    position: relative; /* NEW: Needed for the overlay */
}

/* Remove disabled styles, as the overlay handles it */
/* #chessboard.disabled { ... } */

.square {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    cursor: pointer;
    user-select: none;
}

.square.light {
    background-color: #ebecd0;
}

.square.dark {
    background-color: #779556;
}

.piece {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.square[data-color="w"] .piece {
    color: #f0d9b5;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}

.square[data-color="b"] .piece {
    color: #4a2d1e;
    text-shadow: 2px 2px 4px rgba(255,255,255,0.4);
}

.selected {
    background-color: #f7f769 !important;
}

/* --- NEW: Styles for the pre-game overlay --- */
#pre-game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 44, 44, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    z-index: 10;
    cursor: default;
}

#pre-game-overlay h2 {
    font-size: 48px;
    margin: 0;
    font-weight: 600;
}

#pre-game-overlay .chess-icon {
    font-size: 150px;
    line-height: 1;
    margin-top: 20px;
    opacity: 0.8;
}

/* NEW: Utility class to hide elements */
.hidden {
    display: none !important;
}
/* --- End of new styles --- */

#status-area {
    text-align: center;
    padding: 20px;
    background-color: #444;
    border-radius: 10px;
    width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#status-text {
    margin-top: 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-control-button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    background-color: #779556;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 150px;
    margin-top: auto;
}

#game-control-button:hover {
    background-color: #8ab069;
}

.error-text {
    color: #e74c3c;
    font-weight: bold;
    transition: color 0.2s;
}