body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
}

.game-container {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

h1 {
    text-align: center;
    color: #333;
    font-size: 28px;
    margin-bottom: 20px;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    max-width: 500px;
    width: 100%;
}

.card {
    aspect-ratio: 1 / 1;
    background-color: #3498db;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: scale(1.05);
}

.card.flipped {
    background-color: #2ecc71;
}

.score {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
}

#restart {
    padding: 12px 24px;
    font-size: 18px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#restart:hover {
    background-color: #c0392b;
}

.chat-sidebar {
    width: 300px;
    background-color: #fff;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.chat-sidebar h2 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

#chat-input {
    width: calc(100% - 20px);
    padding: 10px;
    margin: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#send-button {
    width: calc(100% - 20px);
    margin: 0 10px 10px;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.toggle-chat {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .game-container {
        padding: 10px;
    }

    h1 {
        font-size: 24px;
    }

    #game-board {
        max-width: 300px;
        gap: 10px;
    }

    .card {
        font-size: 24px;
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 80%;
        max-width: 300px;
        transform: translateX(100%);
    }

    .chat-sidebar.open {
        transform: translateX(0);
    }

    .toggle-chat {
        display: block;
    }
}
