/* General Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #f9f9f9;
    color: #333;
}

h1, h2, h3, h4 {
    margin: 0;
    text-align: center;
}

button {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
}

button:hover {
    background-color: #45a049;
}

/* Popup Styling */
#popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#popup h2 {
    color: #fff;
    font-size: 24px;
    margin-bottom: 20px;
}

#popup button {
    font-size: 18px;
}

/* Lobby Section */
#lobby-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

#lobby-section input {
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

/* Game Section */
#game-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

#game-header {
    text-align: center;
    margin-bottom: 20px;
}

#game-header h2, #game-header h3, #game-header h4 {
    margin: 10px 0;
}

/* Game Layout */
#game-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
}

#sidebar {
    flex: 1;
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 300px;
}
#waitingPopup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Initially hidden */
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6); /* Semi-transparent background */
    z-index: 10;
}

#waitingPopup .modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#waitingMessage {
    font-size: 18px;
    color: #444;
    font-weight: bold;
}


#sidebar h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

#sidebar ul {
    list-style: none;
    padding: 0;
}

#sidebar li {
    background: #f1f1f1;
    margin: 5px 0;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
}

/* Board Container */
#board-container {
    flex: 2;
    background: #ffffff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: auto;
    max-height: 80vh;
}

#board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 4px;
    width: 100%;
    aspect-ratio: 1; /* Ensure square grid */
}

.cell {
    background: #e0e0e0;
    border: 1px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    aspect-ratio: 1; /* Ensure square cells */
}

.cell:hover {
    background: #d0d0d0;
}

/* Winner Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.modal-content button {
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    #game-layout {
        flex-direction: column;
        align-items: center;
    }

    #board {
        grid-template-columns: repeat(15, 1fr);
    }

    #sidebar {
        max-width: 100%;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    #board {
        gap: 2px;
    }

    .cell {
        font-size: 10px;
    }

    #sidebar {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #board {
        grid-template-columns: repeat(15, 20px);
    }

    .cell {
        font-size: 8px;
    }

    #game-header {
        font-size: 14px;
    }

    #sidebar {
        font-size: 12px;
    }
}
