/* kans: alleen systeemfonts, geen externe bronnen. */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f7f5f0;
}

.kans {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 32rem;
    margin: 0 auto;
    padding: 2rem 1rem;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.2;
}

.dobbelstenen {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 100%;
}

.dobbelsteen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dobbelsteen__pips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0.5rem;
    width: 8rem;
    height: 8rem;
    padding: 1rem;
    background: #ffffff;
    border: 3px solid #1a1a1a;
    border-radius: 1rem;
}

.pip {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #1a1a1a;
    visibility: hidden;
}

[data-waarde="1"] .pip:nth-child(5),
[data-waarde="2"] .pip:nth-child(1),
[data-waarde="2"] .pip:nth-child(9),
[data-waarde="3"] .pip:nth-child(1),
[data-waarde="3"] .pip:nth-child(5),
[data-waarde="3"] .pip:nth-child(9),
[data-waarde="4"] .pip:nth-child(1),
[data-waarde="4"] .pip:nth-child(3),
[data-waarde="4"] .pip:nth-child(7),
[data-waarde="4"] .pip:nth-child(9),
[data-waarde="5"] .pip:nth-child(1),
[data-waarde="5"] .pip:nth-child(3),
[data-waarde="5"] .pip:nth-child(5),
[data-waarde="5"] .pip:nth-child(7),
[data-waarde="5"] .pip:nth-child(9),
[data-waarde="6"] .pip:nth-child(1),
[data-waarde="6"] .pip:nth-child(3),
[data-waarde="6"] .pip:nth-child(4),
[data-waarde="6"] .pip:nth-child(6),
[data-waarde="6"] .pip:nth-child(7),
[data-waarde="6"] .pip:nth-child(9) {
    visibility: visible;
}

.dobbelsteen__waarde {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Bij meer stenen kleiner, zodat er drie naast elkaar passen vanaf 320 px. */
.dobbelstenen--meer .dobbelsteen__pips {
    gap: 0.3rem;
    width: 5rem;
    height: 5rem;
    padding: 0.6rem;
    border-radius: 0.75rem;
}

.dobbelstenen--meer .dobbelsteen__waarde {
    font-size: 1.25rem;
}

.totaal {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.totaal[hidden] {
    display: none;
}

.aantal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.aantal label {
    font-size: 1.125rem;
    font-weight: 600;
}

.aantal select {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    font-size: 1.125rem;
    color: #1a1a1a;
    background: #ffffff;
    border: 2px solid #1a1a1a;
    border-radius: 0.5rem;
    cursor: pointer;
}

.aantal select:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 3px;
}

.gooi-knop {
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem 2rem;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    background: #0b5394;
    border: 2px solid #0b5394;
    border-radius: 0.5rem;
    cursor: pointer;
}

.gooi-knop:hover {
    background: #083d6e;
    border-color: #083d6e;
}

.gooi-knop:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 3px;
}

.uitkomst {
    min-height: 1.5em;
    margin: 0;
    font-size: 1.125rem;
}

.melding {
    margin: 0;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 2px solid #1a1a1a;
    border-radius: 0.5rem;
}

.dobbelsteen--rol .dobbelsteen__pips {
    animation: rol 0.4s ease-out;
}

@keyframes rol {
    from {
        transform: rotate(-90deg) scale(0.9);
    }

    to {
        transform: rotate(0) scale(1);
    }
}

@media (min-width: 40em) {
    h1 {
        font-size: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dobbelsteen--rol .dobbelsteen__pips {
        animation: none;
    }
}
