body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1c3f5f, #2c5f8f);
    color: #f0f0f0;
    font-family: 'Arial', sans-serif;
}

#controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0; /* Add margin to separate from the game container */
    order: -1;
}

#timer, #score {
    font-size: 24px;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 10px;
    align-self: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin: 0 10px;
}

#game-container {
    width: 100%;
    max-width: 1200px;
    padding: 30px;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: auto; /* Add this line to allow scrolling if content overflows */
}

#top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    width: 100%;
}

#foundation {
    display: flex;
    gap: 15px;
}

.card-slot, .foundation-slot, .tableau-pile {
    width: 120px;
    height: 168px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#tableau {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    width: 100%;
    flex-grow: 1; /* Allow the tableau to grow */
}

.tableau-pile {
    position: relative;
    width: 120px;
    background: none;
    border: none;
    box-shadow: none;
    flex-grow: 1; /* Allow each pile to grow */
    min-height: 400px; /* Set a minimum height */
}

.card {
    width: 100px;
    height: 150px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    position: absolute;
    background-repeat: no-repeat;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.card.face-down {
    background-image: url('https://deckofcardsapi.com/static/img/back.png') !important;
}

.card.face-up {
    background-color: white;
}

#controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 0;
    margin-top: 20px;
    order: -1;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    background-color: #1abc9c;
    color: white;
    border: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    box-shadow: 0 7px 10px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #16a085;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

#timer, #score {
    font-size: 24px;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 10px;
    align-self: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin: 0 10px;
}

#score {
    margin-left: 0;
}

/* Responsive design */
@media (max-width: 1200px) {
    .card-slot, .foundation-slot, .tableau-pile, .card {
        width: 100px;
        height: 140px;
    }

    .tableau-pile {
        height: 350px;
    }
}

@media (max-width: 900px) {
    .card-slot, .foundation-slot, .tableau-pile, .card {
        width: 80px;
        height: 112px;
    }

    .tableau-pile {
        height: 300px;
    }
}

@media (max-width: 600px) {
    #game-container {
        padding: 10px;
        border-radius: 10px; /* Reduce border radius for smaller screens */
    }

    #top-row {
        flex-wrap: wrap;
        margin-bottom: 20px; /* Add margin for better spacing */
    }

    #foundation {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        gap: 5px; /* Add gap for better spacing */
    }

    .card-slot, .foundation-slot, .tableau-pile, .card {
        width: 60px;
        height: 84px;
        border-radius: 5px; /* Reduce border radius for smaller screens */
    }

    .tableau-pile {
        height: 250px;
        margin-right: 5px; /* Add margin to improve spacing */
        flex-grow: 1; /* Ensure piles grow to fill space */
    }

    #controls {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 10px; /* Add margin for better spacing */
    }

    button {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 3px; /* Reduce border radius for smaller screens */
    }

    #timer, #score {
        font-size: 20px; /* Reduce font size for smaller screens */
        padding: 8px 16px; /* Adjust padding for smaller screens */
    }

    #custom-dialog {
        padding: 20px; /* Add padding for better spacing */
    }

    .dialog-content {
        padding: 20px;
        border-radius: 10px; /* Reduce border radius for smaller screens */
    }

    #dialog-title {
        font-size: 20px; /* Reduce font size for smaller screens */
    }

    #dialog-message {
        font-size: 16px; /* Reduce font size for smaller screens */
    }

    #dialog-buttons {
        flex-direction: column; /* Stack buttons vertically */
        gap: 5px; /* Add gap for better spacing */
    }

    #dialog-yes, #dialog-no, #dialog-close {
        padding: 8px 16px; /* Adjust padding for smaller screens */
        font-size: 14px; /* Reduce font size for smaller screens */
    }

    .card.face-down {
        background-size: contain; /* Ensure background image fits */
    }

    .card.face-up {
        background-size: contain; /* Ensure background image fits */
    }

    #stock, #waste, .foundation-slot {
        width: 60px;
        height: 84px;
        border-radius: 5px; /* Reduce border radius for smaller screens */
    }
}

#stock, #waste, .foundation-slot {
    width: 120px;
    height: 168px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#waste .card, .foundation-slot .card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#stock:hover, #waste:hover, .foundation-slot:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.feed-item {
    display: flex;
    flex-direction: column;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    width: 100%;
    border: 1px solid #d1d5db;
}

/* Add this at the end of your CSS file */
#custom-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#custom-dialog.hidden {
    display: none;
}

.dialog-content {
    background: linear-gradient(135deg, #2c5f8f, #1c3f5f);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    max-width: 80%;
    color: white;
}

#dialog-title {
    font-size: 24px;
    margin-bottom: 15px;
}

#dialog-message {
    font-size: 18px;
    margin-bottom: 20px;
}

#dialog-close {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    transition: all 0.3s ease;
}

#dialog-close:hover {
    background-color: #c0392b;
}

/* Add this to your existing CSS */
#dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#dialog-yes, #dialog-no, #dialog-close {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: inline-block;
}

#dialog-yes:hover, #dialog-no:hover, #dialog-close:hover {
    background-color: #c0392b;
}

/* Remove this line */
/* #dialog-close {
    display: none;
} */
