body {
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Align items to the top for UI elements */
  min-height: 100vh;
  background-color: #222;
  color: #eee;
  font-family: Arial, sans-serif;
  padding-top: 20px; /* Add some padding at the top */
}

h1 {
  color: #00bcd4;
  margin-bottom: 10px;
}

#capitalDisplay, #stageDisplay {
  font-size: 1.2em;
  margin-bottom: 5px;
  color: #ffeb3b;
}

#profitChangeDisplay {
  position: absolute; /* Position relative to the nearest positioned ancestor (body) */
  font-size: 1.5em;
  font-weight: bold;
  opacity: 0; /* Start hidden */
  transition: opacity 0.5s ease-out, transform 0.5s ease-out; /* For fade out and slight movement */
  pointer-events: none; /* Make it unclickable */
  z-index: 20; /* Ensure it's above other elements */
  margin-top: -20px; /* Adjust as needed to position relative to capital display */
}

canvas {
  background-color: #333;
  border: 2px solid #00bcd4;
  display: block;
  margin-top: 20px; /* Space between UI and canvas */
}

#finalResults {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  color: #fff;
  z-index: 10;
}

#finalResults h2 {
  color: #ff5252;
  margin-bottom: 15px;
}

#finalResults p {
  font-size: 1.2em;
  margin-bottom: 20px;
}

#restartButton {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
}

#restartButton:hover {
  background-color: #45a049;
}
