* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
 
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  font-family: 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
}
 
.calculator {
  background: #16213e;
  border-radius: 24px;
  padding: 24px;
  width: 320px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}
 
/* Display */
.display {
  background: #0f3460;
  border-radius: 16px;
  padding: 20px 24px 16px;
  margin-bottom: 20px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  overflow: hidden;
}
 
.expression {
  font-size: 14px;
  color: #a0aec0;
  min-height: 20px;
  word-break: break-all;
  text-align: right;
}
 
.result {
  font-size: 48px;
  font-weight: 300;
  color: #e2e8f0;
  letter-spacing: -1px;
  word-break: break-all;
  text-align: right;
  line-height: 1.1;
  transition: font-size 0.1s;
}
 
/* Buttons */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
 
.btn {
  background: #1a1a2e;
  color: #e2e8f0;
  border: none;
  border-radius: 14px;
  padding: 0;
  height: 64px;
  font-size: 20px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  outline: none;
}
 
.btn:hover {
  background: #252545;
}
 
.btn:active {
  transform: scale(0.93);
  background: #2d2d50;
}
 
.btn.span2 {
  grid-column: span 2;
}
 
.btn.operator {
  background: #e94560;
  color: #fff;
  font-weight: 500;
}
 
.btn.operator:hover {
  background: #f05672;
}
 
.btn.operator:active {
  background: #c73652;
}
 
.btn.operator.active-op {
  background: #fff;
  color: #e94560;
}
 
.btn.equals {
  background: #e94560;
  color: #fff;
  font-size: 24px;
  font-weight: 500;
}
 
.btn.equals:hover {
  background: #f05672;
}
 
.btn.equals:active {
  background: #c73652;
}
 
/* Responsive */
@media (max-width: 400px) {
  .calculator {
    width: 100vw;
    border-radius: 0;
    padding: 16px;
  }
  .result {
    font-size: 40px;
  }
}