* {
    box-sizing: border-box;
}

body {
    font-family: Karla, sans-serif;
    margin: 0;
    padding: 10px;
    background-color: #0B2434;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

div#root {
    height: 50vh;
    width: 90vw;
    max-height: 600px;
    max-width: 500px;
    min-height: 400px;
    min-width: 300px;
}

main {
    background-color: #F5F5F5;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    gap: 30px;
    box-sizing: border-box;
    flex: 1;
}

.title {
    font-size: 3rem;
    margin: 0;
    text-align: center;
}

.instructions {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
    line-height: 1.4;
}

.dice-container {
    display: grid;
    grid-template: auto auto / repeat(5, 1fr);
    gap: 20px;
    margin: 0;
}

button {
    font-family: Karla, sans-serif;
    cursor: pointer;
}

.dice-container button {
    height: 12vw;
    width: 12vw;
    max-height: 60px;
    max-width: 60px;
    min-height: 45px;
    min-width: 45px;
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    border: none;
    background-color: white;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: bold;
    transition: transform 0.1s ease;
}

.dice-container button:hover {
    transform: scale(1.05);
}

.dice-container button:active {
    transform: scale(0.95);
}

button.roll-dice {
    height: 60px;
    white-space: nowrap;
    width: auto;
    min-width: 120px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background-color: #5035FF;
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 30px 0;
}

button.roll-dice:hover {
    background-color: #3d2bcc;
    transform: translateY(-2px);
}

button.roll-dice:active {
    transform: translateY(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mobile optimizations with proper viewport */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    div#root {
        height: 60vh;
        width: 95vw;
        min-height: 450px;
    }
    
    main {
        padding: 20px;
        gap: 20px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .instructions {
        font-size: 1rem;
    }
    
    .dice-container {
        gap: 15px;
    }
    
    button.roll-dice {
        height: 65px;
        font-size: 1.4rem;
        padding: 15px 25px;
        min-width: 140px;
        margin: 20px 0;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    div#root {
        width: 98vw;
        min-height: 420px;
    }
    
    main {
        padding: 15px;
        gap: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .instructions {
        font-size: 0.9rem;
    }
    
    .dice-container {
        gap: 12px;
    }
    
    button.roll-dice {
        height: 60px;
        font-size: 1.2rem;
        padding: 12px 20px;
        min-width: 120px;
    }
}

/* Landscape phones */
@media (max-height: 600px) and (orientation: landscape) {
    div#root {
        height: 80vh;
        min-height: 350px;
    }
    
    main {
        gap: 15px;
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .instructions {
        font-size: 0.9rem;
        margin: 5px 0;
    }
}