/* --- SİSTEMİ DÜZELTEN TEMEL AYARLAR --- */
body {
    margin: 0;
    padding: 20px;
    background-color: #678b58; 
    /* Arka plana şeritli çim saha deseni */
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.03),
        rgba(255, 255, 255, 0.03) 25px,
        transparent 25px,
        transparent 50px
    );
    font-family: Arial, sans-serif;
    display: block; 
}

/* --- YENİ MİMARİ: SİSTEMİN PATRONU --- */
#app {
    width: 95%;
    max-width: 1450px;      /* KRİTİK DÜZELTME: Big harita (1200px) + Reklam (160px) ve boşluklar için genişletildi */
    margin: 25px auto;
    display: flex;
    flex-direction: column; /* EKRANLARI ALT ALTA DİZMEK İÇİN */
    align-items: center;    /* İçerikleri ortala */
    gap: 20px;              /* Aradaki boşluklar */
}

/* --- OYUN VE REKLAM SARMALAYICISI (BİG HARİTA UYUMLU NİHAİ VERSİYON) --- */
#game-wrapper {
    display: flex;
    flex-direction: row;        /* Yan yana dizilimi korur */
    justify-content: flex-start;/* Big haritada reklamın kaleye binmesini önlemek için sola yaslar */
    align-items: flex-start;
    width: 100%;
    max-width: 100%;            
    gap: 20px;                  /* Oyun alanı ile reklam arasında her zaman 20px boşluk bırakır */
    box-sizing: border-box;
    padding: 0 10px;
    overflow-x: auto;           /* Ekran sığmazsa sahayı ve kaleyi bozmadan yatay kaydırma çubuğu çıkarır */
}

#ana-oyun-alani {
    display: flex;
    flex-direction: column;
    align-items: center;        /* Sahanın kendi içinde ortalanmasını sağlar */
    flex: 0 0 auto;             /* KİTLENDİ: Oyun alanının sıkışmasını veya reklamı ezmesini engeller */
    min-width: 0;               /* İçeriğin taşmasını engeller */
}

#oyun-ekrani {
    width: 100%;
    max-width: 1000px;
}

#sag-reklam {
    flex: 0 0 160px;        /* Reklam hep sabit 160px kalır */
    min-height: 600px;      /* Skyscraper yüksekliği */
    background: #1a1e23;
    border: 1px solid #333;
    display: none;          /* Oda içindeyken açılmaya devam eder */
    margin-top: 0;          /* Üstten boşluk kalmasın */
    position: relative;     /* KATMAN KONTROLÜ İÇİN EKLENDİ */
    z-index: 100;           /* SAHANIN ARKASINA DÜŞMESİNİ ENGELLER, EN ÜSTE ALIR */
}

/* --- GENEL TASARIMLAR --- */
.kutu { 
    background-color: #242a2f; 
    padding: 25px; 
    border-radius: 8px; 
    border: 2px solid #14171a;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    color: white;
}

