* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: #0f172a;
    color: white;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 0, 120, .25), transparent 30%),
        radial-gradient(circle at 80% 15%, rgba(0, 200, 255, .25), transparent 30%),
        radial-gradient(circle at 50% 90%, rgba(255, 220, 0, .22), transparent 30%),
        linear-gradient(135deg, #020617, #111827);
    animation: bgMove 10s infinite alternate;
}

@keyframes bgMove {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(80deg); }
}

.app {
    width: min(540px, 92%);
    padding: 35px;
    border-radius: 32px;
    text-align: center;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(16px);
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

h1 {
    font-size: clamp(2.3rem, 7vw, 4rem);
    margin-bottom: 10px;
}

.subtitle {
    color: #cbd5e1;
    font-weight: 700;
    margin-bottom: 28px;
}

.dice {
    width: 170px;
    height: 170px;
    margin: 0 auto 25px;
    border-radius: 32px;
    background: white;
    color: #111827;
    display: grid;
    place-items: center;
    font-size: 5rem;
    font-weight: 900;
    box-shadow:
        0 18px 0 #cbd5e1,
        0 35px 55px rgba(0,0,0,.35);
    transition: .25s;
}

.dice.rolling {
    animation: roll .65s ease;
}

@keyframes roll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(18deg) scale(1.08); }
    50% { transform: rotate(-18deg) scale(.95); }
    75% { transform: rotate(12deg) scale(1.06); }
    100% { transform: rotate(0deg) scale(1); }
}

button {
    border: none;
    border-radius: 999px;
    padding: 15px 24px;
    background: linear-gradient(135deg, #f97316, #ec4899, #8b5cf6);
    color: white;
    font-weight: 900;
    cursor: pointer;
    font-size: 1rem;
    transition: .2s;
}

button:hover {
    transform: translateY(-4px) scale(1.04);
}

.result {
    margin-top: 25px;
    padding: 22px;
    border-radius: 22px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
}

.result h2 {
    margin-bottom: 8px;
    color: #fde047;
}

.result p {
    color: #e5e7eb;
    font-size: 1.2rem;
    font-weight: 900;
}

.meter {
    margin-top: 22px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    overflow: hidden;
}

#bar {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
    transition: width .8s ease;
}

.reset {
    margin-top: 20px;
    background: #334155;
}

.particle {
    position: fixed;
    pointer-events: none;
    z-index: 20;
    font-size: 1.6rem;
    animation: pop .9s ease-out forwards;
}

@keyframes pop {
    from {
        transform: translate(0,0) scale(.2);
        opacity: 1;
    }
    to {
        transform: translate(var(--x), var(--y)) scale(1.7);
        opacity: 0;
    }
}
