body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  background: #1a1a1a;
  font-family: 'Poppins', sans-serif;
  color: #f1f1f1;
}

.calculator {
  width: 360px;
  background: #2c2c2c;
  border-radius: 10px;
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: width 0.3s ease-in-out;
}

.display {
  background: #1e1e1e;
  color: #00ff00;
  font-size: 3rem;
  text-align: right;
  padding: 20px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow-x: hidden;
  white-space: nowrap;
  word-wrap: break-word;
  max-width: 100%;
  transition: font-size 0.2s ease-in-out;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

button {
  background: #444;
  border: none;
  padding: 20px;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.1s;
  border-radius: 0px;
}

button:hover {
  background: #555;
}

button:active {
  transform: scale(0.95);
}

button.equals {
  background: #00ff00;
  color: black;
  grid-column: span 4; /* Make the equals button span across all columns */
}

button.equals:hover {
  background: #00cc00;
}

button.sqrt, button.square, button.exp {
  background: #555;
}

button.sqrt:hover, button.square:hover, button.exp:hover {
  background: #666;
}

/* Adjustments for the layout as requested */
button.sqrt, button.square {
  grid-column: span 1;
}

button.exp {
  grid-column: span 1;
}

button.number:nth-child(17) {
  grid-column: span 2;
}

/* Popup styling */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px 30px;
  border-radius: 5px;
  font-size: 1.2rem;
  display: none;
}

@media (min-width: 600px) {
  .calculator {
    width: 75%;
  }
  .display {
    font-size: 2.8rem;
  }
}

@media (min-width: 1024px) {
  .calculator {
    width: 50%;
  }
  .display {
    font-size: 3rem;
  }
}

@media (min-width: 1280px) {
  .calculator {
    width: 40%;
  }
  .display {
    font-size: 3.5rem;
  }
}
