* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

.display {
  background: #0f3460;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  overflow: hidden;
}

.expression {
  color: #8899aa;
  font-size: 16px;
  min-height: 24px;
  word-break: break-all;
}

.result {
  color: #e8e8e8;
  font-size: 36px;
  font-weight: 300;
  word-break: break-all;
}

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

.btn {
  height: 60px;
  border: none;
  border-radius: 14px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.95);
}

.btn.num {
  background: #1a1a3e;
  color: #e8e8e8;
}

.btn.num:hover {
  background: #2a2a5e;
}

.btn.func {
  background: #233554;
  color: #a8c8e8;
}

.btn.func:hover {
  background: #2e4a6e;
}

.btn.op {
  background: #e94560;
  color: #fff;
}

.btn.op:hover {
  background: #ff6b81;
}

.btn.equal {
  background: #e94560;
  color: #fff;
}

.btn.equal:hover {
  background: #ff6b81;
}

.btn.zero {
  grid-column: span 2;
}

@media (max-width: 360px) {
  .calculator {
    width: 290px;
    padding: 14px;
  }

  .btn {
    height: 52px;
    font-size: 18px;
  }
}
