Div element going out of parent div in Browser

I am making a website for currency exchange (as a college assignment), and I am facing this absurd issue here.

This is my entire code:

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

#bg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: aquamarine;
}

.wrapper {
  background-color: aliceblue;
  overflow: hidden;
  width: 370px;
}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<section id="bg">
  <div class="wrapper">
    <header>Currency Converter</header>
    <form action="#">
      <div class="amount">
        <p>Enter the amount:</p>
        <input type="text" value="1">
      </div>
      <div class="droplist">
        <div class="from">
          <p>From:</p>
          <div class="select-box">
            <img src="https://flagsapi.com/US/flat/64.png" alt="flag">
            <select title="Country">
              <option value="USD">USD</option>
              <option value="INR">INR</option>
              <option value="PKR">PKR</option>
              <option value="JPY">JPY</option>
            </select>
          </div>
        </div>

        <div class="icon"><i class="fas fa-exchange-alt"></i></div>

        <div class="to"></div>
        <p>To:</p>
        <div class="select-box">
          <img src="https://flagsapi.com/IN/flat/64.png" alt="flag">
          <select title="Country">
            <option value="USD">USD</option>
            <option value="INR">INR</option>
            <option value="PKR">PKR</option>
            <option value="JPY">JPY</option>
          </select>
        </div>
      </div>
  </div>
  </form>
  <div class="exchange-rate">1 USD = 83.343 INR</div>
  <button>Get Exchange Rate</button>
  </div>
</section>

The website is like this: Website Image

And code of the website using Inspect Element:Inspect Code

The last Div and Button are outside the Wrapper Div Element in Edge. I tried adding Section etc to debug and found that even without CSS the problem persists.

Till now, I have tried the following:

  • Remove CSS completely
  • Remove , and only keeping div elements.
  • Open the webpage without Live Server (VS Code).

Everything Works if I put the last two components in between other divs inside the wrapper div, but that’s not what I want.

Can anyone tell me why this absurd issue is happening? Am I making some rudimentary mistake?