<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MEGA Sinema - Sabit Başlık & Yeni Modlar</title>
    <style>
        :root {
            --primary: #e50914;
            --bg: #050505;
            --surface: #121212;
            --text: #ffffff;
            --accent: #00d2d3;
            --gold: #ffd700;
            --purple: #a55eea;
            --orange: #fa8231;
            --green: #2ecc71;
            --blue: #3498db;
        }
 
        body {
            background-color: var(--bg);
            color: var(--text);
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            margin: 0; padding: 0;
            overflow-x: hidden;
        }
 
        /* HEADER DÜZENLEMESİ: position: relative yapıldı (Artık kaymıyor) */
        .header {
            background: linear-gradient(to bottom, #1a1a1a, var(--bg));
            padding: 30px 20px;
            border-bottom: 1px solid #333;
            position: relative; /* DEĞİŞTİ: sticky yerine relative */
            z-index: 100;
            box-shadow: 0 10px 30px rgba(0,0,0,0.8);
        }
 
        .title-area { text-align: center; margin-bottom: 20px; }
        h1 { margin: 0; font-size: 2rem; text-transform: uppercase; letter-spacing: 2px; }
        h1 span { color: var(--primary); }
        .subtitle { color: #888; font-size: 0.9rem; margin-top: 5px; }
 
        /* TİP SEÇİCİ */
        .type-selector { display: flex; justify-content: center; gap: 15px; margin-bottom: 20px; }
        .type-btn {
            background: #222; border: 1px solid #444; color: #888;
            padding: 8px 30px; border-radius: 20px; cursor: pointer;
            font-weight: bold; transition: 0.3s;
        }
        .type-btn.active {
            background: var(--text); color: var(--bg); border-color: var(--text); transform: scale(1.05);
        }
 
        /* MOOD KONTEYNERİ */
        .mood-wrapper {
            background: var(--surface);
            border: 1px solid #333;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 20px;
            max-height: 400px; /* Alanı biraz daha büyüttüm */
            overflow-y: auto;
        }
         
        .mood-wrapper::-webkit-scrollbar { width: 8px; }
        .mood-wrapper::-webkit-scrollbar-track { background: #111; }
        .mood-wrapper::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
 
        .mood-group-title {
            font-size: 13px; color: #aaa; text-transform: uppercase; letter-spacing: 1px; font-weight: bold;
            margin: 20px 0 10px 0; border-bottom: 1px solid #333; padding-bottom: 5px;
        }
        .mood-group-title:first-child { margin-top: 0; }
 
        .mood-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
 
        .mood-tag {
            background: #1f1f1f; border: 1px solid #333; padding: 8px 16px;
            border-radius: 6px; font-size: 14px; cursor: pointer; transition: all 0.2s;
            display: flex; align-items: center; gap: 6px; user-select: none;
        }
         
        .mood-tag:hover { background: #333; transform: translateY(-2px); }
        .mood-tag.selected {
            background: var(--primary); color: white; border-color: var(--primary);
            box-shadow: 0 0 10px rgba(229, 9, 20, 0.4);
        }
         
        /* Renkli Etiketler */
        .mood-tag.gold { border-color: var(--gold); color: var(--gold); }
        .mood-tag.gold.selected { background: var(--gold); color: black; }
         
        .mood-tag.purple { border-color: var(--purple); color: var(--purple); }
        .mood-tag.purple.selected { background: var(--purple); color: white; }
 
        .mood-tag.green { border-color: var(--green); color: var(--green); }
        .mood-tag.green.selected { background: var(--green); color: black; }
 
        .mood-tag.blue { border-color: var(--blue); color: var(--blue); }
        .mood-tag.blue.selected { background: var(--blue); color: white; }
 
 
        /* AKSİYON ALANI */
        .action-bar { display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap; }
        .count-input {
            background: #111; border: 1px solid #444; color: white; padding: 10px;
            border-radius: 6px; width: 80px; text-align: center; font-size: 16px;
        }
        .magic-btn {
            background: linear-gradient(45deg, var(--primary), #b20710);
            color: white; border: none; padding: 12px 50px;
            font-size: 16px; font-weight: bold; border-radius: 6px;
            cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
            box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3); transition: 0.3s;
        }
        .magic-btn:hover { transform: scale(1.05); box-shadow: 0 10px 25px rgba(229, 9, 20, 0.5); }
 
        #statusMsg { text-align: center; margin-top: 10px; color: #aaa; font-size: 13px; min-height: 20px; }
 
        /* GRİD */
        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 20px;
            padding: 30px;
            max-width: 1800px;
            margin: 0 auto;
        }
 
        .card {
            background: #1a1a1a; border-radius: 8px; overflow: hidden;
            position: relative; transition: transform 0.3s; cursor: pointer;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3); aspect-ratio: 2/3;
        }
        .card:hover { transform: scale(1.05) translateY(-5px); z-index: 10; box-shadow: 0 15px 30px rgba(0,0,0,0.6); }
        .poster { width: 100%; height: 100%; object-fit: cover; background: #222; }
 
        .info-overlay {
            position: absolute; bottom: 0; left: 0; width: 100%;
            background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
            padding: 40px 10px 10px 10px; opacity: 0; transition: 0.3s;
        }
        .card:hover .info-overlay { opacity: 1; }
         
        .rating-badge {
            position: absolute; top: 10px; right: 10px;
            background: rgba(0,0,0,0.85); color: var(--accent);
            padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: bold;
            border: 1px solid var(--accent); backdrop-filter: blur(4px);
        }
 
        /* MODAL */
        .modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); align-items: center; justify-content: center; padding: 20px; }
        .modal-box { background: #181818; width: 100%; max-width: 900px; display: flex; border-radius: 10px; overflow: hidden; position: relative; max-height: 90vh; box-shadow: 0 0 50px rgba(200,0,0,0.1); }
        .modal-poster { width: 40%; object-fit: cover; }
        .modal-content { padding: 40px; width: 60%; overflow-y: auto; }
        .close-btn { position: absolute; top: 15px; right: 20px; color: white; font-size: 35px; cursor: pointer; z-index: 10; }
 
        @media (max-width: 768px) {
            .modal-box { flex-direction: column; overflow-y: scroll; }
            .modal-poster { width: 100%; height: 250px; }
            .modal-content { width: 100%; padding: 20px; }
            .mood-list { gap: 6px; }
            .mood-tag { padding: 5px 10px; font-size: 12px; }
        }
    </style>
</head>
<body>
 
    <div class="header">
        <div class="title-area">
            <h1>MEGA <span style="color:white">SİNEMA</span></h1>
            <div class="subtitle">Eksiksiz Kategori Arşivi</div>
        </div>
 
        <div class="type-selector">
            <button class="type-btn active" onclick="changeType('movie')" id="btnMovie">FİLM</button>
            <button class="type-btn" onclick="changeType('tv')" id="btnTv">DİZİ</button>
        </div>
 
        <div class="mood-wrapper">
            <div id="moodContainer"></div>
        </div>
 
        <div class="action-bar">
            <span>Kaç adet?</span>
            <input type="number" id="count" class="count-input" value="100" min="1" max="500" step="10">
            <button class="magic-btn" onclick="startEngine()">KEŞFET</button>
        </div>
        <div id="statusMsg"></div>
    </div>
 
    <div class="grid" id="grid"></div>
 
    <div id="modal" class="modal">
        <div class="modal-box">
            <span class="close-btn" onclick="closeModal()">&times;</span>
            <img src="" class="modal-poster" id="mImg">
            <div class="modal-content">
                <h2 id="mTitle" style="margin-top:0; font-size: 2rem;"></h2>
                <p id="mTag" style="color:#aaa; font-style:italic; margin-bottom:20px;"></p>
                <div style="display:flex; gap:15px; margin-bottom:20px;">
                    <span id="mDate" style="border:1px solid #555; padding:4px 10px; border-radius:4px;"></span>
                    <span id="mRating" style="color:var(--accent); border:1px solid var(--accent); padding:4px 10px; border-radius:4px; font-weight:bold;"></span>
                </div>
                <p id="mDesc" style="line-height:1.6; color:#ddd; font-size:1.1rem;"></p>
                <a id="mLink" href="#" target="_blank"><button style="margin-top:20px; background:white; color:black; border:none; padding:10px 25px; font-weight:bold; cursor:pointer; border-radius:4px;">İzle / Araştır</button></a>
            </div>
        </div>
    </div>
 
    <script>
        const API = 'KENDİ APİNİZİ EKLEYİNİZ';
        const BASE = 'https://api.themoviedb.org/3';
        const IMG = 'https://image.tmdb.org/t/p/w342';
        const ORIG = 'https://image.tmdb.org/t/p/original';
        const TODAY = new Date().toISOString().split('T')[0];
 
        const MOOD_GROUPS = [
            {
                title: "VİZYON & GÜNCEL",
                items: [
                    { id: '2025', name: '<img draggable="false" class="emoji" alt="📅" src="//cdn.***.net/emojis/html/1f4c5.png"> 2025 Vizyon', class:'gold', depth: 3, params: '&primary_release_date.gte=2025-01-01&primary_release_date.lte=2025-12-31' },
                    { id: 'upcoming', name: '<img draggable="false" class="emoji" alt="🚀" src="//cdn.***.net/emojis/html/1f680.png"> Çıkacaklar', class:'gold', depth: 3, params: `&primary_release_date.gte=${TODAY}&release_date.asc` },
                    { id: 'new', name: '<img draggable="false" class="emoji" alt="🆕" src="//cdn.***.net/emojis/html/1f195.png"> 2024 Güncel', class:'gold', depth: 10, params: '&primary_release_date.gte=2024-01-01' },
                    { id: 'cinema', name: '<img draggable="false" class="emoji" alt="🎟" src="//cdn.***.net/emojis/html/1f39f.png">️ Sinemalarda', class:'gold', depth: 3, params: `&primary_release_date.gte=${new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]}&with_release_type=3` },
                ]
            },
            {
                title: "DEV STÜDYOLAR",
                items: [
                    { id: 'marvel', name: '<img draggable="false" class="emoji" alt="🛡" src="//cdn.***.net/emojis/html/1f6e1.png">️ Marvel', class:'purple', depth: 5, params: '&with_companies=420' },
                    { id: 'dc', name: '🦇 DC Comics', class:'purple', depth: 5, params: '&with_companies=9993' },
                    { id: 'ghibli', name: '<img draggable="false" class="emoji" alt="🍃" src="//cdn.***.net/emojis/html/1f343.png"> Studio Ghibli', class:'purple', depth: 2, params: '&with_companies=10342' },
                    { id: 'pixar', name: '<img draggable="false" class="emoji" alt="💡" src="//cdn.***.net/emojis/html/1f4a1.png"> Pixar', class:'purple', depth: 3, params: '&with_companies=3' },
                    { id: 'disney', name: '<img draggable="false" class="emoji" alt="🏰" src="//cdn.***.net/emojis/html/1f3f0.png"> Disney', class:'purple', depth: 10, params: '&with_companies=2' },
                ]
            },
            {
                title: "TEMATİK & ATMOSFER (YENİ EKLENDİ)",
                items: [
                    { id: 'cyber', name: '<img draggable="false" class="emoji" alt="🤖" src="//cdn.***.net/emojis/html/1f916.png"> Cyberpunk', class:'blue', depth: 10, params: '&with_keywords=12190' },
                    { id: 'survival', name: '<img draggable="false" class="emoji" alt="🏝" src="//cdn.***.net/emojis/html/1f3dd.png">️ Hayatta Kalma', class:'blue', depth: 10, params: '&with_keywords=10349' },
                    { id: 'detective', name: '<img draggable="false" class="emoji" alt="🔍" src="//cdn.***.net/emojis/html/1f50d.png"> Dedektif', class:'blue', depth: 10, params: '&with_keywords=703' },
                    { id: 'vampire', name: '🧛 Vampir/Kurtadam', class:'blue', depth: 10, params: '&with_keywords=3133|12564' },
                    { id: 'sport', name: '⚽ Spor', class:'blue', depth: 10, params: '&with_keywords=6075' },
                    { id: 'heist', name: '<img draggable="false" class="emoji" alt="💰" src="//cdn.***.net/emojis/html/1f4b0.png"> Soygun', class:'blue', depth: 10, params: '&with_keywords=642' },
                    { id: 'zombie', name: '🧟 Zombiler', class:'blue', params: '&with_keywords=12377' }, // Zombie Keyword ID
                    { id: 'super', name: '🦸 Süper Kahramanlar', class:'blue', params: '&with_keywords=9748' },
                    { id: 'time', name: '<img draggable="false" class="emoji" alt="⏳" src="//cdn.***.net/emojis/html/23f3.png"> Zaman Yolculuğu', class:'blue', params: '&with_keywords=2964' },
                ]
            },
            {
                title: "Ruh Hali & Duygular",
                items: [
                    { id: 'comedy', name: '<img draggable="false" class="emoji" alt="😂" src="//cdn.***.net/emojis/html/1f602.png"> Gülmek İstiyorum', m: 35, t: 35 },
                    { id: 'sad', name: '<img draggable="false" class="emoji" alt="😢" src="//cdn.***.net/emojis/html/1f622.png"> Ağlamak İstiyorum', m: 18, t: 18 },
                    { id: 'relax', name: '<img draggable="false" class="emoji" alt="😌" src="//cdn.***.net/emojis/html/1f60c.png"> Kafa Dağıtmalık', m: 10751, t: 10751 }, // Family
                    { id: 'adrenaline', name: '<img draggable="false" class="emoji" alt="💥" src="//cdn.***.net/emojis/html/1f4a5.png"> Adrenalin', m: 28, t: 10759 },
                    { id: 'fear', name: '<img draggable="false" class="emoji" alt="😱" src="//cdn.***.net/emojis/html/1f631.png"> Altıma Etmek İstiyorum', m: 27, t: 10765 },
                    { id: 'love', name: '🥰 Romantik', m: 10749, t: 10749 },
                    { id: 'mind', name: '🤯 Beyin Yakan', m: 9648, t: 9648 },
                ]
            },
            {
                title: "DÖNEMLER & NOSTALJİ",
                items: [
                    { id: '90s', name: '<img draggable="false" class="emoji" alt="📼" src="//cdn.***.net/emojis/html/1f4fc.png"> 90\'lar', depth: 30, params: '&primary_release_date.gte=1990-01-01&primary_release_date.lte=1999-12-31' },
                    { id: '80s', name: '<img draggable="false" class="emoji" alt="🕹" src="//cdn.***.net/emojis/html/1f579.png">️ 80\'ler', depth: 20, params: '&primary_release_date.gte=1980-01-01&primary_release_date.lte=1989-12-31' },
                    { id: '70s', name: '🕺 70\'ler', depth: 15, params: '&primary_release_date.gte=1970-01-01&primary_release_date.lte=1979-12-31' },
                    { id: 'oldies', name: '<img draggable="false" class="emoji" alt="🎞" src="//cdn.***.net/emojis/html/1f39e.png">️ Siyah Beyaz', depth: 15, params: '&primary_release_date.lte=1960-12-31' },
                ]
            },
            {
                title: "GENEL KATEGORİLER",
                items: [
                    { id: 'pop', name: '<img draggable="false" class="emoji" alt="🔥" src="//cdn.***.net/emojis/html/1f525.png"> Trendler', class:'green', depth: 50, params: '' },
                    { id: 'top', name: '⭐ IMDB Top', class:'green', depth: 50, params: '&vote_average.gte=8.0&vote_count.gte=300' },
                    { id: 'action', name: '<img draggable="false" class="emoji" alt="💥" src="//cdn.***.net/emojis/html/1f4a5.png"> Aksiyon', depth: 50, m: 28, t: 10759 },
                    { id: 'adventure', name: '<img draggable="false" class="emoji" alt="🗺" src="//cdn.***.net/emojis/html/1f5fa.png">️ Macera', depth: 50, m: 12, t: 10759 },
                    { id: 'scifi', name: '<img draggable="false" class="emoji" alt="👽" src="//cdn.***.net/emojis/html/1f47d.png"> Bilim Kurgu', depth: 50, m: 878, t: 10765 },
                    { id: 'comedy', name: '<img draggable="false" class="emoji" alt="😂" src="//cdn.***.net/emojis/html/1f602.png"> Komedi', depth: 50, m: 35, t: 35 },
                    { id: 'crime', name: '<img draggable="false" class="emoji" alt="🔫" src="//cdn.***.net/emojis/html/1f52b.png"> Suç', depth: 50, m: 80, t: 80 },
                    { id: 'mystery', name: '<img draggable="false" class="emoji" alt="🕵" src="//cdn.***.net/emojis/html/1f575.png">️ Gizem', depth: 50, m: 9648, t: 9648 },
                    { id: 'drama', name: '<img draggable="false" class="emoji" alt="😢" src="//cdn.***.net/emojis/html/1f622.png"> Dram', depth: 50, m: 18, t: 18 },
                    { id: 'horror', name: '<img draggable="false" class="emoji" alt="😱" src="//cdn.***.net/emojis/html/1f631.png"> Korku', depth: 50, m: 27, t: 10765 },
                    { id: 'thriller', name: '<img draggable="false" class="emoji" alt="😬" src="//cdn.***.net/emojis/html/1f62c.png"> Gerilim', depth: 50, m: 53, t: 80 },
                    { id: 'romance', name: '🥰 Aşk', depth: 40, m: 10749, t: 10749 },
                    { id: 'fantasy', name: '<img draggable="false" class="emoji" alt="🐉" src="//cdn.***.net/emojis/html/1f409.png"> Fantastik', depth: 40, m: 14, t: 10765 },
                    { id: 'family', name: '<img draggable="false" class="emoji" alt="👨" src="//cdn.***.net/emojis/html/1f468.png">*<img draggable="false" class="emoji" alt="👩" src="//cdn.***.net/emojis/html/1f469.png">*<img draggable="false" class="emoji" alt="👧" src="//cdn.***.net/emojis/html/1f467.png">*<img draggable="false" class="emoji" alt="👦" src="//cdn.***.net/emojis/html/1f466.png"> Aile', depth: 40, m: 10751, t: 10751 },
                    { id: 'animation', name: '<img draggable="false" class="emoji" alt="🎨" src="//cdn.***.net/emojis/html/1f3a8.png"> Animasyon', depth: 40, m: 16, t: 16 },
                    { id: 'history', name: '<img draggable="false" class="emoji" alt="📜" src="//cdn.***.net/emojis/html/1f4dc.png"> Tarih', depth: 30, m: 36, t: 10768 },
                    { id: 'war', name: '<img draggable="false" class="emoji" alt="⚔️" src="//cdn.***.net/emojis/html/2694.png"> Savaş', depth: 30, m: 10752, t: 10768 },
                    { id: 'western', name: '🤠 Western', depth: 20, m: 37, t: 37 },
                    { id: 'music', name: '<img draggable="false" class="emoji" alt="🎵" src="//cdn.***.net/emojis/html/1f3b5.png"> Müzik', depth: 20, m: 10402, t: 10402 },
                    { id: 'doc', name: '🧠 Belgesel', depth: 20, m: 99, t: 99 },
                    { id: 'anime', name: '<img draggable="false" class="emoji" alt="🇯🇵" src="//cdn.***.net/emojis/html/1f1ef-1f1f5.png"> Anime', depth: 20, params: '&with_genres=16&with_original_language=ja' },
                    { id: 'tr', name: '<img draggable="false" class="emoji" alt="🇹🇷" src="//cdn.***.net/emojis/html/1f1f9-1f1f7.png"> Yerli', depth: 20, params: '&with_original_language=tr' },
                    { id: 'kr', name: '<img draggable="false" class="emoji" alt="🇰🇷" src="//cdn.***.net/emojis/html/1f1f0-1f1f7.png"> Kore', depth: 30, params: '&with_original_language=ko' },
                ]
            }
        ];
 
        let currentType = 'movie';
        let selectedMood = MOOD_GROUPS[0].items[0];
 
        window.() => {
            renderMoods();
            startEngine();
        };
 
        function changeType(type) {
            currentType = type;
            document.getElementById('btnMovie').className = `type-btn ${type === 'movie' ? 'active' : ''}`;
            document.getElementById('btnTv').className = `type-btn ${type === 'tv' ? 'active' : ''}`;
            renderMoods();
        }
 
        function renderMoods() {
            const container = document.getElementById('moodContainer');
            container.innerHTML = '';
            MOOD_GROUPS.forEach(group => {
                const title = document.createElement('div');
                title.className = 'mood-group-title';
                title.innerText = group.title;
                container.appendChild(title);
                const list = document.createElement('div');
                list.className = 'mood-list';
                group.items.forEach(item => {
                    const btn = document.createElement('div');
                    btn.className = `mood-tag ${item.class || ''} ${item === selectedMood ? 'selected' : ''}`;
                    btn.innerHTML = item.name;
                    btn.onclick = () => { selectedMood = item; renderMoods(); };
                    list.appendChild(btn);
                });
                container.appendChild(list);
            });
        }
 
        async function startEngine() {
            const grid = document.getElementById('grid');
            const status = document.getElementById('statusMsg');
            const targetCount = parseInt(document.getElementById('count').value);
 
            grid.innerHTML = '';
            status.innerText = "Kriterler analiz ediliyor...";
 
            let queryParams = selectedMood.params || '';
            if (!queryParams && (selectedMood.m || selectedMood.t)) {
                const genreId = currentType === 'movie' ? selectedMood.m : selectedMood.t;
                queryParams = `&with_genres=${genreId}`;
            }
 
            // OY VE KALİTE FİLTRESİ
            const isFuture = selectedMood.id === 'upcoming' || selectedMood.id === '2025';
             
            if(!isFuture) {
                queryParams += '&vote_count.gte=50&sort_by=vote_count.desc';
            }
 
            // Sayfa Sayısı Kontrolü
            let maxDepth = selectedMood.depth || 10;
            // Eğer çok fazla adet istendiyse derinliği artır
            if (targetCount > 50) maxDepth = 50;
            if (targetCount > 200) maxDepth = 200;
 
            let totalPages = 1;
 
            try {
                const checkUrl = `${BASE}/discover/${currentType}?api_key=${API}&language=tr-TR&include_*****=false${queryParams}`;
                const checkRes = await fetch(checkUrl);
                const checkData = await checkRes.json();
                totalPages = Math.min(checkData.total_pages, maxDepth);
                 
                if (checkData.total_results === 0) {
                    grid.innerHTML = '<p style="text-align:center; color:#aaa; width:100%;">Bu kriterde içerik bulunamadı.</p>';
                    status.innerText = "Sonuç yok.";
                    return;
                }
            } catch (e) {
                console.error(e);
                totalPages = 10;
            }
 
            // RASTGELELİK
            let startPage = 1;
            if (totalPages > 1 && targetCount <= 40) {
                const safeMax = Math.max(1, totalPages - 2);
                startPage = Math.floor(Math.random() * safeMax) + 1;
            }
 
            let collected = [];
            let page = startPage;
             
            // GARANTİ DÖNGÜSÜ
            let safetyBreak = 0;
            const maxLoops = 100;
 
            status.innerText = `İçerikler toplanıyor...`;
 
            try {
                while (collected.length < targetCount && safetyBreak < maxLoops) {
                     
                    let actualPage = page;
                    if (actualPage > totalPages) {
                        actualPage = (actualPage % totalPages) + 1;
                    }
 
                    const url = `${BASE}/discover/${currentType}?api_key=${API}&language=tr-TR&include_*****=false&page=${actualPage}${queryParams}`;
                     
                    const res = await fetch(url);
                    const data = await res.json();
                     
                    if (!data.results || data.results.length === 0) break;
 
                    const clean = data.results.filter(x => x.poster_path);
                     
                    // Tekrar kontrolü
                    clean.forEach(item => {
                        if (!collected.some(c => c.id === item.id)) {
                            collected.push(item);
                        }
                    });
 
                    status.innerText = `Bulunan: ${collected.length} / ${targetCount}`;
                     
                    page++;
                    safetyBreak++;
                     
                    if (collected.length >= targetCount) break;
                }
 
                // SHUFFLE
                collected = collected.sort(() => Math.random() - 0.5);
                const final = collected.slice(0, targetCount);
                renderGrid(final);
                status.innerText = `Hazır! ${final.length} içerik listelendi.`;
 
            } catch (err) {
                console.error(err);
                status.innerText = "Bağlantı hatası.";
            }
        }
 
        function renderGrid(items) {
            const grid = document.getElementById('grid');
            let html = '';
            items.forEach(item => {
                const title = item.title || item.name;
                const date = (item.release_date || item.first_air_date || '----').substring(0,4);
                const rate = item.vote_average ? item.vote_average.toFixed(1) : '-';
                const poster = item.poster_path ? IMG + item.poster_path : '';
                html += `
                <div class="card" onclick="openModal(${item.id})">
                    <div class="rating-badge">${rate}</div>
                    <img src="${poster}" class="poster" loading="lazy">
                    <div class="info-overlay">
                        <div style="font-weight:bold; font-size:14px; text-align:center;">${title}</div>
                        <div style="font-size:12px; color:#ccc; text-align:center; margin-top:5px;">${date}</div>
                    </div>
                </div>`;
            });
            grid.innerHTML = html;
        }
 
        async function openModal(id) {
            const modal = document.getElementById('modal');
            modal.style.display = 'flex';
            const res = await fetch(`${BASE}/${currentType}/${id}?api_key=${API}&language=tr-TR`);
            const data = await res.json();
            document.getElementById('mImg').src = data.poster_path ? ORIG + data.poster_path : '';
            document.getElementById('mTitle').innerText = data.title || data.name;
            document.getElementById('mTag').innerText = data.tagline || '';
            document.getElementById('mDate').innerText = data.release_date || data.first_air_date;
            document.getElementById('mRating').innerText = `IMDB: ${data.vote_average.toFixed(1)}`;
            document.getElementById('mDesc').innerText = data.overview || 'Açıklama bulunamadı.';
            const searchQ = encodeURIComponent(data.title || data.name);
            document.getElementById('mLink').href = `https://www.google.com/search?q=${searchQ} izle`;
        }
 
        function closeModal() { document.getElementById('modal').style.display = 'none'; }
        window.onclick = (e) => { if(e.target == document.getElementById('modal')) closeModal(); }
    </script>
</body>
</html>
 
film veya dizi sonrasında istediğiniz kategoriyi seçiyorsunuz kaç adet öneri istediğinizi yazıyorsunuz random olarak sizlere veriyor




misal 90 lar seçtim 100 adet keşfet dedim önüme getirdi


truman show a tıkladım örnek film hakkında bilgi yıl ay gün idm bilgisi ve izle araştır butonu




izle araştır derseniz yeni sekmede film adı izle şeklinde google sonuçları gelir




Api Nasıl Alırım?

  • themoviedb.org adresinden üye ol.
  • Profil ve Ayarlar -> Ayarlar -> API kısmına git ve yeni bir anahtar oluştur.
  • "API Key (v3 auth)" (api anahtarı) yazan uzun kodu kopyala.

    sonra sana verdiğim tüm kodları not defterinde aç yapıştır const API = 'KENDİ APİNİZİ EKLEYİNİZ'; bu bölümü bul apini ekle masaüstünü isimverin.html kaydetin artık masaüstünüzde size seçtiğiniz kategoriye göre öneri yapan bir sistem var.

    Selamlar yapay zeka ile geliştirdiğim sistem sadece seçtiğiniz kategoriye göre film önerileri ve dizi önerileri yapar çıkacak çıkmış olan filmlerine kadar bir dünya kategoriler mevcuttur misal 10 yazdın arattın tekrar arattığında farklı 10 adet gelir istersem 2 bin yaz sana kalmış ne kadar varsa çıkarır ARTIK BANA FİLM ÖNER DİZİ ÖNER BİTTİ bu sistem ile kategorileri seçin sistem önersin iyi forumlar dilerim