/* ---------- Reset / page layout ---------- */
body {
  background-color: hsl(0, 0%, 95%);
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* ---------- Calculator container ---------- */
#calculator {
  font-family: 'Arial', sans-serif;
  background-color: hsla(0, 0%, 2%, 0.904);
  border-radius: 15px;
  width: min(420px, 95vw); /* responsive width */
  max-width: 500px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

/* ---------- Display ---------- */
#display {
  background-color: hsl(0, 0%, 20%);
  color: #fff;
  text-align: right;
  padding: 10px 14px;
  font-size: 2.4rem;      /* reasonable default */
  border-radius: 5px;
  border: none;
  width: 100%;
  box-sizing: border-box;
  min-height: 56px;
}

/* ---------- Keys grid (controls rows/columns) ---------- */
#keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);       /* 4 equal columns */
  grid-auto-rows: minmax(60px, 1fr);           /* rows controlled by grid */
  gap: 12px;
  padding: 18px;
  box-sizing: border-box;
}

/* ---------- Buttons (fill their grid cell) ---------- */
button {
  width: 100%;
  height: 100%;
  font-size: 1.6rem;
  color: rgb(211, 211, 212);
  border-radius: 18px;
  background-color: #242424;
  border: thick solid #a7a6a6;
  cursor: pointer;

  /* Make button occupy the full grid cell and center content */
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  transition: background-color 0.15s, transform 0.06s;
}

button:hover { background-color: rgb(40,40,40); }
button:active { transform: translateY(1px); background-color: rgb(54,53,53); }

/* operator (orange) buttons */
.operator-btn {
  background-color: hsla(33, 97%, 49%, 0.9);
  color: #fff;
}

/* clear or special button spanning columns (example) */
/* If you want "Clr" to span entire row, use grid-column: 1 / -1; */
.operator-sp {
  grid-column: span 2;        /* change or remove as needed */
  background-color: rgb(248,4,4);
  color: #fff;
}

/* ensure borders do not cause overflow */
#calculator, #keys, button { box-sizing: border-box; }

/* ---------- Mobile adjustments ---------- */
@media screen and (max-width: 480px) {

  #display {
    font-size: 1.6rem;
    padding: 8px 10px;
  }

  #keys { gap: 8px; padding: 12px; grid-auto-rows: minmax(50px, 1fr); }

  button { font-size: 1.25rem; border-radius: 14px; border-width: 2px; }
}

