* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  font-family: "Segoe UI", sans-serif;
}

.calculator {
  width: 320px;
  background: #16213e;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* DISPLAY */
.display {
  background: #0f0f23;
  padding: 20px 24px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
}

.expression {
  font-size: 14px;
  color: #666;
  min-height: 20px;
  margin-bottom: 6px;
  word-break: break-all;
  text-align: right;
}

.result {
  font-size: 42px;
  color: #ffffff;
  font-weight: 300;
  word-break: break-all;
  text-align: right;
  transition: font-size 0.1s;
}

.result.small {
  font-size: 28px;
}
.result.xsmall {
  font-size: 20px;
}
.result.error {
  color: #ff6b6b;
  font-size: 24px;
}

/* BUTTONS GRID */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #0a0a1a;
}

.btn {
  background: #1a1a3e;
  color: #ffffff;
  border: none;
  font-size: 20px;
  padding: 22px 10px;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
  font-family: "Segoe UI", sans-serif;
}

.btn:hover {
  background: #252550;
}
.btn:active {
  transform: scale(0.93);
  background: #2e2e60;
}

/* span 2 columns */
.span2 {
  grid-column: span 2;
}

/* clear button */
.clear {
  background: #2d1b1b;
  color: #ff6b6b;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
}
.clear:hover {
  background: #3d2020;
}

/* utility buttons (+/- and %) */
.op {
  background: #1b1b35;
  color: #7eb8f7;
}
.op:hover {
  background: #252545;
}

/* operator buttons */
.operator {
  background: #0d2137;
  color: #7eb8f7;
  font-size: 22px;
}
.operator:hover {
  background: #132d4d;
}
.operator.active {
  background: #7eb8f7;
  color: #0d0d0d;
}

/* equals button */
.equals {
  background: #7eb8f7;
  color: #0d0d0d;
  font-size: 24px;
  font-weight: 700;
}
.equals:hover {
  background: #9dcbff;
}
.equals:active {
  transform: scale(0.93);
}
