﻿

/****************/

:root {
    font-family: system-ui, sans-serif;
    background: #f3f4f6;
    /* Dice theme variables */
    --die-size: 64px;
    --die-round: 14px;
    --die-border: #111;
    --pip-size: 14px;
    /* Animation */
    --roll-duration: 1s; /* longer spin */
}

body {
    margin: 0;
    /*display: flex;*/
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    /*padding: 2rem 1rem 4rem;*/
}

h2 {
    margin: 0 0 0.5rem;
}

section {
    width: min(420px, 100%);
    background: #fff;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

input[type="number"] {
    width: 4rem;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
}

input[type="color"] {
    border: none;
    background: none;
}

button {
    align-self: flex-start;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    cursor: pointer;
    transition: background .2s;
}

    button:hover {
        background: #1f2937;
    }

.dice-area {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: var(--die-size);
}

/* Die visuals */
.die {
    position: relative;
    width: var(--die-size);
    height: var(--die-size);
    border-radius: var(--die-round);
    background: var(--die-bg,#fefefe);
    border: 2px solid var(--die-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,.25);
    transform-style: preserve-3d;
    perspective: 600px;
}

    .die.rolling {
        animation: spin var(--roll-duration) cubic-bezier(.25,.5,.35,1) forwards;
    }

@keyframes spin {
    0% {
        transform: rotateX(0) rotateY(0) rotateZ(0);
    }

    50% {
        transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
    }

    100% {
        transform: rotateX(720deg) rotateY(720deg) rotateZ(720deg);
    }
}

/* Pips (conventional dice) */
.pip {
    position: absolute;
    width: var(--pip-size);
    height: var(--pip-size);
    border-radius: 50%;
    background: #000;
}

    .pip.pos1 {
        top: 8px;
        left: 8px;
    }

    .pip.pos2 {
        top: 8px;
        right: 8px;
    }

    .pip.pos3 {
        top: calc(50% - var(--pip-size)/2);
        left: calc(50% - var(--pip-size)/2);
    }

    .pip.pos4 {
        bottom: 8px;
        left: 8px;
    }

    .pip.pos5 {
        bottom: 8px;
        right: 8px;
    }

    .pip.pos6 {
        top: 8px;
        left: calc(50% - var(--pip-size)/2);
    }

    .pip.pos7 {
        bottom: 8px;
        left: calc(50% - var(--pip-size)/2);
    }
