/**
 * CPS Test Pro - Professional Gaming Effects Engine
 * Ultra-smooth, GPU-accelerated particle effects & animations
 * Optimized for performance on all devices
 */

/* ============================================
   1. CSS Variables & Design Tokens
   ============================================ */
:root {
    /* Premium Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --gradient-secondary: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-accent: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 50%, #FFC371 100%);
    --gradient-neon: linear-gradient(135deg, #00f5d4 0%, #00bbf9 50%, #9b5de5 100%);
    
    /* Glow Colors */
    --glow-primary: rgba(102, 126, 234, 0.6);
    --glow-success: rgba(56, 239, 125, 0.6);
    --glow-accent: rgba(255, 107, 107, 0.6);
    --glow-neon: rgba(0, 245, 212, 0.6);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    /* Animation Timings */
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ============================================
   2. Premium Click Button - 3D Effect
   ============================================ */
.premium-click-btn {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--gradient-primary);
    box-shadow: 
        0 0 0 6px rgba(102, 126, 234, 0.2),
        0 10px 40px rgba(102, 126, 234, 0.4),
        0 20px 60px rgba(118, 75, 162, 0.3),
        inset 0 -8px 20px rgba(0, 0, 0, 0.3),
        inset 0 8px 20px rgba(255, 255, 255, 0.2);
    transition: all 0.15s var(--ease-smooth);
    transform-style: preserve-3d;
    perspective: 1000px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow: visible;
}

.premium-click-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--gradient-neon);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s, transform 0.3s;
    animation: pulseRing 2s ease-in-out infinite;
}

.premium-click-btn::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 30%;
    height: 20%;
    background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
    pointer-events: none;
}

.premium-click-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 0 0 8px rgba(102, 126, 234, 0.3),
        0 15px 50px rgba(102, 126, 234, 0.5),
        0 30px 80px rgba(118, 75, 162, 0.4),
        inset 0 -8px 20px rgba(0, 0, 0, 0.3),
        inset 0 8px 20px rgba(255, 255, 255, 0.2);
}

.premium-click-btn:hover::before {
    opacity: 0.6;
}

.premium-click-btn:active {
    transform: translateY(2px) scale(0.96);
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.4),
        0 5px 20px rgba(102, 126, 234, 0.4),
        inset 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.05s;
}

.premium-click-btn .btn-text {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.premium-click-btn .click-count {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
}

@keyframes pulseRing {
    0%, 100% { transform: scale(1); opacity: 0; }
    50% { transform: scale(1.1); opacity: 0.4; }
}

/* ============================================
   3. Particle System Container
   ============================================ */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* ============================================
   4. Glass Card - Premium UI
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

/* ============================================
   5. CPS Display - Animated Counter
   ============================================ */
.cps-display {
    font-size: 5rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    position: relative;
    display: inline-block;
    transition: transform 0.1s var(--ease-bounce);
}

.cps-display.pulse {
    animation: cpsPulse 0.15s var(--ease-bounce);
}

@keyframes cpsPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ============================================
   6. Progress Bar - Animated Gradient
   ============================================ */
.progress-bar-container {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    position: relative;
    transition: width 0.05s linear;
    box-shadow: 0 0 20px var(--glow-primary);
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   7. Stat Card - Mini Glass
   ============================================ */
.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s var(--ease-smooth);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

/* ============================================
   8. Time Selection Pills - Premium
   ============================================ */
.time-pill {
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.875rem;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

.time-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.time-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.time-pill.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 20px var(--glow-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.time-pill span {
    position: relative;
    z-index: 1;
}

/* ============================================
   9. Result Popup - Celebration Mode
   ============================================ */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-smooth);
}

.result-overlay.show {
    opacity: 1;
    visibility: visible;
}

.result-card {
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 35, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    padding: 2.5rem;
    max-width: 380px;
    width: 90%;
    text-align: center;
    transform: scale(0.8) translateY(30px);
    opacity: 0;
    transition: all 0.4s var(--ease-spring);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.result-overlay.show .result-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.result-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s var(--ease-bounce);
}

.result-score {
    font-size: 4rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.result-rank {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.result-btn {
    padding: 1rem 2rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.result-btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 20px var(--glow-primary);
}

.result-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-primary);
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================================
   10. Click Effects - Ripple & Burst
   ============================================ */
.click-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
    pointer-events: none;
    animation: rippleExpand 0.6s ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        margin-left: -100px;
        margin-top: -100px;
        opacity: 0;
    }
}

/* ============================================
   11. Floating Numbers - Score Feedback
   ============================================ */
.float-number {
    position: absolute;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 100;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.5);
    }
}

/* ============================================
   12. Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .premium-click-btn {
        width: 160px;
        height: 160px;
    }
    
    .cps-display {
        font-size: 3.5rem;
    }
    
    .result-card {
        padding: 1.5rem;
    }
    
    .result-score {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .premium-click-btn {
        width: 140px;
        height: 140px;
    }
    
    .premium-click-btn .btn-text {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }
    
    .cps-display {
        font-size: 3rem;
    }
}

/* ============================================
   13. Dark Mode Enhancements
   ============================================ */
@media (prefers-color-scheme: dark) {
    .glass-card {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* ============================================
   14. Performance Optimizations
   ============================================ */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}
