/* =============== RESULT POPUP =============== */
.result-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.result-popup-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.result-popup {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    width: 90%;
    max-width: 450px;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: none;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.result-popup::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, 
        rgba(250, 112, 154, 0.8), 
        rgba(254, 225, 64, 0.8),
        rgba(250, 112, 154, 0.8));
    border-radius: var(--border-radius-lg);
    z-index: -1;
    opacity: 0.7;
}

.result-popup-overlay.active .result-popup {
    transform: translateY(0) scale(1);
}

.result-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 25px 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.result-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    color: white;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
    animation: trophyFloat 2s ease-in-out infinite;
}

@keyframes trophyFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

.result-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
}

.result-bimbel {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 500;
    position: relative;
    z-index: 1;
    max-width: 80%;
    margin: 0 auto;
    line-height: 1.4;
}

.result-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 500;
    position: relative;
    z-index: 1;
    max-width: 80%;
    margin: 0 auto;
    line-height: 1.4;
}

.result-content {
    padding: 25px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.result-stat {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    padding: 18px 15px;
    border-radius: var(--border-radius-md);
    text-align: center;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 90px;
}

.result-stat:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 5px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--medium-text);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-stat.highlight {
    border: 2px solid rgba(250, 112, 154, 0.3);
    background: linear-gradient(145deg, #fff5f7, #ffeef1);
    position: relative;
    overflow: hidden;
}

.result-stat.highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(250, 112, 154, 0.1) 50%,
        transparent 70%
    );
    animation: highlightShine 2s linear infinite;
}

@keyframes highlightShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.result-stat.highlight .stat-value {
    background: linear-gradient(45deg, #fa709a, #fee140);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-message {
    font-size: 1.2rem;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f5f7ff 100%);
    border-radius: var(--border-radius-md);
    margin: 20px 0;
    font-weight: 700;
    line-height: 1.5;
    border: 2px dashed #667eea;
    position: relative;
    overflow: hidden;
}

.result-message::before {
    content: '✨';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.5rem;
    opacity: 0.6;
}

.result-message::after {
    content: '⭐';
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 1.5rem;
    opacity: 0.6;
}

.result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-btn {
    padding: 16px 24px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    min-width: 120px;
    max-width: 160px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.result-btn:hover::before {
    left: 100%;
}

.result-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.result-btn:active {
    transform: translateY(-1px);
}

.play-again { 
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.new-level { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.go-menu { 
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

/* =============== RESPONSIVE RESULT POPUP =============== */
@media (max-width: 500px) {
    .result-popup {
        width: 95%;
        max-width: 380px;
    }
    
    .result-header {
        padding: 25px 20px 20px;
    }
    
    .result-icon {
        font-size: 3.5rem;
    }
    
    .result-title {
        font-size: 1.8rem;
    }
    
    .result-subtitle {
        font-size: 1rem;
    }
    
    .result-content {
        padding: 20px;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .result-stat {
        padding: 15px 12px;
        min-height: 80px;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .result-message {
        font-size: 1.1rem;
        padding: 15px;
        margin: 15px 0;
    }
    
    .result-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .result-btn {
        max-width: 100%;
        width: 100%;
        padding: 14px 20px;
    }
}

@media (max-width: 400px) {
    .result-popup {
        max-width: 340px;
    }
    
    .result-header {
        padding: 20px 15px 15px;
    }
    
    .result-icon {
        font-size: 3rem;
    }
    
    .result-title {
        font-size: 1.6rem;
    }
    
    .result-subtitle {
        font-size: 0.9rem;
    }
    
    .result-content {
        padding: 15px;
    }
    
    .result-stat {
        padding: 12px 10px;
        min-height: 70px;
    }
    
    .stat-value {
        font-size: 1.6rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .result-message {
        font-size: 1rem;
        padding: 12px;
    }
}