body {
    background-color: #1b1a1a;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', sans-serif;
    min-height: 100vh;
    margin: 0;
}

.main-container {
    text-align: center;
}

.status {
    margin: 10px 0;
    font-size: 24px;
    font-weight: bold;
    color: #eeeed2;
}

.board {
    width: 90vw;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 5px solid #444;
    margin: 20px auto;
    background-color: #eeeed2;
    opacity: 0;
    pointer-events: none; 
    transition: opacity 0.5s ease;
}

.board.active {
    opacity: 1;
    pointer-events: auto;
}

.square {
    width: 100%;
    height: 100%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(20px, 8vw, 45px);
    cursor: pointer;
    user-select: none;
}

.square.light { background-color: #eeeed2; }
.square.dark  { background-color: #769656; }

.square.selected {
    background-color: rgba(255, 255, 50, 0.5) !important;
}

.square[data-color='w'] {
    color: #fff;
    text-shadow: 0 0 2px #000;
}
.square[data-color='b'] {
    color: #000;
}

button {
    padding: 10px 20px;
    margin: 5px;
    font-size: 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #45A049;
}

.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: #262421;
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.modal-content button {
    display: block;
    width: 100%;
    margin: 15px 0;
}

.hidden { display: none; }

.board.flipped {
    transform: rotate(180deg);
}

.board.flipped .square {
    transform: rotate(180deg);
}
