/* ===== DICE — Royale Violet ===== */
#game-dice {
    --rv-gold: #f5c451;
    --rv-gold-bright: #ffd76a;
    --rv-gold-deep: #b9822a;
    --rv-violet: #8b5cf6;
    --rv-emerald: #22c55e;
    --rv-red: #ef4444;
    --rv-text: #f5f0ff;
    --rv-text2: #a79fc2;
    --rv-text3: #6f6794;
    font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--rv-text);
}
#game-dice .game-body { flex-shrink: 0; }

/* ---------- title (core injects .gh-bar above this for non-self-contained games) ---------- */
.rv-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 4px 0 10px;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -0.01em;
    color: var(--rv-text);
}
.rv-title-icon3d {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 14px rgba(139, 92, 246, 0.35);
}

/* ---------- stage ---------- */
.rv-stage {
    --acc: #8b5cf6;
    position: relative;
    border-radius: 20px;
    padding: 16px 12px 14px;
    background:
        radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--acc) 16%, transparent), transparent 60%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(245, 196, 81, 0.22);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

/* ---- real 3D percentile dice (two 10-face drums) ----
 * Mechanics identical to v1: faces rotateX(i·36°) translateZ(~105px);
 * the scene is an overflow-hidden rounded window so faces never spill.
 */
.dice-3d-stage {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 6px 0 2px;
}
.dice-3d-unit { display: flex; flex-direction: column; align-items: center; }
.dice-3d-scene {
    position: relative;
    width: 84px;
    height: 92px;
    perspective: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px;
    background: radial-gradient(ellipse at 50% 42%, #241243 0%, #0a0616 75%);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.25), inset 0 10px 18px rgba(0, 0, 0, 0.55), inset 0 -10px 18px rgba(0, 0, 0, 0.55);
}
/* curved-window shading: neighbours fade into darkness at top/bottom */
.dice-3d-scene::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(6, 3, 14, 0.72) 0%, transparent 26%, transparent 74%, rgba(6, 3, 14, 0.72) 100%);
}
.dice-3d-drum {
    position: relative;
    width: 68px;
    height: 68px;
    transform-style: preserve-3d;
    transition: transform 1.15s cubic-bezier(0.12, 0.8, 0.16, 1);
}
.dice-3d-drum.slow { transition-duration: 1.35s; }
.dice-3d-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    backface-visibility: hidden;
}
/* tens drum: royal violet */
#dice-drum-tens .dice-3d-face {
    font-size: 1.45rem;
    background: linear-gradient(145deg, #a78bfa 0%, #7c3aed 55%, #4c1d95 100%);
    border: 1px solid rgba(196, 181, 253, 0.55);
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.45), inset 0 -6px 10px rgba(0, 0, 0, 0.35);
}
/* ones drum: casino gold */
#dice-drum-ones .dice-3d-face {
    font-size: 2rem;
    background: linear-gradient(145deg, #ffd76a 0%, #e8a91c 55%, #b9822a 100%);
    border: 1px solid rgba(255, 233, 168, 0.6);
    color: #2a1a00;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.5), inset 0 -6px 10px rgba(0, 0, 0, 0.25);
}
.dice-3d-shadow {
    width: 62px;
    height: 10px;
    margin-top: 8px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55), transparent 70%);
}
.dice-3d-stage.rolling .dice-3d-unit { animation: dice-wobble 0.28s ease-in-out infinite alternate; }
.dice-3d-stage.rolling .dice-3d-unit:last-child { animation-delay: 0.09s; }
@keyframes dice-wobble {
    from { transform: translateY(0) rotate(-1.6deg); }
    to   { transform: translateY(-5px) rotate(1.6deg); }
}
.dice-3d-stage.rolling .dice-3d-shadow { animation: dice-shadow-pulse 0.28s ease-in-out infinite alternate; }
@keyframes dice-shadow-pulse {
    from { transform: scaleX(1); opacity: 0.9; }
    to   { transform: scaleX(0.82); opacity: 0.6; }
}

.dice-roll-value {
    margin-top: 10px;
    font-size: 1.9rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--rv-gold-bright);
    text-shadow: 0 0 18px rgba(245, 196, 81, 0.35);
    text-align: center;
}
.dice-chance {
    margin-top: 8px;
    color: var(--rv-text2);
    font-size: 0.85rem;
    text-align: center;
}
.dice-chance span { color: var(--rv-text); font-weight: 800; }

/* ---------- slider ---------- */
.dice-slider-container { width: 100%; margin-top: 14px; padding: 0 4px; }
.dice-slider {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #22c55e, #8b5cf6, #ef4444);
    border-radius: 6px;
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.dice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffe9a8, #f5c451);
    border: 2px solid #fff8;
    box-shadow: 0 4px 12px rgba(245, 196, 81, 0.5);
    cursor: pointer;
}
.dice-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffe9a8, #f5c451);
    border: 2px solid #fff8;
    box-shadow: 0 4px 12px rgba(245, 196, 81, 0.5);
    cursor: pointer;
}
.dice-target-display { text-align: center; margin-top: 8px; }
.dice-target-display span {
    font-size: 1.1rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #ffe9a8, #f5c451 55%, #c98f1f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .dice-3d-stage.rolling .dice-3d-unit,
    .dice-3d-stage.rolling .dice-3d-shadow { animation: none; }
}
