/*
 * style.css
 * Marko T / Khaida
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --background-color: #e5e5f7; /* Very light background */
    --accent-color: #4a4e69;     /* Dark grey for text/accents */
    --glass-bg: rgba(255, 255, 255, 0.2); /* Semi-transparent white */
    --glass-border: rgba(255, 255, 255, 0.4); /* Lighter border */
    --button-bg: #4a4e69;      /* Dark grey button */
    --button-hover: #2c3143;   /* Darker grey on hover */
    --dice-color: #ffffff;     /* White dice face */
    --dice-dot-color: #2c3143; /* Dark dots */
    --result-highlight: #7b2cbf; /* Subtle purple highlight */

    /* Fontit */
    --font-primary: 'Inter', sans-serif;
}

body {
    background-color: var(--background-color);
    background-image: radial-gradient(#4a4e69 0.5px, var(--background-color) 0.5px);
    background-size: 10px 10px;
    color: var(--accent-color);
    font-family: var(--font-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.app-container {
    /* GLASSMORPHISM TYYLIT */
    background: var(--glass-bg);
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2), 0 0 0 1px var(--glass-border);
    text-align: center;
    max-width: 480px;
    width: 100%;
    transition: transform 0.3s ease-out;
}

h1 {
    color: var(--accent-color);
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* Nopan tyylit */
.dice-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    perspective: 800px;
}

.dice {
    --dice-size: 90px;
    width: var(--dice-size);
    height: var(--dice-size);
    background-color: var(--dice-color);
    border-radius: 12px;
    display: grid;
    padding: 10px;
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.1), 
        0 5px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.1s ease-out; 
    position: relative;
}

/* Animaatio */
.dice.rolling {
    animation: simpleRoll 0.4s ease-out forwards;
}

@keyframes simpleRoll {
    0% {
        transform: rotateX(0deg) rotateY(0deg) translateZ(0);
    }
    50% {
        transform: rotateX(360deg) rotateY(360deg) translateZ(10px);
    }
    100% {
        transform: rotateX(0deg) rotateY(0deg) translateZ(0);
    }
}

/* Dot Styles */
.dot {
    width: 16px;
    height: 16px;
    background-color: var(--dice-dot-color);
    border-radius: 50%;
    align-self: center;
    justify-self: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Grid layout (samana kuin aiemmin) */
.dice[data-value="1"] { grid-template-areas: ". center ."; }
.dice[data-value="2"] { grid-template-areas: "a . ." ". . ." ". . b"; }
.dice[data-value="3"] { grid-template-areas: "a . ." ". center ." ". . b"; }
.dice[data-value="4"] { grid-template-areas: "a . b" ". . ." "c . d"; }
.dice[data-value="5"] { grid-template-areas: "a . b" ". center ." "c . d"; }
.dice[data-value="6"] { grid-template-areas: "a . b" "c . d" "e . f"; }

.dice[data-value]:not([data-value="1"]) {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}
.dice[data-value="1"] .dot:nth-child(1) { grid-area: center; }
.dice[data-value="2"] .dot:nth-child(1) { grid-area: a; }
.dice[data-value="2"] .dot:nth-child(2) { grid-area: b; }
.dice[data-value="3"] .dot:nth-child(1) { grid-area: a; }
.dice[data-value="3"] .dot:nth-child(2) { grid-area: center; }
.dice[data-value="3"] .dot:nth-child(3) { grid-area: b; }
.dice[data-value="4"] .dot:nth-child(1) { grid-area: a; }
.dice[data-value="4"] .dot:nth-child(2) { grid-area: b; }
.dice[data-value="4"] .dot:nth-child(3) { grid-area: c; }
.dice[data-value="4"] .dot:nth-child(4) { grid-area: d; }
.dice[data-value="5"] .dot:nth-child(1) { grid-area: a; }
.dice[data-value="5"] .dot:nth-child(2) { grid-area: b; }
.dice[data-value="5"] .dot:nth-child(3) { grid-area: center; }
.dice[data-value="5"] .dot:nth-child(4) { grid-area: c; }
.dice[data-value="5"] .dot:nth-child(5) { grid-area: d; }
.dice[data-value="6"] .dot:nth-child(1) { grid-area: a; }
.dice[data-value="6"] .dot:nth-child(2) { grid-area: b; }
.dice[data-value="6"] .dot:nth-child(3) { grid-area: c; }
.dice[data-value="6"] .dot:nth-child(4) { grid-area: d; }
.dice[data-value="6"] .dot:nth-child(5) { grid-area: e; }
.dice[data-value="6"] .dot:nth-child(6) { grid-area: f; }


/* Nappien tyylit */
#roll-button {
    background-color: var(--button-bg);
    color: var(--dice-color);
    border: none;
    padding: 15px 35px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#roll-button:hover {
    background-color: var(--button-hover);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

#roll-button:active {
    transform: scale(0.98);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#roll-button:disabled {
    background-color: var(--button-bg);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Tulosten tyylit */
.results-area {
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

#current-result-text {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--accent-color);
}

#current-total {
    font-size: 1.8em;
    color: var(--result-highlight); 
}

.previous-result {
    margin-top: 10px;
    font-size: 1em;
    color: var(--accent-color);
    opacity: 0.7;
}
/* UUDEN LUPAPAINKKEEN TYYLIT */
#permission-container {
    margin-bottom: 20px;
    display: none; 
}

#permission-button {
    background-color: var(--result-highlight); 
    color: var(--dice-color);
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

#permission-button:hover {
    background-color: #6a24aa; 
}