Make the List to be responsive design

Goal:
Make the list (ul and its li) to be responsive design in relation to the screen’s width.

Problem:
I don’t know how to solve it.

Info:
*You need to take account to amount of li in each ul list. Different responsive design depends on the width of the ul.
*Each ul can be random from 1 to 10 li or more.

JSBin:
https://jsbin.com/xibalahave/edit?html,css,output

Thank you!


<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div class="aaa">
    <ul class="listlist">
      <li>1Test 1</li>
      <li>1Test 2</li>
      <li>1Test 3</li>
    </ul>
  </div>
  <br />
  <div class="aaa">
    <ul class="listlist">
      <li>1Test 1</li>
      <li>1Test 2</li>
      <li>1Test 3</li>
      <li>1Test 4</li>      
    </ul>
  </div>  
  <br />
  <div class="aaa">
    <ul class="listlist">
      <li>1Test 1</li>
      <li>1Test 2</li>
    </ul>
  </div> 
  
</body>
</html>

.aaa ul.listlist{
    margin: 10px 0 16px;
    padding: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.aaa ul.listlist li {
  font-size: 1.125rem;
  display: block;  
  margin-right: 24px;
  line-height: 22px;
  border-radius: 12px 12px 12px 12px;  
  padding: 8px 24px;
  background-color: #00FFFF;
  white-space: nowrap;
}