h1 { color: #f9d342; font-size: 48px; margin-bottom: 10px; text-shadow: 2px 2px #000; }
h2 { color: #f9d342; margin-top: 0; }

input { 
    background: #14171a; border: 1px solid #333; color: white;
    padding: 10px; width: 80%; margin-bottom: 15px; border-radius: 3px;
}

.hax-button {
    background: #3b5037; color: white; border: none; padding: 10px;
    cursor: pointer; text-align: center; border-radius: 3px; font-weight: bold;
}
.hax-button:hover { background: #4a6143; }

.lobi-gizli { display: none; }

/* --- 1. GİRİŞ EKRANI TASARIMI --- */
.intro-kutu {
    background-color: rgba(20, 23, 26, 0.9);
    padding: 50px 40px;
    border: 2px solid #333;
    max-width: 600px;
    margin-top: 10vh;
    border-radius: 10px;
}

.logo-text { 
    color: #f9d342; 
    font-size: 65px; 
    margin-bottom: 10px; 
    margin-top: 0;
    text-shadow: 4px 4px 0px #000; 
    letter-spacing: 3px;
}

.slogan {
    color: #ecf0f1;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 35px;
    font-weight: normal;
    text-shadow: 1px 1px 2px #000;
}

.dev-buton {
    background-color: #27ae60;
    color: white;
    font-size: 22px;
    padding: 15px 50px;
    border-radius: 6px;
    border: 2px solid #2ecc71;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
}

.dev-buton:hover { 
    background-color: #2ecc71; 
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

/* --- 2. NİCK EKRANI ÖZEL TASARIMI --- */
.nick-input {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    font-size: 20px;
    text-align: center;
    background-color: #fff;
    color: #333;
    border: 3px solid #ccc;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
    display: block;
    margin-left: auto;
    margin-right: auto;
    transition: border-color 0.3s;
}

.nick-input:focus {
    outline: none;
    border-color: #27ae60;
}

/* Oda listesi başlıkları */
.oda-header {
    display: flex;
    padding: 10px;
    background: #1a1e22;
    font-weight: bold;
    color: #f9d342;
    border-bottom: 2px solid #333;
}

/* Oda satırlarını Haxball'daki gibi yapalım */
.oda-item {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background 0.2s;
}

.oda-item:hover {
    background: #2c3e50;
}

.oda-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- GAME-WRAPPER YATAY SCROLLBAR ÖZELLEŞTİRMESİ --- */
#game-wrapper::-webkit-scrollbar {
    height: 8px; /* Scrollbar kalınlığı */
}

#game-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2); /* Arka plan rayı şeffaf siyah */
    border-radius: 4px;
}

#game-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.4); /* Tutamaç (thumb) şeffaf siyah, azaltılmış opacity */
    border-radius: 4px;
}

#game-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.6); /* Fareyle üzerine gelince biraz daha belirginleşir */
}

/* =========================================================
   🏆 GORBALL TURNUVA MODALI PREMIUM UI TASARIMI 
========================================================= */

/* Modal Arkaplanı ve Karartma */
.modal-arkaplan {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Lobiyi tamamen karanlığa gömer, odak modalda kalır */
    justify-content: center; 
    align-items: center;
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.3s ease;
}
.modal-arkaplan.aktif { 
    opacity: 1; 
    pointer-events: auto; 
    display: flex; 
}

/* =========================================================
   🏆 TÜM LOBİ MODALLARI İÇİN KESİN EKRANA SIĞMA VE SCROLLBAR MİMARİSİ
========================================================= */

/* HATA DÜZELTİLDİ: Sadece dış katmanın "İÇİNDEKİ" asıl kutuyu ( > div ) hedefliyoruz */
.modal-kutu, 
#lig-modal > div, 
#gol-kralligi-modal > div, 
#haberler-modal > div {
    background: #1a1e23;
    color: #ecf0f1;
    width: 90%;
    max-width: 550px;
    max-height: 85vh; /* Ekran yüksekliğinin %85'ini aşmaz, asla dışarı taşmaz */
    overflow-y: auto;  /* İçerik uzadığında özel Gorball scrollbar'ını devreye sokar */
    border-radius: 8px;
    padding: 30px;
    border: 2px solid #f9d342;
    box-shadow: 0 10px 30px rgba(249, 211, 66, 0.2), 0 0 20px rgba(0,0,0,0.9);
    position: relative;
    font-family: 'Arial', sans-serif;
    box-sizing: border-box;
    
    /* Firefox Tarayıcısı İçin Desteği */
    scrollbar-width: thin;
    scrollbar-color: #2c3e50 #14171a;
}

/* 🌟 GORBALL UI UYUMLU ÖZEL SCROLLBAR (TÜM MODALLAR İÇİN GEÇERLİ) */
.modal-kutu::-webkit-scrollbar,
#lig-modal > div::-webkit-scrollbar,
#gol-kralligi-modal > div::-webkit-scrollbar,
#haberler-modal > div::-webkit-scrollbar {
    width: 8px;
}

.modal-kutu::-webkit-scrollbar-track,
#lig-modal > div::-webkit-scrollbar-track,
#gol-kralligi-modal > div::-webkit-scrollbar-track,
#haberler-modal > div::-webkit-scrollbar-track {
    background: #14171a;
    border-radius: 4px;
}

.modal-kutu::-webkit-scrollbar-thumb,
#lig-modal > div::-webkit-scrollbar-thumb,
#gol-kralligi-modal > div::-webkit-scrollbar-thumb,
#haberler-modal > div::-webkit-scrollbar-thumb {
    background: #2c3e50;
    border-radius: 4px;
    border: 1px solid #333;
}

