/* Spin Wheel Styles */
.spinwheel-container {
    text-align: center;
    padding: 20px;
    max-width: 100%;
    overflow-x: hidden;
}

.wheel-container {
    position: relative;
    display: inline-block;
    margin: 20px 0;
    max-width: 100%;
}

.spin-wheel {
    width: min(400px, 90vw);
    height: min(400px, 90vw);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 8px solid #333;
    margin: 0 auto;
    transition: transform 4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
}

#canvas {
    width: min(400px, 90vw) !important;
    height: min(400px, 90vw) !important;
    max-width: 100%;
}

.spin-wheel.winner {
    animation: winner-glow 2s infinite;
    box-shadow: 0 0 50px rgba(255,215,0,0.8);
}

@keyframes winner-glow {
    0% { box-shadow: 0 0 30px rgba(255,215,0,0.5); }
    50% { box-shadow: 0 0 60px rgba(255,215,0,1); }
    100% { box-shadow: 0 0 30px rgba(255,215,0,0.5); }
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    font-weight: bold;
    font-size: 16px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    text-align: center;
    line-height: 1.2;
    padding: 40px 0 0 40px;
}

.wheel-segment span {
    display: block;
    text-align: center;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(0,0,0,0.7);
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid white;
    min-width: 200px;
}

.wheel-segment:nth-child(1) { background: #ff6b6b; transform: rotate(0deg); }
.wheel-segment:nth-child(2) { background: #4ecdc4; transform: rotate(60deg); }
.wheel-segment:nth-child(3) { background: #45b7d1; transform: rotate(120deg); }
.wheel-segment:nth-child(4) { background: #96ceb4; transform: rotate(180deg); }
.wheel-segment:nth-child(5) { background: #feca57; transform: rotate(240deg); }
.wheel-segment:nth-child(6) { background: #ff9ff3; transform: rotate(300deg); }

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #333;
    z-index: 10;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #333;
    border-radius: 50%;
    z-index: 5;
}

.spin-btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: block;
    margin: 0 auto;
    text-align: center;
    width: fit-content;
    min-width: 200px;
    max-width: 90%;
}

@media (max-width: 768px) {
    .spin-btn {
        padding: 12px 20px;
        font-size: 16px;
        min-width: 150px;
    }
}

.spin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.sound-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sound-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    margin: 5px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    min-width: 120px;
    text-align: center;
}

@media (max-width: 768px) {
    .sound-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .sound-btn {
        min-width: 100px;
        font-size: 11px;
        padding: 6px 12px;
    }
}

.sound-btn.active {
    background: #28a745;
}

/* Enhanced Confetti Animation */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    font-size: 20px;
    animation: confetti-fall linear forwards;
}

.confetti-star {
    color: #ffd700;
    animation: star-twinkle 0.5s infinite alternate, confetti-fall linear forwards;
}

.confetti-heart {
    color: #ff69b4;
    animation: heart-pulse 0.8s infinite, confetti-fall linear forwards;
}

.confetti-diamond {
    color: #00ffff;
    animation: diamond-shine 0.6s infinite, confetti-fall linear forwards;
}

.confetti-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: circle-bounce 0.7s infinite, confetti-fall linear forwards;
}

.confetti-square {
    width: 10px;
    height: 10px;
    animation: square-rotate 1s infinite linear, confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
        transform: translateY(50vh) rotate(360deg) scale(1.2);
    }
    100% {
        transform: translateY(120vh) rotate(720deg) scale(0.8);
        opacity: 0;
    }
}

@keyframes star-twinkle {
    0% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    100% { transform: scale(1.3) rotate(180deg); opacity: 1; }
}

@keyframes heart-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes diamond-shine {
    0% { transform: rotate(0deg) scale(1); filter: brightness(1); }
    50% { transform: rotate(180deg) scale(1.1); filter: brightness(1.5); }
    100% { transform: rotate(360deg) scale(1); filter: brightness(1); }
}

@keyframes circle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes square-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fireworks Effect */
.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: firework-explode 1s ease-out forwards;
}

@keyframes firework-explode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Winner Glow Effect */
.winner-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.8) 0%, rgba(255,215,0,0.4) 50%, transparent 100%);
    animation: glow-pulse 2s infinite;
    z-index: 999;
    pointer-events: none;
}

@keyframes glow-pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
}

/* Spinning Animation */
.spinning {
    animation: spin-wheel 6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes spin-wheel {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(var(--final-rotation, 1800deg)); }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .spinwheel-container {
        padding: 10px;
    }
    
    .spinwheel-title {
        font-size: 1.5rem !important;
    }
    
    .spinwheel-subtitle {
        font-size: 0.9rem !important;
    }
    
    .wheel-container {
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .spinwheel-container {
        padding: 5px;
    }
    
    .spin-wheel {
        width: min(300px, 85vw);
        height: min(300px, 85vw);
        border-width: 6px;
    }
    
    #canvas {
        width: min(300px, 85vw) !important;
        height: min(300px, 85vw) !important;
    }
    
    .spinwheel-title {
        font-size: 1.3rem !important;
    }
    
    .spinwheel-subtitle {
        font-size: 0.8rem !important;
    }
}