<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Alıyon Mu Almıyon Mu?</title>
    <style>
        /* Orijinal Oyun Temel Ayarları (Hiç dokunulmadı) */
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #1a1a2e;
            color: white;
            margin: 0;
            padding: 20px;
            text-align: center;
        }
        h1 {
            color: #fca311;
            text-transform: uppercase;
            text-shadow: 2px 2px 4px #000;
            margin-bottom: 5px;
        }
        #info-panel {
            font-size: 1.2rem;
            margin-bottom: 20px;
            background-color: #16213e;
            padding: 10px;
            border-radius: 8px;
            border: 2px solid #0f3460;
            display: inline-block;
        }
        .container {
            display: flex;
            justify-content: space-between;
            max-width: 1200px;
            margin: 0 auto;
        }
        .prize-column {
            width: 20%;
            display: flex;
            flex-direction: column;
            gap: 5px;
        }
        .prize-box {
            padding: 8px;
            border-radius: 4px;
            font-weight: bold;
            border: 1px solid #333;
            transition: 0.3s;
        }
        .prize-blue { background-color: #0077b6; }
        .prize-red { background-color: #d62828; }
        .eliminated {
            opacity: 0.3;
            text-decoration: line-through;
            background-color: #333 !important;
        }
        .board {
            width: 55%;
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 10px;
            align-content: start;
        }
        .box {
            background: linear-gradient(145deg, #fca311, #e59800);
            color: #1a1a2e;
            font-size: 1.5rem;
            font-weight: bold;
            padding: 20px 0;
            border-radius: 8px;
            cursor: pointer;
            box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
            transition: transform 0.1s, background 0.3s;
            border: 2px solid #fff;
            position: relative;
        }
        .box:hover:not(.opened):not(.opening) {
            transform: scale(1.05);
        }
        .box.opened {
            background: #444;
            color: #888;
            cursor: default;
            pointer-events: none;
            border-color: #222;
        }
        /* Heyecanlı kutu açılışı animasyonu */
        @keyframes shake {
            0% { transform: translate(1px, 1px) rotate(0deg); }
            10% { transform: translate(-1px, -2px) rotate(-1deg); }
            20% { transform: translate(-3px, 0px) rotate(1deg); }
            30% { transform: translate(3px, 2px) rotate(0deg); }
            40% { transform: translate(1px, -1px) rotate(1deg); }
            50% { transform: translate(-1px, 2px) rotate(-1deg); }
            60% { transform: translate(-3px, 1px) rotate(0deg); }
            70% { transform: translate(3px, 1px) rotate(-1deg); }
            80% { transform: translate(-1px, -1px) rotate(1deg); }
            90% { transform: translate(1px, 2px) rotate(0deg); }
            100% { transform: translate(1px, -2px) rotate(-1deg); }
        }
        .box.opening {
            animation: shake 0.4s infinite;
            background: linear-gradient(145deg, #e63946, #c1121f);
            color: white;
            cursor: default;
        }
        .player-box-container {
            margin-top: 30px;
            padding: 20px;
            background-color: #16213e;
            border-radius: 10px;
            display: inline-block;
        }
        #player-box-display {
            display: inline-block;
            background: linear-gradient(145deg, #e63946, #c1121f);
            color: white;
            padding: 20px 40px;
            font-size: 2rem;
            font-weight: bold;
            border-radius: 8px;
            margin-top: 10px;
            border: 3px solid #fff;
            box-shadow: 0 0 15px rgba(230, 57, 70, 0.6);
        }
        /* Modal (Teklif Ekranı) */
        #modal-overlay {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.85);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        .modal-content {
            background-color: #1a1a2e;
            padding: 40px;
            border-radius: 15px;
            border: 4px solid #fca311;
            text-align: center;
            max-width: 500px;
            min-width: 300px;
            box-shadow: 0 0 30px rgba(252, 163, 17, 0.4);
        }
        .bank-offer-text {
            font-size: 2.5rem;
            color: #4cc9f0;
            margin: 20px 0;
            font-weight: bold;
        }
        .calling-anim {
            font-size: 3rem;
            animation: blink 1s infinite;
            margin: 20px 0;
        }
        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }
        .btn {
            font-size: 1.5rem;
            padding: 15px 30px;
            margin: 10px;
            cursor: pointer;
            border: none;
            border-radius: 8px;
            font-weight: bold;
            transition: 0.2s;
            color: white;
        }
        .btn-deal { background-color: #4caf50; }
        .btn-deal:hover { background-color: #388e3c; }
        .btn-nodeal { background-color: #f44336; }
        .btn-nodeal:hover { background-color: #d32f2f; }
        .btn-restart { background-color: #fca311; color: #1a1a2e; display: none; margin-top: 20px;}
        
        /* ----- YENİ EKLENEN MENÜ PERDESİ ----- */
        #start-screen {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: radial-gradient(circle, #1a1a2e 0%, #0f172a 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 2000; /* Her şeyin üstünde durmasını sağlar */
        }
        .main-title {
            font-size: 4rem;
            color: #fca311;
            text-transform: uppercase;
            text-shadow: 0px 0px 20px rgba(252, 163, 17, 0.8);
            margin-bottom: 10px;
        }
        .subtitle {
            font-size: 1.5rem;
            color: #4cc9f0;
            margin-bottom: 50px;
            letter-spacing: 2px;
        }
        .btn-start {
            background: linear-gradient(145deg, #fca311, #e59800);
            color: #1a1a2e;
            font-size: 2rem;
            font-weight: bold;
            padding: 20px 60px;
            border: 4px solid #fff;
            border-radius: 50px;
            cursor: pointer;
            text-transform: uppercase;
            transition: all 0.3s;
            animation: pulse 2s infinite;
        }
        .btn-start:hover {
            transform: scale(1.1);
        }
        @keyframes pulse {
            0% { box-shadow: 0 0 15px rgba(252, 163, 17, 0.6); }
            50% { box-shadow: 0 0 40px rgba(252, 163, 17, 1); }
            100% { box-shadow: 0 0 15px rgba(252, 163, 17, 0.6); }
        }

        @media (max-width: 768px) {
            .container { flex-direction: column; align-items: center; }
            .prize-column { width: 90%; flex-direction: row; flex-wrap: wrap; justify-content: center; margin-bottom: 20px;}
            .prize-box { font-size: 0.8rem; padding: 5px; margin: 2px;}
            .board { width: 95%; grid-template-columns: repeat(4, 1fr); }
            .main-title { font-size: 2.5rem; }
            .btn-start { font-size: 1.5rem; padding: 15px 40px; }
        }
    </style>
</head>
<body>

    <div id="start-screen">
        <h1 class="main-title">Alıyon Mu Almıyon Mu?</h1>
        <div class="subtitle">Büyük Ödüle Hazır Mısın?</div>
        <button class="btn-start" onclick="startGame()">YARIŞMAYA BAŞLA</button>
    </div>

    <h1>Alıyon Mu Almıyon Mu?</h1>
    <div id="info-panel">Lütfen oynamak istediğin kendi kutunu seç!</div>

    <div class="container">
        <div class="prize-column" id="left-prizes"></div>
        <div class="board" id="game-board"></div>
        <div class="prize-column" id="right-prizes"></div>
    </div>

    <div class="player-box-container" id="player-container" style="display: none;">
        <div>Senin Kutun</div>
        <div id="player-box-display">?</div>
    </div>

    <button class="btn btn-restart" id="btn-restart" onclick="initGame()">Yeniden Oyna</button>

    <div id="modal-overlay">
        <div class="modal-content">
            <h2 id="modal-title">...</h2>
            <div id="bank-offer"></div>
            <div id="modal-buttons">
                <button class="btn btn-deal" onclick="makeChoice(true)">ALIYOM!</button>
                <button class="btn btn-nodeal" onclick="makeChoice(false)">ALMIYOM!</button>
            </div>
            <button class="btn btn-restart" id="modal-restart" onclick="initGame()" style="display: none;">Yeni Oyun</button>
        </div>
    </div>

    <script>
        // Sadece menüyü kapatan fonksiyon
        function startGame() {
            document.getElementById('start-screen').style.display = 'none';
        }

        const prizeValues = [
            1, 2, 5, 10, 25, 50, 100, 200, 300, 400, 500, 1000, 
            2500, 5000, 10000, 15000, 25000, 50000, 100000, 250000, 500000, 500000, 500000, 1000000
        ];
        
        const rounds = [6, 5, 4, 3, 2, 1, 1];
        const offerRatios = [0.15, 0.30, 0.45, 0.60, 0.75, 0.90, 1.0];

        let boxes = [];
        let playerBox = null;
        let currentRound = 0;
        let boxesOpenedThisRound = 0;
        let gameState = 'CHOOSE_OWN'; 
        let currentOffer = 0;
        let isOpeningInProgress = false;

        function formatMoney(amount) {
            return amount.toLocaleString('tr-TR') + " TL";
        }

        function shuffle(array) {
            let currentIndex = array.length, randomIndex;
            while (currentIndex !== 0) {
                randomIndex = Math.floor(Math.random() * currentIndex);
                currentIndex--;
                [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
            }
            return array;
        }

        function initGame() {
            boxes = [];
            playerBox = null;
            currentRound = 0;
            boxesOpenedThisRound = 0;
            gameState = 'CHOOSE_OWN';
            isOpeningInProgress = false;
            
            document.getElementById('modal-overlay').style.display = 'none';
            document.getElementById('modal-buttons').style.display = 'block';
            document.getElementById('modal-restart').style.display = 'none';
            document.getElementById('btn-restart').style.display = 'none';
            document.getElementById('player-container').style.display = 'none';
            updateInfo("Lütfen oynamak istediğin kendi kutunu seç!");

            let shuffledPrizes = shuffle([...prizeValues]);
            for (let i = 0; i < 24; i++) {
                boxes.push({
                    id: i + 1,
                    value: shuffledPrizes[i],
                    opened: false,
                    isOpening: false
                });
            }

            renderPrizes();
            renderBoard();
        }

        function renderPrizes() {
            const leftPanel = document.getElementById('left-prizes');
            const rightPanel = document.getElementById('right-prizes');
            leftPanel.innerHTML = '';
            rightPanel.innerHTML = '';

            prizeValues.forEach((val, index) => {
                const div = document.createElement('div');
                div.id = `prize-${val}`;
                div.className = `prize-box ${index < 12 ? 'prize-blue' : 'prize-red'}`;
                div.innerText = formatMoney(val);
                
                if (index < 12) leftPanel.appendChild(div);
                else rightPanel.appendChild(div);
            });
            
            updatePrizeBoard();
        }

        function updatePrizeBoard() {
            let openedValues = boxes.filter(b => b.opened).map(b => b.value);
            document.querySelectorAll('.prize-box').forEach(el => el.classList.remove('eliminated'));

            openedValues.forEach(val => {
                let elements = document.querySelectorAll(`[id="prize-${val}"]:not(.eliminated)`);
                if (elements.length > 0) {
                    elements[0].classList.add('eliminated'); 
                }
            });
        }

        function renderBoard() {
            const board = document.getElementById('game-board');
            board.innerHTML = '';

            boxes.forEach(box => {
                const btn = document.createElement('div');
                btn.className = 'box';
                
                if (box.opened) {
                    btn.classList.add('opened');
                    btn.innerText = formatMoney(box.value);
                } else if (box.isOpening) {
                    btn.classList.add('opening');
                    btn.innerText = "?";
                } else if (playerBox && playerBox.id === box.id) {
                    btn.style.display = 'none'; 
                } else {
                    btn.innerText = box.id;
                    btn.onclick = () => handleBoxClick(box);
                }
                board.appendChild(btn);
            });
        }

        function handleBoxClick(box) {
            if (isOpeningInProgress) return; 

            if (gameState === 'CHOOSE_OWN') {
                playerBox = box;
                document.getElementById('player-container').style.display = 'inline-block';
                document.getElementById('player-box-display').innerText = box.id;
                gameState = 'OPEN_BOXES';
                updateInfo(`${rounds[currentRound]} kutu daha açman gerekiyor.`);
                renderBoard();
            } 
            else if (gameState === 'OPEN_BOXES') {
                if (box.opened) return; 
                
                isOpeningInProgress = true;
                box.isOpening = true;
                renderBoard();

                setTimeout(() => {
                    box.isOpening = false;
                    box.opened = true;
                    isOpeningInProgress = false;
                    boxesOpenedThisRound++;
                    
                    renderBoard();
                    updatePrizeBoard();

                    let boxesLeftToOpen = rounds[currentRound] - boxesOpenedThisRound;
                    
                    if (boxesLeftToOpen > 0) {
                        updateInfo(`${boxesLeftToOpen} kutu daha açman gerekiyor.`);
                    } else {
                        gameState = 'OFFER';
                        setTimeout(startPhoneCall, 800); 
                    }
                    
                    let remainingBoxes = boxes.filter(b => !b.opened && b.id !== playerBox.id);
                    if (remainingBoxes.length === 0 && gameState === 'OPEN_BOXES') {
                        endGameWithPlayerBox();
                    }
                }, 1500); 
            }
        }

        function startPhoneCall() {
            document.getElementById('modal-title').innerText = "☎️ Dırırırııınnn... Dırırırııınnn...";
            document.getElementById('bank-offer').innerHTML = '<div class="calling-anim">📱 Haşmet Bey Arıyor...</div>';
            document.getElementById('modal-buttons').style.display = 'none';
            document.getElementById('modal-overlay').style.display = 'flex';

            setTimeout(calculateOffer, 3500);
        }

        function calculateOffer() {
            let unopenedBoxes = boxes.filter(b => !b.opened);
            let sum = unopenedBoxes.reduce((acc, curr) => acc + curr.value, 0);
            let average = sum / unopenedBoxes.length;
            
            currentOffer = Math.floor(average * offerRatios[currentRound]);
            
            document.getElementById('modal-title').innerText = "Haşmet Bey'in Teklifi Geldi!";
            document.getElementById('bank-offer').innerHTML = `<div class="bank-offer-text">${formatMoney(currentOffer)}</div><div>Alıyon Mu? Almıyon Mu?</div>`;
            document.getElementById('modal-buttons').style.display = 'block';
        }

        function makeChoice(isDeal) {
            if (isDeal) {
                document.getElementById('modal-buttons').style.display = 'none';
                document.getElementById('modal-title').innerText = "TEBRİKLER! KABUL ETTİN.";
                document.getElementById('bank-offer').innerHTML = `
                    <div class="bank-offer-text">Kazandığın Tutar:<br>${formatMoney(currentOffer)}</div>
                    <span style="font-size:1.2rem; color:#888;">(Kendi kutunda ${formatMoney(playerBox.value)} vardı)</span>
                `;
                
                document.getElementById('modal-restart').style.display = 'inline-block';
                gameState = 'GAME_OVER';
            } else {
                document.getElementById('modal-overlay').style.display = 'none';
                currentRound++;
                boxesOpenedThisRound = 0;
                
                if (currentRound >= rounds.length) {
                    endGameWithPlayerBox();
                } else {
                    gameState = 'OPEN_BOXES';
                    updateInfo(`Haşmet Bey reddedildi! ${rounds[currentRound]} kutu daha açman gerekiyor.`);
                }
            }
        }

        function endGameWithPlayerBox() {
            gameState = 'GAME_OVER';
            document.getElementById('modal-title').innerText = "Oyun Bitti! Kendi Kutunu Açtın...";
            document.getElementById('bank-offer').innerHTML = `<div class="bank-offer-text">Kazandığın Tutar:<br>${formatMoney(playerBox.value)}</div>`;
            document.getElementById('modal-buttons').style.display = 'none';
            document.getElementById('modal-restart').style.display = 'inline-block';
            document.getElementById('modal-overlay').style.display = 'flex';
            
            document.getElementById('player-box-display').innerText = formatMoney(playerBox.value);
        }

        function updateInfo(text) {
            document.getElementById('info-panel').innerText = text;
        }

        // Oyun ilk açılışta arkada hazır bekler
        initGame();
    </script>
</body>
</html>









Selamlar alıyon mu almıyon mu yapay zeka üretti kodları ilettim geliştirmek isteyenler olursa diye iyi forumlar