*, *::before, *::after {
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
  font-weight: normal;
}

body {
  margin: 0;
  padding: 0;
  background: linear-gradient(to right, #00aaff, #00ff6c);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.calculator-container {
  max-width: 400px;
  width: 100%;
  padding: 20px;
}

.calculator {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: minmax(100px, auto) repeat(5, 70px);
  gap: 2px;
  padding: 10px;
}

.display {
  grid-column: 1 / -1;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-around;
  padding: 10px;
  word-wrap: break-word;
  word-break: break-all;
  border-radius: 5px;
  margin-bottom: 10px;
}

.previous-operand {
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.2rem;
  min-height: 1.5rem;
}

.current-operand {
  color: white;
  font-size: 2.5rem;
}

button {
  cursor: pointer;
  font-size: 1.5rem;
  border: none;
  outline: none;
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 5px;
  transition: background-color 0.3s;
}

button:hover {
  background-color: rgba(255, 255, 255, 0.9);
}

button:active {
  background-color: rgba(255, 255, 255, 1);
  transform: scale(0.98);
}

.span-two {
  grid-column: span 2;
}

.operator {
  background-color: #ffbb00;
  color: white;
}

.operator:hover {
  background-color: #ffa600;
}

.equals {
  background-color: #00aaff;
  color: white;
}

.equals:hover {
  background-color: #0088cc;
}

#clear, #delete {
  background-color: #ff5c5c;
  color: white;
}

#clear:hover, #delete:hover {
  background-color: #ff3c3c;
}

/* Responsive design adjustments */
@media screen and (max-width: 480px) {
  .calculator {
    grid-template-rows: minmax(80px, auto) repeat(5, 60px);
  }

  .current-operand {
    font-size: 2rem;
  }

  button {
    font-size: 1.2rem;
  }

  .calculator-container {
    padding: 10px;
  }
}

@media screen and (max-width: 320px) {
  .calculator {
    grid-template-rows: minmax(70px, auto) repeat(5, 50px);
  }

  .current-operand {
    font-size: 1.7rem;
  }

  .previous-operand {
    font-size: 1rem;
  }

  button {
    font-size: 1rem;
  }
}
