/* Reset default browser styles.
   Browsers add their own padding and margins — we remove them. */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh; /* vh = viewport height. 100vh = full screen. */
  font-family: 'Segoe UI', sans-serif;
}

.calculator {
  background: #16213e;
  border-radius: 20px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.5);
}

.display {
  background: #0f3460;
  color: #e94560;
  font-size: 2.5rem;
  text-align: right;
  padding: 20px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  min-height: 80px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  word-break: break-all; /* prevents long numbers from overflowing */
  overflow: hidden;
}

.buttons {
  display: grid;
  /* 4 equal columns. 1fr = 1 fraction of available space. */
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.btn {
  background: #1a1a2e;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 1.2rem;
  padding: 18px;
  cursor: pointer;
  /* smooth color change on hover and slight scale on click */
  transition: background 0.15s, transform 0.1s;
}

.btn:hover  { background: #0f3460; }
.btn:active { transform: scale(0.95); } /* press effect */

.btn-operator { background: #e94560; color: white; }
.btn-operator:hover { background: #c73652; }

.btn-clear  { background: #533483; color: white; }
.btn-equals { background: #e94560; color: white; }

/* The 0 button takes up 2 grid columns instead of 1 */
.btn-zero {
  grid-column: span 2;
  text-align: left;
  padding-left: 22px;
}