/* Timing Mini-Game Styles */
.timing-minigame-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.timing-minigame-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid rgba(255, 215, 0, 0.6);
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.minigame-header {
    text-align: center;
    margin-bottom: 25px;
}

.minigame-title {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    color: rgba(255, 215, 0, 0.9);
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.minigame-element-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.minigame-element-display img {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.minigame-element-display span {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.minigame-instructions {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    font-size: 14px;
}

/* Timing Bar Container */
.timing-bar-container {
    position: relative;
    height: 60px;
    margin: 30px 0;
    border-radius: 30px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Gradient Background */
.timing-bar-gradient {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, 
        #ff0000 0%, 
        #ff3300 10%, 
        #ff6600 20%, 
        #ff9900 30%, 
        #ffcc00 40%, 
        #00ff00 50%, 
        #ffcc00 60%, 
        #ff9900 70%, 
        #ff6600 80%, 
        #ff3300 90%, 
        #ff0000 100%);
}

/* Dynamic gradient zones - matching the 32-42%, 45-55%, 58-68% zones */
.timing-bar-gradient.zone-left {
    background: linear-gradient(to right, 
        #ff0000 0%, 
        #ff6600 20%, 
        #ffcc00 30%, 
        #00ff00 32%, 
        #00ff00 42%, 
        #ffcc00 44%, 
        #ff9900 55%, 
        #ff6600 75%, 
        #ff0000 100%);
}

.timing-bar-gradient.zone-center {
    background: linear-gradient(to right, 
        #ff0000 0%, 
        #ff6600 25%, 
        #ff9900 40%, 
        #ffcc00 44%, 
        #00ff00 45%, 
        #00ff00 55%, 
        #ffcc00 56%, 
        #ff9900 60%, 
        #ff6600 75%, 
        #ff0000 100%);
}

.timing-bar-gradient.zone-right {
    background: linear-gradient(to right, 
        #ff0000 0%, 
        #ff6600 25%, 
        #ff9900 45%, 
        #ffcc00 56%, 
        #00ff00 58%, 
        #00ff00 68%, 
        #ffcc00 70%, 
        #ff6600 80%, 
        #ff0000 100%);
}

/* Truly random zone using CSS variables */
.timing-bar-gradient.zone-random {
    --green-start: 45%;
    --green-end: 55%;
    --yellow-buffer: 2%;
    background: linear-gradient(to right,
        #ff0000 0%,
        #ff3300 calc(var(--green-start) - 15%),
        #ff6600 calc(var(--green-start) - 10%),
        #ff9900 calc(var(--green-start) - 5%),
        #ffcc00 calc(var(--green-start) - var(--yellow-buffer)),
        #00ff00 var(--green-start),
        #00ff00 var(--green-end),
        #ffcc00 calc(var(--green-end) + var(--yellow-buffer)),
        #ff9900 calc(var(--green-end) + 5%),
        #ff6600 calc(var(--green-end) + 10%),
        #ff3300 calc(var(--green-end) + 15%),
        #ff0000 100%);
}

/* Moving Arrow */
.timing-arrow {
    position: absolute;
    top: -10px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid white;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
    transform: translateX(-15px);
    z-index: 10;
}

.timing-arrow.moving {
    animation: moveArrow linear infinite;
}

@keyframes moveArrow {
    0% {
        left: 0%;
    }
    100% {
        left: 100%;
    }
}

/* Result Indicator */
.timing-result-line {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.timing-result-line.show {
    opacity: 1;
}

/* Click Button */
.timing-click-button {
    display: block;
    width: 200px;
    margin: 20px auto;
    padding: 15px 30px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.8), rgba(255, 140, 0, 0.8));
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.timing-click-button:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 1), rgba(255, 140, 0, 1));
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.timing-click-button:active {
    transform: scale(0.95);
}

.timing-click-button:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: scale(1);
}

/* Result Display */
.timing-result {
    text-align: center;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.5s;
}

.timing-result.show {
    opacity: 1;
}

.timing-stars {
    font-size: 36px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
}

.timing-message {
    font-size: 18px;
    color: white;
    font-weight: bold;
    margin-bottom: 5px;
}

.timing-accuracy {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

/* Continue Button - Hidden since we auto-close */
.timing-continue-btn {
    display: none !important;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .timing-minigame-modal {
        padding: 15px;
        width: 95%;
        max-width: 95vw;
        margin: 10px;
    }
    
    .minigame-title {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .minigame-element-display {
        gap: 10px;
        margin: 10px 0;
    }
    
    .minigame-element-display img {
        width: 40px;
        height: 40px;
    }
    
    .minigame-element-display span {
        font-size: 16px;
    }
    
    .minigame-instructions {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .timing-bar-container {
        height: 45px;
        margin: 20px 0;
    }
    
    .timing-arrow {
        top: -8px;
        border-left-width: 10px;
        border-right-width: 10px;
        border-top-width: 18px;
        transform: translateX(-10px);
    }
    
    .timing-click-button {
        width: 150px;
        padding: 12px 20px;
        font-size: 16px;
        margin: 15px auto;
    }
    
    .timing-stars {
        font-size: 30px;
    }
    
    .timing-message {
        font-size: 16px;
    }
    
    .timing-accuracy {
        font-size: 13px;
    }
    
    .timing-continue-btn {
        padding: 10px 25px;
        font-size: 15px;
        margin: 15px auto;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .timing-minigame-modal {
        padding: 12px;
    }
    
    .minigame-title {
        font-size: 16px;
    }
    
    .timing-bar-container {
        height: 40px;
        margin: 15px 0;
    }
    
    .timing-click-button {
        width: 140px;
        font-size: 15px;
    }
}