<style>
    :root {
        --lunzy-orange: #ff4500;
        --lunzy-blue: #00ccff;
        --jet-gold: #ffd700;
        --combo-pink: #ff00ff;
        --shield-cyan: #00ffff;
        --speed-green: #00ff66;
    }

    #game-wrapper { 
        background: #000; 
        padding: 10px 0; 
        font-family: 'Orbitron', sans-serif; 
        user-select: none;
        touch-action: none; 
    }

    /* Ana Düzen: Oyun ve Liderlik Tablosunu Yan Yana Getirir */
    .main-game-layout {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 20px;
        max-width: 1600px;
        margin: 0 auto;
        padding: 0 10px;
    }

    #game-container {
        flex: 3; /* Oyun alanı daha geniş */
        width: 100%;
        max-width: 1250px; 
        position: relative;
        background: #000; 
        border: 2px solid #222; 
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0,0,0,0.8);
        aspect-ratio: 16 / 8; 
        border-radius: 20px;
    }







/* Liderlik Tablosu Ana Konteynırı */
#leaderboard-side {
    flex: 1;
    min-width: 300px;
    background: rgba(15, 15, 20, 0.9);
    border: 2px solid #333;
    border-radius: 20px;
    padding: 20px;
    color: white;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    max-height: 565px; /* Tablonun toplam maksimum yüksekliği */
}

/* Başlık Alanı */
.lb-header {
    color: var(--lunzy-orange);
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    flex-shrink: 0; /* Başlığın kaybolmasını engeller */
}

/* Kaydırılabilir Liste Alanı */
#lb-list {
    overflow-y: auto; /* Dikey kaydırmayı açar */
    flex-grow: 1;
    padding-right: 8px; /* Kaydırma çubuğu ile isimler arasında boşluk */
}

/* Özelleştirilmiş Scrollbar Tasarımı (Chrome, Edge, Safari) */
#lb-list::-webkit-scrollbar {
    width: 6px;
}
#lb-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
#lb-list::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #ff4500, #ff0000);
    border-radius: 10px;
}

/* Satır Yapısı */
.lb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 14px;
    position: relative;
    transition: 0.3s;
}

/* İLK 3 SATIR İÇİN ÖZEL SOL KENARLIK (LİDERLİK EFEKTİ) */
.lb-row:nth-child(-n+3) {
    background: rgba(255, 69, 0, 0.1); /* Hafif kırmızımsı arka plan */
}

.lb-row:nth-child(-n+3)::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 5px;
    background: linear-gradient(to bottom, #ff4500, #ff0000); /* Kırmızı-Turuncu geçiş */
    border-radius: 0 5px 5px 0;
    box-shadow: 2px 0 12px rgba(255, 69, 0, 0.6);
}

/* Sıralama Numarası Renkleri */
.lb-row span:first-child { 
    font-weight: bold; 
    width: 30px; 
    z-index: 1;
}

.lb-row:nth-child(1) span:first-child { color: #ffd700; } /* Altın */
.lb-row:nth-child(2) span:first-child { color: #00ccff; } /* Gümüş/Mavi */
.lb-row:nth-child(3) span:first-child { color: #00ff66; } /* Bronz/Yeşil */
.lb-row:nth-child(n+4) span:first-child { color: #888; } /* Diğerleri gri */

/* Oyuncu İsmi */
.lb-row span:nth-child(2) { 
    flex-grow: 1; 
    text-align: left; 
    margin-left: 10px; 
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Uzun isimleri keser */
}

/* Skor Alanı */
.lb-row span:last-child { 
    color: var(--lunzy-blue); 
    font-weight: bold; 
    font-family: monospace;
}

/* Aktif Oyuncu (Kullanıcının kendi satırı) */
.lb-row.active { 
    background: rgba(255, 69, 0, 0.2); 
    border: 1px solid var(--lunzy-orange); 
}


   /* Masaüstü ve Genel Stil */
    #ad-popup { 
        position: absolute; 
        bottom: 2px; 
        right: 0px; 
        width: 160px; 
        background: rgba(0, 0, 0, 0.8); 
        border: 1px solid var(--lunzy-orange); 
        padding: 8px;
        border-radius: 12px 0 0 0;
        text-align: center; 
        font-family: 'Orbitron', sans-serif;
        z-index: 100;
        backdrop-filter: blur(5px);
        box-shadow: -5px -5px 15px rgba(255, 69, 0, 0.2);
    }
    #ad-popup img {
        width: 100%;
        border-radius: 6px;
        margin-top: 5px;
    }

    /* MOBİL UYUMLULUK (Yükseklik ve Genişlik Optimizasyonu) */
    @media (max-width: 768px) {
        #ad-popup {
            width: 60px;         /* Genişliği biraz dengeli tuttum */
            max-height: 50px;    /* Yüksekliği kesin olarak sınırladım */
            padding: 2px 4px;    /* Üst-alt boşluğu iyice kıstım */
            bottom: 0px;
            right: 0px;
            border-radius: 6px 0 0 0;
            overflow: hidden;    /* Taşan kısımları gizle */
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        #ad-popup div {
            font-size: 6px !important; 
            line-height: 1;      /* Satır yüksekliğini düşürdüm */
            margin-bottom: 2px;
            letter-spacing: 0px !important;
        }
        #ad-popup img {
            margin-top: 0px;
            max-height: 40px;    /* Görselin kendisini de dikeyde ufalt */
            object-fit: contain; /* Görselin bozulmasını engelle */
        }
    }
    /* Mobil Uyumluluk */
    @media (max-width: 1100px) {
        .main-game-layout { flex-direction: column; align-items: center; }
        #leaderboard-side { width: 95%; }
        #game-container { aspect-ratio: 1 / 1.1; width: 100%; }
    }

    canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

    .game-ui {
        position: absolute; top: 15px; width: 100%; display: flex;
        justify-content: center; color: white; pointer-events: none; z-index: 10;
        flex-wrap: wrap; gap: 8px;
    }

    .ui-box {
        background: rgba(0,0,0,0.8); padding: 8px 12px; border-radius: 10px;
        border: 1px solid #444; font-size: 11px; backdrop-filter: blur(5px);
        text-transform: uppercase;
    }

    @media (min-width: 768px) {
        .ui-box { font-size: 15px; padding: 10px 20px; }
        .game-ui { justify-content: space-around; }
    }

    .game-overlay {
        position: absolute; inset: 0; background: rgba(0, 0, 0, 0.9);
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        z-index: 100; backdrop-filter: blur(10px); padding: 20px;
    }

    .btn-action {
        background: var(--lunzy-orange); color: white; border: none;
        padding: 18px 50px; font-size: 20px; font-weight: bold; border-radius: 12px;
        cursor: pointer; transition: 0.3s; box-shadow: 0 0 25px rgba(255, 69, 0, 0.5);
    }

    .apex-pulse { animation: apexFlash 2s infinite alternate; }
    @keyframes apexFlash {
        from { box-shadow: inset 0 0 20px rgba(255,69,0,0); }
        to { box-shadow: inset 0 0 60px rgba(255,69,0,0.4); }
    }
</style>
