*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: normal;
}

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

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

.calculator {
  background-color: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 1px;
  padding: 1px;
}

.display {
  grid-column: 1 / -1;
  background-color: #f8f9fa;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-around;
  padding: 20px;
  word-wrap: break-word;
  word-break: break-all;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  min-height: 120px;
}

.previous-operand {
  color: rgba(0, 0, 0, 0.6);
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.current-operand {
  color: #000000;
  font-size: 2.5rem;
  font-weight: 500;
}

button {
  cursor: pointer;
  font-size: 1.5rem;
  border: none;
  outline: none;
  background-color: #ffffff;
  padding: 20px;
  transition: background-color 0.3s, transform 0.1s;
  position: relative;
}

button:hover {
  background-color: #f1f3f5;
}

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

button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.05);
  opacity: 0;
  transition: opacity 0.2s;
}

button:hover::after {
  opacity: 1;
}

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

.operator {
  background-color: #f1f3f5;
  color: #4263eb;
  font-weight: 500;
}

.equals {
  background-color: #4263eb;
  color: white;
}

.equals:hover {
  background-color: #3b5bdb;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .calculator-container {
    padding: 10px;
  }

  button {
    padding: 15px;
    font-size: 1.2rem;
  }

  .display {
    padding: 15px;
    min-height: 100px;
  }

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

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

@media (max-width: 320px) {
  button {
    padding: 12px;
    font-size: 1rem;
  }

  .display {
    padding: 12px;
    min-height: 80px;
  }

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

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