body {
  background: linear-gradient(135deg, #141e30, #243b55);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  font-family: "Poppins", sans-serif;
}

.calculator {
  background: rgba(20, 20, 20, 0.95);
  padding: 15px;
  border-radius: 25px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  width: 95vw;              /* full width on mobile */
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.display {
  background: #000;
  color: #00ff88;
  font-size: 9vw;           /* scales with screen width */
  font-weight: bold;
  text-align: right;
  padding: 18px;
  border-radius: 12px;
  height: 50px;             /* taller for mobile */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;  /* auto-shrink effect */
  box-shadow: inset 0 0 12px rgba(0, 255, 136, 0.4);
}

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

button {
  padding: 16px;
  font-size: 1.4rem;
  border: none;
  border-radius: 15px;
  background: linear-gradient(145deg, #2e2e2e, #1a1a1a);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 4px 4px 8px #0d0d0d, -4px -4px 8px #2e2e2e;
}

button:hover {
  background: linear-gradient(145deg, #3a3a3a, #1f1f1f);
  transform: translateY(-2px);
}

button:active {
  transform: scale(0.95);
  box-shadow: inset 4px 4px 8px #0d0d0d, inset -4px -4px 8px #2e2e2e;
}

.operator {
  background: linear-gradient(145deg, #ff9800, #e67e22);
  color: #000;
  font-weight: bold;
}

.clear {
  background: linear-gradient(145deg, #e74c3c, #c0392b);
  font-weight: bold;
}

.equal {
  background: linear-gradient(145deg, #2ecc71, #27ae60);
  font-weight: bold;
}

.backspace {
  background: linear-gradient(145deg, #3498db, #2980b9);
  font-weight: bold;
}

/* ✅ Responsive Media Queries */

/* Phones ≤ 480px */
@media (max-width: 480px) {
  .display {
    font-size: 8vw;   /* adjusts dynamically */
    height: 90px;
  }
  button {
    font-size: 1.3rem;
    padding: 14px;
  }
}

/* Tablets (481px – 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .calculator {
    width: 380px;
  }
  .display {
    font-size: 2.2rem;
  }
  button {
    font-size: 1.2rem;
  }
}

/* Larger Screens */
@media (min-width: 769px) {
  .calculator {
    width: 400px;
  }
  .display {
    font-size: 2.5rem;
  }
  button {
    font-size: 1.4rem;
  }
}
