
.game-result-modal {
    user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-tap-highlight-color: transparent; 
}

.game-result-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #1e1e1e, #2d2d2d);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    min-width: 400px;
    max-width: 500px;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.game-result-modal.show .modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    text-align: center;
    padding: 30px 30px 20px;
    background: linear-gradient(135deg, #2d2d2d, #1e1e1e);
    border-bottom: 1px solid #444;
    position: relative;
}

.grade-circle {
    width: 80px;
    height: 80px;
    border: 4px solid;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    animation: gradeGlow 2s ease-in-out infinite alternate;
}

@keyframes gradeGlow {
    0% { box-shadow: 0 0 20px currentColor; }
    100% { box-shadow: 0 0 40px currentColor; }
}

.grade-text {
    font-size: 32px;
    font-weight: bold;
}

.grade-icon {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 24px;
    animation: bounce 1s ease-in-out infinite;
}

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

.modal-title {
    font-size: 24px;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-body {
    padding: 30px;
}

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

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.stat-item.highlight {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.1));
    border-color: rgba(76, 175, 80, 0.5);
    transform: scale(1.05);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: white;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #ccc;
}

.grade-message {
    text-align: center;
    font-size: 18px;
    color: #4CAF50;
    margin-bottom: 25px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
    background: linear-gradient(90deg, currentColor, rgba(255, 255, 255, 0.8));
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 15px currentColor; }
    100% { box-shadow: 0 0 5px currentColor; }
}

.progress-label {
    text-align: center;
    font-size: 12px;
    color: #999;
}

.modal-footer {
    padding: 20px 30px 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.modal-btn.primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.modal-btn.secondary {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.modal-btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
}


@media (max-width: 1024px) {
    .modal-content {
        min-width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
        transform: translate(-50%, -50%) scale(0.9);
    }
    
    .game-result-modal.show .modal-content {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .modal-header {
        padding: 20px 20px 15px;
    }
    
    .grade-circle {
        width: 60px;
        height: 60px;
        margin: 0 auto 15px;
    }
    
    .grade-text {
        font-size: 24px;
    }
    
    .grade-icon {
        font-size: 18px;
        top: -8px;
        right: -8px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .stat-value {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .grade-message {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .progress-bar {
        height: 6px;
        margin-bottom: 8px;
    }
    
    .progress-label {
        font-size: 11px;
    }
    
    .modal-footer {
        padding: 15px 20px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-btn {
        padding: 15px 20px;
        font-size: 16px;
        min-width: 100%;
        order: 1;
    }
    
    .modal-btn.primary {
        order: 0; 
    }
}

@media (max-width: 480px) {
    .modal-content {
        min-width: 98%;
        max-width: 98%;
        margin: 5px;
    }
    
    .modal-header {
        padding: 15px 15px 10px;
    }
    
    .grade-circle {
        width: 50px;
        height: 50px;
        margin: 0 auto 10px;
    }
    
    .grade-text {
        font-size: 20px;
    }
    
    .grade-icon {
        font-size: 16px;
        top: -6px;
        right: -6px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .grade-message {
        font-size: 14px;
    }
    
    .modal-footer {
        padding: 10px 15px 15px;
    }
    
    .modal-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}