.modal-kutu::-webkit-scrollbar-thumb:hover,
#lig-modal > div::-webkit-scrollbar-thumb:hover,
#gol-kralligi-modal > div::-webkit-scrollbar-thumb:hover,
#haberler-modal > div::-webkit-scrollbar-thumb:hover {
    background: #f9d342; /* Üzerine gelince Gorball altın sarısı parlar */
}

/* =========================================================
   --- ÇARPI (X) BUTONLARINI KESİN OLARAK SAĞ ÜST KÖŞEYE SABİTLEME ---
========================================================= */

/* Ana modal kutularının pozisyonunu absolute için güvenli hale getiriyoruz. 
   Hem eski (.modal-content) hem yeni modalları kapsar! */
.modal-kutu, 
.modal-content,
#lig-modal > div, 
#gol-kralligi-modal > div, 
#haberler-modal > div {
    position: relative !important;
}

/* Çarpı butonunu soldan koparıp absolute ile sağ üst köşeye kilitliyoruz.
   HEM YENİ (.kapat-btn) HEM ESKİ (.close-btn) SINIFLARINI BİRLEŞTİRDİK! */
.kapat-btn,
.close-btn {
    position: absolute !important;
    top: 20px !important;
    right: 25px !important;
    left: auto !important;
    float: none !important;
    color: #7f8c8d !important;
    font-size: 28px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    z-index: 999 !important;
    line-height: 20px !important;
    text-decoration: none !important;
}

/* Üzerine gelince çalışacak o şık kırmızı neon parlama efekti (v4 Tasarımı) */
.kapat-btn:hover,
.close-btn:hover { 
    color: #ff4757 !important;
    transform: scale(1.15) translateY(-1px) !important;
    text-shadow: 0 0 12px rgba(255, 71, 87, 0.7) !important;
}

/* Ana Başlık ve Açıklama */
.modal-baslik { 
    color: #f9d342; 
    margin-top: 0; 
    text-align: center; 
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-bottom: 15px;
}
.modal-aciklama { 
    text-align: center; 
    margin-bottom: 25px; 
    color: #bdc3c7; 
    font-size: 15px;
}

