Right align child div to parent using CSS

How can I adjust my css to have the child div (popup like menu) right align to the parent div which is a button in this case?

Right now i have this

enter image description here

and im trying to make it look like this....

enter image description here

https://jsfiddle.net/JokerMartini/pqw2jeb9/

body {
  padding: 20px;
  font-family: Helvetica;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 10px;
}

.box {
  background-color: #20262e;
  color: #fff;
  border-radius: 3px;
  padding: 20px;
  font-size: 14px;
  overflow: hidden;
}

.menuRoot {
  display: inline-block;
}

.overlay {
  background: rgba(0, 0, 0, 0.25);
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

.popup {
  position: absolute;
  z-index: 90;
  background: blue;
  border-radius: 4px;
  padding: 12px;
  box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.75);
}
<div class="wrapper">
  <div class="box">A</div>
  <div class="box">B</div>
  <div class="box">
    Hi
    <div role="menu" class="menuRoot">
      <div>
        <!-- Activator -->
        <div>
          <button type="button" class="relative p-1 duration-300 rounded-full hover:bg-gray-200">Paret Button</button>
        </div>
        
        <!-- Overlay -->
        <div class="overlay"></div>

        <!-- Popup -->
        <div class="popup">
          <button type="button" class="relative p-1 duration-300 rounded-full hover:bg-gray-200">Child Button</button>
        </div>
      </div>
    </div>
    Great
  </div>
  <div class="box d">D</div>
</div>

I tried a lot, I remembered I'm Arabic and I did this too much, my lovely language starts from right to left so just add dir="rtl" to menu root, then add dir="ltr" to the popup.

so the popup's Xaxis changed to the right while it was on the left, when adding extra content the width will increase to the right and the dir="ltr" to the popup to just override the parent's direction.

body {
  padding: 20px;
  font-family: Helvetica;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 10px;
}

.box {
  background-color: #20262e;
  color: #fff;
  border-radius: 3px;
  padding: 20px;
  font-size: 14px;
  overflow: hidden;
}

.menuRoot {
  display: inline-block;
}

.overlay {
  background: rgba(0, 0, 0, 0.25);
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

.popup {
  position: absolute;
  z-index: 90;
  background: blue;
  border-radius: 4px;
  padding: 12px;
  box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.75);
}
<div class="wrapper">
  <div class="box">A</div>
  <div class="box">B</div>
  <div class="box">C</div>
  <div class="box d">
    Hi
    <div role="menu" class="menuRoot" dir="rtl">
      <div>
        <!-- Activator -->
        <div>
          <button type="button" class="relative p-1 duration-300 rounded-full hover:bg-gray-200">Paret Button</button>
        </div>

        <!-- Overlay -->
        <div class="overlay"></div>

        <!-- Popup -->
        <div dir="ltr" class="popup">
          <button type="button" class="relative p-1 duration-300 rounded-full hover:bg-gray-200">Child Button 1</button>
          <button type="button" class="relative p-1 duration-300 rounded-full hover:bg-gray-200">Child Button 2</button>
          <button type="button" class="relative p-1 duration-300 rounded-full hover:bg-gray-200">Child Button 3</button>
        </div>
      </div>
    </div>
    Great
  </div>
</div>