@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

:root {
    --font-family: 'Barlow', serif; /* Change this to apply a new font everywhere */
    --card-border-radius: 16px; /* Change this to update card corners */
    --button-border-radius: 8px; /* Change this to update button corners */
    --card-width: 264px; /* Doubled from 132px */
    --card-height: 402px; /* Doubled from 201px */
}

body {
    font-family: var(--font-family);
    text-align: center;
    background-color: #F5F5F5;
    color: #212121;
    margin: 0;
    padding: 0;
}

h1, h2, button {
    font-family: var(--font-family);
}

.container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px;
    flex-wrap: wrap; /* Allows proper layout on smaller screens */
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

button {
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: var(--button-border-radius);
    background-color: #4285F4;
    color: white;
    font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #3367D6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.card-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap; /* Ensures good layout on mobile */
    justify-content: center;
}

.pile {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--card-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.pile img {
    width: 100%;
    height: 100%;
    cursor: pointer;
    border-radius: var(--card-border-radius);
}

#discard-pile {
    width: calc(var(--card-width) / 3); /* Adjusted size for discard pile */
    height: calc(var(--card-height) / 3);
    border-radius: var(--card-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#discard-pile img {
    width: 100%;
    height: 100%;
    border-radius: var(--card-border-radius);
}

#played-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.card-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap; /* Allows rows to adjust on smaller screens */
}

.drawn-card {
    width: var(--card-width); /* Ensure drawn cards keep their correct size */
    height: var(--card-height);
    border-radius: var(--card-border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease-in-out;
}

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

.discard-card {
    width: 100%;
    height: 100%;
    border-radius: var(--card-border-radius);
    opacity: 1;
}

/* Mobile-friendly scaling while maintaining drawn card size */
@media (max-width: 768px) {
    .container {
        flex-direction: column; /* Stack elements vertically on small screens */
        align-items: center;
    }

    .card-container {
        flex-direction: column;
    }

    .pile {
        width: 80vw; /* Make sure the pile scales properly */
        height: auto; /* Adjust proportionally */
        max-width: var(--card-width);
    }

    .drawn-card {
        width: 80vw; /* Keep drawn cards correctly scaled */
        height: auto;
        max-width: var(--card-width);
    }

    #discard-pile {
        width: calc(var(--card-width) / 1.5);
        height: calc(var(--card-height) / 1.5);
    }
}