body {
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f0f0, #c8e0e0);
    margin: 0;
    padding: 0;
}

.container {
    background-color: #fff;
    padding: 20px 25px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 450px;
    width: 95%;
}

h1 {
    color: #2a7575;
    margin-bottom: 25px;
    font-size: 2rem;
}

#controls {
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: auto auto;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

label {
    font-weight: bold;
    color: #333;
    text-align: right;
}

input[type="number"],
select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9rem;
    width: 70px;
    box-sizing: border-box;
}

#roll-button {
    padding: 10px 20px;
    background-color: #2a7575;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    width: auto;
    white-space: nowrap;
    grid-column: 1/3;
    justify-self: center;
}

#roll-button:hover {
    background-color: #235e5e;
}

#dice-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 25px;
}

.die {
    width: 65px;
    height: 65px;
    margin: 8px;
    border-radius: 5px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.3s ease;
}

.die:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

#result {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2a7575;
    margin-top: 20px;
}

/* Media Queries for Responsiveness */
@media (max-width: 500px) {
    .container {
        padding: 15px;
        margin: 0 15px;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    #controls {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        /* Explicit rows for vertical stacking */
        gap: 10px;
        margin-bottom: 20px;
        align-items: center;
    }

    #controls>label[for="dice-type"] {
        grid-row: 3;
    }

    #controls>select#dice-type {
        grid-row: 4;
    }

    #roll-button {
        grid-row: 5;
        grid-column: 1;
        padding: 8px 15px;
        font-size: 1rem;
        width: auto;
        justify-self: center;
    }

    .die {
        width: 55px;
        height: 55px;
        margin: 5px;
    }

    #result {
        font-size: 1.2rem;
        margin-top: 15px;
    }

    label {
        text-align: center;
    }

    input[type="number"],
    select {
        width: auto;
    }

    #controls>input,
    #controls>select {
        margin: 0 auto;
    }

    #controls>label {
        justify-self: center;
    }
}