<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<title>الآلة الحاسبة الذكية</title>
<style>
body { font-family: sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: #f0f2f5; margin: 0; }
.calc { background: white; padding: 20px; border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 300px; text-align: center; }
input { width: 100%; height: 50px; font-size: 24px; text-align: right; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 5px; padding: 5px; box-sizing: border-box; }
.btn { width: 70px; height: 50px; margin: 5px; font-size: 18px; cursor: pointer; border: none; border-radius: 5px; background: #e4e6eb; }
.btn:hover { background: #d8dadf; }
</style>
</head>
<body>
<div class="calc">
<h3>الآلة الحاسبة</h3>
<input type="text" id="display" placeholder="0" readonly>
<br>
<button class="btn" onclick="add('7')">7</button><button class="btn" onclick="add('8')">8</button><button class="btn" onclick="add('9')">9</button>
<br>
<button class="btn" onclick="add('4')">4</button><button class="btn" onclick="add('5')">5</button><button class="btn" onclick="add('6')">6</button>
<br>
<button class="btn" onclick="add('1')">1</button><button class="btn" onclick="add('2')">2</button><button class="btn" onclick="add('3')">3</button>
<br>
<button class="btn" onclick="add('0')">0</button>
<button class="btn" style="background: #0084ff; color: white;" onclick="check()">احسب</button>
<button class="btn" style="background: #ff4444; color: white;" onclick="reset()">C</button>
</div>
<script>
function add(val) { document.getElementById('display').value += val; }
function reset() { document.getElementById('display').value = ""; }
function check() {
var val = document.getElementById('display').value;
// رجعنا الرقم لـ 1000
if(val === "1000") {
window.location.href = "https://www.instagram.com";
} else {
try {
// إذا كان الرقم مش 1000، بيعمل عملية حسابية عادية
var result = eval(val);
alert("النتيجة: " + (result !== undefined ? result : 0));
} catch(e) {
alert("خطأ في العملية");
}
reset();
}
}
</script>
</body>
</html>