/* Adım Kutuları (İçerikteki karanlık kartlar) */
.adim-kutusu { 
    background: #242a2f; 
    padding: 15px 20px; 
    border-radius: 6px; 
    margin-bottom: 15px; 
    border-left: 4px solid #3498db; /* Mavi vurgu çizgisi */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}
.adim-kutusu h3 { 
    margin-top: 0; 
    color: #fff; 
    font-size: 17px; 
    margin-bottom: 10px;
}
.adim-kutusu p {
    margin: 5px 0;
    font-size: 14px;
    color: #ecf0f1;
}

/* Cüzdan Kopyalama Alanı */
.cuzdan-alani { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    background: #14171a; /* En koyu arkaplan */
    padding: 10px; 
    border-radius: 4px; 
    margin-top: 10px;
    border: 1px solid #333;
}
.cuzdan-alani span {
    font-size: 12px;
    color: #7f8c8d;
}
.cuzdan-alani code { 
    color: #2ecc71; /* Neon yeşil kod rengi */
    flex-grow: 1; 
    font-size: 14px; 
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* Kopyala Butonu */
.btn-kopyala { 
    background: #2980b9; 
    color: #fff; 
    border: none; 
    padding: 6px 12px; 
    border-radius: 3px; 
    cursor: pointer; 
    font-weight: bold;
    transition: background 0.2s;
}
.btn-kopyala:hover { background: #3498db; }

/* Şık Instagram Butonu */
.btn-instagram { 
    display: block; 
    text-align: center; 
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: white; 
    text-decoration: none; 
    padding: 12px; 
    border-radius: 6px; 
    font-weight: bold; 
    margin-top: 15px; 
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-instagram:hover { 
    transform: translateY(-2px); /* Üzerine gelince hafif yukarı kalkar */
    filter: brightness(1.1); 
}

/* Alt Bilgi Alanı */
.modal-alt-bilgi { 
    text-align: center; 
    margin-top: 25px; 
    font-size: 13px; 
    color: #7f8c8d; 
}
.modal-alt-bilgi a { 
    color: #f9d342; 
    text-decoration: none; 
    font-weight: bold;
}
.modal-alt-bilgi a:hover { text-decoration: underline; }

/* --- YENİ EKLENEN TURNUVA CSS AYARLARI --- */

/* Kategori Seçim Butonları */
.btn-turnuva-secim {
    display: flex;
    align-items: center;
    background: #242a2f;
    border: 2px solid #333;
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    color: #ecf0f1;
}
.btn-turnuva-secim:hover {
    background: #2c3e50;
    border-color: #f9d342;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(249, 211, 66, 0.2);
}
.btn-turnuva-secim .icon {
    font-size: 35px;
    margin-right: 20px;
}
.btn-turnuva-secim .text strong {
    display: block;
    font-size: 18px;
    color: #f9d342;
    margin-bottom: 5px;
}
.btn-turnuva-secim .text small {
    color: #bdc3c7;
    font-size: 13px;
}

/* Geri Dön Butonu */
.btn-geri {
    background: transparent;
    border: none;
    color: #7f8c8d;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    padding: 10px 0;
    transition: color 0.2s;
}
.btn-geri:hover {
    color: #ecf0f1;
}

/* Ödülleri Gör Butonu */
.btn-odulleri-gor {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    color: #111;
    border: none;
    padding: 15px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 10px rgba(241, 196, 15, 0.4);
    transition: transform 0.2s ease;
}
.btn-odulleri-gor:hover {
    transform: scale(1.02);
}

/* Ödül Listesi Tasarımı */
.odul-listesi {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}
.odul-listesi li {
    display: flex;
    justify-content: space-between;
    background: #242a2f;
    margin-bottom: 8px;
    padding: 12px 20px;
    border-radius: 4px;
    border: 1px solid #333;
    font-size: 16px;
    font-weight: bold;
}
.odul-listesi li .sira { color: #bdc3c7; }
.odul-listesi li .sira.altin { color: #f1c40f; font-size: 18px; }
.odul-listesi li .sira.gumus { color: #d3d3d3; font-size: 17px; }
.odul-listesi li .sira.bronz { color: #cd7f32; font-size: 17px;}
.odul-listesi li .miktar { color: #2ecc71; }

/* =========================================================
   --- GORBALL UI UYUMLU ÜST MENÜ TURNUVA BUTONU (NİHAİ HİZALANMIŞ) ---
========================================================= */
.btn-header-turnuva {
    background: linear-gradient(135deg, #8c7317, #594709); /* Derin ve koyu lüks altın/bronz tonu */
    color: #ffffff;
    border: 1px solid #f9d342; /* Parlak altın sarısı çerçeve */
    padding: 8px 16px; /* Diğer butonlarla dikey kalınlık/yükseklik dengesi */
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 150px; /* "Olan-Biten" butonundan gösterdiğin ok yönünde uzaklaştırarak sağa taşıdık */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    vertical-align: middle; /* Üst menü içindeki diğer elementlerle dikey eksende tam ortalar */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); /* Beyaz yazının net okunması */
    animation: sihirliParilti 2.5s infinite ease-in-out; /* Büyülü parıltı efekti */
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-header-turnuva:hover {
    background: linear-gradient(135deg, #a68512, #735b0b);
    border-color: #fff;
    transform: translateY(-2px);
    animation: none; /* Hover anında parıltıyı sabitleyip daha güçlü glow verelim */
    box-shadow: 0 0 20px rgba(249, 211, 66, 0.9), 0 0 35px rgba(243, 156, 18, 0.6);
}

/* Sihirli Nefes Alan Altın Parıltı Efekti */
@keyframes sihirliParilti {
    0% {
        box-shadow: 0 0 6px rgba(249, 211, 66, 0.3), inset 0 0 4px rgba(249, 211, 66, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(249, 211, 66, 0.8), 0 0 26px rgba(243, 156, 18, 0.4), inset 0 0 8px rgba(249, 211, 66, 0.4);
    }
    100% {
        box-shadow: 0 0 6px rgba(249, 211, 66, 0.3), inset 0 0 4px rgba(249, 211, 66, 0.2);
    }
}