/* Fortune Dice - App-Specific Styles */

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

body {
    overflow: hidden;
    font-family: Impact, "Arial Black", sans-serif;
    background: #fafafa;
    margin: 0;
    padding: 0;
}

/* ==================== DICE-SPECIFIC LAYOUT ==================== */
.dice-container {
    display: flex;
    gap: 30px;
    margin: 0;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.bottom-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: clamp(120px, 20vh, 180px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fafafa;
    padding: clamp(10px, 2vh, 20px);
    box-sizing: border-box;
}

.roll-button {
    margin-bottom: 15px;
}

.share-button {
    display: none;
}

.share-button.show {
    display: flex;
}

/* ==================== DICE STYLING ==================== */
.dice {
    width: 100px;
    height: 100px;
    background: white;
    border: 3px solid #fd243d;
    border-radius: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(253, 36, 61, 0.2);
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.dice:hover {
    transform: translateY(-5px) rotateX(-5deg) rotateY(5deg);
    box-shadow: 0 8px 25px rgba(253, 36, 61, 0.3);
}

.dice:active {
    transform: scale(0.95);
}

.dice.rolling {
    animation: cuteDiceRoll 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dice.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

.dice.shaking {
    animation: cuteShake 0.4s ease-in-out;
}

.dice.landed {
    animation: cuteGlow 0.6s ease-out;
}

/* ==================== DICE DOTS ==================== */
.dot {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ff6b7a 0%, #fd243d 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s, transform 0.3s ease;
    margin: auto;
    box-shadow: 0 2px 4px rgba(253, 36, 61, 0.3);
}

.dot.active {
    opacity: 1;
    animation: dotPulse 2s infinite ease-in-out;
}

.dot.active:nth-child(odd) {
    animation-delay: 0.3s;
}

.dot.active:nth-child(even) {
    animation-delay: 0.6s;
}

/* ==================== FORTUNE DISPLAY ==================== */
.fortune-display {
    background: transparent;
    border: none;
    padding: clamp(10px, 2vh, 15px);
    max-width: 90vw;
    width: 100%;
    text-align: center;
    opacity: 0;
    transition: all 0.5s ease;
    position: fixed;
    top: 52%;
    left: 50%;
    transform: translate(-50%, 20px);
    max-height: 30vh;
    overflow-y: auto;
}

.fortune-display.show {
    opacity: 1;
    transform: translate(-50%, 0);
}


.dice-sum {
    font-size: clamp(18px, 4.5vw, 28px);
    color: #fd243d;
    font-weight: bold;
    margin-bottom: clamp(8px, 2vh, 12px);
    font-family: Georgia, serif;
    white-space: pre-line;
    line-height: 1.5;
}

/* ==================== INSTRUCTIONS ==================== */
.instructions {
    color: #fd243d;
    text-align: center;
    margin: 20px 0;
    font-size: clamp(12px, 2.5vw, 16px);
    font-family: Georgia, serif;
}

/* ==================== SPARKLE EFFECTS ==================== */
.sparkle {
    position: absolute;
    pointer-events: none;
    animation: floatUp 1.2s ease-out forwards;
    font-size: 20px;
    z-index: 1000;
}

.heart-particle {
    color: #fd243d;
    animation: heartFloat 1.5s ease-out forwards;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cuteDiceRoll {
    0% { transform: translateY(0) rotate(0deg) scale(1, 1); }
    5% { transform: translateY(-5px) rotate(-5deg) scale(1.1, 0.9); }
    10% { transform: translateY(-20px) rotate(-10deg) scale(0.9, 1.1); }
    15% { transform: translateY(-80px) rotate(180deg) scale(1.2, 0.8); }
    20% { transform: translateY(-120px) rotate(270deg) scale(0.8, 1.2); }
    25% { transform: translateY(-140px) rotate(360deg) scale(1.15, 0.85); }
    30% { transform: translateY(-150px) rotate(450deg) scale(0.85, 1.15); }
    35% { transform: translateY(-140px) rotate(540deg) scale(1.1, 0.9); }
    40% { transform: translateY(-100px) rotate(630deg) scale(0.9, 1.1); }
    45% { transform: translateY(-50px) rotate(720deg) scale(1.05, 0.95); }
    50% { transform: translateY(-20px) rotate(810deg) scale(0.95, 1.05); }
    55% { transform: translateY(0) rotate(900deg) scale(1.2, 0.8); }
    60% { transform: translateY(-15px) rotate(990deg) scale(0.8, 1.2); }
    65% { transform: translateY(0) rotate(1080deg) scale(1.1, 0.9); }
    70% { transform: translateY(-8px) rotate(1080deg) scale(0.9, 1.1); }
    75% { transform: translateY(0) rotate(1080deg) scale(1.15, 0.85); }
    80% { transform: translateY(-4px) rotate(1080deg) scale(0.85, 1.15); }
    85% { transform: translateY(0) rotate(1080deg) scale(1.05, 0.95); }
    90% { transform: translateY(-2px) rotate(1080deg) scale(0.95, 1.05); }
    95% { transform: translateY(0) rotate(1080deg) scale(1.02, 0.98); }
    100% { transform: translateY(0) rotate(1080deg) scale(1, 1); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-8deg) scale(1.05); }
    20% { transform: rotate(8deg) scale(0.95); }
    30% { transform: rotate(-8deg) scale(1.05); }
    40% { transform: rotate(8deg) scale(0.95); }
    50% { transform: rotate(-4deg) scale(1.02); }
    60% { transform: rotate(4deg) scale(0.98); }
    70% { transform: rotate(-4deg) scale(1.02); }
    80% { transform: rotate(4deg) scale(0.98); }
    90% { transform: rotate(-2deg) scale(1.01); }
}

@keyframes cuteShake {
    0%, 100% { transform: translateX(0) rotate(0deg) scale(1); }
    10% { transform: translateX(-3px) rotate(-5deg) scale(1.05); }
    20% { transform: translateX(3px) rotate(5deg) scale(0.95); }
    30% { transform: translateX(-3px) rotate(-5deg) scale(1.05); }
    40% { transform: translateX(3px) rotate(5deg) scale(0.95); }
    50% { transform: translateX(-2px) rotate(-3deg) scale(1.03); }
    60% { transform: translateX(2px) rotate(3deg) scale(0.97); }
    70% { transform: translateX(-2px) rotate(-3deg) scale(1.03); }
    80% { transform: translateX(2px) rotate(3deg) scale(0.97); }
    90% { transform: translateX(-1px) rotate(-1deg) scale(1.01); }
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(253, 36, 61, 0.3);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 3px 8px rgba(253, 36, 61, 0.5);
    }
}

@keyframes floatUp {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: translate(var(--x), calc(var(--y) * 0.3)) scale(1.2) rotate(180deg);
        opacity: 1;
    }
    40% {
        transform: translate(calc(var(--x) * 1.5), calc(var(--y) * 0.6)) scale(0.8) rotate(360deg);
    }
    100% {
        transform: translate(calc(var(--x) * 2), var(--y)) scale(0) rotate(720deg);
        opacity: 0;
    }
}

@keyframes heartFloat {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: translate(var(--x), calc(var(--y) * 0.3)) scale(1.3) rotate(-20deg);
        opacity: 1;
    }
    40% {
        transform: translate(calc(var(--x) * 1.2), calc(var(--y) * 0.5)) scale(1) rotate(20deg);
    }
    60% {
        transform: translate(calc(var(--x) * 1.5), calc(var(--y) * 0.7)) scale(1.1) rotate(-10deg);
    }
    100% {
        transform: translate(calc(var(--x) * 2), var(--y)) scale(0) rotate(45deg);
        opacity: 0;
    }
}

@keyframes cuteGlow {
    0% {
        box-shadow: 0 5px 15px rgba(253, 36, 61, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 5px 40px rgba(253, 36, 61, 0.6),
                    0 0 60px rgba(255, 192, 203, 0.4),
                    inset 0 0 20px rgba(255, 182, 193, 0.2);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 5px 15px rgba(253, 36, 61, 0.2);
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .dice-container {
        gap: 20px;
        top: 30%;
    }

    .dice {
        width: 90px;
        height: 90px;
        padding: 12px;
    }

    .dot {
        width: 15px;
        height: 15px;
    }

    .fortune-display {
        top: 48%;
        max-height: 25vh;
        padding: clamp(8px, 1.5vh, 12px);
    }

    .dice-sum {
        font-size: clamp(16px, 4vw, 22px);
        margin-bottom: clamp(6px, 1.5vh, 10px);
    }
}
